summaryrefslogtreecommitdiff
path: root/src/mbgl
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2016-04-26 16:39:56 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-06-02 14:51:39 -0700
commitc902f9098b331302aaa1baac77d1575db624a132 (patch)
tree211901cd04454aedbac40c469198438e46d7038c /src/mbgl
parent18149cbcc27a926f280b08d8d0e09104b2147688 (diff)
downloadqtlocation-mapboxgl-c902f9098b331302aaa1baac77d1575db624a132.tar.gz
[core] Rationalize naming for style-related code
Diffstat (limited to 'src/mbgl')
-rw-r--r--src/mbgl/annotation/annotation_manager.cpp10
-rw-r--r--src/mbgl/annotation/annotation_manager.hpp5
-rw-r--r--src/mbgl/annotation/fill_annotation_impl.cpp4
-rw-r--r--src/mbgl/annotation/fill_annotation_impl.hpp2
-rw-r--r--src/mbgl/annotation/line_annotation_impl.cpp4
-rw-r--r--src/mbgl/annotation/line_annotation_impl.hpp2
-rw-r--r--src/mbgl/annotation/shape_annotation_impl.cpp1
-rw-r--r--src/mbgl/annotation/shape_annotation_impl.hpp7
-rw-r--r--src/mbgl/annotation/style_sourced_annotation_impl.cpp6
-rw-r--r--src/mbgl/annotation/style_sourced_annotation_impl.hpp2
-rw-r--r--src/mbgl/geometry/feature_index.cpp14
-rw-r--r--src/mbgl/geometry/feature_index.hpp11
-rw-r--r--src/mbgl/layer/background_layer_impl.hpp24
-rw-r--r--src/mbgl/layer/raster_layer_impl.hpp24
-rw-r--r--src/mbgl/map/map.cpp42
-rw-r--r--src/mbgl/map/zoom_history.hpp (renamed from src/mbgl/style/zoom_history.hpp)0
-rw-r--r--src/mbgl/renderer/bucket.hpp7
-rw-r--r--src/mbgl/renderer/circle_bucket.cpp8
-rw-r--r--src/mbgl/renderer/circle_bucket.hpp2
-rw-r--r--src/mbgl/renderer/fill_bucket.cpp22
-rw-r--r--src/mbgl/renderer/fill_bucket.hpp2
-rw-r--r--src/mbgl/renderer/line_bucket.cpp8
-rw-r--r--src/mbgl/renderer/line_bucket.hpp7
-rw-r--r--src/mbgl/renderer/painter.cpp17
-rw-r--r--src/mbgl/renderer/painter.hpp45
-rw-r--r--src/mbgl/renderer/painter_background.cpp10
-rw-r--r--src/mbgl/renderer/painter_circle.cpp10
-rw-r--r--src/mbgl/renderer/painter_clipping.cpp2
-rw-r--r--src/mbgl/renderer/painter_fill.cpp10
-rw-r--r--src/mbgl/renderer/painter_line.cpp10
-rw-r--r--src/mbgl/renderer/painter_raster.cpp10
-rw-r--r--src/mbgl/renderer/painter_symbol.cpp9
-rw-r--r--src/mbgl/renderer/raster_bucket.cpp8
-rw-r--r--src/mbgl/renderer/raster_bucket.hpp2
-rw-r--r--src/mbgl/renderer/symbol_bucket.cpp4
-rw-r--r--src/mbgl/renderer/symbol_bucket.hpp10
-rw-r--r--src/mbgl/style/bucket_parameters.cpp (renamed from src/mbgl/style/style_bucket_parameters.cpp)6
-rw-r--r--src/mbgl/style/bucket_parameters.hpp (renamed from src/mbgl/style/style_bucket_parameters.hpp)7
-rw-r--r--src/mbgl/style/calculation_parameters.hpp30
-rw-r--r--src/mbgl/style/cascade_parameters.hpp22
-rw-r--r--src/mbgl/style/class_dictionary.cpp2
-rw-r--r--src/mbgl/style/class_dictionary.hpp2
-rw-r--r--src/mbgl/style/filter_evaluator.hpp2
-rw-r--r--src/mbgl/style/layer.cpp (renamed from src/mbgl/layer/layer.cpp)4
-rw-r--r--src/mbgl/style/layer_impl.cpp (renamed from src/mbgl/layer/layer_impl.cpp)4
-rw-r--r--src/mbgl/style/layer_impl.hpp (renamed from src/mbgl/layer/layer_impl.hpp)16
-rw-r--r--src/mbgl/style/layers/background_layer.cpp (renamed from src/mbgl/layer/background_layer.cpp)6
-rw-r--r--src/mbgl/style/layers/background_layer_impl.cpp (renamed from src/mbgl/layer/background_layer_impl.cpp)10
-rw-r--r--src/mbgl/style/layers/background_layer_impl.hpp26
-rw-r--r--src/mbgl/style/layers/background_layer_properties.cpp (renamed from src/mbgl/layer/background_layer_properties.cpp)8
-rw-r--r--src/mbgl/style/layers/background_layer_properties.hpp (renamed from src/mbgl/layer/background_layer_properties.hpp)10
-rw-r--r--src/mbgl/style/layers/circle_layer.cpp (renamed from src/mbgl/layer/circle_layer.cpp)6
-rw-r--r--src/mbgl/style/layers/circle_layer_impl.cpp (renamed from src/mbgl/layer/circle_layer_impl.cpp)12
-rw-r--r--src/mbgl/style/layers/circle_layer_impl.hpp (renamed from src/mbgl/layer/circle_layer_impl.hpp)14
-rw-r--r--src/mbgl/style/layers/circle_layer_properties.cpp (renamed from src/mbgl/layer/circle_layer_properties.cpp)8
-rw-r--r--src/mbgl/style/layers/circle_layer_properties.hpp (renamed from src/mbgl/layer/circle_layer_properties.hpp)10
-rw-r--r--src/mbgl/style/layers/custom_layer.cpp (renamed from src/mbgl/layer/custom_layer.cpp)6
-rw-r--r--src/mbgl/style/layers/custom_layer_impl.cpp (renamed from src/mbgl/layer/custom_layer_impl.cpp)8
-rw-r--r--src/mbgl/style/layers/custom_layer_impl.hpp (renamed from src/mbgl/layer/custom_layer_impl.hpp)13
-rw-r--r--src/mbgl/style/layers/fill_layer.cpp (renamed from src/mbgl/layer/fill_layer.cpp)6
-rw-r--r--src/mbgl/style/layers/fill_layer_impl.cpp (renamed from src/mbgl/layer/fill_layer_impl.cpp)12
-rw-r--r--src/mbgl/style/layers/fill_layer_impl.hpp (renamed from src/mbgl/layer/fill_layer_impl.hpp)14
-rw-r--r--src/mbgl/style/layers/fill_layer_properties.cpp (renamed from src/mbgl/layer/fill_layer_properties.cpp)8
-rw-r--r--src/mbgl/style/layers/fill_layer_properties.hpp (renamed from src/mbgl/layer/fill_layer_properties.hpp)10
-rw-r--r--src/mbgl/style/layers/line_layer.cpp (renamed from src/mbgl/layer/line_layer.cpp)6
-rw-r--r--src/mbgl/style/layers/line_layer_impl.cpp (renamed from src/mbgl/layer/line_layer_impl.cpp)16
-rw-r--r--src/mbgl/style/layers/line_layer_impl.hpp (renamed from src/mbgl/layer/line_layer_impl.hpp)14
-rw-r--r--src/mbgl/style/layers/line_layer_properties.cpp (renamed from src/mbgl/layer/line_layer_properties.cpp)10
-rw-r--r--src/mbgl/style/layers/line_layer_properties.hpp (renamed from src/mbgl/layer/line_layer_properties.hpp)12
-rw-r--r--src/mbgl/style/layers/raster_layer.cpp (renamed from src/mbgl/layer/raster_layer.cpp)6
-rw-r--r--src/mbgl/style/layers/raster_layer_impl.cpp (renamed from src/mbgl/layer/raster_layer_impl.cpp)10
-rw-r--r--src/mbgl/style/layers/raster_layer_impl.hpp26
-rw-r--r--src/mbgl/style/layers/raster_layer_properties.cpp (renamed from src/mbgl/layer/raster_layer_properties.cpp)8
-rw-r--r--src/mbgl/style/layers/raster_layer_properties.hpp (renamed from src/mbgl/layer/raster_layer_properties.hpp)10
-rw-r--r--src/mbgl/style/layers/symbol_layer.cpp (renamed from src/mbgl/layer/symbol_layer.cpp)6
-rw-r--r--src/mbgl/style/layers/symbol_layer_impl.cpp (renamed from src/mbgl/layer/symbol_layer_impl.cpp)22
-rw-r--r--src/mbgl/style/layers/symbol_layer_impl.hpp (renamed from src/mbgl/layer/symbol_layer_impl.hpp)20
-rw-r--r--src/mbgl/style/layers/symbol_layer_properties.cpp (renamed from src/mbgl/layer/symbol_layer_properties.cpp)10
-rw-r--r--src/mbgl/style/layers/symbol_layer_properties.hpp (renamed from src/mbgl/layer/symbol_layer_properties.hpp)12
-rw-r--r--src/mbgl/style/layout_property.hpp4
-rw-r--r--src/mbgl/style/observer.hpp (renamed from src/mbgl/style/style_observer.hpp)14
-rw-r--r--src/mbgl/style/paint_property.hpp18
-rw-r--r--src/mbgl/style/parser.cpp (renamed from src/mbgl/style/style_parser.cpp)69
-rw-r--r--src/mbgl/style/parser.hpp (renamed from src/mbgl/style/style_parser.hpp)21
-rw-r--r--src/mbgl/style/property_evaluator.cpp5
-rw-r--r--src/mbgl/style/property_evaluator.hpp15
-rw-r--r--src/mbgl/style/property_parsing.cpp7
-rw-r--r--src/mbgl/style/property_parsing.hpp7
-rw-r--r--src/mbgl/style/property_value.hpp36
-rw-r--r--src/mbgl/style/query_parameters.hpp (renamed from src/mbgl/style/style_query_parameters.hpp)5
-rw-r--r--src/mbgl/style/render_item.hpp9
-rw-r--r--src/mbgl/style/source.cpp (renamed from src/mbgl/source/source.cpp)52
-rw-r--r--src/mbgl/style/source.hpp (renamed from src/mbgl/source/source.hpp)26
-rw-r--r--src/mbgl/style/source_observer.hpp (renamed from src/mbgl/source/source_observer.hpp)6
-rw-r--r--src/mbgl/style/style.cpp52
-rw-r--r--src/mbgl/style/style.hpp39
-rw-r--r--src/mbgl/style/style_calculation_parameters.hpp28
-rw-r--r--src/mbgl/style/style_cascade_parameters.hpp20
-rw-r--r--src/mbgl/style/style_render_parameters.hpp15
-rw-r--r--src/mbgl/style/update_parameters.hpp (renamed from src/mbgl/style/style_update_parameters.hpp)12
-rw-r--r--src/mbgl/text/glyph_pbf.hpp2
-rw-r--r--src/mbgl/text/glyph_store.hpp2
-rw-r--r--src/mbgl/text/glyph_store_observer.hpp1
-rw-r--r--src/mbgl/text/quads.cpp4
-rw-r--r--src/mbgl/text/quads.hpp74
-rw-r--r--src/mbgl/text/shaping.cpp4
-rw-r--r--src/mbgl/text/shaping.hpp34
-rw-r--r--src/mbgl/tile/raster_tile_data.cpp4
-rw-r--r--src/mbgl/tile/raster_tile_data.hpp8
-rw-r--r--src/mbgl/tile/tile_data.hpp7
-rw-r--r--src/mbgl/tile/tile_worker.cpp18
-rw-r--r--src/mbgl/tile/tile_worker.hpp11
-rw-r--r--src/mbgl/tile/vector_tile.cpp2
-rw-r--r--src/mbgl/tile/vector_tile_data.cpp6
-rw-r--r--src/mbgl/tile/vector_tile_data.hpp11
-rw-r--r--src/mbgl/util/font_stack.cpp (renamed from src/mbgl/style/types.cpp)2
-rw-r--r--src/mbgl/util/tileset.hpp (renamed from src/mbgl/source/source_info.hpp)5
-rw-r--r--src/mbgl/util/worker.cpp4
-rw-r--r--src/mbgl/util/worker.hpp2
119 files changed, 831 insertions, 661 deletions
diff --git a/src/mbgl/annotation/annotation_manager.cpp b/src/mbgl/annotation/annotation_manager.cpp
index 09442b165c..e332850357 100644
--- a/src/mbgl/annotation/annotation_manager.cpp
+++ b/src/mbgl/annotation/annotation_manager.cpp
@@ -4,15 +4,17 @@
#include <mbgl/annotation/line_annotation_impl.hpp>
#include <mbgl/annotation/fill_annotation_impl.hpp>
#include <mbgl/annotation/style_sourced_annotation_impl.hpp>
-#include <mbgl/source/source.hpp>
+#include <mbgl/style/source.hpp>
#include <mbgl/style/style.hpp>
-#include <mbgl/layer/symbol_layer.hpp>
-#include <mbgl/layer/symbol_layer_impl.hpp>
+#include <mbgl/style/layers/symbol_layer.hpp>
+#include <mbgl/style/layers/symbol_layer_impl.hpp>
#include <boost/function_output_iterator.hpp>
namespace mbgl {
+using namespace style;
+
const std::string AnnotationManager::SourceID = "com.mapbox.annotations";
const std::string AnnotationManager::PointLayerID = "com.mapbox.annotations.points";
@@ -105,7 +107,7 @@ std::unique_ptr<AnnotationTile> AnnotationManager::getTile(const CanonicalTileID
void AnnotationManager::updateStyle(Style& style) {
// Create annotation source, point layer, and point bucket
if (!style.getSource(SourceID)) {
- std::unique_ptr<Source> source = std::make_unique<Source>(SourceType::Annotations, SourceID, "", util::tileSize, std::make_unique<SourceInfo>(), nullptr);
+ std::unique_ptr<Source> source = std::make_unique<Source>(SourceType::Annotations, SourceID, "", util::tileSize, std::make_unique<Tileset>(), nullptr);
source->enabled = true;
style.addSource(std::move(source));
diff --git a/src/mbgl/annotation/annotation_manager.hpp b/src/mbgl/annotation/annotation_manager.hpp
index 6862739ebb..73907e10c8 100644
--- a/src/mbgl/annotation/annotation_manager.hpp
+++ b/src/mbgl/annotation/annotation_manager.hpp
@@ -18,7 +18,10 @@ class AnnotationTile;
class AnnotationTileMonitor;
class SymbolAnnotationImpl;
class ShapeAnnotationImpl;
+
+namespace style {
class Style;
+}
class AnnotationManager : private util::noncopyable {
public:
@@ -36,7 +39,7 @@ public:
double getTopOffsetPixelsForIcon(const std::string& name);
SpriteAtlas& getSpriteAtlas() { return spriteAtlas; }
- void updateStyle(Style&);
+ void updateStyle(style::Style&);
void addTileMonitor(AnnotationTileMonitor&);
void removeTileMonitor(AnnotationTileMonitor&);
diff --git a/src/mbgl/annotation/fill_annotation_impl.cpp b/src/mbgl/annotation/fill_annotation_impl.cpp
index 17bdd9c38e..31c9f6d720 100644
--- a/src/mbgl/annotation/fill_annotation_impl.cpp
+++ b/src/mbgl/annotation/fill_annotation_impl.cpp
@@ -1,11 +1,11 @@
#include <mbgl/annotation/fill_annotation_impl.hpp>
#include <mbgl/annotation/annotation_manager.hpp>
#include <mbgl/style/style.hpp>
-#include <mbgl/layer/fill_layer.hpp>
+#include <mbgl/style/layers/fill_layer.hpp>
namespace mbgl {
-namespace geojsonvt = mapbox::geojsonvt;
+using namespace style;
FillAnnotationImpl::FillAnnotationImpl(const AnnotationID id_, const FillAnnotation& annotation_, const uint8_t maxZoom_)
: ShapeAnnotationImpl(id_, maxZoom_),
diff --git a/src/mbgl/annotation/fill_annotation_impl.hpp b/src/mbgl/annotation/fill_annotation_impl.hpp
index c396499e38..b879860c08 100644
--- a/src/mbgl/annotation/fill_annotation_impl.hpp
+++ b/src/mbgl/annotation/fill_annotation_impl.hpp
@@ -9,7 +9,7 @@ class FillAnnotationImpl : public ShapeAnnotationImpl {
public:
FillAnnotationImpl(const AnnotationID, const FillAnnotation&, const uint8_t maxZoom);
- void updateStyle(Style&) const final;
+ void updateStyle(style::Style&) const final;
const ShapeAnnotationGeometry& geometry() const final;
private:
diff --git a/src/mbgl/annotation/line_annotation_impl.cpp b/src/mbgl/annotation/line_annotation_impl.cpp
index 11febc7de7..85177591f4 100644
--- a/src/mbgl/annotation/line_annotation_impl.cpp
+++ b/src/mbgl/annotation/line_annotation_impl.cpp
@@ -1,11 +1,11 @@
#include <mbgl/annotation/line_annotation_impl.hpp>
#include <mbgl/annotation/annotation_manager.hpp>
#include <mbgl/style/style.hpp>
-#include <mbgl/layer/line_layer.hpp>
+#include <mbgl/style/layers/line_layer.hpp>
namespace mbgl {
-namespace geojsonvt = mapbox::geojsonvt;
+using namespace style;
LineAnnotationImpl::LineAnnotationImpl(const AnnotationID id_, const LineAnnotation& annotation_, const uint8_t maxZoom_)
: ShapeAnnotationImpl(id_, maxZoom_),
diff --git a/src/mbgl/annotation/line_annotation_impl.hpp b/src/mbgl/annotation/line_annotation_impl.hpp
index 05d650c051..c9a37dd390 100644
--- a/src/mbgl/annotation/line_annotation_impl.hpp
+++ b/src/mbgl/annotation/line_annotation_impl.hpp
@@ -9,7 +9,7 @@ class LineAnnotationImpl : public ShapeAnnotationImpl {
public:
LineAnnotationImpl(const AnnotationID, const LineAnnotation&, const uint8_t maxZoom);
- void updateStyle(Style&) const final;
+ void updateStyle(style::Style&) const final;
const ShapeAnnotationGeometry& geometry() const final;
private:
diff --git a/src/mbgl/annotation/shape_annotation_impl.cpp b/src/mbgl/annotation/shape_annotation_impl.cpp
index 283e736c6d..be6e12558d 100644
--- a/src/mbgl/annotation/shape_annotation_impl.cpp
+++ b/src/mbgl/annotation/shape_annotation_impl.cpp
@@ -10,6 +10,7 @@
namespace mbgl {
+using namespace style;
namespace geojsonvt = mapbox::geojsonvt;
ShapeAnnotationImpl::ShapeAnnotationImpl(const AnnotationID id_, const uint8_t maxZoom_)
diff --git a/src/mbgl/annotation/shape_annotation_impl.hpp b/src/mbgl/annotation/shape_annotation_impl.hpp
index 7f36f8b888..e6ba9a4bd7 100644
--- a/src/mbgl/annotation/shape_annotation_impl.hpp
+++ b/src/mbgl/annotation/shape_annotation_impl.hpp
@@ -9,16 +9,19 @@
namespace mbgl {
-class Style;
class AnnotationTile;
class CanonicalTileID;
+namespace style {
+class Style;
+}
+
class ShapeAnnotationImpl {
public:
ShapeAnnotationImpl(const AnnotationID, const uint8_t maxZoom);
virtual ~ShapeAnnotationImpl() = default;
- virtual void updateStyle(Style&) const = 0;
+ virtual void updateStyle(style::Style&) const = 0;
virtual const ShapeAnnotationGeometry& geometry() const = 0;
void updateTile(const CanonicalTileID&, AnnotationTile&);
diff --git a/src/mbgl/annotation/style_sourced_annotation_impl.cpp b/src/mbgl/annotation/style_sourced_annotation_impl.cpp
index e1e11a664a..43a27c8aac 100644
--- a/src/mbgl/annotation/style_sourced_annotation_impl.cpp
+++ b/src/mbgl/annotation/style_sourced_annotation_impl.cpp
@@ -2,12 +2,12 @@
#include <mbgl/annotation/annotation_manager.hpp>
#include <mbgl/style/style.hpp>
#include <mbgl/style/layer.hpp>
-#include <mbgl/layer/line_layer.hpp>
-#include <mbgl/layer/fill_layer.hpp>
+#include <mbgl/style/layers/line_layer.hpp>
+#include <mbgl/style/layers/fill_layer.hpp>
namespace mbgl {
-namespace geojsonvt = mapbox::geojsonvt;
+using namespace style;
StyleSourcedAnnotationImpl::StyleSourcedAnnotationImpl(const AnnotationID id_, const StyleSourcedAnnotation& annotation_, const uint8_t maxZoom_)
: ShapeAnnotationImpl(id_, maxZoom_),
diff --git a/src/mbgl/annotation/style_sourced_annotation_impl.hpp b/src/mbgl/annotation/style_sourced_annotation_impl.hpp
index 98e9910c66..09ef474fc0 100644
--- a/src/mbgl/annotation/style_sourced_annotation_impl.hpp
+++ b/src/mbgl/annotation/style_sourced_annotation_impl.hpp
@@ -9,7 +9,7 @@ class StyleSourcedAnnotationImpl : public ShapeAnnotationImpl {
public:
StyleSourcedAnnotationImpl(const AnnotationID, const StyleSourcedAnnotation&, const uint8_t maxZoom);
- void updateStyle(Style&) const final;
+ void updateStyle(style::Style&) const final;
const ShapeAnnotationGeometry& geometry() const final;
private:
diff --git a/src/mbgl/geometry/feature_index.cpp b/src/mbgl/geometry/feature_index.cpp
index e72aa344fa..8c10344915 100644
--- a/src/mbgl/geometry/feature_index.cpp
+++ b/src/mbgl/geometry/feature_index.cpp
@@ -1,8 +1,8 @@
#include <mbgl/geometry/feature_index.hpp>
#include <mbgl/style/style.hpp>
#include <mbgl/style/layer.hpp>
-#include <mbgl/layer/layer_impl.hpp>
-#include <mbgl/layer/symbol_layer.hpp>
+#include <mbgl/style/layer_impl.hpp>
+#include <mbgl/style/layers/symbol_layer.hpp>
#include <mbgl/text/collision_tile.hpp>
#include <mbgl/util/constants.hpp>
#include <mbgl/util/math.hpp>
@@ -59,7 +59,7 @@ void FeatureIndex::query(
const optional<std::vector<std::string>>& filterLayerIDs,
const GeometryTile& geometryTile,
const CanonicalTileID& tileID,
- const Style& style) const {
+ const style::Style& style) const {
mapbox::geometry::box<int16_t> box = mapbox::geometry::envelope(queryGeometry);
@@ -94,7 +94,7 @@ void FeatureIndex::addFeature(
const optional<std::vector<std::string>>& filterLayerIDs,
const GeometryTile& geometryTile,
const CanonicalTileID& tileID,
- const Style& style,
+ const style::Style& style,
const float bearing,
const float pixelsToTileUnits) const {
@@ -116,7 +116,7 @@ void FeatureIndex::addFeature(
auto styleLayer = style.getLayer(layerID);
if (!styleLayer ||
- (!styleLayer->is<SymbolLayer>() &&
+ (!styleLayer->is<style::SymbolLayer>() &&
!styleLayer->baseImpl->queryIntersectsGeometry(queryGeometry, geometryTileFeature->getGeometries(), bearing, pixelsToTileUnits))) {
continue;
}
@@ -128,7 +128,7 @@ void FeatureIndex::addFeature(
optional<GeometryCollection> FeatureIndex::translateQueryGeometry(
const GeometryCollection& queryGeometry,
const std::array<float, 2>& translate,
- const TranslateAnchorType anchorType,
+ const style::TranslateAnchorType anchorType,
const float bearing,
const float pixelsToTileUnits) {
if (translate[0] == 0 && translate[1] == 0) {
@@ -136,7 +136,7 @@ optional<GeometryCollection> FeatureIndex::translateQueryGeometry(
}
GeometryCoordinate translateVec(translate[0] * pixelsToTileUnits, translate[1] * pixelsToTileUnits);
- if (anchorType == TranslateAnchorType::Viewport) {
+ if (anchorType == style::TranslateAnchorType::Viewport) {
translateVec = util::rotate(translateVec, -bearing);
}
diff --git a/src/mbgl/geometry/feature_index.hpp b/src/mbgl/geometry/feature_index.hpp
index 0dcc154f02..c944a98130 100644
--- a/src/mbgl/geometry/feature_index.hpp
+++ b/src/mbgl/geometry/feature_index.hpp
@@ -1,5 +1,6 @@
#pragma once
+#include <mbgl/style/types.hpp>
#include <mbgl/tile/geometry_tile.hpp>
#include <mbgl/util/grid_index.hpp>
#include <mbgl/util/feature.hpp>
@@ -10,9 +11,11 @@
namespace mbgl {
+namespace style {
class Style;
+}
+
class CollisionTile;
-enum class TranslateAnchorType : bool;
class CanonicalTileID;
class IndexedSubfeature {
@@ -39,12 +42,12 @@ public:
const optional<std::vector<std::string>>& layerIDs,
const GeometryTile&,
const CanonicalTileID&,
- const Style&) const;
+ const style::Style&) const;
static optional<GeometryCollection> translateQueryGeometry(
const GeometryCollection& queryGeometry,
const std::array<float, 2>& translate,
- const TranslateAnchorType,
+ const style::TranslateAnchorType,
const float bearing,
const float pixelsToTileUnits);
@@ -60,7 +63,7 @@ private:
const optional<std::vector<std::string>>& filterLayerIDs,
const GeometryTile&,
const CanonicalTileID&,
- const Style&,
+ const style::Style&,
const float bearing,
const float pixelsToTileUnits) const;
diff --git a/src/mbgl/layer/background_layer_impl.hpp b/src/mbgl/layer/background_layer_impl.hpp
deleted file mode 100644
index 6af31dd921..0000000000
--- a/src/mbgl/layer/background_layer_impl.hpp
+++ /dev/null
@@ -1,24 +0,0 @@
-#pragma once
-
-#include <mbgl/layer/layer_impl.hpp>
-#include <mbgl/layer/background_layer.hpp>
-#include <mbgl/layer/background_layer_properties.hpp>
-
-namespace mbgl {
-
-class BackgroundLayer::Impl : public Layer::Impl {
-public:
- std::unique_ptr<Layer> clone() const override;
-
- void parseLayout(const JSValue&) override {};
- void parsePaints(const JSValue&) override;
-
- void cascade(const StyleCascadeParameters&) override;
- bool recalculate(const StyleCalculationParameters&) override;
-
- std::unique_ptr<Bucket> createBucket(StyleBucketParameters&) const override;
-
- BackgroundPaintProperties paint;
-};
-
-} // namespace mbgl
diff --git a/src/mbgl/layer/raster_layer_impl.hpp b/src/mbgl/layer/raster_layer_impl.hpp
deleted file mode 100644
index a83c7f259e..0000000000
--- a/src/mbgl/layer/raster_layer_impl.hpp
+++ /dev/null
@@ -1,24 +0,0 @@
-#pragma once
-
-#include <mbgl/layer/layer_impl.hpp>
-#include <mbgl/layer/raster_layer.hpp>
-#include <mbgl/layer/raster_layer_properties.hpp>
-
-namespace mbgl {
-
-class RasterLayer::Impl : public Layer::Impl {
-public:
- std::unique_ptr<Layer> clone() const override;
-
- void parseLayout(const JSValue&) override {};
- void parsePaints(const JSValue&) override;
-
- void cascade(const StyleCascadeParameters&) override;
- bool recalculate(const StyleCalculationParameters&) override;
-
- std::unique_ptr<Bucket> createBucket(StyleBucketParameters&) const override;
-
- RasterPaintProperties paint;
-};
-
-} // namespace mbgl
diff --git a/src/mbgl/map/map.cpp b/src/mbgl/map/map.cpp
index 4f1c4634ca..ec961a6485 100644
--- a/src/mbgl/map/map.cpp
+++ b/src/mbgl/map/map.cpp
@@ -5,11 +5,11 @@
#include <mbgl/map/transform_state.hpp>
#include <mbgl/annotation/annotation_manager.hpp>
#include <mbgl/style/style.hpp>
-#include <mbgl/style/style_observer.hpp>
-#include <mbgl/style/property_transition.hpp>
-#include <mbgl/style/style_update_parameters.hpp>
-#include <mbgl/style/style_query_parameters.hpp>
-#include <mbgl/layer/custom_layer.hpp>
+#include <mbgl/style/layer.hpp>
+#include <mbgl/style/observer.hpp>
+#include <mbgl/style/transition_options.hpp>
+#include <mbgl/style/update_parameters.hpp>
+#include <mbgl/style/query_parameters.hpp>
#include <mbgl/renderer/painter.hpp>
#include <mbgl/storage/file_source.hpp>
#include <mbgl/storage/resource.hpp>
@@ -25,13 +25,15 @@
namespace mbgl {
+using namespace style;
+
enum class RenderState {
never,
partial,
fully
};
-class Map::Impl : public StyleObserver {
+class Map::Impl : public style::Observer {
public:
Impl(View&, FileSource&, MapMode, GLContextMode, ConstrainMode, ViewportMode);
@@ -221,17 +223,17 @@ void Map::Impl::update() {
style->recalculate(transform.getZoom(), timePoint, mode);
}
- StyleUpdateParameters parameters(pixelRatio,
- debugOptions,
- timePoint,
- transform.getState(),
- style->workers,
- fileSource,
- *texturePool,
- style->shouldReparsePartialTiles,
- mode,
- *annotationManager,
- *style);
+ style::UpdateParameters parameters(pixelRatio,
+ debugOptions,
+ timePoint,
+ transform.getState(),
+ style->workers,
+ fileSource,
+ *texturePool,
+ style->shouldReparsePartialTiles,
+ mode,
+ *annotationManager,
+ *style);
style->update(parameters);
@@ -799,19 +801,19 @@ bool Map::isFullyLoaded() const {
return impl->style->isLoaded();
}
-void Map::addClass(const std::string& className, const PropertyTransition& properties) {
+void Map::addClass(const std::string& className, const TransitionOptions& properties) {
if (impl->style->addClass(className, properties)) {
update(Update::Classes);
}
}
-void Map::removeClass(const std::string& className, const PropertyTransition& properties) {
+void Map::removeClass(const std::string& className, const TransitionOptions& properties) {
if (impl->style->removeClass(className, properties)) {
update(Update::Classes);
}
}
-void Map::setClasses(const std::vector<std::string>& classNames, const PropertyTransition& properties) {
+void Map::setClasses(const std::vector<std::string>& classNames, const TransitionOptions& properties) {
impl->style->setClasses(classNames, properties);
update(Update::Classes);
}
diff --git a/src/mbgl/style/zoom_history.hpp b/src/mbgl/map/zoom_history.hpp
index 8c88ea6507..8c88ea6507 100644
--- a/src/mbgl/style/zoom_history.hpp
+++ b/src/mbgl/map/zoom_history.hpp
diff --git a/src/mbgl/renderer/bucket.hpp b/src/mbgl/renderer/bucket.hpp
index 89b0ceefb2..c7ebe480ed 100644
--- a/src/mbgl/renderer/bucket.hpp
+++ b/src/mbgl/renderer/bucket.hpp
@@ -13,7 +13,6 @@
namespace mbgl {
class Painter;
-class Layer;
class UnwrappedTileID;
class CollisionTile;
@@ -21,6 +20,10 @@ namespace gl {
class ObjectStore;
}
+namespace style {
+class Layer;
+}
+
class Bucket : private util::noncopyable {
public:
Bucket() : uploaded(false) {}
@@ -31,7 +34,7 @@ public:
// Every time this bucket is getting rendered, this function is called. This happens either
// once or twice (for Opaque and Transparent render passes).
- virtual void render(Painter&, const Layer&, const UnwrappedTileID&, const mat4&) = 0;
+ virtual void render(Painter&, const style::Layer&, const UnwrappedTileID&, const mat4&) = 0;
virtual ~Bucket() = default;
diff --git a/src/mbgl/renderer/circle_bucket.cpp b/src/mbgl/renderer/circle_bucket.cpp
index 969e05131b..4ae63fed46 100644
--- a/src/mbgl/renderer/circle_bucket.cpp
+++ b/src/mbgl/renderer/circle_bucket.cpp
@@ -2,10 +2,12 @@
#include <mbgl/renderer/painter.hpp>
#include <mbgl/shader/circle_shader.hpp>
-#include <mbgl/layer/circle_layer.hpp>
+#include <mbgl/style/layers/circle_layer.hpp>
#include <mbgl/util/constants.hpp>
-using namespace mbgl;
+namespace mbgl {
+
+using namespace style;
CircleBucket::CircleBucket(MapMode mode_) : mode(mode_) {
}
@@ -97,3 +99,5 @@ void CircleBucket::drawCircles(CircleShader& shader, gl::ObjectStore& store) {
elementsIndex += group->elements_length * elementsBuffer_.itemSize;
}
}
+
+}
diff --git a/src/mbgl/renderer/circle_bucket.hpp b/src/mbgl/renderer/circle_bucket.hpp
index 9c95fce045..fa34aa088a 100644
--- a/src/mbgl/renderer/circle_bucket.hpp
+++ b/src/mbgl/renderer/circle_bucket.hpp
@@ -19,7 +19,7 @@ public:
~CircleBucket() override;
void upload(gl::ObjectStore&) override;
- void render(Painter&, const Layer&, const UnwrappedTileID&, const mat4&) override;
+ void render(Painter&, const style::Layer&, const UnwrappedTileID&, const mat4&) override;
bool hasData() const override;
bool needsClipping() const override;
diff --git a/src/mbgl/renderer/fill_bucket.cpp b/src/mbgl/renderer/fill_bucket.cpp
index 4a9709f4e8..02f346decb 100644
--- a/src/mbgl/renderer/fill_bucket.cpp
+++ b/src/mbgl/renderer/fill_bucket.cpp
@@ -1,5 +1,5 @@
#include <mbgl/renderer/fill_bucket.hpp>
-#include <mbgl/layer/fill_layer.hpp>
+#include <mbgl/style/layers/fill_layer.hpp>
#include <mbgl/renderer/painter.hpp>
#include <mbgl/shader/plain_shader.hpp>
#include <mbgl/shader/pattern_shader.hpp>
@@ -12,22 +12,24 @@
#include <cassert>
-struct GeometryTooLongException : std::exception {};
-
-using namespace mbgl;
-
namespace mapbox {
namespace util {
-template <> struct nth<0, GeometryCoordinate> {
- inline static int64_t get(const GeometryCoordinate& t) { return t.x; };
+template <> struct nth<0, mbgl::GeometryCoordinate> {
+ inline static int64_t get(const mbgl::GeometryCoordinate& t) { return t.x; };
};
-template <> struct nth<1, GeometryCoordinate> {
- inline static int64_t get(const GeometryCoordinate& t) { return t.y; };
+template <> struct nth<1, mbgl::GeometryCoordinate> {
+ inline static int64_t get(const mbgl::GeometryCoordinate& t) { return t.y; };
};
}
}
+namespace mbgl {
+
+using namespace style;
+
+struct GeometryTooLongException : std::exception {};
+
FillBucket::FillBucket() {
}
@@ -165,3 +167,5 @@ void FillBucket::drawVertices(OutlinePatternShader& shader, gl::ObjectStore& sto
elements_index += group->elements_length * lineElementsBuffer.itemSize;
}
}
+
+}
diff --git a/src/mbgl/renderer/fill_bucket.hpp b/src/mbgl/renderer/fill_bucket.hpp
index 21e3239f29..35d70d169c 100644
--- a/src/mbgl/renderer/fill_bucket.hpp
+++ b/src/mbgl/renderer/fill_bucket.hpp
@@ -21,7 +21,7 @@ public:
~FillBucket() override;
void upload(gl::ObjectStore&) override;
- void render(Painter&, const Layer&, const UnwrappedTileID&, const mat4&) override;
+ void render(Painter&, const style::Layer&, const UnwrappedTileID&, const mat4&) override;
bool hasData() const override;
bool needsClipping() const override;
diff --git a/src/mbgl/renderer/line_bucket.cpp b/src/mbgl/renderer/line_bucket.cpp
index 8124a5daed..d207cdb8c5 100644
--- a/src/mbgl/renderer/line_bucket.cpp
+++ b/src/mbgl/renderer/line_bucket.cpp
@@ -1,5 +1,5 @@
#include <mbgl/renderer/line_bucket.hpp>
-#include <mbgl/layer/line_layer.hpp>
+#include <mbgl/style/layers/line_layer.hpp>
#include <mbgl/geometry/elements_buffer.hpp>
#include <mbgl/renderer/painter.hpp>
#include <mbgl/shader/line_shader.hpp>
@@ -11,7 +11,9 @@
#include <cassert>
-using namespace mbgl;
+namespace mbgl {
+
+using namespace style;
LineBucket::LineBucket(uint32_t overscaling_) : overscaling(overscaling_) {
}
@@ -505,3 +507,5 @@ void LineBucket::drawLinePatterns(LinepatternShader& shader, gl::ObjectStore& st
elements_index += group->elements_length * triangleElementsBuffer.itemSize;
}
}
+
+}
diff --git a/src/mbgl/renderer/line_bucket.hpp b/src/mbgl/renderer/line_bucket.hpp
index 1093ec2a48..d746f29c7e 100644
--- a/src/mbgl/renderer/line_bucket.hpp
+++ b/src/mbgl/renderer/line_bucket.hpp
@@ -5,13 +5,12 @@
#include <mbgl/geometry/vao.hpp>
#include <mbgl/geometry/elements_buffer.hpp>
#include <mbgl/geometry/line_buffer.hpp>
-#include <mbgl/layer/line_layer_impl.hpp>
+#include <mbgl/style/layers/line_layer_properties.hpp>
#include <vector>
namespace mbgl {
-class Style;
class LineVertexBuffer;
class TriangleElementsBuffer;
class LineShader;
@@ -26,7 +25,7 @@ public:
~LineBucket() override;
void upload(gl::ObjectStore&) override;
- void render(Painter&, const Layer&, const UnwrappedTileID&, const mat4&) override;
+ void render(Painter&, const style::Layer&, const UnwrappedTileID&, const mat4&) override;
bool hasData() const override;
bool needsClipping() const override;
@@ -50,7 +49,7 @@ private:
std::vector<TriangleElement>& triangleStore);
public:
- LineLayoutProperties layout;
+ style::LineLayoutProperties layout;
private:
LineVertexBuffer vertexBuffer;
diff --git a/src/mbgl/renderer/painter.cpp b/src/mbgl/renderer/painter.cpp
index ccc6e23408..1864bf7ef1 100644
--- a/src/mbgl/renderer/painter.cpp
+++ b/src/mbgl/renderer/painter.cpp
@@ -1,18 +1,17 @@
#include <mbgl/renderer/painter.hpp>
-#include <mbgl/source/source.hpp>
+#include <mbgl/style/source.hpp>
#include <mbgl/tile/tile.hpp>
#include <mbgl/platform/log.hpp>
#include <mbgl/gl/debugging.hpp>
#include <mbgl/style/style.hpp>
-#include <mbgl/layer/layer_impl.hpp>
-#include <mbgl/style/style_render_parameters.hpp>
+#include <mbgl/style/layer_impl.hpp>
-#include <mbgl/layer/background_layer.hpp>
-#include <mbgl/layer/custom_layer.hpp>
-#include <mbgl/layer/custom_layer_impl.hpp>
+#include <mbgl/style/layers/background_layer.hpp>
+#include <mbgl/style/layers/custom_layer.hpp>
+#include <mbgl/style/layers/custom_layer_impl.hpp>
#include <mbgl/sprite/sprite_atlas.hpp>
#include <mbgl/geometry/line_atlas.hpp>
@@ -46,7 +45,9 @@
#include <algorithm>
#include <iostream>
-using namespace mbgl;
+namespace mbgl {
+
+using namespace style;
Painter::Painter(const TransformState& state_, gl::ObjectStore& store_)
: state(state_),
@@ -308,3 +309,5 @@ void Painter::setDepthSublayer(int n) {
float farDepth = nearDepth + depthRangeSize;
config.depthRange = { nearDepth, farDepth };
}
+
+}
diff --git a/src/mbgl/renderer/painter.hpp b/src/mbgl/renderer/painter.hpp
index ad26457555..f040fee67f 100644
--- a/src/mbgl/renderer/painter.hpp
+++ b/src/mbgl/renderer/painter.hpp
@@ -13,7 +13,7 @@
#include <mbgl/gl/gl_config.hpp>
#include <mbgl/style/render_item.hpp>
-#include <mbgl/style/types.hpp>
+#include <mbgl/style/style.hpp>
#include <mbgl/gl/gl.hpp>
@@ -28,27 +28,19 @@
namespace mbgl {
-class Style;
class Tile;
class SpriteAtlas;
class GlyphAtlas;
class LineAtlas;
-class Source;
struct FrameData;
class TileData;
class DebugBucket;
class FillBucket;
-class FillLayer;
class LineBucket;
-class LineLayer;
class CircleBucket;
-class CircleLayer;
class SymbolBucket;
-class SymbolLayer;
class RasterBucket;
-class RasterLayer;
-class BackgroundLayer;
class SDFShader;
class PlainShader;
@@ -72,6 +64,17 @@ namespace util {
class ObjectStore;
}
+namespace style {
+class Style;
+class Source;
+class FillLayer;
+class LineLayer;
+class CircleLayer;
+class SymbolLayer;
+class RasterLayer;
+class BackgroundLayer;
+}
+
struct FrameData {
std::array<uint16_t, 2> framebufferSize;
TimePoint timePoint;
@@ -86,8 +89,8 @@ public:
Painter(const TransformState&, gl::ObjectStore&);
~Painter();
- void render(const Style& style,
- const FrameData& frame,
+ void render(const style::Style&,
+ const FrameData&,
SpriteAtlas& annotationSpriteAtlas);
// Renders debug information for a tile.
@@ -99,12 +102,12 @@ public:
void renderClipMasks();
void renderDebugText(TileData&, const mat4&);
- void renderFill(FillBucket&, const FillLayer&, const UnwrappedTileID&, const mat4&);
- void renderLine(LineBucket&, const LineLayer&, const UnwrappedTileID&, const mat4&);
- void renderCircle(CircleBucket&, const CircleLayer&, const UnwrappedTileID&, const mat4&);
- void renderSymbol(SymbolBucket&, const SymbolLayer&, const UnwrappedTileID&, const mat4&);
- void renderRaster(RasterBucket&, const RasterLayer&, const UnwrappedTileID&, const mat4&);
- void renderBackground(const BackgroundLayer&);
+ void renderFill(FillBucket&, const style::FillLayer&, const UnwrappedTileID&, const mat4&);
+ void renderLine(LineBucket&, const style::LineLayer&, const UnwrappedTileID&, const mat4&);
+ void renderCircle(CircleBucket&, const style::CircleLayer&, const UnwrappedTileID&, const mat4&);
+ void renderSymbol(SymbolBucket&, const style::SymbolLayer&, const UnwrappedTileID&, const mat4&);
+ void renderRaster(RasterBucket&, const style::RasterLayer&, const UnwrappedTileID&, const mat4&);
+ void renderBackground(const style::BackgroundLayer&);
float saturationFactor(float saturation);
float contrastFactor(float contrast);
@@ -118,9 +121,9 @@ private:
mat4 translatedMatrix(const mat4& matrix,
const std::array<float, 2>& translation,
const UnwrappedTileID& id,
- TranslateAnchorType anchor);
+ style::TranslateAnchorType anchor);
- std::vector<RenderItem> determineRenderOrder(const Style& style);
+ std::vector<RenderItem> determineRenderOrder(const style::Style&);
template <class Iterator>
void renderPass(RenderPass,
@@ -138,7 +141,7 @@ private:
void (SymbolBucket::*drawSDF)(SDFShader&, gl::ObjectStore&),
// Layout
- RotationAlignmentType rotationAlignment,
+ style::RotationAlignmentType rotationAlignment,
float layoutSize,
// Paint
@@ -148,7 +151,7 @@ private:
float haloWidth,
float haloBlur,
std::array<float, 2> translate,
- TranslateAnchorType translateAnchor,
+ style::TranslateAnchorType translateAnchor,
float paintSize);
void setDepthSublayer(int n);
diff --git a/src/mbgl/renderer/painter_background.cpp b/src/mbgl/renderer/painter_background.cpp
index bc01d3c32f..07e5821ce8 100644
--- a/src/mbgl/renderer/painter_background.cpp
+++ b/src/mbgl/renderer/painter_background.cpp
@@ -1,14 +1,16 @@
#include <mbgl/renderer/painter.hpp>
-#include <mbgl/layer/background_layer.hpp>
-#include <mbgl/layer/background_layer_impl.hpp>
+#include <mbgl/style/layers/background_layer.hpp>
+#include <mbgl/style/layers/background_layer_impl.hpp>
#include <mbgl/shader/pattern_shader.hpp>
#include <mbgl/shader/plain_shader.hpp>
#include <mbgl/sprite/sprite_atlas.hpp>
#include <mbgl/util/mat4.hpp>
#include <mbgl/util/tile_cover.hpp>
-using namespace mbgl;
+namespace mbgl {
+
+using namespace style;
void Painter::renderBackground(const BackgroundLayer& layer) {
// Note that for bottommost layers without a pattern, the background color is drawn with
@@ -107,3 +109,5 @@ void Painter::renderBackground(const BackgroundLayer& layer) {
MBGL_CHECK_ERROR(glDrawArrays(GL_TRIANGLE_STRIP, 0, (GLsizei)tileStencilBuffer.index()));
}
}
+
+}
diff --git a/src/mbgl/renderer/painter_circle.cpp b/src/mbgl/renderer/painter_circle.cpp
index c371f4debe..9f2cd17f7f 100644
--- a/src/mbgl/renderer/painter_circle.cpp
+++ b/src/mbgl/renderer/painter_circle.cpp
@@ -1,12 +1,14 @@
#include <mbgl/renderer/painter.hpp>
#include <mbgl/renderer/circle_bucket.hpp>
-#include <mbgl/layer/circle_layer.hpp>
-#include <mbgl/layer/circle_layer_impl.hpp>
+#include <mbgl/style/layers/circle_layer.hpp>
+#include <mbgl/style/layers/circle_layer_impl.hpp>
#include <mbgl/shader/circle_shader.hpp>
-using namespace mbgl;
+namespace mbgl {
+
+using namespace style;
void Painter::renderCircle(CircleBucket& bucket,
const CircleLayer& layer,
@@ -43,3 +45,5 @@ void Painter::renderCircle(CircleBucket& bucket,
bucket.drawCircles(*circleShader, store);
}
+
+}
diff --git a/src/mbgl/renderer/painter_clipping.cpp b/src/mbgl/renderer/painter_clipping.cpp
index f0fd498267..e6ce1a040e 100644
--- a/src/mbgl/renderer/painter_clipping.cpp
+++ b/src/mbgl/renderer/painter_clipping.cpp
@@ -1,5 +1,5 @@
#include <mbgl/renderer/painter.hpp>
-#include <mbgl/source/source.hpp>
+#include <mbgl/style/source.hpp>
#include <mbgl/shader/plain_shader.hpp>
#include <mbgl/util/clip_id.hpp>
#include <mbgl/util/string.hpp>
diff --git a/src/mbgl/renderer/painter_fill.cpp b/src/mbgl/renderer/painter_fill.cpp
index b499d20da3..b89686c815 100644
--- a/src/mbgl/renderer/painter_fill.cpp
+++ b/src/mbgl/renderer/painter_fill.cpp
@@ -1,14 +1,16 @@
#include <mbgl/renderer/painter.hpp>
#include <mbgl/renderer/fill_bucket.hpp>
-#include <mbgl/layer/fill_layer.hpp>
-#include <mbgl/layer/fill_layer_impl.hpp>
+#include <mbgl/style/layers/fill_layer.hpp>
+#include <mbgl/style/layers/fill_layer_impl.hpp>
#include <mbgl/sprite/sprite_atlas.hpp>
#include <mbgl/shader/outline_shader.hpp>
#include <mbgl/shader/outlinepattern_shader.hpp>
#include <mbgl/shader/pattern_shader.hpp>
#include <mbgl/shader/plain_shader.hpp>
-using namespace mbgl;
+namespace mbgl {
+
+using namespace style;
void Painter::renderFill(FillBucket& bucket,
const FillLayer& layer,
@@ -195,3 +197,5 @@ void Painter::renderFill(FillBucket& bucket,
bucket.drawVertices(*outlineShader, store);
}
}
+
+}
diff --git a/src/mbgl/renderer/painter_line.cpp b/src/mbgl/renderer/painter_line.cpp
index 3cf1ad4147..26041a8165 100644
--- a/src/mbgl/renderer/painter_line.cpp
+++ b/src/mbgl/renderer/painter_line.cpp
@@ -1,7 +1,7 @@
#include <mbgl/renderer/painter.hpp>
#include <mbgl/renderer/line_bucket.hpp>
-#include <mbgl/layer/line_layer.hpp>
-#include <mbgl/layer/line_layer_impl.hpp>
+#include <mbgl/style/layers/line_layer.hpp>
+#include <mbgl/style/layers/line_layer_impl.hpp>
#include <mbgl/shader/line_shader.hpp>
#include <mbgl/shader/linesdf_shader.hpp>
#include <mbgl/shader/linepattern_shader.hpp>
@@ -9,7 +9,9 @@
#include <mbgl/geometry/line_atlas.hpp>
#include <mbgl/util/mat2.hpp>
-using namespace mbgl;
+namespace mbgl {
+
+using namespace style;
void Painter::renderLine(LineBucket& bucket,
const LineLayer& layer,
@@ -161,3 +163,5 @@ void Painter::renderLine(LineBucket& bucket,
bucket.drawLines(*lineShader, store);
}
}
+
+}
diff --git a/src/mbgl/renderer/painter_raster.cpp b/src/mbgl/renderer/painter_raster.cpp
index 511ac96387..cce71e8ce2 100644
--- a/src/mbgl/renderer/painter_raster.cpp
+++ b/src/mbgl/renderer/painter_raster.cpp
@@ -1,11 +1,13 @@
#include <mbgl/renderer/painter.hpp>
#include <mbgl/gl/gl.hpp>
#include <mbgl/renderer/raster_bucket.hpp>
-#include <mbgl/layer/raster_layer.hpp>
-#include <mbgl/layer/raster_layer_impl.hpp>
+#include <mbgl/style/layers/raster_layer.hpp>
+#include <mbgl/style/layers/raster_layer_impl.hpp>
#include <mbgl/shader/raster_shader.hpp>
-using namespace mbgl;
+namespace mbgl {
+
+using namespace style;
void Painter::renderRaster(RasterBucket& bucket,
const RasterLayer& layer,
@@ -66,3 +68,5 @@ std::array<float, 3> Painter::spinWeights(float spin) {
}};
return spin_weights;
}
+
+}
diff --git a/src/mbgl/renderer/painter_symbol.cpp b/src/mbgl/renderer/painter_symbol.cpp
index 9774568074..3c453242ae 100644
--- a/src/mbgl/renderer/painter_symbol.cpp
+++ b/src/mbgl/renderer/painter_symbol.cpp
@@ -1,6 +1,7 @@
#include <mbgl/renderer/painter.hpp>
#include <mbgl/renderer/symbol_bucket.hpp>
-#include <mbgl/layer/symbol_layer.hpp>
+#include <mbgl/style/layers/symbol_layer.hpp>
+#include <mbgl/style/layers/symbol_layer_impl.hpp>
#include <mbgl/geometry/glyph_atlas.hpp>
#include <mbgl/sprite/sprite_atlas.hpp>
#include <mbgl/shader/sdf_shader.hpp>
@@ -10,7 +11,9 @@
#include <cmath>
-using namespace mbgl;
+namespace mbgl {
+
+using namespace style;
void Painter::renderSDF(SymbolBucket &bucket,
const UnwrappedTileID &tileID,
@@ -257,3 +260,5 @@ void Painter::renderSymbol(SymbolBucket& bucket,
config.activeTexture = GL_TEXTURE0;
}
+
+}
diff --git a/src/mbgl/renderer/raster_bucket.cpp b/src/mbgl/renderer/raster_bucket.cpp
index b16d7f8161..39f8dacd92 100644
--- a/src/mbgl/renderer/raster_bucket.cpp
+++ b/src/mbgl/renderer/raster_bucket.cpp
@@ -1,9 +1,11 @@
#include <mbgl/renderer/raster_bucket.hpp>
-#include <mbgl/layer/raster_layer.hpp>
+#include <mbgl/style/layers/raster_layer.hpp>
#include <mbgl/shader/raster_shader.hpp>
#include <mbgl/renderer/painter.hpp>
-using namespace mbgl;
+namespace mbgl {
+
+using namespace style;
RasterBucket::RasterBucket(gl::TexturePool& texturePool)
: raster(texturePool) {
@@ -40,3 +42,5 @@ bool RasterBucket::hasData() const {
bool RasterBucket::needsClipping() const {
return false;
}
+
+}
diff --git a/src/mbgl/renderer/raster_bucket.hpp b/src/mbgl/renderer/raster_bucket.hpp
index 9125ef2047..93331755fb 100644
--- a/src/mbgl/renderer/raster_bucket.hpp
+++ b/src/mbgl/renderer/raster_bucket.hpp
@@ -14,7 +14,7 @@ public:
RasterBucket(gl::TexturePool&);
void upload(gl::ObjectStore&) override;
- void render(Painter&, const Layer&, const UnwrappedTileID&, const mat4&) override;
+ void render(Painter&, const style::Layer&, const UnwrappedTileID&, const mat4&) override;
bool hasData() const override;
bool needsClipping() const override;
diff --git a/src/mbgl/renderer/symbol_bucket.cpp b/src/mbgl/renderer/symbol_bucket.cpp
index 67c8468ecd..f4e55432c1 100644
--- a/src/mbgl/renderer/symbol_bucket.cpp
+++ b/src/mbgl/renderer/symbol_bucket.cpp
@@ -1,6 +1,6 @@
#include <mbgl/renderer/symbol_bucket.hpp>
#include <mbgl/style/filter_evaluator.hpp>
-#include <mbgl/layer/symbol_layer.hpp>
+#include <mbgl/style/layers/symbol_layer.hpp>
#include <mbgl/tile/geometry_tile.hpp>
#include <mbgl/sprite/sprite_image.hpp>
#include <mbgl/sprite/sprite_store.hpp>
@@ -31,6 +31,8 @@
namespace mbgl {
+using namespace style;
+
SymbolInstance::SymbolInstance(Anchor& anchor, const GeometryCoordinates& line,
const Shaping& shapedText, const PositionedIcon& shapedIcon,
const SymbolLayoutProperties& layout, const bool addToBuffers, const uint32_t index_,
diff --git a/src/mbgl/renderer/symbol_bucket.hpp b/src/mbgl/renderer/symbol_bucket.hpp
index b19a86b275..314d44bdee 100644
--- a/src/mbgl/renderer/symbol_bucket.hpp
+++ b/src/mbgl/renderer/symbol_bucket.hpp
@@ -13,7 +13,7 @@
#include <mbgl/text/shaping.hpp>
#include <mbgl/text/quads.hpp>
#include <mbgl/style/filter.hpp>
-#include <mbgl/layer/symbol_layer_impl.hpp>
+#include <mbgl/style/layers/symbol_layer_properties.hpp>
#include <memory>
#include <map>
@@ -46,7 +46,7 @@ class SymbolInstance {
public:
explicit SymbolInstance(Anchor& anchor, const GeometryCoordinates& line,
const Shaping& shapedText, const PositionedIcon& shapedIcon,
- const SymbolLayoutProperties& layout, const bool inside, const uint32_t index,
+ const style::SymbolLayoutProperties&, const bool inside, const uint32_t index,
const float textBoxScale, const float textPadding, const float textAlongLine,
const float iconBoxScale, const float iconPadding, const float iconAlongLine,
const GlyphPositions& face, const IndexedSubfeature& indexedfeature);
@@ -70,7 +70,7 @@ public:
~SymbolBucket() override;
void upload(gl::ObjectStore&) override;
- void render(Painter&, const Layer&, const UnwrappedTileID&, const mat4&) override;
+ void render(Painter&, const style::Layer&, const UnwrappedTileID&, const mat4&) override;
bool hasData() const override;
bool hasTextData() const;
bool hasIconData() const;
@@ -87,7 +87,7 @@ public:
void drawIcons(IconShader&, gl::ObjectStore&);
void drawCollisionBoxes(CollisionBoxShader&, gl::ObjectStore&);
- void parseFeatures(const GeometryTileLayer&, const Filter&);
+ void parseFeatures(const GeometryTileLayer&, const style::Filter&);
bool needsDependencies(GlyphStore&, SpriteStore&);
void placeFeatures(CollisionTile&) override;
@@ -109,7 +109,7 @@ private:
const bool keepUpright, const bool alongLine, const float placementAngle);
public:
- SymbolLayoutProperties layout;
+ style::SymbolLayoutProperties layout;
float iconMaxSize = 1.0f;
float textMaxSize = 16.0f;
diff --git a/src/mbgl/style/style_bucket_parameters.cpp b/src/mbgl/style/bucket_parameters.cpp
index 0b4b2affcd..f3367d57e1 100644
--- a/src/mbgl/style/style_bucket_parameters.cpp
+++ b/src/mbgl/style/bucket_parameters.cpp
@@ -1,10 +1,11 @@
-#include <mbgl/style/style_bucket_parameters.hpp>
+#include <mbgl/style/bucket_parameters.hpp>
#include <mbgl/style/filter_evaluator.hpp>
#include <mbgl/tile/geometry_tile.hpp>
namespace mbgl {
+namespace style {
-void StyleBucketParameters::eachFilteredFeature(const Filter& filter,
+void BucketParameters::eachFilteredFeature(const Filter& filter,
std::function<void (const GeometryTileFeature&, std::size_t index, const std::string& layerName)> function) {
auto name = layer.getName();
for (std::size_t i = 0; !cancelled() && i < layer.featureCount(); i++) {
@@ -18,4 +19,5 @@ void StyleBucketParameters::eachFilteredFeature(const Filter& filter,
}
}
+} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/style/style_bucket_parameters.hpp b/src/mbgl/style/bucket_parameters.hpp
index 17639afae7..f85e1e17ef 100644
--- a/src/mbgl/style/style_bucket_parameters.hpp
+++ b/src/mbgl/style/bucket_parameters.hpp
@@ -18,9 +18,11 @@ class GlyphStore;
class CollisionTile;
class FeatureIndex;
-class StyleBucketParameters {
+namespace style {
+
+class BucketParameters {
public:
- StyleBucketParameters(const OverscaledTileID& tileID_,
+ BucketParameters(const OverscaledTileID& tileID_,
const GeometryTileLayer& layer_,
const std::atomic<bool>& obsolete_,
uintptr_t tileUID_,
@@ -59,4 +61,5 @@ public:
const MapMode mode;
};
+} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/style/calculation_parameters.hpp b/src/mbgl/style/calculation_parameters.hpp
new file mode 100644
index 0000000000..2afd7c4b34
--- /dev/null
+++ b/src/mbgl/style/calculation_parameters.hpp
@@ -0,0 +1,30 @@
+#pragma once
+
+#include <mbgl/map/zoom_history.hpp>
+#include <mbgl/util/chrono.hpp>
+
+namespace mbgl {
+namespace style {
+
+class CalculationParameters {
+public:
+ explicit CalculationParameters(float z_)
+ : z(z_) {}
+
+ CalculationParameters(float z_,
+ const TimePoint& now_,
+ const ZoomHistory& zoomHistory_,
+ const Duration& defaultFadeDuration_)
+ : z(z_),
+ now(now_),
+ zoomHistory(zoomHistory_),
+ defaultFadeDuration(defaultFadeDuration_) {}
+
+ float z;
+ TimePoint now;
+ ZoomHistory zoomHistory;
+ Duration defaultFadeDuration;
+};
+
+} // namespace style
+} // namespace mbgl
diff --git a/src/mbgl/style/cascade_parameters.hpp b/src/mbgl/style/cascade_parameters.hpp
new file mode 100644
index 0000000000..4ad6da2ce3
--- /dev/null
+++ b/src/mbgl/style/cascade_parameters.hpp
@@ -0,0 +1,22 @@
+#pragma once
+
+#include <mbgl/util/chrono.hpp>
+#include <mbgl/style/class_dictionary.hpp>
+#include <mbgl/style/transition_options.hpp>
+
+#include <vector>
+
+namespace mbgl {
+namespace style {
+
+class TransitionOptions;
+
+class CascadeParameters {
+public:
+ std::vector<ClassID> classes;
+ TimePoint now;
+ TransitionOptions transition;
+};
+
+} // namespace style
+} // namespace mbgl
diff --git a/src/mbgl/style/class_dictionary.cpp b/src/mbgl/style/class_dictionary.cpp
index 53ea5c1484..ec06ee7d9d 100644
--- a/src/mbgl/style/class_dictionary.cpp
+++ b/src/mbgl/style/class_dictionary.cpp
@@ -3,6 +3,7 @@
#include <pthread.h>
namespace mbgl {
+namespace style {
ClassDictionary::ClassDictionary() {}
@@ -46,4 +47,5 @@ ClassID ClassDictionary::normalize(ClassID id) {
}
}
+} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/style/class_dictionary.hpp b/src/mbgl/style/class_dictionary.hpp
index 703e27b438..c95773d7c3 100644
--- a/src/mbgl/style/class_dictionary.hpp
+++ b/src/mbgl/style/class_dictionary.hpp
@@ -5,6 +5,7 @@
#include <unordered_map>
namespace mbgl {
+namespace style {
enum class ClassID : uint32_t {
Fallback = 0, // These values are from the fallback properties
@@ -31,4 +32,5 @@ private:
uint32_t offset = 0;
};
+} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/style/filter_evaluator.hpp b/src/mbgl/style/filter_evaluator.hpp
index b607a0c658..e03beaa4d0 100644
--- a/src/mbgl/style/filter_evaluator.hpp
+++ b/src/mbgl/style/filter_evaluator.hpp
@@ -6,6 +6,7 @@
#include <type_traits>
namespace mbgl {
+namespace style {
class FilterEvaluator {
public:
@@ -159,3 +160,4 @@ private:
};
} // namespace mbgl
+} // namespace mbgl
diff --git a/src/mbgl/layer/layer.cpp b/src/mbgl/style/layer.cpp
index c26eb9a723..342699a2c9 100644
--- a/src/mbgl/layer/layer.cpp
+++ b/src/mbgl/style/layer.cpp
@@ -1,7 +1,8 @@
#include <mbgl/style/layer.hpp>
-#include <mbgl/layer/layer_impl.hpp>
+#include <mbgl/style/layer_impl.hpp>
namespace mbgl {
+namespace style {
Layer::Layer(Type type_, std::unique_ptr<Impl> baseImpl_)
: baseImpl(std::move(baseImpl_)), type(type_) {
@@ -45,4 +46,5 @@ std::unique_ptr<Layer> Layer::copy(const std::string& id,
return result;
}
+} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/layer/layer_impl.cpp b/src/mbgl/style/layer_impl.cpp
index 315a1cb1b1..74cc80d253 100644
--- a/src/mbgl/layer/layer_impl.cpp
+++ b/src/mbgl/style/layer_impl.cpp
@@ -1,6 +1,7 @@
-#include <mbgl/layer/layer_impl.hpp>
+#include <mbgl/style/layer_impl.hpp>
namespace mbgl {
+namespace style {
const std::string& Layer::Impl::bucketName() const {
return ref.empty() ? id : ref;
@@ -14,4 +15,5 @@ bool Layer::Impl::needsRendering() const {
return passes != RenderPass::None && visibility != VisibilityType::None;
}
+} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/layer/layer_impl.hpp b/src/mbgl/style/layer_impl.hpp
index 3d6b5cccfd..dcd5d9906b 100644
--- a/src/mbgl/layer/layer_impl.hpp
+++ b/src/mbgl/style/layer_impl.hpp
@@ -14,11 +14,14 @@
namespace mbgl {
-class StyleCascadeParameters;
-class StyleCalculationParameters;
-class StyleBucketParameters;
class Bucket;
+namespace style {
+
+class CascadeParameters;
+class CalculationParameters;
+class BucketParameters;
+
/**
* `Layer::Impl` contains the internal implementation of `Layer`: the details that need to be accessible to other parts
* of the code, but hidden from the public API. Like `Layer`, it is an abstract base class, with derived classes for
@@ -44,13 +47,13 @@ public:
const std::string& bucketName() const;
// Partially evaluate paint properties based on a set of classes.
- virtual void cascade(const StyleCascadeParameters&) = 0;
+ virtual void cascade(const CascadeParameters&) = 0;
// Fully evaluate cascaded paint properties based on a zoom level.
// Returns true if any paint properties have active transitions.
- virtual bool recalculate(const StyleCalculationParameters&) = 0;
+ virtual bool recalculate(const CalculationParameters&) = 0;
- virtual std::unique_ptr<Bucket> createBucket(StyleBucketParameters&) const = 0;
+ virtual std::unique_ptr<Bucket> createBucket(BucketParameters&) const = 0;
// Checks whether this layer needs to be rendered in the given render pass.
bool hasRenderPass(RenderPass) const;
@@ -85,4 +88,5 @@ protected:
RenderPass passes = RenderPass::None;
};
+} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/layer/background_layer.cpp b/src/mbgl/style/layers/background_layer.cpp
index 36cf6be07c..aeb4067503 100644
--- a/src/mbgl/layer/background_layer.cpp
+++ b/src/mbgl/style/layers/background_layer.cpp
@@ -1,9 +1,10 @@
// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`.
-#include <mbgl/layer/background_layer.hpp>
-#include <mbgl/layer/background_layer_impl.hpp>
+#include <mbgl/style/layers/background_layer.hpp>
+#include <mbgl/style/layers/background_layer_impl.hpp>
namespace mbgl {
+namespace style {
BackgroundLayer::BackgroundLayer(const std::string& layerID)
: Layer(Type::Background, std::make_unique<Impl>())
@@ -52,4 +53,5 @@ void BackgroundLayer::setBackgroundOpacity(PropertyValue<float> value) {
impl->paint.backgroundOpacity.set(value);
}
+} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/layer/background_layer_impl.cpp b/src/mbgl/style/layers/background_layer_impl.cpp
index 626c8fc805..0c09c5d158 100644
--- a/src/mbgl/layer/background_layer_impl.cpp
+++ b/src/mbgl/style/layers/background_layer_impl.cpp
@@ -1,17 +1,18 @@
-#include <mbgl/layer/background_layer_impl.hpp>
+#include <mbgl/style/layers/background_layer_impl.hpp>
#include <mbgl/renderer/bucket.hpp>
namespace mbgl {
+namespace style {
void BackgroundLayer::Impl::parsePaints(const JSValue& layer) {
paint.parse(layer);
}
-void BackgroundLayer::Impl::cascade(const StyleCascadeParameters& parameters) {
+void BackgroundLayer::Impl::cascade(const CascadeParameters& parameters) {
paint.cascade(parameters);
}
-bool BackgroundLayer::Impl::recalculate(const StyleCalculationParameters& parameters) {
+bool BackgroundLayer::Impl::recalculate(const CalculationParameters& parameters) {
bool hasTransitions = paint.recalculate(parameters);
passes = paint.backgroundOpacity > 0 ? RenderPass::Translucent : RenderPass::None;
@@ -19,8 +20,9 @@ bool BackgroundLayer::Impl::recalculate(const StyleCalculationParameters& parame
return hasTransitions;
}
-std::unique_ptr<Bucket> BackgroundLayer::Impl::createBucket(StyleBucketParameters&) const {
+std::unique_ptr<Bucket> BackgroundLayer::Impl::createBucket(BucketParameters&) const {
return nullptr;
}
+} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/style/layers/background_layer_impl.hpp b/src/mbgl/style/layers/background_layer_impl.hpp
new file mode 100644
index 0000000000..19e2a062a4
--- /dev/null
+++ b/src/mbgl/style/layers/background_layer_impl.hpp
@@ -0,0 +1,26 @@
+#pragma once
+
+#include <mbgl/style/layer_impl.hpp>
+#include <mbgl/style/layers/background_layer.hpp>
+#include <mbgl/style/layers/background_layer_properties.hpp>
+
+namespace mbgl {
+namespace style {
+
+class BackgroundLayer::Impl : public Layer::Impl {
+public:
+ std::unique_ptr<Layer> clone() const override;
+
+ void parseLayout(const JSValue&) override {};
+ void parsePaints(const JSValue&) override;
+
+ void cascade(const CascadeParameters&) override;
+ bool recalculate(const CalculationParameters&) override;
+
+ std::unique_ptr<Bucket> createBucket(BucketParameters&) const override;
+
+ BackgroundPaintProperties paint;
+};
+
+} // namespace style
+} // namespace mbgl
diff --git a/src/mbgl/layer/background_layer_properties.cpp b/src/mbgl/style/layers/background_layer_properties.cpp
index d866df7eee..a20cedf12c 100644
--- a/src/mbgl/layer/background_layer_properties.cpp
+++ b/src/mbgl/style/layers/background_layer_properties.cpp
@@ -1,8 +1,9 @@
// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`.
-#include <mbgl/layer/background_layer_properties.hpp>
+#include <mbgl/style/layers/background_layer_properties.hpp>
namespace mbgl {
+namespace style {
void BackgroundPaintProperties::parse(const JSValue& value) {
backgroundColor.parse("background-color", value);
@@ -10,13 +11,13 @@ void BackgroundPaintProperties::parse(const JSValue& value) {
backgroundOpacity.parse("background-opacity", value);
}
-void BackgroundPaintProperties::cascade(const StyleCascadeParameters& parameters) {
+void BackgroundPaintProperties::cascade(const CascadeParameters& parameters) {
backgroundColor.cascade(parameters);
backgroundPattern.cascade(parameters);
backgroundOpacity.cascade(parameters);
}
-bool BackgroundPaintProperties::recalculate(const StyleCalculationParameters& parameters) {
+bool BackgroundPaintProperties::recalculate(const CalculationParameters& parameters) {
bool hasTransitions = false;
hasTransitions |= backgroundColor.calculate(parameters);
@@ -26,4 +27,5 @@ bool BackgroundPaintProperties::recalculate(const StyleCalculationParameters& pa
return hasTransitions;
}
+} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/layer/background_layer_properties.hpp b/src/mbgl/style/layers/background_layer_properties.hpp
index 20db9b22fb..a1a1a3a5a7 100644
--- a/src/mbgl/layer/background_layer_properties.hpp
+++ b/src/mbgl/style/layers/background_layer_properties.hpp
@@ -7,19 +7,21 @@
#include <mbgl/util/rapidjson.hpp>
namespace mbgl {
+namespace style {
-class StyleCascadeParameters;
-class StyleCalculationParameters;
+class CascadeParameters;
+class CalculationParameters;
class BackgroundPaintProperties {
public:
void parse(const JSValue&);
- void cascade(const StyleCascadeParameters&);
- bool recalculate(const StyleCalculationParameters&);
+ void cascade(const CascadeParameters&);
+ bool recalculate(const CalculationParameters&);
PaintProperty<Color> backgroundColor { {{ 0, 0, 0, 1 }} };
PaintProperty<std::string, CrossFadedPropertyEvaluator> backgroundPattern { "" };
PaintProperty<float> backgroundOpacity { 1 };
};
+} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/layer/circle_layer.cpp b/src/mbgl/style/layers/circle_layer.cpp
index efc0e9488d..bdfbf629e6 100644
--- a/src/mbgl/layer/circle_layer.cpp
+++ b/src/mbgl/style/layers/circle_layer.cpp
@@ -1,9 +1,10 @@
// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`.
-#include <mbgl/layer/circle_layer.hpp>
-#include <mbgl/layer/circle_layer_impl.hpp>
+#include <mbgl/style/layers/circle_layer.hpp>
+#include <mbgl/style/layers/circle_layer_impl.hpp>
namespace mbgl {
+namespace style {
CircleLayer::CircleLayer(const std::string& layerID)
: Layer(Type::Circle, std::make_unique<Impl>())
@@ -100,4 +101,5 @@ void CircleLayer::setCircleTranslateAnchor(PropertyValue<TranslateAnchorType> va
impl->paint.circleTranslateAnchor.set(value);
}
+} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/layer/circle_layer_impl.cpp b/src/mbgl/style/layers/circle_layer_impl.cpp
index b1ba778cd6..c2efac5cef 100644
--- a/src/mbgl/layer/circle_layer_impl.cpp
+++ b/src/mbgl/style/layers/circle_layer_impl.cpp
@@ -1,21 +1,22 @@
-#include <mbgl/layer/circle_layer_impl.hpp>
-#include <mbgl/style/style_bucket_parameters.hpp>
+#include <mbgl/style/layers/circle_layer_impl.hpp>
+#include <mbgl/style/bucket_parameters.hpp>
#include <mbgl/renderer/circle_bucket.hpp>
#include <mbgl/geometry/feature_index.hpp>
#include <mbgl/util/math.hpp>
#include <mbgl/util/intersection_tests.hpp>
namespace mbgl {
+namespace style {
void CircleLayer::Impl::parsePaints(const JSValue& layer) {
paint.parse(layer);
}
-void CircleLayer::Impl::cascade(const StyleCascadeParameters& parameters) {
+void CircleLayer::Impl::cascade(const CascadeParameters& parameters) {
paint.cascade(parameters);
}
-bool CircleLayer::Impl::recalculate(const StyleCalculationParameters& parameters) {
+bool CircleLayer::Impl::recalculate(const CalculationParameters& parameters) {
bool hasTransitions = paint.recalculate(parameters);
passes = (paint.circleRadius > 0 && paint.circleColor.value[3] > 0 && paint.circleOpacity > 0)
@@ -24,7 +25,7 @@ bool CircleLayer::Impl::recalculate(const StyleCalculationParameters& parameters
return hasTransitions;
}
-std::unique_ptr<Bucket> CircleLayer::Impl::createBucket(StyleBucketParameters& parameters) const {
+std::unique_ptr<Bucket> CircleLayer::Impl::createBucket(BucketParameters& parameters) const {
auto bucket = std::make_unique<CircleBucket>(parameters.mode);
auto& name = bucketName();
@@ -57,4 +58,5 @@ bool CircleLayer::Impl::queryIntersectsGeometry(
translatedQueryGeometry.value_or(queryGeometry), geometry, circleRadius);
}
+} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/layer/circle_layer_impl.hpp b/src/mbgl/style/layers/circle_layer_impl.hpp
index 1cb19a6205..463f3ca18d 100644
--- a/src/mbgl/layer/circle_layer_impl.hpp
+++ b/src/mbgl/style/layers/circle_layer_impl.hpp
@@ -1,10 +1,11 @@
#pragma once
-#include <mbgl/layer/layer_impl.hpp>
-#include <mbgl/layer/circle_layer.hpp>
-#include <mbgl/layer/circle_layer_properties.hpp>
+#include <mbgl/style/layer_impl.hpp>
+#include <mbgl/style/layers/circle_layer.hpp>
+#include <mbgl/style/layers/circle_layer_properties.hpp>
namespace mbgl {
+namespace style {
class CircleLayer::Impl : public Layer::Impl {
public:
@@ -13,10 +14,10 @@ public:
void parseLayout(const JSValue&) override {};
void parsePaints(const JSValue&) override;
- void cascade(const StyleCascadeParameters&) override;
- bool recalculate(const StyleCalculationParameters&) override;
+ void cascade(const CascadeParameters&) override;
+ bool recalculate(const CalculationParameters&) override;
- std::unique_ptr<Bucket> createBucket(StyleBucketParameters&) const override;
+ std::unique_ptr<Bucket> createBucket(BucketParameters&) const override;
float getQueryRadius() const override;
bool queryIntersectsGeometry(
@@ -28,4 +29,5 @@ public:
CirclePaintProperties paint;
};
+} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/layer/circle_layer_properties.cpp b/src/mbgl/style/layers/circle_layer_properties.cpp
index 48d99b579e..b21df1e2d0 100644
--- a/src/mbgl/layer/circle_layer_properties.cpp
+++ b/src/mbgl/style/layers/circle_layer_properties.cpp
@@ -1,8 +1,9 @@
// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`.
-#include <mbgl/layer/circle_layer_properties.hpp>
+#include <mbgl/style/layers/circle_layer_properties.hpp>
namespace mbgl {
+namespace style {
void CirclePaintProperties::parse(const JSValue& value) {
circleRadius.parse("circle-radius", value);
@@ -13,7 +14,7 @@ void CirclePaintProperties::parse(const JSValue& value) {
circleTranslateAnchor.parse("circle-translate-anchor", value);
}
-void CirclePaintProperties::cascade(const StyleCascadeParameters& parameters) {
+void CirclePaintProperties::cascade(const CascadeParameters& parameters) {
circleRadius.cascade(parameters);
circleColor.cascade(parameters);
circleBlur.cascade(parameters);
@@ -22,7 +23,7 @@ void CirclePaintProperties::cascade(const StyleCascadeParameters& parameters) {
circleTranslateAnchor.cascade(parameters);
}
-bool CirclePaintProperties::recalculate(const StyleCalculationParameters& parameters) {
+bool CirclePaintProperties::recalculate(const CalculationParameters& parameters) {
bool hasTransitions = false;
hasTransitions |= circleRadius.calculate(parameters);
@@ -35,4 +36,5 @@ bool CirclePaintProperties::recalculate(const StyleCalculationParameters& parame
return hasTransitions;
}
+} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/layer/circle_layer_properties.hpp b/src/mbgl/style/layers/circle_layer_properties.hpp
index a88db27605..956e423c45 100644
--- a/src/mbgl/layer/circle_layer_properties.hpp
+++ b/src/mbgl/style/layers/circle_layer_properties.hpp
@@ -7,15 +7,16 @@
#include <mbgl/util/rapidjson.hpp>
namespace mbgl {
+namespace style {
-class StyleCascadeParameters;
-class StyleCalculationParameters;
+class CascadeParameters;
+class CalculationParameters;
class CirclePaintProperties {
public:
void parse(const JSValue&);
- void cascade(const StyleCascadeParameters&);
- bool recalculate(const StyleCalculationParameters&);
+ void cascade(const CascadeParameters&);
+ bool recalculate(const CalculationParameters&);
PaintProperty<float> circleRadius { 5 };
PaintProperty<Color> circleColor { {{ 0, 0, 0, 1 }} };
@@ -25,4 +26,5 @@ public:
PaintProperty<TranslateAnchorType> circleTranslateAnchor { TranslateAnchorType::Map };
};
+} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/layer/custom_layer.cpp b/src/mbgl/style/layers/custom_layer.cpp
index a33176e7f9..3407a7f5a5 100644
--- a/src/mbgl/layer/custom_layer.cpp
+++ b/src/mbgl/style/layers/custom_layer.cpp
@@ -1,7 +1,8 @@
-#include <mbgl/layer/custom_layer.hpp>
-#include <mbgl/layer/custom_layer_impl.hpp>
+#include <mbgl/style/layers/custom_layer.hpp>
+#include <mbgl/style/layers/custom_layer_impl.hpp>
namespace mbgl {
+namespace style {
CustomLayer::CustomLayer(const std::string& layerID,
CustomLayerInitializeFunction init,
@@ -19,4 +20,5 @@ CustomLayer::CustomLayer(const Impl& other)
CustomLayer::~CustomLayer() = default;
+} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/layer/custom_layer_impl.cpp b/src/mbgl/style/layers/custom_layer_impl.cpp
index 8a08c804ed..214d4ce663 100644
--- a/src/mbgl/layer/custom_layer_impl.cpp
+++ b/src/mbgl/style/layers/custom_layer_impl.cpp
@@ -1,8 +1,9 @@
-#include <mbgl/layer/custom_layer_impl.hpp>
+#include <mbgl/style/layers/custom_layer_impl.hpp>
#include <mbgl/renderer/bucket.hpp>
#include <mbgl/map/transform_state.hpp>
namespace mbgl {
+namespace style {
CustomLayer::Impl::Impl(const std::string& id_,
CustomLayerInitializeFunction initializeFn_,
@@ -54,13 +55,14 @@ void CustomLayer::Impl::render(const TransformState& state) const {
renderFn(context, parameters);
}
-bool CustomLayer::Impl::recalculate(const StyleCalculationParameters&) {
+bool CustomLayer::Impl::recalculate(const CalculationParameters&) {
passes = RenderPass::Translucent;
return false;
}
-std::unique_ptr<Bucket> CustomLayer::Impl::createBucket(StyleBucketParameters&) const {
+std::unique_ptr<Bucket> CustomLayer::Impl::createBucket(BucketParameters&) const {
return nullptr;
}
+} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/layer/custom_layer_impl.hpp b/src/mbgl/style/layers/custom_layer_impl.hpp
index 09709a2f9d..00e576b6a3 100644
--- a/src/mbgl/layer/custom_layer_impl.hpp
+++ b/src/mbgl/style/layers/custom_layer_impl.hpp
@@ -1,12 +1,14 @@
#pragma once
-#include <mbgl/layer/layer_impl.hpp>
-#include <mbgl/layer/custom_layer.hpp>
+#include <mbgl/style/layer_impl.hpp>
+#include <mbgl/style/layers/custom_layer.hpp>
namespace mbgl {
class TransformState;
+namespace style {
+
class CustomLayer::Impl : public Layer::Impl {
public:
Impl(const std::string& id,
@@ -27,10 +29,10 @@ private:
void parseLayout(const JSValue&) final {}
void parsePaints(const JSValue&) final {}
- void cascade(const StyleCascadeParameters&) final {}
- bool recalculate(const StyleCalculationParameters&) final;
+ void cascade(const CascadeParameters&) final {}
+ bool recalculate(const CalculationParameters&) final;
- std::unique_ptr<Bucket> createBucket(StyleBucketParameters&) const final;
+ std::unique_ptr<Bucket> createBucket(BucketParameters&) const final;
CustomLayerInitializeFunction initializeFn = nullptr;
CustomLayerRenderFunction renderFn = nullptr;
@@ -38,4 +40,5 @@ private:
void* context = nullptr;
};
+} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/layer/fill_layer.cpp b/src/mbgl/style/layers/fill_layer.cpp
index 77efaa61aa..1deaabb5ef 100644
--- a/src/mbgl/layer/fill_layer.cpp
+++ b/src/mbgl/style/layers/fill_layer.cpp
@@ -1,9 +1,10 @@
// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`.
-#include <mbgl/layer/fill_layer.hpp>
-#include <mbgl/layer/fill_layer_impl.hpp>
+#include <mbgl/style/layers/fill_layer.hpp>
+#include <mbgl/style/layers/fill_layer_impl.hpp>
namespace mbgl {
+namespace style {
FillLayer::FillLayer(const std::string& layerID)
: Layer(Type::Fill, std::make_unique<Impl>())
@@ -108,4 +109,5 @@ void FillLayer::setFillPattern(PropertyValue<std::string> value) {
impl->paint.fillPattern.set(value);
}
+} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/layer/fill_layer_impl.cpp b/src/mbgl/style/layers/fill_layer_impl.cpp
index 21f482922d..c183617482 100644
--- a/src/mbgl/layer/fill_layer_impl.cpp
+++ b/src/mbgl/style/layers/fill_layer_impl.cpp
@@ -1,21 +1,22 @@
-#include <mbgl/layer/fill_layer_impl.hpp>
-#include <mbgl/style/style_bucket_parameters.hpp>
+#include <mbgl/style/layers/fill_layer_impl.hpp>
+#include <mbgl/style/bucket_parameters.hpp>
#include <mbgl/renderer/fill_bucket.hpp>
#include <mbgl/geometry/feature_index.hpp>
#include <mbgl/util/math.hpp>
#include <mbgl/util/intersection_tests.hpp>
namespace mbgl {
+namespace style {
void FillLayer::Impl::parsePaints(const JSValue& layer) {
paint.parse(layer);
}
-void FillLayer::Impl::cascade(const StyleCascadeParameters& parameters) {
+void FillLayer::Impl::cascade(const CascadeParameters& parameters) {
paint.cascade(parameters);
}
-bool FillLayer::Impl::recalculate(const StyleCalculationParameters& parameters) {
+bool FillLayer::Impl::recalculate(const CalculationParameters& parameters) {
bool hasTransitions = paint.recalculate(parameters);
passes = RenderPass::None;
@@ -33,7 +34,7 @@ bool FillLayer::Impl::recalculate(const StyleCalculationParameters& parameters)
return hasTransitions;
}
-std::unique_ptr<Bucket> FillLayer::Impl::createBucket(StyleBucketParameters& parameters) const {
+std::unique_ptr<Bucket> FillLayer::Impl::createBucket(BucketParameters& parameters) const {
auto bucket = std::make_unique<FillBucket>();
auto& name = bucketName();
@@ -63,4 +64,5 @@ bool FillLayer::Impl::queryIntersectsGeometry(
return util::multiPolygonIntersectsMultiPolygon(translatedQueryGeometry.value_or(queryGeometry), geometry);
}
+} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/layer/fill_layer_impl.hpp b/src/mbgl/style/layers/fill_layer_impl.hpp
index 2af0d6491d..a37dd76ace 100644
--- a/src/mbgl/layer/fill_layer_impl.hpp
+++ b/src/mbgl/style/layers/fill_layer_impl.hpp
@@ -1,10 +1,11 @@
#pragma once
-#include <mbgl/layer/layer_impl.hpp>
-#include <mbgl/layer/fill_layer.hpp>
-#include <mbgl/layer/fill_layer_properties.hpp>
+#include <mbgl/style/layer_impl.hpp>
+#include <mbgl/style/layers/fill_layer.hpp>
+#include <mbgl/style/layers/fill_layer_properties.hpp>
namespace mbgl {
+namespace style {
class FillLayer::Impl : public Layer::Impl {
public:
@@ -13,10 +14,10 @@ public:
void parseLayout(const JSValue&) override {};
void parsePaints(const JSValue&) override;
- void cascade(const StyleCascadeParameters&) override;
- bool recalculate(const StyleCalculationParameters&) override;
+ void cascade(const CascadeParameters&) override;
+ bool recalculate(const CalculationParameters&) override;
- std::unique_ptr<Bucket> createBucket(StyleBucketParameters&) const override;
+ std::unique_ptr<Bucket> createBucket(BucketParameters&) const override;
float getQueryRadius() const override;
bool queryIntersectsGeometry(
@@ -28,4 +29,5 @@ public:
FillPaintProperties paint;
};
+} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/layer/fill_layer_properties.cpp b/src/mbgl/style/layers/fill_layer_properties.cpp
index e0d4f10bc9..a4714689f9 100644
--- a/src/mbgl/layer/fill_layer_properties.cpp
+++ b/src/mbgl/style/layers/fill_layer_properties.cpp
@@ -1,8 +1,9 @@
// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`.
-#include <mbgl/layer/fill_layer_properties.hpp>
+#include <mbgl/style/layers/fill_layer_properties.hpp>
namespace mbgl {
+namespace style {
void FillPaintProperties::parse(const JSValue& value) {
fillAntialias.parse("fill-antialias", value);
@@ -14,7 +15,7 @@ void FillPaintProperties::parse(const JSValue& value) {
fillPattern.parse("fill-pattern", value);
}
-void FillPaintProperties::cascade(const StyleCascadeParameters& parameters) {
+void FillPaintProperties::cascade(const CascadeParameters& parameters) {
fillAntialias.cascade(parameters);
fillOpacity.cascade(parameters);
fillColor.cascade(parameters);
@@ -24,7 +25,7 @@ void FillPaintProperties::cascade(const StyleCascadeParameters& parameters) {
fillPattern.cascade(parameters);
}
-bool FillPaintProperties::recalculate(const StyleCalculationParameters& parameters) {
+bool FillPaintProperties::recalculate(const CalculationParameters& parameters) {
bool hasTransitions = false;
hasTransitions |= fillAntialias.calculate(parameters);
@@ -38,4 +39,5 @@ bool FillPaintProperties::recalculate(const StyleCalculationParameters& paramete
return hasTransitions;
}
+} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/layer/fill_layer_properties.hpp b/src/mbgl/style/layers/fill_layer_properties.hpp
index 2ae67ef0a0..43396f45d2 100644
--- a/src/mbgl/layer/fill_layer_properties.hpp
+++ b/src/mbgl/style/layers/fill_layer_properties.hpp
@@ -7,15 +7,16 @@
#include <mbgl/util/rapidjson.hpp>
namespace mbgl {
+namespace style {
-class StyleCascadeParameters;
-class StyleCalculationParameters;
+class CascadeParameters;
+class CalculationParameters;
class FillPaintProperties {
public:
void parse(const JSValue&);
- void cascade(const StyleCascadeParameters&);
- bool recalculate(const StyleCalculationParameters&);
+ void cascade(const CascadeParameters&);
+ bool recalculate(const CalculationParameters&);
PaintProperty<bool> fillAntialias { true };
PaintProperty<float> fillOpacity { 1 };
@@ -26,4 +27,5 @@ public:
PaintProperty<std::string, CrossFadedPropertyEvaluator> fillPattern { "" };
};
+} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/layer/line_layer.cpp b/src/mbgl/style/layers/line_layer.cpp
index e1a7d813af..abe326a672 100644
--- a/src/mbgl/layer/line_layer.cpp
+++ b/src/mbgl/style/layers/line_layer.cpp
@@ -1,9 +1,10 @@
// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`.
-#include <mbgl/layer/line_layer.hpp>
-#include <mbgl/layer/line_layer_impl.hpp>
+#include <mbgl/style/layers/line_layer.hpp>
+#include <mbgl/style/layers/line_layer_impl.hpp>
namespace mbgl {
+namespace style {
LineLayer::LineLayer(const std::string& layerID)
: Layer(Type::Line, std::make_unique<Impl>())
@@ -160,4 +161,5 @@ void LineLayer::setLinePattern(PropertyValue<std::string> value) {
impl->paint.linePattern.set(value);
}
+} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/layer/line_layer_impl.cpp b/src/mbgl/style/layers/line_layer_impl.cpp
index aee1687046..b7ee9dc5bf 100644
--- a/src/mbgl/layer/line_layer_impl.cpp
+++ b/src/mbgl/style/layers/line_layer_impl.cpp
@@ -1,11 +1,12 @@
-#include <mbgl/layer/line_layer_impl.hpp>
-#include <mbgl/style/style_bucket_parameters.hpp>
+#include <mbgl/style/layers/line_layer_impl.hpp>
+#include <mbgl/style/bucket_parameters.hpp>
#include <mbgl/renderer/line_bucket.hpp>
#include <mbgl/geometry/feature_index.hpp>
#include <mbgl/util/math.hpp>
#include <mbgl/util/intersection_tests.hpp>
namespace mbgl {
+namespace style {
void LineLayer::Impl::parseLayout(const JSValue& value) {
layout.parse(value);
@@ -15,13 +16,13 @@ void LineLayer::Impl::parsePaints(const JSValue& layer) {
paint.parse(layer);
}
-void LineLayer::Impl::cascade(const StyleCascadeParameters& parameters) {
+void LineLayer::Impl::cascade(const CascadeParameters& parameters) {
paint.cascade(parameters);
}
-bool LineLayer::Impl::recalculate(const StyleCalculationParameters& parameters) {
+bool LineLayer::Impl::recalculate(const CalculationParameters& parameters) {
// for scaling dasharrays
- StyleCalculationParameters dashArrayParams = parameters;
+ CalculationParameters dashArrayParams = parameters;
dashArrayParams.z = std::floor(dashArrayParams.z);
paint.lineWidth.calculate(dashArrayParams);
dashLineWidth = paint.lineWidth;
@@ -34,11 +35,11 @@ bool LineLayer::Impl::recalculate(const StyleCalculationParameters& parameters)
return hasTransitions;
}
-std::unique_ptr<Bucket> LineLayer::Impl::createBucket(StyleBucketParameters& parameters) const {
+std::unique_ptr<Bucket> LineLayer::Impl::createBucket(BucketParameters& parameters) const {
auto bucket = std::make_unique<LineBucket>(parameters.tileID.overscaleFactor());
bucket->layout = layout;
- bucket->layout.recalculate(StyleCalculationParameters(parameters.tileID.overscaledZ));
+ bucket->layout.recalculate(CalculationParameters(parameters.tileID.overscaledZ));
auto& name = bucketName();
parameters.eachFilteredFeature(filter, [&] (const auto& feature, std::size_t index, const std::string& layerName) {
@@ -111,4 +112,5 @@ bool LineLayer::Impl::queryIntersectsGeometry(
halfWidth);
}
+} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/layer/line_layer_impl.hpp b/src/mbgl/style/layers/line_layer_impl.hpp
index b602df52fa..3356dc2ceb 100644
--- a/src/mbgl/layer/line_layer_impl.hpp
+++ b/src/mbgl/style/layers/line_layer_impl.hpp
@@ -1,10 +1,11 @@
#pragma once
-#include <mbgl/layer/layer_impl.hpp>
-#include <mbgl/layer/line_layer.hpp>
-#include <mbgl/layer/line_layer_properties.hpp>
+#include <mbgl/style/layer_impl.hpp>
+#include <mbgl/style/layers/line_layer.hpp>
+#include <mbgl/style/layers/line_layer_properties.hpp>
namespace mbgl {
+namespace style {
class LineLayer::Impl : public Layer::Impl {
public:
@@ -13,10 +14,10 @@ public:
void parseLayout(const JSValue&) override;
void parsePaints(const JSValue&) override;
- void cascade(const StyleCascadeParameters&) override;
- bool recalculate(const StyleCalculationParameters&) override;
+ void cascade(const CascadeParameters&) override;
+ bool recalculate(const CalculationParameters&) override;
- std::unique_ptr<Bucket> createBucket(StyleBucketParameters&) const override;
+ std::unique_ptr<Bucket> createBucket(BucketParameters&) const override;
float getQueryRadius() const override;
bool queryIntersectsGeometry(
@@ -35,4 +36,5 @@ private:
float getLineWidth() const;
};
+} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/layer/line_layer_properties.cpp b/src/mbgl/style/layers/line_layer_properties.cpp
index 4941a1ecd2..7c74f6de04 100644
--- a/src/mbgl/layer/line_layer_properties.cpp
+++ b/src/mbgl/style/layers/line_layer_properties.cpp
@@ -1,8 +1,9 @@
// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`.
-#include <mbgl/layer/line_layer_properties.hpp>
+#include <mbgl/style/layers/line_layer_properties.hpp>
namespace mbgl {
+namespace style {
void LineLayoutProperties::parse(const JSValue& value) {
lineCap.parse("line-cap", value);
@@ -11,7 +12,7 @@ void LineLayoutProperties::parse(const JSValue& value) {
lineRoundLimit.parse("line-round-limit", value);
}
-void LineLayoutProperties::recalculate(const StyleCalculationParameters& parameters) {
+void LineLayoutProperties::recalculate(const CalculationParameters& parameters) {
lineCap.calculate(parameters);
lineJoin.calculate(parameters);
lineMiterLimit.calculate(parameters);
@@ -31,7 +32,7 @@ void LinePaintProperties::parse(const JSValue& value) {
linePattern.parse("line-pattern", value);
}
-void LinePaintProperties::cascade(const StyleCascadeParameters& parameters) {
+void LinePaintProperties::cascade(const CascadeParameters& parameters) {
lineOpacity.cascade(parameters);
lineColor.cascade(parameters);
lineTranslate.cascade(parameters);
@@ -44,7 +45,7 @@ void LinePaintProperties::cascade(const StyleCascadeParameters& parameters) {
linePattern.cascade(parameters);
}
-bool LinePaintProperties::recalculate(const StyleCalculationParameters& parameters) {
+bool LinePaintProperties::recalculate(const CalculationParameters& parameters) {
bool hasTransitions = false;
hasTransitions |= lineOpacity.calculate(parameters);
@@ -61,4 +62,5 @@ bool LinePaintProperties::recalculate(const StyleCalculationParameters& paramete
return hasTransitions;
}
+} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/layer/line_layer_properties.hpp b/src/mbgl/style/layers/line_layer_properties.hpp
index f4dad055bd..e0c63b516b 100644
--- a/src/mbgl/layer/line_layer_properties.hpp
+++ b/src/mbgl/style/layers/line_layer_properties.hpp
@@ -7,14 +7,15 @@
#include <mbgl/util/rapidjson.hpp>
namespace mbgl {
+namespace style {
-class StyleCascadeParameters;
-class StyleCalculationParameters;
+class CascadeParameters;
+class CalculationParameters;
class LineLayoutProperties {
public:
void parse(const JSValue&);
- void recalculate(const StyleCalculationParameters&);
+ void recalculate(const CalculationParameters&);
LayoutProperty<LineCapType> lineCap { LineCapType::Butt };
LayoutProperty<LineJoinType> lineJoin { LineJoinType::Miter };
@@ -25,8 +26,8 @@ public:
class LinePaintProperties {
public:
void parse(const JSValue&);
- void cascade(const StyleCascadeParameters&);
- bool recalculate(const StyleCalculationParameters&);
+ void cascade(const CascadeParameters&);
+ bool recalculate(const CalculationParameters&);
PaintProperty<float> lineOpacity { 1 };
PaintProperty<Color> lineColor { {{ 0, 0, 0, 1 }} };
@@ -40,4 +41,5 @@ public:
PaintProperty<std::string, CrossFadedPropertyEvaluator> linePattern { "" };
};
+} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/layer/raster_layer.cpp b/src/mbgl/style/layers/raster_layer.cpp
index 661c44b7d5..fb7f08fbe9 100644
--- a/src/mbgl/layer/raster_layer.cpp
+++ b/src/mbgl/style/layers/raster_layer.cpp
@@ -1,9 +1,10 @@
// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`.
-#include <mbgl/layer/raster_layer.hpp>
-#include <mbgl/layer/raster_layer_impl.hpp>
+#include <mbgl/style/layers/raster_layer.hpp>
+#include <mbgl/style/layers/raster_layer_impl.hpp>
namespace mbgl {
+namespace style {
RasterLayer::RasterLayer(const std::string& layerID)
: Layer(Type::Raster, std::make_unique<Impl>())
@@ -93,4 +94,5 @@ void RasterLayer::setRasterFadeDuration(PropertyValue<float> value) {
impl->paint.rasterFadeDuration.set(value);
}
+} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/layer/raster_layer_impl.cpp b/src/mbgl/style/layers/raster_layer_impl.cpp
index f44a424f99..4854ec041d 100644
--- a/src/mbgl/layer/raster_layer_impl.cpp
+++ b/src/mbgl/style/layers/raster_layer_impl.cpp
@@ -1,17 +1,18 @@
-#include <mbgl/layer/raster_layer_impl.hpp>
+#include <mbgl/style/layers/raster_layer_impl.hpp>
#include <mbgl/renderer/bucket.hpp>
namespace mbgl {
+namespace style {
void RasterLayer::Impl::parsePaints(const JSValue& layer) {
paint.parse(layer);
}
-void RasterLayer::Impl::cascade(const StyleCascadeParameters& parameters) {
+void RasterLayer::Impl::cascade(const CascadeParameters& parameters) {
paint.cascade(parameters);
}
-bool RasterLayer::Impl::recalculate(const StyleCalculationParameters& parameters) {
+bool RasterLayer::Impl::recalculate(const CalculationParameters& parameters) {
bool hasTransitions = paint.recalculate(parameters);
passes = paint.rasterOpacity > 0 ? RenderPass::Translucent : RenderPass::None;
@@ -19,8 +20,9 @@ bool RasterLayer::Impl::recalculate(const StyleCalculationParameters& parameters
return hasTransitions;
}
-std::unique_ptr<Bucket> RasterLayer::Impl::createBucket(StyleBucketParameters&) const {
+std::unique_ptr<Bucket> RasterLayer::Impl::createBucket(BucketParameters&) const {
return nullptr;
}
+} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/style/layers/raster_layer_impl.hpp b/src/mbgl/style/layers/raster_layer_impl.hpp
new file mode 100644
index 0000000000..6812b469a6
--- /dev/null
+++ b/src/mbgl/style/layers/raster_layer_impl.hpp
@@ -0,0 +1,26 @@
+#pragma once
+
+#include <mbgl/style/layer_impl.hpp>
+#include <mbgl/style/layers/raster_layer.hpp>
+#include <mbgl/style/layers/raster_layer_properties.hpp>
+
+namespace mbgl {
+namespace style {
+
+class RasterLayer::Impl : public Layer::Impl {
+public:
+ std::unique_ptr<Layer> clone() const override;
+
+ void parseLayout(const JSValue&) override {};
+ void parsePaints(const JSValue&) override;
+
+ void cascade(const CascadeParameters&) override;
+ bool recalculate(const CalculationParameters&) override;
+
+ std::unique_ptr<Bucket> createBucket(BucketParameters&) const override;
+
+ RasterPaintProperties paint;
+};
+
+} // namespace style
+} // namespace mbgl
diff --git a/src/mbgl/layer/raster_layer_properties.cpp b/src/mbgl/style/layers/raster_layer_properties.cpp
index 898188bc83..0e6afc5e9c 100644
--- a/src/mbgl/layer/raster_layer_properties.cpp
+++ b/src/mbgl/style/layers/raster_layer_properties.cpp
@@ -1,8 +1,9 @@
// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`.
-#include <mbgl/layer/raster_layer_properties.hpp>
+#include <mbgl/style/layers/raster_layer_properties.hpp>
namespace mbgl {
+namespace style {
void RasterPaintProperties::parse(const JSValue& value) {
rasterOpacity.parse("raster-opacity", value);
@@ -14,7 +15,7 @@ void RasterPaintProperties::parse(const JSValue& value) {
rasterFadeDuration.parse("raster-fade-duration", value);
}
-void RasterPaintProperties::cascade(const StyleCascadeParameters& parameters) {
+void RasterPaintProperties::cascade(const CascadeParameters& parameters) {
rasterOpacity.cascade(parameters);
rasterHueRotate.cascade(parameters);
rasterBrightnessMin.cascade(parameters);
@@ -24,7 +25,7 @@ void RasterPaintProperties::cascade(const StyleCascadeParameters& parameters) {
rasterFadeDuration.cascade(parameters);
}
-bool RasterPaintProperties::recalculate(const StyleCalculationParameters& parameters) {
+bool RasterPaintProperties::recalculate(const CalculationParameters& parameters) {
bool hasTransitions = false;
hasTransitions |= rasterOpacity.calculate(parameters);
@@ -38,4 +39,5 @@ bool RasterPaintProperties::recalculate(const StyleCalculationParameters& parame
return hasTransitions;
}
+} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/layer/raster_layer_properties.hpp b/src/mbgl/style/layers/raster_layer_properties.hpp
index 46bd00ff2e..049da87312 100644
--- a/src/mbgl/layer/raster_layer_properties.hpp
+++ b/src/mbgl/style/layers/raster_layer_properties.hpp
@@ -7,15 +7,16 @@
#include <mbgl/util/rapidjson.hpp>
namespace mbgl {
+namespace style {
-class StyleCascadeParameters;
-class StyleCalculationParameters;
+class CascadeParameters;
+class CalculationParameters;
class RasterPaintProperties {
public:
void parse(const JSValue&);
- void cascade(const StyleCascadeParameters&);
- bool recalculate(const StyleCalculationParameters&);
+ void cascade(const CascadeParameters&);
+ bool recalculate(const CalculationParameters&);
PaintProperty<float> rasterOpacity { 1 };
PaintProperty<float> rasterHueRotate { 0 };
@@ -26,4 +27,5 @@ public:
PaintProperty<float> rasterFadeDuration { 300 };
};
+} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/layer/symbol_layer.cpp b/src/mbgl/style/layers/symbol_layer.cpp
index 66d018b581..d7d6a02ace 100644
--- a/src/mbgl/layer/symbol_layer.cpp
+++ b/src/mbgl/style/layers/symbol_layer.cpp
@@ -1,9 +1,10 @@
// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`.
-#include <mbgl/layer/symbol_layer.hpp>
-#include <mbgl/layer/symbol_layer_impl.hpp>
+#include <mbgl/style/layers/symbol_layer.hpp>
+#include <mbgl/style/layers/symbol_layer_impl.hpp>
namespace mbgl {
+namespace style {
SymbolLayer::SymbolLayer(const std::string& layerID)
: Layer(Type::Symbol, std::make_unique<Impl>())
@@ -381,4 +382,5 @@ void SymbolLayer::setTextTranslateAnchor(PropertyValue<TranslateAnchorType> valu
impl->paint.textTranslateAnchor.set(value);
}
+} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/layer/symbol_layer_impl.cpp b/src/mbgl/style/layers/symbol_layer_impl.cpp
index 3a0e0dceca..a4dc264ed2 100644
--- a/src/mbgl/layer/symbol_layer_impl.cpp
+++ b/src/mbgl/style/layers/symbol_layer_impl.cpp
@@ -1,8 +1,9 @@
-#include <mbgl/layer/symbol_layer_impl.hpp>
+#include <mbgl/style/layers/symbol_layer_impl.hpp>
#include <mbgl/renderer/symbol_bucket.hpp>
-#include <mbgl/style/style_bucket_parameters.hpp>
+#include <mbgl/style/bucket_parameters.hpp>
namespace mbgl {
+namespace style {
void SymbolLayer::Impl::parseLayout(const JSValue& value) {
layout.parse(value);
@@ -12,11 +13,11 @@ void SymbolLayer::Impl::parsePaints(const JSValue& layer) {
paint.parse(layer);
}
-void SymbolLayer::Impl::cascade(const StyleCascadeParameters& parameters) {
+void SymbolLayer::Impl::cascade(const CascadeParameters& parameters) {
paint.cascade(parameters);
}
-bool SymbolLayer::Impl::recalculate(const StyleCalculationParameters& parameters) {
+bool SymbolLayer::Impl::recalculate(const CalculationParameters& parameters) {
bool hasTransitions = paint.recalculate(parameters);
// text-size and icon-size are layout properties but they also need to be evaluated as paint properties:
@@ -32,7 +33,7 @@ bool SymbolLayer::Impl::recalculate(const StyleCalculationParameters& parameters
return hasTransitions;
}
-std::unique_ptr<Bucket> SymbolLayer::Impl::createBucket(StyleBucketParameters& parameters) const {
+std::unique_ptr<Bucket> SymbolLayer::Impl::createBucket(BucketParameters& parameters) const {
auto bucket = std::make_unique<SymbolBucket>(parameters.tileID.overscaleFactor(),
parameters.tileID.overscaledZ,
parameters.mode,
@@ -41,7 +42,7 @@ std::unique_ptr<Bucket> SymbolLayer::Impl::createBucket(StyleBucketParameters& p
bucket->layout = layout;
- StyleCalculationParameters p(parameters.tileID.overscaledZ);
+ CalculationParameters p(parameters.tileID.overscaledZ);
bucket->layout.symbolPlacement.calculate(p);
if (bucket->layout.symbolPlacement.value == SymbolPlacementType::Line) {
bucket->layout.iconRotationAlignment.value = RotationAlignmentType::Map;
@@ -50,12 +51,12 @@ std::unique_ptr<Bucket> SymbolLayer::Impl::createBucket(StyleBucketParameters& p
bucket->layout.recalculate(p);
- bucket->layout.iconSize.calculate(StyleCalculationParameters(18));
- bucket->layout.textSize.calculate(StyleCalculationParameters(18));
+ bucket->layout.iconSize.calculate(CalculationParameters(18));
+ bucket->layout.textSize.calculate(CalculationParameters(18));
bucket->iconMaxSize = bucket->layout.iconSize;
bucket->textMaxSize = bucket->layout.textSize;
- bucket->layout.iconSize.calculate(StyleCalculationParameters(p.z + 1));
- bucket->layout.textSize.calculate(StyleCalculationParameters(p.z + 1));
+ bucket->layout.iconSize.calculate(CalculationParameters(p.z + 1));
+ bucket->layout.textSize.calculate(CalculationParameters(p.z + 1));
bucket->parseFeatures(parameters.layer, filter);
@@ -77,4 +78,5 @@ std::unique_ptr<Bucket> SymbolLayer::Impl::createBucket(StyleBucketParameters& p
return std::move(bucket);
}
+} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/layer/symbol_layer_impl.hpp b/src/mbgl/style/layers/symbol_layer_impl.hpp
index 46503ab916..9727cc6480 100644
--- a/src/mbgl/layer/symbol_layer_impl.hpp
+++ b/src/mbgl/style/layers/symbol_layer_impl.hpp
@@ -1,14 +1,15 @@
-#ifndef MBGL_SYMBOL_LAYER
-#define MBGL_SYMBOL_LAYER
+#pragma once
-#include <mbgl/layer/layer_impl.hpp>
-#include <mbgl/layer/symbol_layer.hpp>
-#include <mbgl/layer/symbol_layer_properties.hpp>
+#include <mbgl/style/layer_impl.hpp>
+#include <mbgl/style/layers/symbol_layer.hpp>
+#include <mbgl/style/layers/symbol_layer_properties.hpp>
namespace mbgl {
class SpriteAtlas;
+namespace style {
+
class SymbolLayer::Impl : public Layer::Impl {
public:
std::unique_ptr<Layer> clone() const override;
@@ -16,10 +17,10 @@ public:
void parseLayout(const JSValue&) override;
void parsePaints(const JSValue&) override;
- void cascade(const StyleCascadeParameters&) override;
- bool recalculate(const StyleCalculationParameters&) override;
+ void cascade(const CascadeParameters&) override;
+ bool recalculate(const CalculationParameters&) override;
- std::unique_ptr<Bucket> createBucket(StyleBucketParameters&) const override;
+ std::unique_ptr<Bucket> createBucket(BucketParameters&) const override;
SymbolLayoutProperties layout;
SymbolPaintProperties paint;
@@ -30,6 +31,5 @@ public:
SpriteAtlas* spriteAtlas = nullptr;
};
+} // namespace style
} // namespace mbgl
-
-#endif
diff --git a/src/mbgl/layer/symbol_layer_properties.cpp b/src/mbgl/style/layers/symbol_layer_properties.cpp
index 4b9e9a5fb6..ce16ae2e50 100644
--- a/src/mbgl/layer/symbol_layer_properties.cpp
+++ b/src/mbgl/style/layers/symbol_layer_properties.cpp
@@ -1,8 +1,9 @@
// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`.
-#include <mbgl/layer/symbol_layer_properties.hpp>
+#include <mbgl/style/layers/symbol_layer_properties.hpp>
namespace mbgl {
+namespace style {
void SymbolLayoutProperties::parse(const JSValue& value) {
symbolPlacement.parse("symbol-placement", value);
@@ -38,7 +39,7 @@ void SymbolLayoutProperties::parse(const JSValue& value) {
textOptional.parse("text-optional", value);
}
-void SymbolLayoutProperties::recalculate(const StyleCalculationParameters& parameters) {
+void SymbolLayoutProperties::recalculate(const CalculationParameters& parameters) {
symbolPlacement.calculate(parameters);
symbolSpacing.calculate(parameters);
symbolAvoidEdges.calculate(parameters);
@@ -89,7 +90,7 @@ void SymbolPaintProperties::parse(const JSValue& value) {
textTranslateAnchor.parse("text-translate-anchor", value);
}
-void SymbolPaintProperties::cascade(const StyleCascadeParameters& parameters) {
+void SymbolPaintProperties::cascade(const CascadeParameters& parameters) {
iconOpacity.cascade(parameters);
iconColor.cascade(parameters);
iconHaloColor.cascade(parameters);
@@ -106,7 +107,7 @@ void SymbolPaintProperties::cascade(const StyleCascadeParameters& parameters) {
textTranslateAnchor.cascade(parameters);
}
-bool SymbolPaintProperties::recalculate(const StyleCalculationParameters& parameters) {
+bool SymbolPaintProperties::recalculate(const CalculationParameters& parameters) {
bool hasTransitions = false;
hasTransitions |= iconOpacity.calculate(parameters);
@@ -127,4 +128,5 @@ bool SymbolPaintProperties::recalculate(const StyleCalculationParameters& parame
return hasTransitions;
}
+} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/layer/symbol_layer_properties.hpp b/src/mbgl/style/layers/symbol_layer_properties.hpp
index ccbecef00e..38455b5cac 100644
--- a/src/mbgl/layer/symbol_layer_properties.hpp
+++ b/src/mbgl/style/layers/symbol_layer_properties.hpp
@@ -7,14 +7,15 @@
#include <mbgl/util/rapidjson.hpp>
namespace mbgl {
+namespace style {
-class StyleCascadeParameters;
-class StyleCalculationParameters;
+class CascadeParameters;
+class CalculationParameters;
class SymbolLayoutProperties {
public:
void parse(const JSValue&);
- void recalculate(const StyleCalculationParameters&);
+ void recalculate(const CalculationParameters&);
LayoutProperty<SymbolPlacementType> symbolPlacement { SymbolPlacementType::Point };
LayoutProperty<float> symbolSpacing { 250 };
@@ -52,8 +53,8 @@ public:
class SymbolPaintProperties {
public:
void parse(const JSValue&);
- void cascade(const StyleCascadeParameters&);
- bool recalculate(const StyleCalculationParameters&);
+ void cascade(const CascadeParameters&);
+ bool recalculate(const CalculationParameters&);
PaintProperty<float> iconOpacity { 1 };
PaintProperty<Color> iconColor { {{ 0, 0, 0, 1 }} };
@@ -71,4 +72,5 @@ public:
PaintProperty<TranslateAnchorType> textTranslateAnchor { TranslateAnchorType::Map };
};
+} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/style/layout_property.hpp b/src/mbgl/style/layout_property.hpp
index b4857aeae5..f5045b47fc 100644
--- a/src/mbgl/style/layout_property.hpp
+++ b/src/mbgl/style/layout_property.hpp
@@ -8,6 +8,7 @@
#include <utility>
namespace mbgl {
+namespace style {
template <typename T>
class LayoutProperty {
@@ -30,7 +31,7 @@ public:
}
}
- void calculate(const StyleCalculationParameters& parameters) {
+ void calculate(const CalculationParameters& parameters) {
if (currentValue) {
PropertyEvaluator<T> evaluator(parameters, defaultValue);
value = PropertyValue<T>::visit(currentValue, evaluator);
@@ -46,4 +47,5 @@ private:
PropertyValue<T> currentValue;
};
+} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/style/style_observer.hpp b/src/mbgl/style/observer.hpp
index 9e2c946f7d..c19f58904f 100644
--- a/src/mbgl/style/style_observer.hpp
+++ b/src/mbgl/style/observer.hpp
@@ -2,22 +2,24 @@
#include <mbgl/text/glyph_store_observer.hpp>
#include <mbgl/sprite/sprite_store_observer.hpp>
-#include <mbgl/source/source_observer.hpp>
+#include <mbgl/style/source_observer.hpp>
namespace mbgl {
+namespace style {
-class StyleObserver : public GlyphStoreObserver, public SpriteStoreObserver, public SourceObserver {
+class Observer : public GlyphStoreObserver,
+ public SpriteStoreObserver,
+ public SourceObserver {
public:
- virtual ~StyleObserver() = default;
-
/**
* In addition to the individual glyph, sprite, and source events, the
* following "rollup" events are provided for convenience. They are
* strictly additive; e.g. when a source is loaded, both `onSourceLoaded`
* and `onResourceLoaded` will be called.
*/
- virtual void onResourceLoaded() {}
- virtual void onResourceError(std::exception_ptr) {}
+ virtual void onResourceLoaded() {};
+ virtual void onResourceError(std::exception_ptr) {};
};
+} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/style/paint_property.hpp b/src/mbgl/style/paint_property.hpp
index 8428a90533..62fd59684e 100644
--- a/src/mbgl/style/paint_property.hpp
+++ b/src/mbgl/style/paint_property.hpp
@@ -3,9 +3,9 @@
#include <mbgl/style/class_dictionary.hpp>
#include <mbgl/style/property_parsing.hpp>
#include <mbgl/style/property_evaluator.hpp>
-#include <mbgl/style/property_transition.hpp>
-#include <mbgl/style/style_cascade_parameters.hpp>
-#include <mbgl/style/style_calculation_parameters.hpp>
+#include <mbgl/style/transition_options.hpp>
+#include <mbgl/style/cascade_parameters.hpp>
+#include <mbgl/style/calculation_parameters.hpp>
#include <mbgl/util/interpolate.hpp>
#include <mbgl/util/std.hpp>
#include <mbgl/util/rapidjson.hpp>
@@ -14,6 +14,7 @@
#include <utility>
namespace mbgl {
+namespace style {
template <class T, template <class S> class Evaluator = PropertyEvaluator>
class PaintProperty {
@@ -62,14 +63,14 @@ public:
}
if (it->value.HasMember(transitionName.c_str())) {
- if (auto v = parsePropertyTransition(name, it->value[transitionName.c_str()])) {
+ if (auto v = parseTransitionOptions(name, it->value[transitionName.c_str()])) {
transitions.emplace(classID, *v);
}
}
}
}
- void cascade(const StyleCascadeParameters& params) {
+ void cascade(const CascadeParameters& params) {
const bool overrideTransition = !params.transition.delay && !params.transition.duration;
Duration delay = params.transition.delay.value_or(Duration::zero());
Duration duration = params.transition.duration.value_or(Duration::zero());
@@ -79,7 +80,7 @@ public:
continue;
if (overrideTransition && transitions.find(classID) != transitions.end()) {
- const PropertyTransition& transition = transitions[classID];
+ const TransitionOptions& transition = transitions[classID];
if (transition.delay) delay = *transition.delay;
if (transition.duration) duration = *transition.duration;
}
@@ -95,7 +96,7 @@ public:
assert(cascaded);
}
- bool calculate(const StyleCalculationParameters& parameters) {
+ bool calculate(const CalculationParameters& parameters) {
assert(cascaded);
Evaluator<T> evaluator(parameters, defaultValue);
value = cascaded->calculate(evaluator, parameters.now);
@@ -109,7 +110,7 @@ public:
private:
T defaultValue;
std::map<ClassID, PropertyValue<T>> values;
- std::map<ClassID, PropertyTransition> transitions;
+ std::map<ClassID, TransitionOptions> transitions;
struct CascadedValue {
CascadedValue(std::unique_ptr<CascadedValue> prior_,
@@ -147,4 +148,5 @@ private:
std::unique_ptr<CascadedValue> cascaded;
};
+} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/style/style_parser.cpp b/src/mbgl/style/parser.cpp
index 95ab36498d..28a7d2e81b 100644
--- a/src/mbgl/style/style_parser.cpp
+++ b/src/mbgl/style/parser.cpp
@@ -1,11 +1,11 @@
-#include <mbgl/style/style_parser.hpp>
-#include <mbgl/layer/fill_layer.hpp>
-#include <mbgl/layer/line_layer.hpp>
-#include <mbgl/layer/circle_layer.hpp>
-#include <mbgl/layer/symbol_layer.hpp>
-#include <mbgl/layer/raster_layer.hpp>
-#include <mbgl/layer/background_layer.hpp>
-#include <mbgl/layer/layer_impl.hpp>
+#include <mbgl/style/parser.hpp>
+#include <mbgl/style/layer_impl.hpp>
+#include <mbgl/style/layers/fill_layer.hpp>
+#include <mbgl/style/layers/line_layer.hpp>
+#include <mbgl/style/layers/circle_layer.hpp>
+#include <mbgl/style/layers/symbol_layer.hpp>
+#include <mbgl/style/layers/raster_layer.hpp>
+#include <mbgl/style/layers/background_layer.hpp>
#include <mbgl/platform/log.hpp>
@@ -23,7 +23,7 @@
#include <set>
namespace mbgl {
-
+namespace style {
namespace {
@@ -102,9 +102,9 @@ void parseTileJSONMember(const JSValue& value, std::array<double, 4>& target, co
} // end namespace
-StyleParser::~StyleParser() = default;
+Parser::~Parser() = default;
-void StyleParser::parse(const std::string& json) {
+void Parser::parse(const std::string& json) {
rapidjson::GenericDocument<rapidjson::UTF8<>, rapidjson::CrtAllocator> document;
document.Parse<0>(json.c_str());
@@ -143,7 +143,7 @@ void StyleParser::parse(const std::string& json) {
}
}
-void StyleParser::parseSources(const JSValue& value) {
+void Parser::parseSources(const JSValue& value) {
if (!value.IsObject()) {
Log::Warning(Event::ParseStyle, "sources must be an object");
return;
@@ -174,7 +174,7 @@ void StyleParser::parseSources(const JSValue& value) {
uint16_t tileSize = util::tileSize;
- std::unique_ptr<SourceInfo> info;
+ std::unique_ptr<Tileset> tileset;
std::unique_ptr<mapbox::geojsonvt::GeoJSONVT> geojsonvt;
switch (type) {
@@ -200,12 +200,12 @@ void StyleParser::parseSources(const JSValue& value) {
continue;
}
} else {
- info = parseTileJSON(sourceVal);
+ tileset = parseTileJSON(sourceVal);
}
break;
case SourceType::GeoJSON:
- info = std::make_unique<SourceInfo>();
+ tileset = std::make_unique<Tileset>();
// We should probably split this up to have URLs in the url property, and actual data
// in the data property. Until then, we're going to detect the content based on the
@@ -218,7 +218,7 @@ void StyleParser::parseSources(const JSValue& value) {
} else if (dataVal.IsObject()) {
// We need to parse dataVal as a GeoJSON object
geojsonvt = parseGeoJSON(dataVal);
- info->maxZoom = geojsonvt->options.maxZoom;
+ tileset->maxZoom = geojsonvt->options.maxZoom;
} else {
Log::Error(Event::ParseStyle, "GeoJSON data must be a URL or an object");
continue;
@@ -236,14 +236,14 @@ void StyleParser::parseSources(const JSValue& value) {
}
const std::string id { nameVal.GetString(), nameVal.GetStringLength() };
- std::unique_ptr<Source> source = std::make_unique<Source>(type, id, url, tileSize, std::move(info), std::move(geojsonvt));
+ std::unique_ptr<Source> source = std::make_unique<Source>(type, id, url, tileSize, std::move(tileset), std::move(geojsonvt));
sourcesMap.emplace(id, source.get());
sources.emplace_back(std::move(source));
}
}
-std::unique_ptr<mapbox::geojsonvt::GeoJSONVT> StyleParser::parseGeoJSON(const JSValue& value) {
+std::unique_ptr<mapbox::geojsonvt::GeoJSONVT> parseGeoJSON(const JSValue& value) {
using namespace mapbox::geojsonvt;
Options options;
@@ -260,7 +260,7 @@ std::unique_ptr<mapbox::geojsonvt::GeoJSONVT> StyleParser::parseGeoJSON(const JS
}
}
-std::unique_ptr<SourceInfo> StyleParser::parseTileJSON(const std::string& json, const std::string& sourceURL, SourceType type, uint16_t tileSize) {
+std::unique_ptr<Tileset> parseTileJSON(const std::string& json, const std::string& sourceURL, SourceType type, uint16_t tileSize) {
rapidjson::GenericDocument<rapidjson::UTF8<>, rapidjson::CrtAllocator> document;
document.Parse<0>(json.c_str());
@@ -270,7 +270,7 @@ std::unique_ptr<SourceInfo> StyleParser::parseTileJSON(const std::string& json,
throw std::runtime_error(message.str());
}
- std::unique_ptr<SourceInfo> result = StyleParser::parseTileJSON(document);
+ std::unique_ptr<Tileset> result = parseTileJSON(document);
// TODO: Remove this hack by delivering proper URLs in the TileJSON to begin with.
if (util::mapbox::isMapboxURL(sourceURL)) {
@@ -282,24 +282,24 @@ std::unique_ptr<SourceInfo> StyleParser::parseTileJSON(const std::string& json,
return result;
}
-std::unique_ptr<SourceInfo> StyleParser::parseTileJSON(const JSValue& value) {
- auto info = std::make_unique<SourceInfo>();
- parseTileJSONMember(value, info->tiles, "tiles");
- parseTileJSONMember(value, info->minZoom, "minzoom");
- parseTileJSONMember(value, info->maxZoom, "maxzoom");
- parseTileJSONMember(value, info->attribution, "attribution");
+std::unique_ptr<Tileset> parseTileJSON(const JSValue& value) {
+ auto tileset = std::make_unique<Tileset>();
+ parseTileJSONMember(value, tileset->tiles, "tiles");
+ parseTileJSONMember(value, tileset->minZoom, "minzoom");
+ parseTileJSONMember(value, tileset->maxZoom, "maxzoom");
+ parseTileJSONMember(value, tileset->attribution, "attribution");
std::array<double, 4> array;
parseTileJSONMember(value, array, "center");
- info->center = { array[0], array[1] };
- info->zoom = array[2];
+ tileset->center = { array[0], array[1] };
+ tileset->zoom = array[2];
parseTileJSONMember(value, array, "bounds");
- info->bounds = LatLngBounds::hull({ array[0], array[1] }, { array[2], array[3] });
+ tileset->bounds = LatLngBounds::hull({ array[0], array[1] }, { array[2], array[3] });
- return info;
+ return tileset;
}
-void StyleParser::parseLayers(const JSValue& value) {
+void Parser::parseLayers(const JSValue& value) {
std::vector<std::string> ids;
if (!value.IsArray()) {
@@ -353,7 +353,7 @@ void StyleParser::parseLayers(const JSValue& value) {
}
}
-void StyleParser::parseLayer(const std::string& id, const JSValue& value, std::unique_ptr<Layer>& layer) {
+void Parser::parseLayer(const std::string& id, const JSValue& value, std::unique_ptr<Layer>& layer) {
if (layer) {
// Skip parsing this again. We already have a valid layer definition.
return;
@@ -486,7 +486,7 @@ MBGL_DEFINE_ENUM_CLASS(VisibilityTypeClass, VisibilityType, {
{ VisibilityType::None, "none" },
});
-void StyleParser::parseVisibility(Layer& layer, const JSValue& value) {
+void Parser::parseVisibility(Layer& layer, const JSValue& value) {
Layer::Impl& impl = *layer.baseImpl;
if (!value.HasMember("visibility")) {
return;
@@ -664,7 +664,7 @@ Filter parseFilter(const JSValue& value) {
}
}
-std::vector<FontStack> StyleParser::fontStacks() const {
+std::vector<FontStack> Parser::fontStacks() const {
std::set<FontStack> result;
for (const auto& layer : layers) {
@@ -685,4 +685,5 @@ std::vector<FontStack> StyleParser::fontStacks() const {
return std::vector<FontStack>(result.begin(), result.end());
}
+} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/style/style_parser.hpp b/src/mbgl/style/parser.hpp
index b5445bbfb3..ea821fabde 100644
--- a/src/mbgl/style/style_parser.hpp
+++ b/src/mbgl/style/parser.hpp
@@ -1,10 +1,11 @@
#pragma once
-#include <mbgl/style/types.hpp>
#include <mbgl/style/layer.hpp>
-#include <mbgl/source/source.hpp>
+#include <mbgl/style/source.hpp>
#include <mbgl/style/filter.hpp>
+
#include <mbgl/util/rapidjson.hpp>
+#include <mbgl/util/font_stack.hpp>
#include <vector>
#include <memory>
@@ -13,12 +14,18 @@
#include <forward_list>
namespace mbgl {
+namespace style {
+
+std::unique_ptr<Tileset> parseTileJSON(const std::string& json, const std::string& sourceURL, SourceType, uint16_t tileSize);
+std::unique_ptr<Tileset> parseTileJSON(const JSValue&);
+
+std::unique_ptr<mapbox::geojsonvt::GeoJSONVT> parseGeoJSON(const JSValue&);
Filter parseFilter(const JSValue&);
-class StyleParser {
+class Parser {
public:
- ~StyleParser();
+ ~Parser();
void parse(const std::string&);
@@ -31,11 +38,6 @@ public:
// Statically evaluate layer properties to determine what font stacks are used.
std::vector<FontStack> fontStacks() const;
- static std::unique_ptr<SourceInfo> parseTileJSON(const std::string& json, const std::string& sourceURL, SourceType, uint16_t tileSize);
- static std::unique_ptr<SourceInfo> parseTileJSON(const JSValue&);
-
- static std::unique_ptr<mapbox::geojsonvt::GeoJSONVT> parseGeoJSON(const JSValue&);
-
private:
void parseSources(const JSValue&);
void parseLayers(const JSValue&);
@@ -49,4 +51,5 @@ private:
std::forward_list<std::string> stack;
};
+} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/style/property_evaluator.cpp b/src/mbgl/style/property_evaluator.cpp
index 08eea899c2..d2e633c782 100644
--- a/src/mbgl/style/property_evaluator.cpp
+++ b/src/mbgl/style/property_evaluator.cpp
@@ -1,12 +1,14 @@
#include <mbgl/style/property_evaluator.hpp>
-#include <mbgl/style/style_calculation_parameters.hpp>
+#include <mbgl/style/calculation_parameters.hpp>
#include <mbgl/style/types.hpp>
#include <mbgl/util/interpolate.hpp>
#include <mbgl/util/chrono.hpp>
+#include <mbgl/util/color.hpp>
#include <cmath>
namespace mbgl {
+namespace style {
template <typename T>
inline T defaultStopsValue();
@@ -140,4 +142,5 @@ Faded<T> CrossFadedPropertyEvaluator<T>::calculate(const T& min, const T& mid, c
template class CrossFadedPropertyEvaluator<std::string>;
template class CrossFadedPropertyEvaluator<std::vector<float>>;
+} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/style/property_evaluator.hpp b/src/mbgl/style/property_evaluator.hpp
index 112c373a44..77100bda46 100644
--- a/src/mbgl/style/property_evaluator.hpp
+++ b/src/mbgl/style/property_evaluator.hpp
@@ -4,15 +4,16 @@
#include <mbgl/util/interpolate.hpp>
namespace mbgl {
+namespace style {
-class StyleCalculationParameters;
+class CalculationParameters;
template <typename T>
class PropertyEvaluator {
public:
using ResultType = T;
- PropertyEvaluator(const StyleCalculationParameters& parameters_, const T& defaultValue_)
+ PropertyEvaluator(const CalculationParameters& parameters_, const T& defaultValue_)
: parameters(parameters_),
defaultValue(defaultValue_) {}
@@ -21,7 +22,7 @@ public:
T operator()(const Function<T>&) const;
private:
- const StyleCalculationParameters& parameters;
+ const CalculationParameters& parameters;
T defaultValue;
};
@@ -39,7 +40,7 @@ class CrossFadedPropertyEvaluator {
public:
using ResultType = Faded<T>;
- CrossFadedPropertyEvaluator(const StyleCalculationParameters& parameters_, const T& defaultValue_)
+ CrossFadedPropertyEvaluator(const CalculationParameters& parameters_, const T& defaultValue_)
: parameters(parameters_),
defaultValue(defaultValue_) {}
@@ -50,13 +51,15 @@ public:
private:
Faded<T> calculate(const T& min, const T& mid, const T& max) const;
- const StyleCalculationParameters& parameters;
+ const CalculationParameters& parameters;
T defaultValue;
};
+} // namespace style
+
namespace util {
template <typename T>
-struct Interpolator<Faded<T>>
+struct Interpolator<style::Faded<T>>
: Uninterpolated {};
}
diff --git a/src/mbgl/style/property_parsing.cpp b/src/mbgl/style/property_parsing.cpp
index 67baa3ec8d..9f60ddf3b6 100644
--- a/src/mbgl/style/property_parsing.cpp
+++ b/src/mbgl/style/property_parsing.cpp
@@ -1,11 +1,11 @@
#include <mbgl/style/property_parsing.hpp>
-#include <mbgl/style/property_transition.hpp>
#include <mbgl/platform/log.hpp>
#include <csscolorparser/csscolorparser.hpp>
namespace mbgl {
+namespace style {
template <>
optional<bool> parseConstant(const char* name, const JSValue& value) {
@@ -264,7 +264,7 @@ optional<std::vector<std::string>> parseConstant(const char* name, const JSValue
return result;
}
-optional<PropertyTransition> parsePropertyTransition(const char *, const JSValue& value) {
+optional<TransitionOptions> parseTransitionOptions(const char *, const JSValue& value) {
if (!value.IsObject()) {
return {};
}
@@ -283,7 +283,8 @@ optional<PropertyTransition> parsePropertyTransition(const char *, const JSValue
return {};
}
- return PropertyTransition(duration, delay);
+ return TransitionOptions(duration, delay);
}
+} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/style/property_parsing.hpp b/src/mbgl/style/property_parsing.hpp
index c0fe5ce2bc..bb894c2407 100644
--- a/src/mbgl/style/property_parsing.hpp
+++ b/src/mbgl/style/property_parsing.hpp
@@ -2,10 +2,11 @@
#include <mbgl/style/types.hpp>
#include <mbgl/style/property_value.hpp>
-#include <mbgl/style/property_transition.hpp>
+#include <mbgl/style/transition_options.hpp>
#include <mbgl/util/rapidjson.hpp>
#include <mbgl/util/optional.hpp>
+#include <mbgl/util/color.hpp>
#include <mbgl/platform/log.hpp>
@@ -14,6 +15,7 @@
#include <vector>
namespace mbgl {
+namespace style {
template <typename T>
optional<T> parseConstant(const char* name, const JSValue&);
@@ -104,6 +106,7 @@ PropertyValue<T> parseProperty(const char* name, const JSValue& value) {
return Function<T>(stops, base);
}
-optional<PropertyTransition> parsePropertyTransition(const char * name, const JSValue&);
+optional<TransitionOptions> parseTransitionOptions(const char * name, const JSValue&);
+} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/style/property_value.hpp b/src/mbgl/style/property_value.hpp
deleted file mode 100644
index 377e4f17e0..0000000000
--- a/src/mbgl/style/property_value.hpp
+++ /dev/null
@@ -1,36 +0,0 @@
-#pragma once
-
-#include <mbgl/util/variant.hpp>
-#include <mbgl/style/types.hpp>
-
-namespace mbgl {
-
-class Undefined {};
-
-template <class T>
-class PropertyValue {
-private:
- using Value = variant<Undefined, T, Function<T>>;
- Value value;
-
-public:
- PropertyValue() : value() {}
- PropertyValue( T constant) : value(constant) {}
- PropertyValue(Function<T> function) : value(function) {}
-
- bool isUndefined() const { return value.which() == 0; }
- bool isConstant() const { return value.which() == 1; }
- bool isFunction() const { return value.which() == 2; }
-
- const T & asConstant() const { return value.template get< T >(); }
- const Function<T>& asFunction() const { return value.template get<Function<T>>(); }
-
- explicit operator bool() const { return !isUndefined(); };
-
- template <typename Visitor>
- static auto visit(const PropertyValue<T>& value, Visitor&& visitor) {
- return Value::visit(value.value, visitor);
- }
-};
-
-}
diff --git a/src/mbgl/style/style_query_parameters.hpp b/src/mbgl/style/query_parameters.hpp
index 33115bdfb2..3c1abf3b70 100644
--- a/src/mbgl/style/style_query_parameters.hpp
+++ b/src/mbgl/style/query_parameters.hpp
@@ -8,11 +8,14 @@ namespace mbgl {
class TransformState;
-class StyleQueryParameters {
+namespace style {
+
+class QueryParameters {
public:
const ScreenLineString& geometry;
const TransformState& transformState;
const optional<std::vector<std::string>>& layerIDs;
};
+} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/style/render_item.hpp b/src/mbgl/style/render_item.hpp
index ebf6799828..da59591c36 100644
--- a/src/mbgl/style/render_item.hpp
+++ b/src/mbgl/style/render_item.hpp
@@ -2,12 +2,15 @@
namespace mbgl {
-class Layer;
class Tile;
class Bucket;
+namespace style {
+class Layer;
+}
+
struct RenderItem {
- inline RenderItem(const Layer& layer_,
+ inline RenderItem(const style::Layer& layer_,
const Tile* tile_ = nullptr,
Bucket* bucket_ = nullptr)
: tile(tile_), bucket(bucket_), layer(layer_) {
@@ -15,7 +18,7 @@ struct RenderItem {
const Tile* const tile;
Bucket* const bucket;
- const Layer& layer;
+ const style::Layer& layer;
};
} // namespace mbgl
diff --git a/src/mbgl/source/source.cpp b/src/mbgl/style/source.cpp
index 66546909ac..8e5973f412 100644
--- a/src/mbgl/source/source.cpp
+++ b/src/mbgl/style/source.cpp
@@ -1,5 +1,5 @@
-#include <mbgl/source/source.hpp>
-#include <mbgl/source/source_observer.hpp>
+#include <mbgl/style/source.hpp>
+#include <mbgl/style/source_observer.hpp>
#include <mbgl/map/transform.hpp>
#include <mbgl/tile/tile.hpp>
#include <mbgl/tile/vector_tile.hpp>
@@ -12,8 +12,8 @@
#include <mbgl/storage/response.hpp>
#include <mbgl/storage/file_source.hpp>
#include <mbgl/style/layer.hpp>
-#include <mbgl/style/style_update_parameters.hpp>
-#include <mbgl/style/style_query_parameters.hpp>
+#include <mbgl/style/update_parameters.hpp>
+#include <mbgl/style/query_parameters.hpp>
#include <mbgl/platform/log.hpp>
#include <mbgl/math/minmax.hpp>
#include <mbgl/math/clamp.hpp>
@@ -24,7 +24,7 @@
#include <mbgl/tile/vector_tile_data.hpp>
#include <mbgl/tile/raster_tile_data.hpp>
-#include <mbgl/style/style_parser.hpp>
+#include <mbgl/style/parser.hpp>
#include <mbgl/gl/debugging.hpp>
#include <mbgl/algorithm/update_renderables.hpp>
@@ -39,6 +39,7 @@
#include <sstream>
namespace mbgl {
+namespace style {
static SourceObserver nullObserver;
@@ -46,13 +47,13 @@ Source::Source(SourceType type_,
const std::string& id_,
const std::string& url_,
uint16_t tileSize_,
- std::unique_ptr<SourceInfo>&& info_,
+ std::unique_ptr<Tileset>&& tileset_,
std::unique_ptr<mapbox::geojsonvt::GeoJSONVT>&& geojsonvt_)
: type(type_),
id(id_),
url(url_),
tileSize(tileSize_),
- info(std::move(info_)),
+ tileset(std::move(tileset_)),
geojsonvt(std::move(geojsonvt_)),
observer(&nullObserver) {
}
@@ -84,7 +85,7 @@ void Source::load(FileSource& fileSource) {
}
if (req) {
- // We don't have a SourceInfo object yet, but there's already a request underway to load
+ // We don't have a Tileset object yet, but there's already a request underway to load
// the data.
return;
}
@@ -101,20 +102,20 @@ void Source::load(FileSource& fileSource) {
bool reloadTiles = false;
if (type == SourceType::Vector || type == SourceType::Raster) {
- std::unique_ptr<SourceInfo> newInfo;
+ std::unique_ptr<Tileset> newTileset;
- // Create a new copy of the SourceInfo object that holds the base values we've parsed
+ // Create a new copy of the Tileset object that holds the base values we've parsed
// from the stylesheet. Then merge in the values parsed from the TileJSON we retrieved
// via the URL.
try {
- newInfo = StyleParser::parseTileJSON(*res.data, url, type, tileSize);
+ newTileset = style::parseTileJSON(*res.data, url, type, tileSize);
} catch (...) {
observer->onSourceError(*this, std::current_exception());
return;
}
// Check whether previous information specifies different tile
- if (info && info->tiles != newInfo->tiles) {
+ if (tileset && tileset->tiles != newTileset->tiles) {
reloadTiles = true;
// Tile size changed: We need to recalculate the tiles we need to load because we
@@ -132,9 +133,9 @@ void Source::load(FileSource& fileSource) {
// Center/bounds changed: We're not using these values currently
}
- info = std::move(newInfo);
+ tileset = std::move(newTileset);
} else if (type == SourceType::GeoJSON) {
- std::unique_ptr<SourceInfo> newInfo = std::make_unique<SourceInfo>();
+ std::unique_ptr<Tileset> newTileset = std::make_unique<Tileset>();
rapidjson::GenericDocument<rapidjson::UTF8<>, rapidjson::CrtAllocator> d;
d.Parse<0>(res.data->c_str());
@@ -146,11 +147,11 @@ void Source::load(FileSource& fileSource) {
return;
}
- geojsonvt = StyleParser::parseGeoJSON(d);
+ geojsonvt = style::parseGeoJSON(d);
reloadTiles = true;
- newInfo->maxZoom = geojsonvt->options.maxZoom;
- info = std::move(newInfo);
+ newTileset->maxZoom = geojsonvt->options.maxZoom;
+ tileset = std::move(newTileset);
}
if (reloadTiles) {
@@ -186,7 +187,7 @@ const std::map<UnwrappedTileID, Tile>& Source::getTiles() const {
}
std::unique_ptr<TileData> Source::createTile(const OverscaledTileID& overscaledTileID,
- const StyleUpdateParameters& parameters) {
+ const UpdateParameters& parameters) {
std::unique_ptr<TileData> data = cache.get(overscaledTileID);
if (data) {
return data;
@@ -198,13 +199,13 @@ std::unique_ptr<TileData> Source::createTile(const OverscaledTileID& overscaledT
// If we don't find working tile data, we're just going to load it.
if (type == SourceType::Raster) {
data = std::make_unique<RasterTileData>(overscaledTileID, parameters.pixelRatio,
- info->tiles.at(0), parameters.texturePool,
+ tileset->tiles.at(0), parameters.texturePool,
parameters.worker, parameters.fileSource, callback);
} else {
std::unique_ptr<GeometryTileMonitor> monitor;
if (type == SourceType::Vector) {
- monitor = std::make_unique<VectorTileMonitor>(overscaledTileID, parameters.pixelRatio, info->tiles.at(0), parameters.fileSource);
+ monitor = std::make_unique<VectorTileMonitor>(overscaledTileID, parameters.pixelRatio, tileset->tiles.at(0), parameters.fileSource);
} else if (type == SourceType::Annotations) {
monitor = std::make_unique<AnnotationTileMonitor>(overscaledTileID, parameters.annotationManager);
} else if (type == SourceType::GeoJSON) {
@@ -230,7 +231,7 @@ TileData* Source::getTileData(const OverscaledTileID& overscaledTileID) const {
}
}
-bool Source::update(const StyleUpdateParameters& parameters) {
+bool Source::update(const UpdateParameters& parameters) {
bool allTilesUpdated = true;
if (!loaded || parameters.animationTime <= updated) {
@@ -242,8 +243,8 @@ bool Source::update(const StyleUpdateParameters& parameters) {
int32_t dataTileZoom = overscaledZoom;
std::vector<UnwrappedTileID> idealTiles;
- if (overscaledZoom >= info->minZoom) {
- int32_t idealZoom = std::min<int32_t>(info->maxZoom, overscaledZoom);
+ if (overscaledZoom >= tileset->minZoom) {
+ int32_t idealZoom = std::min<int32_t>(tileset->maxZoom, overscaledZoom);
// Make sure we're not reparsing overzoomed raster tiles.
if (type == SourceType::Raster) {
@@ -278,7 +279,7 @@ bool Source::update(const StyleUpdateParameters& parameters) {
tiles.clear();
algorithm::updateRenderables(getTileDataFn, createTileDataFn, retainTileDataFn, renderTileFn,
- idealTiles, *info, dataTileZoom);
+ idealTiles, *tileset, dataTileZoom);
if (type != SourceType::Raster && type != SourceType::Annotations && cache.getSize() == 0) {
size_t conservativeCacheSize =
@@ -341,7 +342,7 @@ static Point<int16_t> coordinateToTilePoint(const UnwrappedTileID& tileID, const
};
}
-std::unordered_map<std::string, std::vector<Feature>> Source::queryRenderedFeatures(const StyleQueryParameters& parameters) const {
+std::unordered_map<std::string, std::vector<Feature>> Source::queryRenderedFeatures(const QueryParameters& parameters) const {
LineString<double> queryGeometry;
for (const auto& p : parameters.geometry) {
@@ -423,4 +424,5 @@ void Source::dumpDebugLogs() const {
}
}
+} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/source/source.hpp b/src/mbgl/style/source.hpp
index cbdf4afa15..cadc45c25c 100644
--- a/src/mbgl/source/source.hpp
+++ b/src/mbgl/style/source.hpp
@@ -3,12 +3,13 @@
#include <mbgl/tile/tile_id.hpp>
#include <mbgl/tile/tile_data.hpp>
#include <mbgl/tile/tile_cache.hpp>
-#include <mbgl/source/source_info.hpp>
+#include <mbgl/style/types.hpp>
#include <mbgl/renderer/renderable.hpp>
#include <mbgl/util/mat4.hpp>
#include <mbgl/util/rapidjson.hpp>
#include <mbgl/util/feature.hpp>
+#include <mbgl/util/tileset.hpp>
#include <forward_list>
#include <vector>
@@ -22,15 +23,18 @@ class GeoJSONVT;
namespace mbgl {
-class Style;
-class StyleUpdateParameters;
-class StyleQueryParameters;
class Painter;
class FileSource;
class AsyncRequest;
class TransformState;
class Tile;
struct ClipID;
+
+namespace style {
+
+class Style;
+class UpdateParameters;
+class QueryParameters;
class SourceObserver;
class Source : private util::noncopyable {
@@ -39,7 +43,7 @@ public:
const std::string& id,
const std::string& url,
uint16_t tileSize,
- std::unique_ptr<SourceInfo>&&,
+ std::unique_ptr<Tileset>&&,
std::unique_ptr<mapbox::geojsonvt::GeoJSONVT>&&);
~Source();
@@ -48,13 +52,13 @@ public:
bool isLoading() const;
bool isLoaded() const;
- const SourceInfo* getInfo() const { return info.get(); }
+ const Tileset* getTileset() const { return tileset.get(); }
// Request or parse all the tiles relevant for the "TransformState". This method
// will return true if all the tiles were scheduled for updating of false if
// they were not. shouldReparsePartialTiles must be set to "true" if there is
// new data available that a tile in the "partial" state might be interested at.
- bool update(const StyleUpdateParameters&);
+ bool update(const UpdateParameters&);
template <typename ClipIDGenerator>
void updateClipIDs(ClipIDGenerator& generator) {
@@ -69,7 +73,7 @@ public:
TileData* getTileData(const OverscaledTileID&) const;
std::unordered_map<std::string, std::vector<Feature>>
- queryRenderedFeatures(const StyleQueryParameters&) const;
+ queryRenderedFeatures(const QueryParameters&) const;
void setCacheSize(size_t);
void onLowMemory();
@@ -86,11 +90,10 @@ public:
private:
void tileLoadingCallback(const OverscaledTileID&, std::exception_ptr, bool isNewTile);
- std::unique_ptr<TileData> createTile(const OverscaledTileID&,
- const StyleUpdateParameters& parameters);
+ std::unique_ptr<TileData> createTile(const OverscaledTileID&, const UpdateParameters&);
private:
- std::unique_ptr<const SourceInfo> info;
+ std::unique_ptr<const Tileset> tileset;
std::unique_ptr<mapbox::geojsonvt::GeoJSONVT> geojsonvt;
@@ -106,4 +109,5 @@ private:
SourceObserver* observer = nullptr;
};
+} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/source/source_observer.hpp b/src/mbgl/style/source_observer.hpp
index 828e562a3e..a669e8e756 100644
--- a/src/mbgl/source/source_observer.hpp
+++ b/src/mbgl/style/source_observer.hpp
@@ -4,9 +4,12 @@
namespace mbgl {
-class Source;
class OverscaledTileID;
+namespace style {
+
+class Source;
+
class SourceObserver {
public:
virtual ~SourceObserver() = default;
@@ -18,4 +21,5 @@ public:
virtual void onPlacementRedone() {}
};
+} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/style/style.cpp b/src/mbgl/style/style.cpp
index ee847ccf57..136c98df03 100644
--- a/src/mbgl/style/style.cpp
+++ b/src/mbgl/style/style.cpp
@@ -1,23 +1,23 @@
#include <mbgl/style/style.hpp>
-#include <mbgl/style/style_observer.hpp>
-#include <mbgl/source/source.hpp>
+#include <mbgl/style/observer.hpp>
+#include <mbgl/style/source.hpp>
#include <mbgl/tile/tile.hpp>
#include <mbgl/map/transform_state.hpp>
-#include <mbgl/layer/symbol_layer.hpp>
-#include <mbgl/layer/symbol_layer_impl.hpp>
-#include <mbgl/layer/custom_layer.hpp>
-#include <mbgl/layer/custom_layer_impl.hpp>
-#include <mbgl/layer/background_layer.hpp>
-#include <mbgl/layer/background_layer_impl.hpp>
+#include <mbgl/style/layers/symbol_layer.hpp>
+#include <mbgl/style/layers/symbol_layer_impl.hpp>
+#include <mbgl/style/layers/custom_layer.hpp>
+#include <mbgl/style/layers/custom_layer_impl.hpp>
+#include <mbgl/style/layers/background_layer.hpp>
+#include <mbgl/style/layers/background_layer_impl.hpp>
#include <mbgl/sprite/sprite_store.hpp>
#include <mbgl/sprite/sprite_atlas.hpp>
-#include <mbgl/layer/layer_impl.hpp>
-#include <mbgl/style/style_parser.hpp>
-#include <mbgl/style/property_transition.hpp>
+#include <mbgl/style/layer_impl.hpp>
+#include <mbgl/style/parser.hpp>
+#include <mbgl/style/transition_options.hpp>
#include <mbgl/style/class_dictionary.hpp>
-#include <mbgl/style/style_update_parameters.hpp>
-#include <mbgl/style/style_cascade_parameters.hpp>
-#include <mbgl/style/style_calculation_parameters.hpp>
+#include <mbgl/style/update_parameters.hpp>
+#include <mbgl/style/cascade_parameters.hpp>
+#include <mbgl/style/calculation_parameters.hpp>
#include <mbgl/geometry/glyph_atlas.hpp>
#include <mbgl/geometry/line_atlas.hpp>
#include <mbgl/util/constants.hpp>
@@ -30,10 +30,11 @@
#include <algorithm>
namespace mbgl {
+namespace style {
-static StyleObserver nullObserver;
+static Observer nullObserver;
-bool Style::addClass(const std::string& className, const PropertyTransition& properties) {
+bool Style::addClass(const std::string& className, const TransitionOptions& properties) {
if (std::find(classes.begin(), classes.end(), className) != classes.end()) return false;
classes.push_back(className);
transitionProperties = properties;
@@ -44,7 +45,7 @@ bool Style::hasClass(const std::string& className) const {
return std::find(classes.begin(), classes.end(), className) != classes.end();
}
-bool Style::removeClass(const std::string& className, const PropertyTransition& properties) {
+bool Style::removeClass(const std::string& className, const TransitionOptions& properties) {
const auto it = std::find(classes.begin(), classes.end(), className);
if (it != classes.end()) {
classes.erase(it);
@@ -54,7 +55,7 @@ bool Style::removeClass(const std::string& className, const PropertyTransition&
return false;
}
-void Style::setClasses(const std::vector<std::string>& classNames, const PropertyTransition& properties) {
+void Style::setClasses(const std::vector<std::string>& classNames, const TransitionOptions& properties) {
classes = classNames;
transitionProperties = properties;
}
@@ -81,7 +82,7 @@ void Style::setJSON(const std::string& json, const std::string&) {
layers.clear();
classes.clear();
- StyleParser parser;
+ Parser parser;
parser.parse(json);
for (auto& source : parser.sources) {
@@ -153,7 +154,7 @@ void Style::removeLayer(const std::string& id) {
layers.erase(it);
}
-void Style::update(const StyleUpdateParameters& parameters) {
+void Style::update(const UpdateParameters& parameters) {
bool allTilesUpdated = true;
for (const auto& source : sources) {
@@ -172,7 +173,7 @@ void Style::update(const StyleUpdateParameters& parameters) {
void Style::cascade(const TimePoint& timePoint, MapMode mode) {
// When in continuous mode, we can either have user- or style-defined
// transitions. Still mode is always immediate.
- static const PropertyTransition immediateTransition;
+ static const TransitionOptions immediateTransition;
std::vector<ClassID> classIDs;
for (const auto& className : classes) {
@@ -181,7 +182,7 @@ void Style::cascade(const TimePoint& timePoint, MapMode mode) {
classIDs.push_back(ClassID::Default);
classIDs.push_back(ClassID::Fallback);
- const StyleCascadeParameters parameters {
+ const CascadeParameters parameters {
classIDs,
mode == MapMode::Continuous ? timePoint : Clock::time_point::max(),
mode == MapMode::Continuous ? transitionProperties.value_or(immediateTransition) : immediateTransition
@@ -201,7 +202,7 @@ void Style::recalculate(float z, const TimePoint& timePoint, MapMode mode) {
zoomHistory.update(z, timePoint);
- const StyleCalculationParameters parameters {
+ const CalculationParameters parameters {
z,
mode == MapMode::Continuous ? timePoint : Clock::time_point::max(),
zoomHistory,
@@ -325,7 +326,7 @@ RenderData Style::getRenderData() const {
return result;
}
-std::vector<Feature> Style::queryRenderedFeatures(const StyleQueryParameters& parameters) const {
+std::vector<Feature> Style::queryRenderedFeatures(const QueryParameters& parameters) const {
std::unordered_map<std::string, std::vector<Feature>> resultsByLayer;
for (const auto& source : sources) {
@@ -367,7 +368,7 @@ void Style::onLowMemory() {
}
}
-void Style::setObserver(StyleObserver* observer_) {
+void Style::setObserver(style::Observer* observer_) {
observer = observer_;
}
@@ -440,4 +441,5 @@ void Style::dumpDebugLogs() const {
spriteStore->dumpDebugLogs();
}
+} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/style/style.hpp b/src/mbgl/style/style.hpp
index 6892f4967a..49af674336 100644
--- a/src/mbgl/style/style.hpp
+++ b/src/mbgl/style/style.hpp
@@ -1,20 +1,21 @@
#pragma once
#include <mbgl/style/render_item.hpp>
-#include <mbgl/style/zoom_history.hpp>
-#include <mbgl/style/types.hpp>
-#include <mbgl/style/property_transition.hpp>
+#include <mbgl/style/transition_options.hpp>
-#include <mbgl/source/source_observer.hpp>
+#include <mbgl/style/observer.hpp>
+#include <mbgl/style/source_observer.hpp>
#include <mbgl/text/glyph_store_observer.hpp>
#include <mbgl/sprite/sprite_store_observer.hpp>
#include <mbgl/map/mode.hpp>
+#include <mbgl/map/zoom_history.hpp>
#include <mbgl/util/noncopyable.hpp>
#include <mbgl/util/chrono.hpp>
#include <mbgl/util/worker.hpp>
#include <mbgl/util/optional.hpp>
#include <mbgl/util/feature.hpp>
+#include <mbgl/util/color.hpp>
#include <cstdint>
#include <string>
@@ -25,20 +26,20 @@ namespace mbgl {
class FileSource;
class GlyphAtlas;
-class GlyphStore;
-class SpriteStore;
class SpriteAtlas;
class LineAtlas;
-class StyleUpdateParameters;
-class StyleQueryParameters;
-class StyleObserver;
struct RenderData {
Color backgroundColor = {{ 0, 0, 0, 0 }};
- std::set<Source*> sources;
+ std::set<style::Source*> sources;
std::vector<RenderItem> order;
};
+namespace style {
+
+class UpdateParameters;
+class QueryParameters;
+
class Style : public GlyphStoreObserver,
public SpriteStoreObserver,
public SourceObserver,
@@ -49,13 +50,13 @@ public:
void setJSON(const std::string& data, const std::string& base);
- void setObserver(StyleObserver*);
+ void setObserver(Observer*);
bool isLoaded() const;
// Fetch the tiles needed by the current viewport and emit a signal when
// a tile is ready so observers can render the tile.
- void update(const StyleUpdateParameters&);
+ void update(const UpdateParameters&);
void cascade(const TimePoint&, MapMode);
void recalculate(float z, const TimePoint&, MapMode);
@@ -75,15 +76,15 @@ public:
optional<std::string> beforeLayerID = {});
void removeLayer(const std::string& layerID);
- bool addClass(const std::string&, const PropertyTransition& = {});
- bool removeClass(const std::string&, const PropertyTransition& = {});
+ bool addClass(const std::string&, const TransitionOptions& = {});
+ bool removeClass(const std::string&, const TransitionOptions& = {});
bool hasClass(const std::string&) const;
- void setClasses(const std::vector<std::string>&, const PropertyTransition& = {});
+ void setClasses(const std::vector<std::string>&, const TransitionOptions& = {});
std::vector<std::string> getClasses() const;
RenderData getRenderData() const;
- std::vector<Feature> queryRenderedFeatures(const StyleQueryParameters&) const;
+ std::vector<Feature> queryRenderedFeatures(const QueryParameters&) const;
float getQueryRadius() const;
@@ -103,7 +104,7 @@ private:
std::vector<std::unique_ptr<Source>> sources;
std::vector<std::unique_ptr<Layer>> layers;
std::vector<std::string> classes;
- optional<PropertyTransition> transitionProperties;
+ optional<TransitionOptions> transitionProperties;
std::vector<std::unique_ptr<Layer>>::const_iterator findLayer(const std::string& layerID) const;
@@ -122,7 +123,8 @@ private:
void onTileError(Source&, const OverscaledTileID&, std::exception_ptr) override;
void onPlacementRedone() override;
- StyleObserver* observer = nullptr;
+ Observer nullObserver;
+ Observer* observer = &nullObserver;
std::exception_ptr lastError;
@@ -135,4 +137,5 @@ public:
Worker workers;
};
+} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/style/style_calculation_parameters.hpp b/src/mbgl/style/style_calculation_parameters.hpp
deleted file mode 100644
index 1c50bd6128..0000000000
--- a/src/mbgl/style/style_calculation_parameters.hpp
+++ /dev/null
@@ -1,28 +0,0 @@
-#pragma once
-
-#include <mbgl/style/zoom_history.hpp>
-#include <mbgl/util/chrono.hpp>
-
-namespace mbgl {
-
-class StyleCalculationParameters {
-public:
- explicit StyleCalculationParameters(float z_)
- : z(z_) {}
-
- StyleCalculationParameters(float z_,
- const TimePoint& now_,
- const ZoomHistory& zoomHistory_,
- const Duration& defaultFadeDuration_)
- : z(z_),
- now(now_),
- zoomHistory(zoomHistory_),
- defaultFadeDuration(defaultFadeDuration_) {}
-
- float z;
- TimePoint now;
- ZoomHistory zoomHistory;
- Duration defaultFadeDuration;
-};
-
-} // namespace mbgl
diff --git a/src/mbgl/style/style_cascade_parameters.hpp b/src/mbgl/style/style_cascade_parameters.hpp
deleted file mode 100644
index 569145bd04..0000000000
--- a/src/mbgl/style/style_cascade_parameters.hpp
+++ /dev/null
@@ -1,20 +0,0 @@
-#pragma once
-
-#include <mbgl/map/mode.hpp>
-#include <mbgl/util/chrono.hpp>
-#include <mbgl/style/types.hpp>
-
-#include <vector>
-
-namespace mbgl {
-
-class PropertyTransition;
-
-class StyleCascadeParameters {
-public:
- std::vector<ClassID> classes;
- TimePoint now;
- PropertyTransition transition;
-};
-
-} // namespace mbgl
diff --git a/src/mbgl/style/style_render_parameters.hpp b/src/mbgl/style/style_render_parameters.hpp
deleted file mode 100644
index 7347717a1d..0000000000
--- a/src/mbgl/style/style_render_parameters.hpp
+++ /dev/null
@@ -1,15 +0,0 @@
-#pragma once
-
-namespace mbgl {
-
-class TransformState;
-
-class StyleRenderParameters {
-public:
- StyleRenderParameters(const TransformState& state_)
- : state(state_) {}
-
- const TransformState& state;
-};
-
-}
diff --git a/src/mbgl/style/style_update_parameters.hpp b/src/mbgl/style/update_parameters.hpp
index 73ed500e8e..9faaa32d6f 100644
--- a/src/mbgl/style/style_update_parameters.hpp
+++ b/src/mbgl/style/update_parameters.hpp
@@ -7,13 +7,16 @@ namespace mbgl {
class TransformState;
class Worker;
class FileSource;
-class Style;
namespace gl { class TexturePool; }
class AnnotationManager;
-class StyleUpdateParameters {
+namespace style {
+
+class Style;
+
+class UpdateParameters {
public:
- StyleUpdateParameters(float pixelRatio_,
+ UpdateParameters(float pixelRatio_,
MapDebugOptions debugOptions_,
TimePoint animationTime_,
const TransformState& transformState_,
@@ -51,4 +54,5 @@ public:
Style& style;
};
-}
+} // namespace style
+} // namespace mbgl
diff --git a/src/mbgl/text/glyph_pbf.hpp b/src/mbgl/text/glyph_pbf.hpp
index 08616b268b..85f4b62e6f 100644
--- a/src/mbgl/text/glyph_pbf.hpp
+++ b/src/mbgl/text/glyph_pbf.hpp
@@ -2,7 +2,7 @@
#include <mbgl/text/glyph.hpp>
#include <mbgl/text/glyph_store.hpp>
-#include <mbgl/style/types.hpp>
+#include <mbgl/util/font_stack.hpp>
#include <mbgl/util/noncopyable.hpp>
#include <atomic>
diff --git a/src/mbgl/text/glyph_store.hpp b/src/mbgl/text/glyph_store.hpp
index d614a4947f..edc89b4894 100644
--- a/src/mbgl/text/glyph_store.hpp
+++ b/src/mbgl/text/glyph_store.hpp
@@ -2,7 +2,7 @@
#include <mbgl/text/glyph.hpp>
#include <mbgl/text/glyph_set.hpp>
-#include <mbgl/style/types.hpp>
+#include <mbgl/util/font_stack.hpp>
#include <mbgl/util/exclusive.hpp>
#include <mbgl/util/noncopyable.hpp>
#include <mbgl/util/work_queue.hpp>
diff --git a/src/mbgl/text/glyph_store_observer.hpp b/src/mbgl/text/glyph_store_observer.hpp
index 89650892ea..39f10cd812 100644
--- a/src/mbgl/text/glyph_store_observer.hpp
+++ b/src/mbgl/text/glyph_store_observer.hpp
@@ -2,6 +2,7 @@
#include <mbgl/style/types.hpp>
#include <mbgl/text/glyph_range.hpp>
+#include <mbgl/util/font_stack.hpp>
#include <exception>
diff --git a/src/mbgl/text/quads.cpp b/src/mbgl/text/quads.cpp
index 3cb508a102..ce320791c3 100644
--- a/src/mbgl/text/quads.cpp
+++ b/src/mbgl/text/quads.cpp
@@ -2,13 +2,15 @@
#include <mbgl/text/shaping.hpp>
#include <mbgl/tile/geometry_tile.hpp>
#include <mbgl/geometry/anchor.hpp>
-#include <mbgl/layer/symbol_layer_properties.hpp>
+#include <mbgl/style/layers/symbol_layer_properties.hpp>
#include <mbgl/util/math.hpp>
#include <mbgl/util/constants.hpp>
#include <cassert>
namespace mbgl {
+using namespace style;
+
const float globalMinScale = 0.5f; // underscale by 1 zoom level
SymbolQuads getIconQuads(Anchor& anchor, const PositionedIcon& shapedIcon,
diff --git a/src/mbgl/text/quads.hpp b/src/mbgl/text/quads.hpp
index c68ea2fe6a..0627647f4c 100644
--- a/src/mbgl/text/quads.hpp
+++ b/src/mbgl/text/quads.hpp
@@ -7,39 +7,43 @@
namespace mbgl {
- struct SymbolQuad {
- explicit SymbolQuad(const Point<float> &tl_, const Point<float> &tr_,
- const Point<float> &bl_, const Point<float> &br_,
- const Rect<uint16_t> &tex_, float angle_, const Point<float> &anchorPoint_,
- float minScale_, float maxScale_)
- : tl(tl_),
- tr(tr_),
- bl(bl_),
- br(br_),
- tex(tex_),
- angle(angle_),
- anchorPoint(anchorPoint_),
- minScale(minScale_),
- maxScale(maxScale_) {}
-
- Point<float> tl, tr, bl, br;
- Rect<uint16_t> tex;
- float angle;
- Point<float> anchorPoint;
- float minScale, maxScale;
- };
-
- typedef std::vector<SymbolQuad> SymbolQuads;
-
- struct Anchor;
- class SymbolLayoutProperties;
- class PositionedIcon;
-
- SymbolQuads getIconQuads(Anchor& anchor, const PositionedIcon& shapedIcon,
- const GeometryCoordinates& line, const SymbolLayoutProperties& layout,
- const bool alongLine);
-
- SymbolQuads getGlyphQuads(Anchor& anchor, const Shaping& shapedText,
- const float boxScale, const GeometryCoordinates& line, const SymbolLayoutProperties& layout,
- const bool alongLine, const GlyphPositions& face);
+struct Anchor;
+class PositionedIcon;
+
+namespace style {
+class SymbolLayoutProperties;
+}
+
+struct SymbolQuad {
+ explicit SymbolQuad(const Point<float> &tl_, const Point<float> &tr_,
+ const Point<float> &bl_, const Point<float> &br_,
+ const Rect<uint16_t> &tex_, float angle_, const Point<float> &anchorPoint_,
+ float minScale_, float maxScale_)
+ : tl(tl_),
+ tr(tr_),
+ bl(bl_),
+ br(br_),
+ tex(tex_),
+ angle(angle_),
+ anchorPoint(anchorPoint_),
+ minScale(minScale_),
+ maxScale(maxScale_) {}
+
+ Point<float> tl, tr, bl, br;
+ Rect<uint16_t> tex;
+ float angle;
+ Point<float> anchorPoint;
+ float minScale, maxScale;
+};
+
+typedef std::vector<SymbolQuad> SymbolQuads;
+
+SymbolQuads getIconQuads(Anchor& anchor, const PositionedIcon& shapedIcon,
+ const GeometryCoordinates& line, const style::SymbolLayoutProperties&,
+ const bool alongLine);
+
+SymbolQuads getGlyphQuads(Anchor& anchor, const Shaping& shapedText,
+ const float boxScale, const GeometryCoordinates& line, const style::SymbolLayoutProperties&,
+ const bool alongLine, const GlyphPositions& face);
+
} // namespace mbgl
diff --git a/src/mbgl/text/shaping.cpp b/src/mbgl/text/shaping.cpp
index ce93b4977e..1091cd6e94 100644
--- a/src/mbgl/text/shaping.cpp
+++ b/src/mbgl/text/shaping.cpp
@@ -1,9 +1,9 @@
#include <mbgl/text/shaping.hpp>
-#include <mbgl/layer/symbol_layer_properties.hpp>
+#include <mbgl/style/layers/symbol_layer_properties.hpp>
namespace mbgl {
-PositionedIcon shapeIcon(const SpriteAtlasElement& image, const SymbolLayoutProperties& layout) {
+PositionedIcon shapeIcon(const SpriteAtlasElement& image, const style::SymbolLayoutProperties& layout) {
float dx = layout.iconOffset.value[0];
float dy = layout.iconOffset.value[1];
float x1 = dx - image.spriteImage->getWidth() / 2.0f;
diff --git a/src/mbgl/text/shaping.hpp b/src/mbgl/text/shaping.hpp
index ea169b8dc6..f81230acec 100644
--- a/src/mbgl/text/shaping.hpp
+++ b/src/mbgl/text/shaping.hpp
@@ -7,26 +7,28 @@
namespace mbgl {
- struct SpriteAtlasElement;
+struct SpriteAtlasElement;
- class PositionedIcon {
- public:
- inline explicit PositionedIcon() {}
- inline explicit PositionedIcon(const SpriteAtlasElement& _image,
- float _top, float _bottom, float _left, float _right) :
- image(_image), top(_top), bottom(_bottom), left(_left), right(_right) {}
+namespace style {
+class SymbolLayoutProperties;
+}
- optional<SpriteAtlasElement> image;
- float top = 0;
- float bottom = 0;
- float left = 0;
- float right = 0;
+class PositionedIcon {
+ public:
+ inline explicit PositionedIcon() {}
+ inline explicit PositionedIcon(const SpriteAtlasElement& _image,
+ float _top, float _bottom, float _left, float _right) :
+ image(_image), top(_top), bottom(_bottom), left(_left), right(_right) {}
- operator bool() const { return image && (*image).pos.hasArea(); }
- };
+ optional<SpriteAtlasElement> image;
+ float top = 0;
+ float bottom = 0;
+ float left = 0;
+ float right = 0;
- class SymbolLayoutProperties;
+ operator bool() const { return image && (*image).pos.hasArea(); }
+};
- PositionedIcon shapeIcon(const SpriteAtlasElement& image, const SymbolLayoutProperties&);
+PositionedIcon shapeIcon(const SpriteAtlasElement& image, const style::SymbolLayoutProperties&);
} // namespace mbgl
diff --git a/src/mbgl/tile/raster_tile_data.cpp b/src/mbgl/tile/raster_tile_data.cpp
index a5eab3fb23..420cb7055e 100644
--- a/src/mbgl/tile/raster_tile_data.cpp
+++ b/src/mbgl/tile/raster_tile_data.cpp
@@ -1,5 +1,5 @@
#include <mbgl/tile/raster_tile_data.hpp>
-#include <mbgl/source/source.hpp>
+#include <mbgl/style/source.hpp>
#include <mbgl/storage/resource.hpp>
#include <mbgl/storage/response.hpp>
#include <mbgl/storage/file_source.hpp>
@@ -61,7 +61,7 @@ RasterTileData::~RasterTileData() {
cancel();
}
-Bucket* RasterTileData::getBucket(const Layer&) {
+Bucket* RasterTileData::getBucket(const style::Layer&) {
return bucket.get();
}
diff --git a/src/mbgl/tile/raster_tile_data.hpp b/src/mbgl/tile/raster_tile_data.hpp
index ea9b144e25..62d21d28c4 100644
--- a/src/mbgl/tile/raster_tile_data.hpp
+++ b/src/mbgl/tile/raster_tile_data.hpp
@@ -7,9 +7,13 @@ namespace mbgl {
class FileSource;
class AsyncRequest;
-class Layer;
+
namespace gl { class TexturePool; }
+namespace style {
+class Layer;
+}
+
class RasterTileData : public TileData {
public:
RasterTileData(const OverscaledTileID&,
@@ -22,7 +26,7 @@ public:
~RasterTileData();
void cancel() override;
- Bucket* getBucket(const Layer&) override;
+ Bucket* getBucket(const style::Layer&) override;
private:
gl::TexturePool& texturePool;
diff --git a/src/mbgl/tile/tile_data.hpp b/src/mbgl/tile/tile_data.hpp
index 035a7ed319..5b6583faf8 100644
--- a/src/mbgl/tile/tile_data.hpp
+++ b/src/mbgl/tile/tile_data.hpp
@@ -16,11 +16,14 @@
namespace mbgl {
-class Layer;
class Worker;
class DebugBucket;
class TransformState;
+namespace style {
+class Layer;
+}
+
class TileData : private util::noncopyable {
public:
TileData(const OverscaledTileID&);
@@ -29,7 +32,7 @@ public:
// Mark this tile as no longer needed and cancel any pending work.
virtual void cancel() = 0;
- virtual Bucket* getBucket(const Layer&) = 0;
+ virtual Bucket* getBucket(const style::Layer&) = 0;
virtual bool parsePending(std::function<void (std::exception_ptr)>) { return true; }
virtual void redoPlacement(PlacementConfig, const std::function<void()>&) {}
diff --git a/src/mbgl/tile/tile_worker.cpp b/src/mbgl/tile/tile_worker.cpp
index 9076684a2d..b2283043da 100644
--- a/src/mbgl/tile/tile_worker.cpp
+++ b/src/mbgl/tile/tile_worker.cpp
@@ -1,11 +1,11 @@
#include <mbgl/text/collision_tile.hpp>
#include <mbgl/tile/tile_worker.hpp>
#include <mbgl/tile/geometry_tile.hpp>
-#include <mbgl/style/style_bucket_parameters.hpp>
-#include <mbgl/layer/background_layer.hpp>
-#include <mbgl/layer/custom_layer.hpp>
-#include <mbgl/layer/symbol_layer.hpp>
-#include <mbgl/layer/symbol_layer_impl.hpp>
+#include <mbgl/style/bucket_parameters.hpp>
+#include <mbgl/style/layers/background_layer.hpp>
+#include <mbgl/style/layers/custom_layer.hpp>
+#include <mbgl/style/layers/symbol_layer.hpp>
+#include <mbgl/style/layers/symbol_layer_impl.hpp>
#include <mbgl/sprite/sprite_atlas.hpp>
#include <mbgl/geometry/glyph_atlas.hpp>
#include <mbgl/renderer/symbol_bucket.hpp>
@@ -15,7 +15,9 @@
#include <mbgl/util/exception.hpp>
#include <utility>
-using namespace mbgl;
+namespace mbgl {
+
+using namespace mbgl::style;
TileWorker::TileWorker(const OverscaledTileID& id_,
std::string sourceID_,
@@ -155,7 +157,7 @@ void TileWorker::parseLayer(const Layer* layer) {
return;
}
- StyleBucketParameters parameters(id,
+ BucketParameters parameters(id,
*geometryLayer,
obsolete,
reinterpret_cast<uintptr_t>(this),
@@ -185,3 +187,5 @@ void TileWorker::insertBucket(const std::string& name, std::unique_ptr<Bucket> b
result.buckets.emplace(name, std::move(bucket));
}
}
+
+}
diff --git a/src/mbgl/tile/tile_worker.hpp b/src/mbgl/tile/tile_worker.hpp
index a04ef6a78f..2757c0f9ba 100644
--- a/src/mbgl/tile/tile_worker.hpp
+++ b/src/mbgl/tile/tile_worker.hpp
@@ -23,8 +23,11 @@ class SpriteStore;
class GlyphAtlas;
class GlyphStore;
class Bucket;
+
+namespace style {
class Layer;
class SymbolLayer;
+}
// We're using this class to shuttle the resulting buckets from the worker thread to the MapContext
// thread. This class is movable-only because the vector contains movable-only value elements.
@@ -51,7 +54,7 @@ public:
const MapMode);
~TileWorker();
- TileParseResult parseAllLayers(std::vector<std::unique_ptr<Layer>>,
+ TileParseResult parseAllLayers(std::vector<std::unique_ptr<style::Layer>>,
std::unique_ptr<const GeometryTile> geometryTile,
PlacementConfig);
@@ -62,7 +65,7 @@ public:
private:
TileParseResult prepareResult(const PlacementConfig& config);
- void parseLayer(const Layer*);
+ void parseLayer(const style::Layer*);
void insertBucket(const std::string& name, std::unique_ptr<Bucket>);
std::unique_ptr<CollisionTile> placeLayers(PlacementConfig);
@@ -77,14 +80,14 @@ private:
bool partialParse = false;
- std::vector<std::unique_ptr<Layer>> layers;
+ std::vector<std::unique_ptr<style::Layer>> layers;
std::unique_ptr<FeatureIndex> featureIndex;
std::unique_ptr<const GeometryTile> geometryTile;
// Contains buckets that we couldn't parse so far due to missing resources.
// They will be attempted on subsequent parses.
- std::list<std::pair<const SymbolLayer*, std::unique_ptr<Bucket>>> pending;
+ std::list<std::pair<const style::SymbolLayer*, std::unique_ptr<Bucket>>> pending;
// Contains buckets that have been parsed, but still need placement.
// They will be placed when all buckets have been parsed.
diff --git a/src/mbgl/tile/vector_tile.cpp b/src/mbgl/tile/vector_tile.cpp
index 8a69a82314..5126d0ce83 100644
--- a/src/mbgl/tile/vector_tile.cpp
+++ b/src/mbgl/tile/vector_tile.cpp
@@ -1,5 +1,5 @@
#include <mbgl/tile/vector_tile.hpp>
-#include <mbgl/source/source.hpp>
+#include <mbgl/style/source.hpp>
#include <mbgl/storage/resource.hpp>
#include <mbgl/storage/response.hpp>
#include <mbgl/storage/file_source.hpp>
diff --git a/src/mbgl/tile/vector_tile_data.cpp b/src/mbgl/tile/vector_tile_data.cpp
index db0ec8029e..1ab2566a25 100644
--- a/src/mbgl/tile/vector_tile_data.cpp
+++ b/src/mbgl/tile/vector_tile_data.cpp
@@ -1,6 +1,6 @@
#include <mbgl/tile/vector_tile_data.hpp>
#include <mbgl/tile/geometry_tile.hpp>
-#include <mbgl/layer/layer_impl.hpp>
+#include <mbgl/style/layer_impl.hpp>
#include <mbgl/util/worker.hpp>
#include <mbgl/util/work_request.hpp>
#include <mbgl/style/style.hpp>
@@ -14,7 +14,7 @@ namespace mbgl {
VectorTileData::VectorTileData(const OverscaledTileID& id_,
std::unique_ptr<GeometryTileMonitor> monitor_,
std::string sourceID,
- Style& style_,
+ style::Style& style_,
const MapMode mode_,
const std::function<void(std::exception_ptr)>& callback)
: TileData(id_),
@@ -139,7 +139,7 @@ bool VectorTileData::parsePending(std::function<void(std::exception_ptr)> callba
return true;
}
-Bucket* VectorTileData::getBucket(const Layer& layer) {
+Bucket* VectorTileData::getBucket(const style::Layer& layer) {
const auto it = buckets.find(layer.baseImpl->bucketName());
if (it == buckets.end()) {
return nullptr;
diff --git a/src/mbgl/tile/vector_tile_data.hpp b/src/mbgl/tile/vector_tile_data.hpp
index 4695338e1e..e7de39e038 100644
--- a/src/mbgl/tile/vector_tile_data.hpp
+++ b/src/mbgl/tile/vector_tile_data.hpp
@@ -11,23 +11,26 @@
namespace mbgl {
-class Style;
class AsyncRequest;
class GeometryTileMonitor;
class FeatureIndex;
+namespace style {
+class Style;
+}
+
class VectorTileData : public TileData {
public:
VectorTileData(const OverscaledTileID&,
std::unique_ptr<GeometryTileMonitor> monitor,
std::string sourceID,
- Style&,
+ style::Style&,
const MapMode,
const std::function<void(std::exception_ptr)>& callback);
~VectorTileData();
- Bucket* getBucket(const Layer&) override;
+ Bucket* getBucket(const style::Layer&) override;
bool parsePending(std::function<void(std::exception_ptr)> callback) override;
@@ -43,7 +46,7 @@ public:
void cancel() override;
private:
- Style& style;
+ style::Style& style;
Worker& worker;
TileWorker tileWorker;
diff --git a/src/mbgl/style/types.cpp b/src/mbgl/util/font_stack.cpp
index 27574afa93..fb3b1b60a2 100644
--- a/src/mbgl/style/types.cpp
+++ b/src/mbgl/util/font_stack.cpp
@@ -1,4 +1,4 @@
-#include <mbgl/style/types.hpp>
+#include <mbgl/util/font_stack.hpp>
#include <boost/functional/hash.hpp>
#include <boost/algorithm/string/join.hpp>
diff --git a/src/mbgl/source/source_info.hpp b/src/mbgl/util/tileset.hpp
index dc79695dc9..972fc51f8c 100644
--- a/src/mbgl/source/source_info.hpp
+++ b/src/mbgl/util/tileset.hpp
@@ -1,6 +1,5 @@
#pragma once
-#include <mbgl/style/types.hpp>
#include <mbgl/util/constants.hpp>
#include <mbgl/util/geo.hpp>
@@ -11,9 +10,7 @@
namespace mbgl {
-class TileID;
-
-class SourceInfo {
+class Tileset {
public:
std::vector<std::string> tiles;
uint8_t minZoom = 0;
diff --git a/src/mbgl/util/worker.cpp b/src/mbgl/util/worker.cpp
index 43abe6792a..2bc545c704 100644
--- a/src/mbgl/util/worker.cpp
+++ b/src/mbgl/util/worker.cpp
@@ -30,7 +30,7 @@ public:
}
void parseGeometryTile(TileWorker* worker,
- std::vector<std::unique_ptr<Layer>> layers,
+ std::vector<std::unique_ptr<style::Layer>> layers,
std::unique_ptr<GeometryTile> tile,
PlacementConfig config,
std::function<void(TileParseResult)> callback) {
@@ -79,7 +79,7 @@ Worker::parseRasterTile(std::unique_ptr<RasterBucket> bucket,
std::unique_ptr<AsyncRequest>
Worker::parseGeometryTile(TileWorker& worker,
- std::vector<std::unique_ptr<Layer>> layers,
+ std::vector<std::unique_ptr<style::Layer>> layers,
std::unique_ptr<GeometryTile> tile,
PlacementConfig config,
std::function<void(TileParseResult)> callback) {
diff --git a/src/mbgl/util/worker.hpp b/src/mbgl/util/worker.hpp
index 68625f42bf..678dfaedb3 100644
--- a/src/mbgl/util/worker.hpp
+++ b/src/mbgl/util/worker.hpp
@@ -40,7 +40,7 @@ public:
std::function<void(RasterTileParseResult)> callback);
Request parseGeometryTile(TileWorker&,
- std::vector<std::unique_ptr<Layer>>,
+ std::vector<std::unique_ptr<style::Layer>>,
std::unique_ptr<GeometryTile>,
PlacementConfig,
std::function<void(TileParseResult)> callback);