summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2015-10-19 13:19:52 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2015-10-22 09:21:30 -0700
commitdf89de5cc5bf043ca2fe57ef4dd9a7b5d25464cb (patch)
treeecac13b203cd45451aeff565cb11b179a5ef84d6
parent83d39364f9de987d7840900db2e01673bc1ed6ef (diff)
downloadqtlocation-mapboxgl-df89de5cc5bf043ca2fe57ef4dd9a7b5d25464cb.tar.gz
[core] Rationalize style property classes: <type>{Paint,Layout}Properties
-rw-r--r--android/cpp/jni.cpp8
-rw-r--r--include/mbgl/style/style_properties.hpp124
-rw-r--r--platform/default/glfw_view.cpp4
-rw-r--r--platform/ios/MGLMapView.mm8
-rw-r--r--src/mbgl/annotation/shape_annotation_impl.cpp14
-rw-r--r--src/mbgl/map/raster_tile_data.hpp4
-rw-r--r--src/mbgl/renderer/circle_bucket.hpp2
-rw-r--r--src/mbgl/renderer/fill_bucket.cpp2
-rw-r--r--src/mbgl/renderer/line_bucket.cpp2
-rw-r--r--src/mbgl/renderer/line_bucket.hpp4
-rw-r--r--src/mbgl/renderer/painter.cpp6
-rw-r--r--src/mbgl/renderer/painter_circle.cpp4
-rw-r--r--src/mbgl/renderer/painter_fill.cpp4
-rw-r--r--src/mbgl/renderer/painter_line.cpp6
-rw-r--r--src/mbgl/renderer/painter_raster.cpp2
-rw-r--r--src/mbgl/renderer/painter_symbol.cpp6
-rw-r--r--src/mbgl/renderer/raster_bucket.cpp2
-rw-r--r--src/mbgl/renderer/raster_bucket.hpp6
-rw-r--r--src/mbgl/renderer/symbol_bucket.cpp10
-rw-r--r--src/mbgl/renderer/symbol_bucket.hpp12
-rw-r--r--src/mbgl/style/property_fallback.cpp154
-rw-r--r--src/mbgl/style/style_layer.cpp62
-rw-r--r--src/mbgl/style/style_layer.hpp8
-rw-r--r--src/mbgl/style/style_layout.cpp11
-rw-r--r--src/mbgl/style/style_layout.hpp110
-rw-r--r--src/mbgl/style/style_properties.cpp8
-rw-r--r--src/mbgl/text/quads.cpp12
-rw-r--r--src/mbgl/text/quads.hpp12
-rw-r--r--src/mbgl/text/shaping.cpp4
-rw-r--r--src/mbgl/text/shaping.hpp4
-rw-r--r--test/api/annotations.cpp16
31 files changed, 279 insertions, 352 deletions
diff --git a/android/cpp/jni.cpp b/android/cpp/jni.cpp
index ac9256bb7e..ae1066f38f 100644
--- a/android/cpp/jni.cpp
+++ b/android/cpp/jni.cpp
@@ -356,11 +356,11 @@ std::pair<mbgl::AnnotationSegment, mbgl::StyleProperties> annotation_std_pair_fr
int aS = (strokeColor >> 24) & 0xFF;
mbgl::StyleProperties shapeProperties;
- mbgl::FillProperties fillProperties;
+ mbgl::FillPaintProperties fillProperties;
fillProperties.opacity = alpha;
fillProperties.stroke_color = {{ static_cast<float>(rS) / 255.0f, static_cast<float>(gS) / 255.0f, static_cast<float>(bS) / 255.0f, static_cast<float>(aS) / 255.0f }};
fillProperties.fill_color = {{ static_cast<float>(rF) / 255.0f, static_cast<float>(gF) / 255.0f, static_cast<float>(bF) / 255.0f, static_cast<float>(aF) / 255.0f }};
- shapeProperties.set<mbgl::FillProperties>(fillProperties);
+ shapeProperties.set<mbgl::FillPaintProperties>(fillProperties);
jobject points = env->GetObjectField(polygon, polygonPointsId);
mbgl::AnnotationSegment segment = annotation_segment_from_latlng_jlist(env, points);
@@ -940,11 +940,11 @@ jlong JNICALL nativeAddPolyline(JNIEnv *env, jobject obj, jlong nativeMapViewPtr
}
mbgl::StyleProperties shapeProperties;
- mbgl::LineProperties lineProperties;
+ mbgl::LinePaintProperties lineProperties;
lineProperties.opacity = alpha;
lineProperties.color = {{ static_cast<float>(r) / 255.0f, static_cast<float>(g) / 255.0f, static_cast<float>(b) / 255.0f, static_cast<float>(a) / 255.0f }};
lineProperties.width = width;
- shapeProperties.set<mbgl::LineProperties>(lineProperties);
+ shapeProperties.set<mbgl::LinePaintProperties>(lineProperties);
jobject points = env->GetObjectField(polyline, polylinePointsId);
mbgl::AnnotationSegment segment = annotation_segment_from_latlng_jlist(env, points);
diff --git a/include/mbgl/style/style_properties.hpp b/include/mbgl/style/style_properties.hpp
index c0ecc35201..aacac3387b 100644
--- a/include/mbgl/style/style_properties.hpp
+++ b/include/mbgl/style/style_properties.hpp
@@ -13,8 +13,8 @@
namespace mbgl {
-struct FillProperties {
- FillProperties() {}
+class FillPaintProperties {
+public:
bool antialias = true;
float opacity = 1.0f;
Color fill_color = {{ 0, 0, 0, 1 }};
@@ -28,8 +28,12 @@ struct FillProperties {
}
};
-struct LineProperties {
- inline LineProperties() {}
+class FillLayoutProperties {
+public:
+};
+
+class LinePaintProperties {
+public:
float opacity = 1.0f;
Color color = {{ 0, 0, 0, 1 }};
std::array<float, 2> translate = {{ 0, 0 }};
@@ -46,23 +50,16 @@ struct LineProperties {
}
};
-struct CircleProperties {
- inline CircleProperties() {}
- float radius = 5.0f;
- Color color = {{ 0, 0, 0, 1 }};
- float opacity = 1.0f;
- std::array<float, 2> translate = {{ 0, 0 }};
- TranslateAnchorType translateAnchor = TranslateAnchorType::Map;
- float blur = 0;
-
- inline bool isVisible() const {
- return radius > 0 && color[3] > 0 && opacity > 0;
- }
+class LineLayoutProperties {
+public:
+ CapType cap = CapType::Butt;
+ JoinType join = JoinType::Miter;
+ float miter_limit = 2.0f;
+ float round_limit = 1.0f;
};
-struct SymbolProperties {
- inline SymbolProperties() {}
-
+class SymbolPaintProperties {
+public:
struct {
float opacity = 1.0f;
float size = 1.0f;
@@ -91,8 +88,66 @@ struct SymbolProperties {
}
};
-struct RasterProperties {
- inline RasterProperties() {}
+class SymbolLayoutProperties {
+public:
+ PlacementType placement = PlacementType::Point;
+ float spacing = 250.0f;
+ bool avoid_edges = false;
+
+ struct {
+ bool allow_overlap = false;
+ bool ignore_placement = false;
+ bool optional = false;
+ RotationAlignmentType rotation_alignment = RotationAlignmentType::Viewport;
+ float size = 1.0f;
+ float max_size = 1.0f;
+ std::string image;
+ float rotate = 0.0f;
+ float padding = 2.0f;
+ bool keep_upright = false;
+ std::array<float, 2> offset = {{ 0, 0 }};
+ } icon;
+
+ struct {
+ RotationAlignmentType rotation_alignment = RotationAlignmentType::Viewport;
+ std::string field;
+ std::string font = "Open Sans Regular, Arial Unicode MS Regular";
+ float size = 16.0f;
+ float max_size = 16.0f;
+ float max_width = 15.0f /* em */;
+ float line_height = 1.2f /* em */;
+ float letter_spacing = 0.0f /* em */;
+ TextJustifyType justify = TextJustifyType::Center;
+ TextAnchorType anchor = TextAnchorType::Center;
+ float max_angle = 45.0f /* degrees */;
+ float rotate = 0.0f;
+ float padding = 2.0f;
+ bool keep_upright = true;
+ TextTransformType transform = TextTransformType::None;
+ std::array<float, 2> offset = {{ 0, 0 }};
+ bool allow_overlap = false;
+ bool ignore_placement = false;
+ bool optional = false;
+ } text;
+};
+
+
+class CirclePaintProperties {
+public:
+ float radius = 5.0f;
+ Color color = {{ 0, 0, 0, 1 }};
+ float opacity = 1.0f;
+ std::array<float, 2> translate = {{ 0, 0 }};
+ TranslateAnchorType translateAnchor = TranslateAnchorType::Map;
+ float blur = 0;
+
+ inline bool isVisible() const {
+ return radius > 0 && color[3] > 0 && opacity > 0;
+ }
+};
+
+class RasterPaintProperties {
+public:
float opacity = 1.0f;
float hue_rotate = 0.0f;
std::array<float, 2> brightness = {{ 0, 1 }};
@@ -105,26 +160,31 @@ struct RasterProperties {
}
};
-struct BackgroundProperties {
- inline BackgroundProperties() {}
+class RasterLayoutProperties {
+public:
+};
+
+class BackgroundPaintProperties {
+public:
float opacity = 1.0f;
Color color = {{ 0, 0, 0, 1 }};
Faded<std::string> image;
};
+class BackgroundLayoutProperties {
+public:
+};
+
typedef mapbox::util::variant<
- FillProperties,
- LineProperties,
- CircleProperties,
- SymbolProperties,
- RasterProperties,
- BackgroundProperties,
+ FillPaintProperties,
+ LinePaintProperties,
+ CirclePaintProperties,
+ SymbolPaintProperties,
+ RasterPaintProperties,
+ BackgroundPaintProperties,
std::false_type
> StyleProperties;
-template <typename T>
-const T &defaultStyleProperties();
-
}
#endif
diff --git a/platform/default/glfw_view.cpp b/platform/default/glfw_view.cpp
index cf7bb01213..78461462d1 100644
--- a/platform/default/glfw_view.cpp
+++ b/platform/default/glfw_view.cpp
@@ -223,11 +223,11 @@ void GLFWView::addRandomPointAnnotations(int count) {
void GLFWView::addRandomShapeAnnotations(int count) {
std::vector<mbgl::ShapeAnnotation> shapes;
- mbgl::FillProperties fillProperties;
+ mbgl::FillPaintProperties fillProperties;
fillProperties.opacity = .1;
mbgl::StyleProperties properties;
- properties.set<mbgl::FillProperties>(fillProperties);
+ properties.set<mbgl::FillPaintProperties>(fillProperties);
for (int i = 0; i < count; i++) {
mbgl::AnnotationSegment triangle;
diff --git a/platform/ios/MGLMapView.mm b/platform/ios/MGLMapView.mm
index ae9411dfc1..4165cd3974 100644
--- a/platform/ios/MGLMapView.mm
+++ b/platform/ios/MGLMapView.mm
@@ -2175,11 +2175,11 @@ CLLocationCoordinate2D MGLLocationCoordinate2DFromLatLng(mbgl::LatLng latLng)
[self.delegate mapView:self lineWidthForPolylineAnnotation:(MGLPolyline *)annotation] :
3.0);
- mbgl::LineProperties lineProperties;
+ mbgl::LinePaintProperties lineProperties;
lineProperties.opacity = alpha;
lineProperties.color = strokeNativeColor;
lineProperties.width = lineWidth;
- shapeProperties.set<mbgl::LineProperties>(lineProperties);
+ shapeProperties.set<mbgl::LinePaintProperties>(lineProperties);
}
else if ([annotation isKindOfClass:[MGLPolygon class]])
@@ -2193,11 +2193,11 @@ CLLocationCoordinate2D MGLLocationCoordinate2DFromLatLng(mbgl::LatLng latLng)
[fillColor getRed:&r green:&g blue:&b alpha:&a];
mbgl::Color fillNativeColor({{ (float)r, (float)g, (float)b, (float)a }});
- mbgl::FillProperties fillProperties;
+ mbgl::FillPaintProperties fillProperties;
fillProperties.opacity = alpha;
fillProperties.stroke_color = strokeNativeColor;
fillProperties.fill_color = fillNativeColor;
- shapeProperties.set<mbgl::FillProperties>(fillProperties);
+ shapeProperties.set<mbgl::FillPaintProperties>(fillProperties);
}
else
{
diff --git a/src/mbgl/annotation/shape_annotation_impl.cpp b/src/mbgl/annotation/shape_annotation_impl.cpp
index e17509d669..74daf849ec 100644
--- a/src/mbgl/annotation/shape_annotation_impl.cpp
+++ b/src/mbgl/annotation/shape_annotation_impl.cpp
@@ -33,7 +33,7 @@ ShapeAnnotationImpl::ShapeAnnotationImpl(const AnnotationID id_,
ProjectedFeatureType featureType;
- if (shape.styleProperties.is<FillProperties>()) {
+ if (shape.styleProperties.is<FillPaintProperties>()) {
featureType = ProjectedFeatureType::Polygon;
if (points.front().lon != points.back().lon || points.front().lat != points.back().lat) {
@@ -57,13 +57,13 @@ void ShapeAnnotationImpl::updateStyle(Style& style) {
ClassProperties paintProperties;
- if (shape.styleProperties.is<LineProperties>()) {
- const LineProperties& lineProperties = shape.styleProperties.get<LineProperties>();
+ if (shape.styleProperties.is<LinePaintProperties>()) {
+ const LinePaintProperties& lineProperties = shape.styleProperties.get<LinePaintProperties>();
paintProperties.set(PropertyKey::LineOpacity, ConstantFunction<float>(lineProperties.opacity));
paintProperties.set(PropertyKey::LineWidth, ConstantFunction<float>(lineProperties.width));
paintProperties.set(PropertyKey::LineColor, ConstantFunction<Color>(lineProperties.color));
- } else if (shape.styleProperties.is<FillProperties>()) {
- const FillProperties& fillProperties = shape.styleProperties.get<FillProperties>();
+ } else if (shape.styleProperties.is<FillPaintProperties>()) {
+ const FillPaintProperties& fillProperties = shape.styleProperties.get<FillPaintProperties>();
paintProperties.set(PropertyKey::FillOpacity, ConstantFunction<float>(fillProperties.opacity));
paintProperties.set(PropertyKey::FillColor, ConstantFunction<Color>(fillProperties.fill_color));
paintProperties.set(PropertyKey::FillOutlineColor, ConstantFunction<Color>(fillProperties.stroke_color));
@@ -72,13 +72,13 @@ void ShapeAnnotationImpl::updateStyle(Style& style) {
std::map<ClassID, ClassProperties> shapePaints;
shapePaints.emplace(ClassID::Default, std::move(paintProperties));
std::unique_ptr<StyleLayer> shapeLayer = std::make_unique<StyleLayer>(layerID, std::move(shapePaints));
- shapeLayer->type = (shape.styleProperties.is<LineProperties>() ? StyleLayerType::Line : StyleLayerType::Fill);
+ shapeLayer->type = (shape.styleProperties.is<LinePaintProperties>() ? StyleLayerType::Line : StyleLayerType::Fill);
util::ptr<StyleBucket> shapeBucket = std::make_shared<StyleBucket>(shapeLayer->type);
shapeBucket->name = shapeLayer->id;
shapeBucket->source = AnnotationManager::SourceID;
shapeBucket->source_layer = shapeLayer->id;
- if (shape.styleProperties.is<LineProperties>()) {
+ if (shape.styleProperties.is<LinePaintProperties>()) {
shapeBucket->layout.set(PropertyKey::LineJoin, ConstantFunction<JoinType>(JoinType::Round));
}
diff --git a/src/mbgl/map/raster_tile_data.hpp b/src/mbgl/map/raster_tile_data.hpp
index 93d018bced..f5711e506a 100644
--- a/src/mbgl/map/raster_tile_data.hpp
+++ b/src/mbgl/map/raster_tile_data.hpp
@@ -2,7 +2,7 @@
#define MBGL_MAP_RASTER_TILE_DATA
#include <mbgl/map/tile_data.hpp>
-#include <mbgl/style/style_layout.hpp>
+#include <mbgl/style/style_properties.hpp>
#include <mbgl/renderer/raster_bucket.hpp>
namespace mbgl {
@@ -30,7 +30,7 @@ private:
Worker& worker;
Request* req = nullptr;
- StyleLayoutRaster layout;
+ RasterLayoutProperties layout;
RasterBucket bucket;
std::unique_ptr<WorkRequest> workRequest;
diff --git a/src/mbgl/renderer/circle_bucket.hpp b/src/mbgl/renderer/circle_bucket.hpp
index d7908cf02e..a83d158cb2 100644
--- a/src/mbgl/renderer/circle_bucket.hpp
+++ b/src/mbgl/renderer/circle_bucket.hpp
@@ -9,7 +9,7 @@
#include <mbgl/geometry/circle_buffer.hpp>
#include <mbgl/style/style_bucket.hpp>
-#include <mbgl/style/style_layout.hpp>
+#include <mbgl/style/style_properties.hpp>
namespace mbgl {
diff --git a/src/mbgl/renderer/fill_bucket.cpp b/src/mbgl/renderer/fill_bucket.cpp
index 0fbb02e7c1..38582c0123 100644
--- a/src/mbgl/renderer/fill_bucket.cpp
+++ b/src/mbgl/renderer/fill_bucket.cpp
@@ -3,7 +3,7 @@
#include <mbgl/geometry/elements_buffer.hpp>
#include <mbgl/renderer/painter.hpp>
#include <mbgl/style/style.hpp>
-#include <mbgl/style/style_layout.hpp>
+#include <mbgl/style/style_properties.hpp>
#include <mbgl/shader/plain_shader.hpp>
#include <mbgl/shader/pattern_shader.hpp>
#include <mbgl/shader/outline_shader.hpp>
diff --git a/src/mbgl/renderer/line_bucket.cpp b/src/mbgl/renderer/line_bucket.cpp
index 8824b6fed9..d2d7650d70 100644
--- a/src/mbgl/renderer/line_bucket.cpp
+++ b/src/mbgl/renderer/line_bucket.cpp
@@ -3,7 +3,7 @@
#include <mbgl/geometry/elements_buffer.hpp>
#include <mbgl/renderer/painter.hpp>
#include <mbgl/style/style.hpp>
-#include <mbgl/style/style_layout.hpp>
+#include <mbgl/style/style_properties.hpp>
#include <mbgl/shader/line_shader.hpp>
#include <mbgl/shader/linesdf_shader.hpp>
#include <mbgl/shader/linepattern_shader.hpp>
diff --git a/src/mbgl/renderer/line_bucket.hpp b/src/mbgl/renderer/line_bucket.hpp
index ce93cb76f9..2e220829b0 100644
--- a/src/mbgl/renderer/line_bucket.hpp
+++ b/src/mbgl/renderer/line_bucket.hpp
@@ -7,7 +7,7 @@
#include <mbgl/geometry/elements_buffer.hpp>
#include <mbgl/geometry/line_buffer.hpp>
#include <mbgl/style/style_bucket.hpp>
-#include <mbgl/style/style_layout.hpp>
+#include <mbgl/style/style_properties.hpp>
#include <mbgl/util/vec.hpp>
#include <vector>
@@ -52,7 +52,7 @@ private:
std::vector<TriangleElement>& triangleStore);
public:
- StyleLayoutLine layout;
+ LineLayoutProperties layout;
private:
LineVertexBuffer vertexBuffer;
diff --git a/src/mbgl/renderer/painter.cpp b/src/mbgl/renderer/painter.cpp
index 5670c4098e..d5dfed4421 100644
--- a/src/mbgl/renderer/painter.cpp
+++ b/src/mbgl/renderer/painter.cpp
@@ -303,8 +303,8 @@ std::vector<RenderItem> Painter::determineRenderOrder(const Style& style) {
if (layer.bucket->visibility == VisibilityType::None) continue;
if (layer.type == StyleLayerType::Background) {
// This layer defines a background color/image.
- if (layer.properties.is<BackgroundProperties>()) {
- auto &props = layer.properties.get<BackgroundProperties>();
+ if (layer.properties.is<BackgroundPaintProperties>()) {
+ auto& props = layer.properties.get<BackgroundPaintProperties>();
if (props.image.from.empty()) {
// This is a solid background. We can use glClear().
background = props.color;
@@ -381,7 +381,7 @@ std::vector<RenderItem> Painter::determineRenderOrder(const Style& style) {
void Painter::renderBackground(const StyleLayer &layer_desc) {
// Note: This function is only called for textured background. Otherwise, the background color
// is created with glClear.
- const BackgroundProperties& properties = layer_desc.getProperties<BackgroundProperties>();
+ const BackgroundPaintProperties& properties = layer_desc.getProperties<BackgroundPaintProperties>();
if (!properties.image.to.empty()) {
if ((properties.opacity >= 1.0f) != (pass == RenderPass::Opaque))
diff --git a/src/mbgl/renderer/painter_circle.cpp b/src/mbgl/renderer/painter_circle.cpp
index 538ba9e6ab..a7aa6ac455 100644
--- a/src/mbgl/renderer/painter_circle.cpp
+++ b/src/mbgl/renderer/painter_circle.cpp
@@ -3,7 +3,7 @@
#include <mbgl/style/style.hpp>
#include <mbgl/style/style_layer.hpp>
-#include <mbgl/style/style_layout.hpp>
+#include <mbgl/style/style_properties.hpp>
#include <mbgl/map/sprite.hpp>
#include <mbgl/map/tile_id.hpp>
@@ -22,7 +22,7 @@ void Painter::renderCircle(CircleBucket& bucket,
config.stencilTest = false;
- const CircleProperties& properties = layer_desc.getProperties<CircleProperties>();
+ const CirclePaintProperties& properties = layer_desc.getProperties<CirclePaintProperties>();
mat4 vtxMatrix = translatedMatrix(matrix, properties.translate, id, properties.translateAnchor);
Color color = properties.color;
diff --git a/src/mbgl/renderer/painter_fill.cpp b/src/mbgl/renderer/painter_fill.cpp
index d27feb4693..33fc14a0dc 100644
--- a/src/mbgl/renderer/painter_fill.cpp
+++ b/src/mbgl/renderer/painter_fill.cpp
@@ -2,7 +2,7 @@
#include <mbgl/renderer/fill_bucket.hpp>
#include <mbgl/style/style.hpp>
#include <mbgl/style/style_layer.hpp>
-#include <mbgl/style/style_layout.hpp>
+#include <mbgl/style/style_properties.hpp>
#include <mbgl/map/sprite.hpp>
#include <mbgl/map/tile_id.hpp>
#include <mbgl/geometry/sprite_atlas.hpp>
@@ -14,7 +14,7 @@
using namespace mbgl;
void Painter::renderFill(FillBucket& bucket, const StyleLayer &layer_desc, const TileID& id, const mat4 &matrix) {
- const FillProperties &properties = layer_desc.getProperties<FillProperties>();
+ const FillPaintProperties& properties = layer_desc.getProperties<FillPaintProperties>();
mat4 vtxMatrix = translatedMatrix(matrix, properties.translate, id, properties.translateAnchor);
Color fill_color = properties.fill_color;
diff --git a/src/mbgl/renderer/painter_line.cpp b/src/mbgl/renderer/painter_line.cpp
index 258bab6aef..fdbe690f72 100644
--- a/src/mbgl/renderer/painter_line.cpp
+++ b/src/mbgl/renderer/painter_line.cpp
@@ -2,7 +2,7 @@
#include <mbgl/renderer/line_bucket.hpp>
#include <mbgl/style/style.hpp>
#include <mbgl/style/style_layer.hpp>
-#include <mbgl/style/style_layout.hpp>
+#include <mbgl/style/style_properties.hpp>
#include <mbgl/map/sprite.hpp>
#include <mbgl/map/tile_id.hpp>
#include <mbgl/map/map_data.hpp>
@@ -23,8 +23,8 @@ void Painter::renderLine(LineBucket& bucket, const StyleLayer &layer_desc, const
config.depthTest = true;
config.depthMask = GL_FALSE;
- const auto &properties = layer_desc.getProperties<LineProperties>();
- const auto &layout = bucket.layout;
+ const auto& properties = layer_desc.getProperties<LinePaintProperties>();
+ const auto& layout = bucket.layout;
// the distance over which the line edge fades out.
// Retina devices need a smaller distance to avoid aliasing.
diff --git a/src/mbgl/renderer/painter_raster.cpp b/src/mbgl/renderer/painter_raster.cpp
index 70cbcb4ca5..f052563187 100644
--- a/src/mbgl/renderer/painter_raster.cpp
+++ b/src/mbgl/renderer/painter_raster.cpp
@@ -9,7 +9,7 @@ using namespace mbgl;
void Painter::renderRaster(RasterBucket& bucket, const StyleLayer &layer_desc, const TileID&, const mat4 &matrix) {
if (pass != RenderPass::Translucent) return;
- const RasterProperties &properties = layer_desc.getProperties<RasterProperties>();
+ const RasterPaintProperties& properties = layer_desc.getProperties<RasterPaintProperties>();
if (bucket.hasData()) {
useProgram(rasterShader->program);
diff --git a/src/mbgl/renderer/painter_symbol.cpp b/src/mbgl/renderer/painter_symbol.cpp
index c6ea372398..f1ebef3989 100644
--- a/src/mbgl/renderer/painter_symbol.cpp
+++ b/src/mbgl/renderer/painter_symbol.cpp
@@ -1,7 +1,7 @@
#include <mbgl/renderer/painter.hpp>
#include <mbgl/renderer/symbol_bucket.hpp>
#include <mbgl/style/style_layer.hpp>
-#include <mbgl/style/style_layout.hpp>
+#include <mbgl/style/style_properties.hpp>
#include <mbgl/geometry/glyph_atlas.hpp>
#include <mbgl/geometry/sprite_atlas.hpp>
#include <mbgl/shader/sdf_shader.hpp>
@@ -132,8 +132,8 @@ void Painter::renderSymbol(SymbolBucket &bucket, const StyleLayer &layer_desc, c
return;
}
- const auto &properties = layer_desc.getProperties<SymbolProperties>();
- const auto &layout = bucket.layout;
+ const auto& properties = layer_desc.getProperties<SymbolPaintProperties>();
+ const auto& layout = bucket.layout;
config.depthMask = GL_FALSE;
diff --git a/src/mbgl/renderer/raster_bucket.cpp b/src/mbgl/renderer/raster_bucket.cpp
index cf72f860a7..9f28dfd324 100644
--- a/src/mbgl/renderer/raster_bucket.cpp
+++ b/src/mbgl/renderer/raster_bucket.cpp
@@ -4,7 +4,7 @@
using namespace mbgl;
-RasterBucket::RasterBucket(TexturePool& texturePool, const StyleLayoutRaster& layout_)
+RasterBucket::RasterBucket(TexturePool& texturePool, const RasterLayoutProperties& layout_)
: layout(layout_),
raster(texturePool) {
}
diff --git a/src/mbgl/renderer/raster_bucket.hpp b/src/mbgl/renderer/raster_bucket.hpp
index 3c8730e61e..a20828102d 100644
--- a/src/mbgl/renderer/raster_bucket.hpp
+++ b/src/mbgl/renderer/raster_bucket.hpp
@@ -7,14 +7,14 @@
namespace mbgl {
-class StyleLayoutRaster;
+class RasterLayoutProperties;
class RasterShader;
class StaticVertexBuffer;
class VertexArrayObject;
class RasterBucket : public Bucket {
public:
- RasterBucket(TexturePool&, const StyleLayoutRaster&);
+ RasterBucket(TexturePool&, const RasterLayoutProperties&);
void upload() override;
void render(Painter&, const StyleLayer&, const TileID&, const mat4&) override;
@@ -22,7 +22,7 @@ public:
bool setImage(std::unique_ptr<util::Image> image);
- const StyleLayoutRaster &layout;
+ const RasterLayoutProperties& layout;
void drawRaster(RasterShader& shader, StaticVertexBuffer &vertices, VertexArrayObject &array);
diff --git a/src/mbgl/renderer/symbol_bucket.cpp b/src/mbgl/renderer/symbol_bucket.cpp
index dabffa14ff..a56a926b77 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/map/geometry_tile.hpp>
-#include <mbgl/style/style_layout.hpp>
+#include <mbgl/style/style_properties.hpp>
#include <mbgl/annotation/sprite_image.hpp>
#include <mbgl/geometry/text_buffer.hpp>
#include <mbgl/geometry/icon_buffer.hpp>
@@ -27,12 +27,12 @@
namespace mbgl {
-SymbolInstance::SymbolInstance(Anchor &anchor, const std::vector<Coordinate> &line,
- const Shaping &shapedText, const PositionedIcon &shapedIcon,
- const StyleLayoutSymbol &layout, const bool addToBuffers,
+SymbolInstance::SymbolInstance(Anchor& anchor, const std::vector<Coordinate>& line,
+ const Shaping& shapedText, const PositionedIcon& shapedIcon,
+ const SymbolLayoutProperties& layout, const bool addToBuffers,
const float textBoxScale, const float textPadding, const float textAlongLine,
const float iconBoxScale, const float iconPadding, const float iconAlongLine,
- const GlyphPositions &face) :
+ const GlyphPositions& face) :
x(anchor.x),
y(anchor.y),
hasText(shapedText),
diff --git a/src/mbgl/renderer/symbol_bucket.hpp b/src/mbgl/renderer/symbol_bucket.hpp
index c8264bc438..c3c39627cf 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/style_bucket.hpp>
-#include <mbgl/style/style_layout.hpp>
+#include <mbgl/style/style_properties.hpp>
#include <memory>
#include <map>
@@ -42,12 +42,12 @@ struct Anchor;
class SymbolInstance {
public:
- explicit SymbolInstance(Anchor &anchor, const std::vector<Coordinate> &line,
- const Shaping &shapedText, const PositionedIcon &shapedIcon,
- const StyleLayoutSymbol &layout, const bool inside,
+ explicit SymbolInstance(Anchor& anchor, const std::vector<Coordinate>& line,
+ const Shaping& shapedText, const PositionedIcon& shapedIcon,
+ const SymbolLayoutProperties& layout, const bool inside,
const float textBoxScale, const float textPadding, const float textAlongLine,
const float iconBoxScale, const float iconPadding, const float iconAlongLine,
- const GlyphPositions &face);
+ const GlyphPositions& face);
float x;
float y;
bool hasText;
@@ -109,7 +109,7 @@ private:
const bool keepUpright, const bool alongLine, const float placementAngle);
public:
- StyleLayoutSymbol layout;
+ SymbolLayoutProperties layout;
bool sdfIcons = false;
private:
diff --git a/src/mbgl/style/property_fallback.cpp b/src/mbgl/style/property_fallback.cpp
index 0c4a01ef4f..4b60b7939b 100644
--- a/src/mbgl/style/property_fallback.cpp
+++ b/src/mbgl/style/property_fallback.cpp
@@ -1,98 +1,98 @@
#include <mbgl/style/property_fallback.hpp>
#include <mbgl/style/style_properties.hpp>
#include <mbgl/style/style_bucket.hpp>
-#include <mbgl/style/style_layout.hpp>
+#include <mbgl/style/style_properties.hpp>
namespace mbgl {
const std::map<PropertyKey, PropertyValue> PropertyFallbackValue::properties = {
- { PropertyKey::FillAntialias, defaultStyleProperties<FillProperties>().antialias },
- { PropertyKey::FillOpacity, defaultStyleProperties<FillProperties>().opacity },
- { PropertyKey::FillColor, defaultStyleProperties<FillProperties>().fill_color },
+ { PropertyKey::FillAntialias, FillPaintProperties().antialias },
+ { PropertyKey::FillOpacity, FillPaintProperties().opacity },
+ { PropertyKey::FillColor, FillPaintProperties().fill_color },
// no FillOutlineColor on purpose.
- { PropertyKey::FillTranslate, defaultStyleProperties<FillProperties>().translate },
- { PropertyKey::FillTranslateAnchor, defaultStyleProperties<FillProperties>().translateAnchor },
+ { PropertyKey::FillTranslate, FillPaintProperties().translate },
+ { PropertyKey::FillTranslateAnchor, FillPaintProperties().translateAnchor },
- { PropertyKey::LineOpacity, defaultStyleProperties<LineProperties>().opacity },
- { PropertyKey::LineColor, defaultStyleProperties<LineProperties>().color },
- { PropertyKey::LineTranslate, defaultStyleProperties<LineProperties>().translate },
- { PropertyKey::LineTranslateAnchor, defaultStyleProperties<LineProperties>().translateAnchor },
- { PropertyKey::LineWidth, defaultStyleProperties<LineProperties>().width },
- { PropertyKey::LineGapWidth, defaultStyleProperties<LineProperties>().gap_width },
- { PropertyKey::LineBlur, defaultStyleProperties<LineProperties>().blur },
+ { PropertyKey::LineOpacity, LinePaintProperties().opacity },
+ { PropertyKey::LineColor, LinePaintProperties().color },
+ { PropertyKey::LineTranslate, LinePaintProperties().translate },
+ { PropertyKey::LineTranslateAnchor, LinePaintProperties().translateAnchor },
+ { PropertyKey::LineWidth, LinePaintProperties().width },
+ { PropertyKey::LineGapWidth, LinePaintProperties().gap_width },
+ { PropertyKey::LineBlur, LinePaintProperties().blur },
- { PropertyKey::CircleRadius, defaultStyleProperties<CircleProperties>().radius },
- { PropertyKey::CircleColor, defaultStyleProperties<CircleProperties>().color },
- { PropertyKey::CircleOpacity, defaultStyleProperties<CircleProperties>().opacity },
- { PropertyKey::CircleTranslate, defaultStyleProperties<CircleProperties>().translate },
- { PropertyKey::CircleTranslateAnchor, defaultStyleProperties<CircleProperties>().translateAnchor },
- { PropertyKey::CircleBlur, defaultStyleProperties<CircleProperties>().blur },
+ { PropertyKey::CircleRadius, CirclePaintProperties().radius },
+ { PropertyKey::CircleColor, CirclePaintProperties().color },
+ { PropertyKey::CircleOpacity, CirclePaintProperties().opacity },
+ { PropertyKey::CircleTranslate, CirclePaintProperties().translate },
+ { PropertyKey::CircleTranslateAnchor, CirclePaintProperties().translateAnchor },
+ { PropertyKey::CircleBlur, CirclePaintProperties().blur },
- { PropertyKey::IconOpacity, defaultStyleProperties<SymbolProperties>().icon.opacity },
- { PropertyKey::IconSize, defaultStyleProperties<SymbolProperties>().icon.size },
- { PropertyKey::IconColor, defaultStyleProperties<SymbolProperties>().icon.color },
- { PropertyKey::IconHaloColor, defaultStyleProperties<SymbolProperties>().icon.halo_color },
- { PropertyKey::IconHaloWidth, defaultStyleProperties<SymbolProperties>().icon.halo_width },
- { PropertyKey::IconHaloBlur, defaultStyleProperties<SymbolProperties>().icon.halo_blur },
- { PropertyKey::IconTranslate, defaultStyleProperties<SymbolProperties>().icon.translate },
- { PropertyKey::IconTranslateAnchor, defaultStyleProperties<SymbolProperties>().icon.translate_anchor },
+ { PropertyKey::IconOpacity, SymbolPaintProperties().icon.opacity },
+ { PropertyKey::IconSize, SymbolPaintProperties().icon.size },
+ { PropertyKey::IconColor, SymbolPaintProperties().icon.color },
+ { PropertyKey::IconHaloColor, SymbolPaintProperties().icon.halo_color },
+ { PropertyKey::IconHaloWidth, SymbolPaintProperties().icon.halo_width },
+ { PropertyKey::IconHaloBlur, SymbolPaintProperties().icon.halo_blur },
+ { PropertyKey::IconTranslate, SymbolPaintProperties().icon.translate },
+ { PropertyKey::IconTranslateAnchor, SymbolPaintProperties().icon.translate_anchor },
- { PropertyKey::TextOpacity, defaultStyleProperties<SymbolProperties>().text.opacity },
- { PropertyKey::TextSize, defaultStyleProperties<SymbolProperties>().text.size },
- { PropertyKey::TextColor, defaultStyleProperties<SymbolProperties>().text.color },
- { PropertyKey::TextHaloColor, defaultStyleProperties<SymbolProperties>().text.halo_color },
- { PropertyKey::TextHaloWidth, defaultStyleProperties<SymbolProperties>().text.halo_width },
- { PropertyKey::TextHaloBlur, defaultStyleProperties<SymbolProperties>().text.halo_blur },
- { PropertyKey::TextTranslate, defaultStyleProperties<SymbolProperties>().text.translate },
- { PropertyKey::TextTranslateAnchor, defaultStyleProperties<SymbolProperties>().text.translate_anchor },
+ { PropertyKey::TextOpacity, SymbolPaintProperties().text.opacity },
+ { PropertyKey::TextSize, SymbolPaintProperties().text.size },
+ { PropertyKey::TextColor, SymbolPaintProperties().text.color },
+ { PropertyKey::TextHaloColor, SymbolPaintProperties().text.halo_color },
+ { PropertyKey::TextHaloWidth, SymbolPaintProperties().text.halo_width },
+ { PropertyKey::TextHaloBlur, SymbolPaintProperties().text.halo_blur },
+ { PropertyKey::TextTranslate, SymbolPaintProperties().text.translate },
+ { PropertyKey::TextTranslateAnchor, SymbolPaintProperties().text.translate_anchor },
- { PropertyKey::RasterOpacity, defaultStyleProperties<RasterProperties>().opacity },
- { PropertyKey::RasterHueRotate, defaultStyleProperties<RasterProperties>().hue_rotate },
- { PropertyKey::RasterBrightnessLow, defaultStyleProperties<RasterProperties>().brightness[0] },
- { PropertyKey::RasterBrightnessHigh, defaultStyleProperties<RasterProperties>().brightness[1] },
- { PropertyKey::RasterSaturation, defaultStyleProperties<RasterProperties>().saturation },
- { PropertyKey::RasterContrast, defaultStyleProperties<RasterProperties>().contrast },
- { PropertyKey::RasterFade, defaultStyleProperties<RasterProperties>().fade },
+ { PropertyKey::RasterOpacity, RasterPaintProperties().opacity },
+ { PropertyKey::RasterHueRotate, RasterPaintProperties().hue_rotate },
+ { PropertyKey::RasterBrightnessLow, RasterPaintProperties().brightness[0] },
+ { PropertyKey::RasterBrightnessHigh, RasterPaintProperties().brightness[1] },
+ { PropertyKey::RasterSaturation, RasterPaintProperties().saturation },
+ { PropertyKey::RasterContrast, RasterPaintProperties().contrast },
+ { PropertyKey::RasterFade, RasterPaintProperties().fade },
- { PropertyKey::BackgroundOpacity, defaultStyleProperties<BackgroundProperties>().opacity },
- { PropertyKey::BackgroundColor, defaultStyleProperties<BackgroundProperties>().color },
+ { PropertyKey::BackgroundOpacity, BackgroundPaintProperties().opacity },
+ { PropertyKey::BackgroundColor, BackgroundPaintProperties().color },
- { PropertyKey::LineCap, defaultStyleLayout<StyleLayoutLine>().cap },
- { PropertyKey::LineJoin, defaultStyleLayout<StyleLayoutLine>().join },
- { PropertyKey::LineMiterLimit, defaultStyleLayout<StyleLayoutLine>().miter_limit },
- { PropertyKey::LineRoundLimit, defaultStyleLayout<StyleLayoutLine>().round_limit },
+ { PropertyKey::LineCap, LineLayoutProperties().cap },
+ { PropertyKey::LineJoin, LineLayoutProperties().join },
+ { PropertyKey::LineMiterLimit, LineLayoutProperties().miter_limit },
+ { PropertyKey::LineRoundLimit, LineLayoutProperties().round_limit },
- { PropertyKey::SymbolPlacement, defaultStyleLayout<StyleLayoutSymbol>().placement },
- { PropertyKey::SymbolSpacing, defaultStyleLayout<StyleLayoutSymbol>().spacing },
- { PropertyKey::SymbolAvoidEdges, defaultStyleLayout<StyleLayoutSymbol>().avoid_edges },
+ { PropertyKey::SymbolPlacement, SymbolLayoutProperties().placement },
+ { PropertyKey::SymbolSpacing, SymbolLayoutProperties().spacing },
+ { PropertyKey::SymbolAvoidEdges, SymbolLayoutProperties().avoid_edges },
- { PropertyKey::IconAllowOverlap, defaultStyleLayout<StyleLayoutSymbol>().icon.allow_overlap },
- { PropertyKey::IconIgnorePlacement, defaultStyleLayout<StyleLayoutSymbol>().icon.ignore_placement },
- { PropertyKey::IconOptional, defaultStyleLayout<StyleLayoutSymbol>().icon.optional },
- { PropertyKey::IconRotationAlignment, defaultStyleLayout<StyleLayoutSymbol>().icon.rotation_alignment },
- { PropertyKey::IconImage, defaultStyleLayout<StyleLayoutSymbol>().icon.image },
- { PropertyKey::IconRotate, defaultStyleLayout<StyleLayoutSymbol>().icon.rotate },
- { PropertyKey::IconPadding, defaultStyleLayout<StyleLayoutSymbol>().icon.padding },
- { PropertyKey::IconKeepUpright, defaultStyleLayout<StyleLayoutSymbol>().icon.keep_upright },
- { PropertyKey::IconOffset, defaultStyleLayout<StyleLayoutSymbol>().icon.offset },
+ { PropertyKey::IconAllowOverlap, SymbolLayoutProperties().icon.allow_overlap },
+ { PropertyKey::IconIgnorePlacement, SymbolLayoutProperties().icon.ignore_placement },
+ { PropertyKey::IconOptional, SymbolLayoutProperties().icon.optional },
+ { PropertyKey::IconRotationAlignment, SymbolLayoutProperties().icon.rotation_alignment },
+ { PropertyKey::IconImage, SymbolLayoutProperties().icon.image },
+ { PropertyKey::IconRotate, SymbolLayoutProperties().icon.rotate },
+ { PropertyKey::IconPadding, SymbolLayoutProperties().icon.padding },
+ { PropertyKey::IconKeepUpright, SymbolLayoutProperties().icon.keep_upright },
+ { PropertyKey::IconOffset, SymbolLayoutProperties().icon.offset },
- { PropertyKey::TextRotationAlignment, defaultStyleLayout<StyleLayoutSymbol>().text.rotation_alignment },
- { PropertyKey::TextField, defaultStyleLayout<StyleLayoutSymbol>().text.field },
- { PropertyKey::TextFont, defaultStyleLayout<StyleLayoutSymbol>().text.font },
- { PropertyKey::TextMaxWidth, defaultStyleLayout<StyleLayoutSymbol>().text.max_width },
- { PropertyKey::TextLineHeight, defaultStyleLayout<StyleLayoutSymbol>().text.line_height },
- { PropertyKey::TextLetterSpacing, defaultStyleLayout<StyleLayoutSymbol>().text.letter_spacing },
- { PropertyKey::TextJustify, defaultStyleLayout<StyleLayoutSymbol>().text.justify },
- { PropertyKey::TextAnchor, defaultStyleLayout<StyleLayoutSymbol>().text.anchor },
- { PropertyKey::TextMaxAngle, defaultStyleLayout<StyleLayoutSymbol>().text.max_angle },
- { PropertyKey::TextRotate, defaultStyleLayout<StyleLayoutSymbol>().text.rotate },
- { PropertyKey::TextPadding, defaultStyleLayout<StyleLayoutSymbol>().text.padding },
- { PropertyKey::TextKeepUpright, defaultStyleLayout<StyleLayoutSymbol>().text.keep_upright },
- { PropertyKey::TextTransform, defaultStyleLayout<StyleLayoutSymbol>().text.transform },
- { PropertyKey::TextOffset, defaultStyleLayout<StyleLayoutSymbol>().text.offset },
- { PropertyKey::TextAllowOverlap, defaultStyleLayout<StyleLayoutSymbol>().text.allow_overlap },
- { PropertyKey::TextIgnorePlacement, defaultStyleLayout<StyleLayoutSymbol>().text.ignore_placement },
- { PropertyKey::TextOptional, defaultStyleLayout<StyleLayoutSymbol>().text.optional },
+ { PropertyKey::TextRotationAlignment, SymbolLayoutProperties().text.rotation_alignment },
+ { PropertyKey::TextField, SymbolLayoutProperties().text.field },
+ { PropertyKey::TextFont, SymbolLayoutProperties().text.font },
+ { PropertyKey::TextMaxWidth, SymbolLayoutProperties().text.max_width },
+ { PropertyKey::TextLineHeight, SymbolLayoutProperties().text.line_height },
+ { PropertyKey::TextLetterSpacing, SymbolLayoutProperties().text.letter_spacing },
+ { PropertyKey::TextJustify, SymbolLayoutProperties().text.justify },
+ { PropertyKey::TextAnchor, SymbolLayoutProperties().text.anchor },
+ { PropertyKey::TextMaxAngle, SymbolLayoutProperties().text.max_angle },
+ { PropertyKey::TextRotate, SymbolLayoutProperties().text.rotate },
+ { PropertyKey::TextPadding, SymbolLayoutProperties().text.padding },
+ { PropertyKey::TextKeepUpright, SymbolLayoutProperties().text.keep_upright },
+ { PropertyKey::TextTransform, SymbolLayoutProperties().text.transform },
+ { PropertyKey::TextOffset, SymbolLayoutProperties().text.offset },
+ { PropertyKey::TextAllowOverlap, SymbolLayoutProperties().text.allow_overlap },
+ { PropertyKey::TextIgnorePlacement, SymbolLayoutProperties().text.ignore_placement },
+ { PropertyKey::TextOptional, SymbolLayoutProperties().text.optional },
};
diff --git a/src/mbgl/style/style_layer.cpp b/src/mbgl/style/style_layer.cpp
index 8ab5b3e508..17c6fa9386 100644
--- a/src/mbgl/style/style_layer.cpp
+++ b/src/mbgl/style/style_layer.cpp
@@ -16,15 +16,15 @@ bool StyleLayer::isBackground() const {
bool StyleLayer::isVisible() const {
switch (type) {
case StyleLayerType::Fill:
- return getProperties<FillProperties>().isVisible();
+ return getProperties<FillPaintProperties>().isVisible();
case StyleLayerType::Line:
- return getProperties<LineProperties>().isVisible();
+ return getProperties<LinePaintProperties>().isVisible();
case StyleLayerType::Circle:
- return getProperties<CircleProperties>().isVisible();
+ return getProperties<CirclePaintProperties>().isVisible();
case StyleLayerType::Symbol:
- return getProperties<SymbolProperties>().isVisible();
+ return getProperties<SymbolPaintProperties>().isVisible();
case StyleLayerType::Raster:
- return getProperties<RasterProperties>().isVisible();
+ return getProperties<RasterPaintProperties>().isVisible();
default:
return false;
}
@@ -189,9 +189,9 @@ void StyleLayer::applyTransitionedStyleProperty(PropertyKey key, T &target, cons
}
template <>
-void StyleLayer::applyStyleProperties<FillProperties>(const float z, const TimePoint& now, const ZoomHistory &zoomHistory) {
- properties.set<FillProperties>();
- FillProperties &fill = properties.get<FillProperties>();
+void StyleLayer::applyStyleProperties<FillPaintProperties>(const float z, const TimePoint& now, const ZoomHistory &zoomHistory) {
+ properties.set<FillPaintProperties>();
+ FillPaintProperties& fill = properties.get<FillPaintProperties>();
applyStyleProperty(PropertyKey::FillAntialias, fill.antialias, z, now, zoomHistory);
applyTransitionedStyleProperty(PropertyKey::FillOpacity, fill.opacity, z, now, zoomHistory);
applyTransitionedStyleProperty(PropertyKey::FillColor, fill.fill_color, z, now, zoomHistory);
@@ -202,9 +202,9 @@ void StyleLayer::applyStyleProperties<FillProperties>(const float z, const TimeP
}
template <>
-void StyleLayer::applyStyleProperties<LineProperties>(const float z, const TimePoint& now, const ZoomHistory &zoomHistory) {
- properties.set<LineProperties>();
- LineProperties &line = properties.get<LineProperties>();
+void StyleLayer::applyStyleProperties<LinePaintProperties>(const float z, const TimePoint& now, const ZoomHistory &zoomHistory) {
+ properties.set<LinePaintProperties>();
+ LinePaintProperties& line = properties.get<LinePaintProperties>();
applyTransitionedStyleProperty(PropertyKey::LineOpacity, line.opacity, z, now, zoomHistory);
applyTransitionedStyleProperty(PropertyKey::LineColor, line.color, z, now, zoomHistory);
applyTransitionedStyleProperty(PropertyKey::LineTranslate, line.translate, z, now, zoomHistory);
@@ -220,9 +220,9 @@ void StyleLayer::applyStyleProperties<LineProperties>(const float z, const TimeP
}
template <>
-void StyleLayer::applyStyleProperties<CircleProperties>(const float z, const TimePoint& now, const ZoomHistory &zoomHistory) {
- properties.set<CircleProperties>();
- CircleProperties& circle = properties.get<CircleProperties>();
+void StyleLayer::applyStyleProperties<CirclePaintProperties>(const float z, const TimePoint& now, const ZoomHistory &zoomHistory) {
+ properties.set<CirclePaintProperties>();
+ CirclePaintProperties& circle = properties.get<CirclePaintProperties>();
applyTransitionedStyleProperty(PropertyKey::CircleRadius, circle.radius, z, now, zoomHistory);
applyTransitionedStyleProperty(PropertyKey::CircleColor, circle.color, z, now, zoomHistory);
applyTransitionedStyleProperty(PropertyKey::CircleOpacity, circle.opacity, z, now, zoomHistory);
@@ -232,9 +232,9 @@ void StyleLayer::applyStyleProperties<CircleProperties>(const float z, const Tim
}
template <>
-void StyleLayer::applyStyleProperties<SymbolProperties>(const float z, const TimePoint& now, const ZoomHistory &zoomHistory) {
- properties.set<SymbolProperties>();
- SymbolProperties &symbol = properties.get<SymbolProperties>();
+void StyleLayer::applyStyleProperties<SymbolPaintProperties>(const float z, const TimePoint& now, const ZoomHistory &zoomHistory) {
+ properties.set<SymbolPaintProperties>();
+ SymbolPaintProperties& symbol = properties.get<SymbolPaintProperties>();
applyTransitionedStyleProperty(PropertyKey::IconOpacity, symbol.icon.opacity, z, now, zoomHistory);
applyTransitionedStyleProperty(PropertyKey::IconColor, symbol.icon.color, z, now, zoomHistory);
applyTransitionedStyleProperty(PropertyKey::IconHaloColor, symbol.icon.halo_color, z, now, zoomHistory);
@@ -265,9 +265,9 @@ void StyleLayer::applyStyleProperties<SymbolProperties>(const float z, const Tim
}
template <>
-void StyleLayer::applyStyleProperties<RasterProperties>(const float z, const TimePoint& now, const ZoomHistory &zoomHistory) {
- properties.set<RasterProperties>();
- RasterProperties &raster = properties.get<RasterProperties>();
+void StyleLayer::applyStyleProperties<RasterPaintProperties>(const float z, const TimePoint& now, const ZoomHistory &zoomHistory) {
+ properties.set<RasterPaintProperties>();
+ RasterPaintProperties& raster = properties.get<RasterPaintProperties>();
applyTransitionedStyleProperty(PropertyKey::RasterOpacity, raster.opacity, z, now, zoomHistory);
applyTransitionedStyleProperty(PropertyKey::RasterHueRotate, raster.hue_rotate, z, now, zoomHistory);
applyTransitionedStyleProperty(PropertyKey::RasterBrightnessLow, raster.brightness[0], z, now, zoomHistory);
@@ -278,9 +278,9 @@ void StyleLayer::applyStyleProperties<RasterProperties>(const float z, const Tim
}
template <>
-void StyleLayer::applyStyleProperties<BackgroundProperties>(const float z, const TimePoint& now, const ZoomHistory &zoomHistory) {
- properties.set<BackgroundProperties>();
- BackgroundProperties &background = properties.get<BackgroundProperties>();
+void StyleLayer::applyStyleProperties<BackgroundPaintProperties>(const float z, const TimePoint& now, const ZoomHistory &zoomHistory) {
+ properties.set<BackgroundPaintProperties>();
+ BackgroundPaintProperties& background = properties.get<BackgroundPaintProperties>();
applyTransitionedStyleProperty(PropertyKey::BackgroundOpacity, background.opacity, z, now, zoomHistory);
applyTransitionedStyleProperty(PropertyKey::BackgroundColor, background.color, z, now, zoomHistory);
applyStyleProperty(PropertyKey::BackgroundImage, background.image, z, now, zoomHistory);
@@ -293,20 +293,20 @@ void StyleLayer::updateProperties(float z, const TimePoint& now, ZoomHistory &zo
hasPendingTransitions = false;
switch (type) {
- case StyleLayerType::Fill: applyStyleProperties<FillProperties>(z, now, zoomHistory); break;
- case StyleLayerType::Line: applyStyleProperties<LineProperties>(z, now, zoomHistory); break;
- case StyleLayerType::Circle: applyStyleProperties<CircleProperties>(z, now, zoomHistory); break;
- case StyleLayerType::Symbol: applyStyleProperties<SymbolProperties>(z, now, zoomHistory); break;
- case StyleLayerType::Raster: applyStyleProperties<RasterProperties>(z, now, zoomHistory); break;
- case StyleLayerType::Background: applyStyleProperties<BackgroundProperties>(z, now, zoomHistory); break;
+ case StyleLayerType::Fill: applyStyleProperties<FillPaintProperties>(z, now, zoomHistory); break;
+ case StyleLayerType::Line: applyStyleProperties<LinePaintProperties>(z, now, zoomHistory); break;
+ case StyleLayerType::Circle: applyStyleProperties<CirclePaintProperties>(z, now, zoomHistory); break;
+ case StyleLayerType::Symbol: applyStyleProperties<SymbolPaintProperties>(z, now, zoomHistory); break;
+ case StyleLayerType::Raster: applyStyleProperties<RasterPaintProperties>(z, now, zoomHistory); break;
+ case StyleLayerType::Background: applyStyleProperties<BackgroundPaintProperties>(z, now, zoomHistory); break;
default: properties.set<std::false_type>(); break;
}
// Update the render passes when this layer is visible.
passes = RenderPass::None;
if (isVisible()) {
- if (properties.is<FillProperties>()) {
- const FillProperties &fillProperties = properties.get<FillProperties>();
+ if (properties.is<FillPaintProperties>()) {
+ const FillPaintProperties &fillProperties = properties.get<FillPaintProperties>();
const float alpha = fillProperties.fill_color[3] * fillProperties.opacity;
if (fillProperties.antialias) {
diff --git a/src/mbgl/style/style_layer.hpp b/src/mbgl/style/style_layer.hpp
index 28d3f5ca9e..fdba827645 100644
--- a/src/mbgl/style/style_layer.hpp
+++ b/src/mbgl/style/style_layer.hpp
@@ -26,12 +26,8 @@ class StyleLayer : public util::noncopyable {
public:
StyleLayer(const std::string &id, std::map<ClassID, ClassProperties> &&styles);
- template <typename T> const T &getProperties() const {
- if (properties.is<T>()) {
- return properties.get<T>();
- } else {
- return defaultStyleProperties<T>();
- }
+ template <typename T> const T& getProperties() const {
+ return properties.get<T>();
}
// Determines whether this layer is the background layer.
diff --git a/src/mbgl/style/style_layout.cpp b/src/mbgl/style/style_layout.cpp
deleted file mode 100644
index 1071c8b73d..0000000000
--- a/src/mbgl/style/style_layout.cpp
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <mbgl/style/style_layout.hpp>
-
-namespace mbgl {
-
-template<> const StyleLayoutFill &defaultStyleLayout() { static StyleLayoutFill p; return p; }
-template<> const StyleLayoutLine &defaultStyleLayout() { static StyleLayoutLine p; return p; }
-template<> const StyleLayoutSymbol &defaultStyleLayout() { static StyleLayoutSymbol p; return p; }
-template<> const StyleLayoutRaster &defaultStyleLayout() { static StyleLayoutRaster p; return p; }
-template<> const StyleLayoutBackground &defaultStyleLayout() { static StyleLayoutBackground p; return p; }
-
-} \ No newline at end of file
diff --git a/src/mbgl/style/style_layout.hpp b/src/mbgl/style/style_layout.hpp
deleted file mode 100644
index 6db8ce1930..0000000000
--- a/src/mbgl/style/style_layout.hpp
+++ /dev/null
@@ -1,110 +0,0 @@
-#ifndef MBGL_STYLE_STYLE_LAYOUT
-#define MBGL_STYLE_STYLE_LAYOUT
-
-#include <mbgl/style/types.hpp>
-
-namespace mbgl {
-
-class Source;
-
-class StyleLayoutFill {
-public:
- // Make movable only.
- StyleLayoutFill() = default;
- StyleLayoutFill(StyleLayoutFill &&) = default;
- StyleLayoutFill& operator=(StyleLayoutFill &&) = default;
- StyleLayoutFill(const StyleLayoutFill &) = delete;
- StyleLayoutFill& operator=(const StyleLayoutFill &) = delete;
-};
-
-class StyleLayoutLine {
-public:
- // Make movable only.
- StyleLayoutLine() = default;
- StyleLayoutLine(StyleLayoutLine &&) = default;
- StyleLayoutLine& operator=(StyleLayoutLine &&) = default;
- StyleLayoutLine(const StyleLayoutLine &) = delete;
- StyleLayoutLine& operator=(const StyleLayoutLine &) = delete;
-
- CapType cap = CapType::Butt;
- JoinType join = JoinType::Miter;
- float miter_limit = 2.0f;
- float round_limit = 1.0f;
-};
-
-class StyleLayoutSymbol {
-public:
- // Make movable only.
- StyleLayoutSymbol() = default;
- StyleLayoutSymbol(StyleLayoutSymbol &&) = default;
- StyleLayoutSymbol& operator=(StyleLayoutSymbol &&) = default;
- StyleLayoutSymbol(const StyleLayoutSymbol &) = delete;
- StyleLayoutSymbol& operator=(const StyleLayoutSymbol &) = delete;
-
- PlacementType placement = PlacementType::Point;
- float spacing = 250.0f;
- bool avoid_edges = false;
-
- struct {
- bool allow_overlap = false;
- bool ignore_placement = false;
- bool optional = false;
- RotationAlignmentType rotation_alignment = RotationAlignmentType::Viewport;
- float size = 1.0f;
- float max_size = 1.0f;
- std::string image;
- float rotate = 0.0f;
- float padding = 2.0f;
- bool keep_upright = false;
- std::array<float, 2> offset = {{ 0, 0 }};
- } icon;
-
- struct {
- RotationAlignmentType rotation_alignment = RotationAlignmentType::Viewport;
- std::string field;
- std::string font = "Open Sans Regular, Arial Unicode MS Regular";
- float size = 16.0f;
- float max_size = 16.0f;
- float max_width = 15.0f /* em */;
- float line_height = 1.2f /* em */;
- float letter_spacing = 0.0f /* em */;
- TextJustifyType justify = TextJustifyType::Center;
- TextAnchorType anchor = TextAnchorType::Center;
- float max_angle = 45.0f /* degrees */;
- float rotate = 0.0f;
- float padding = 2.0f;
- bool keep_upright = true;
- TextTransformType transform = TextTransformType::None;
- std::array<float, 2> offset = {{ 0, 0 }};
- bool allow_overlap = false;
- bool ignore_placement = false;
- bool optional = false;
- } text;
-};
-
-class StyleLayoutRaster {
-public:
- // Make movable only.
- StyleLayoutRaster() = default;
- StyleLayoutRaster(StyleLayoutRaster &&) = default;
- StyleLayoutRaster& operator=(StyleLayoutRaster &&) = default;
- StyleLayoutRaster(const StyleLayoutRaster &) = delete;
- StyleLayoutRaster& operator=(const StyleLayoutRaster &) = delete;
-};
-
-class StyleLayoutBackground {
-public:
- // Make movable only.
- StyleLayoutBackground() = default;
- StyleLayoutBackground(StyleLayoutBackground &&) = default;
- StyleLayoutBackground& operator=(StyleLayoutBackground &&) = default;
- StyleLayoutBackground(const StyleLayoutBackground &) = delete;
- StyleLayoutBackground& operator=(const StyleLayoutBackground &) = delete;
-};
-
-template <typename T>
-const T &defaultStyleLayout();
-
-};
-
-#endif
diff --git a/src/mbgl/style/style_properties.cpp b/src/mbgl/style/style_properties.cpp
index aa4c7e29c7..69a9cede50 100644
--- a/src/mbgl/style/style_properties.cpp
+++ b/src/mbgl/style/style_properties.cpp
@@ -1,13 +1,5 @@
#include <mbgl/style/style_properties.hpp>
-#include <mbgl/style/piecewisefunction_properties.hpp>
namespace mbgl {
-template<> const FillProperties &defaultStyleProperties() { static const FillProperties p; return p; }
-template<> const LineProperties &defaultStyleProperties() { static const LineProperties p; return p; }
-template<> const CircleProperties &defaultStyleProperties() { static const CircleProperties p; return p; }
-template<> const SymbolProperties &defaultStyleProperties() { static const SymbolProperties p; return p; }
-template<> const RasterProperties &defaultStyleProperties() { static const RasterProperties p; return p; }
-template<> const BackgroundProperties &defaultStyleProperties() { static const BackgroundProperties p; return p; }
-
}
diff --git a/src/mbgl/text/quads.cpp b/src/mbgl/text/quads.cpp
index 61f5eef71a..35f224ac12 100644
--- a/src/mbgl/text/quads.cpp
+++ b/src/mbgl/text/quads.cpp
@@ -1,7 +1,7 @@
#include <mbgl/text/quads.hpp>
#include <mbgl/text/shaping.hpp>
#include <mbgl/geometry/anchor.hpp>
-#include <mbgl/style/style_layout.hpp>
+#include <mbgl/style/style_properties.hpp>
#include <mbgl/util/math.hpp>
#include <cassert>
@@ -9,8 +9,8 @@ namespace mbgl {
const float globalMinScale = 0.5f; // underscale by 1 zoom level
-SymbolQuads getIconQuads(Anchor &anchor, const PositionedIcon &shapedIcon,
- const std::vector<Coordinate> &line, const StyleLayoutSymbol &layout,
+SymbolQuads getIconQuads(Anchor& anchor, const PositionedIcon& shapedIcon,
+ const std::vector<Coordinate>& line, const SymbolLayoutProperties& layout,
const bool alongLine) {
const float border = 1.0;
@@ -128,9 +128,9 @@ void getSegmentGlyphs(std::back_insert_iterator<GlyphInstances> glyphs, Anchor &
}
}
-SymbolQuads getGlyphQuads(Anchor &anchor, const Shaping &shapedText,
- const float boxScale, const std::vector<Coordinate> &line, const StyleLayoutSymbol &layout,
- const bool alongLine, const GlyphPositions &face) {
+SymbolQuads getGlyphQuads(Anchor& anchor, const Shaping& shapedText,
+ const float boxScale, const std::vector<Coordinate>& line, const SymbolLayoutProperties& layout,
+ const bool alongLine, const GlyphPositions& face) {
const float textRotate = layout.text.rotate * M_PI / 180;
const bool keepUpright = layout.text.keep_upright;
diff --git a/src/mbgl/text/quads.hpp b/src/mbgl/text/quads.hpp
index 97fdb6a1fc..814452a72f 100644
--- a/src/mbgl/text/quads.hpp
+++ b/src/mbgl/text/quads.hpp
@@ -33,16 +33,16 @@ namespace mbgl {
typedef std::vector<SymbolQuad> SymbolQuads;
struct Anchor;
- class StyleLayoutSymbol;
+ class SymbolLayoutProperties;
class PositionedIcon;
- SymbolQuads getIconQuads(Anchor &anchor, const PositionedIcon &shapedIcon,
- const std::vector<Coordinate> &line, const StyleLayoutSymbol &layout,
+ SymbolQuads getIconQuads(Anchor& anchor, const PositionedIcon& shapedIcon,
+ const std::vector<Coordinate>& line, const SymbolLayoutProperties& layout,
const bool alongLine);
- SymbolQuads getGlyphQuads(Anchor &anchor, const Shaping &shapedText,
- const float boxScale, const std::vector<Coordinate> &line, const StyleLayoutSymbol &layout,
- const bool alongLine, const GlyphPositions &face);
+ SymbolQuads getGlyphQuads(Anchor& anchor, const Shaping& shapedText,
+ const float boxScale, const std::vector<Coordinate>& line, const SymbolLayoutProperties& layout,
+ const bool alongLine, const GlyphPositions& face);
}
#endif
diff --git a/src/mbgl/text/shaping.cpp b/src/mbgl/text/shaping.cpp
index 35fe5dc24b..c3911718e0 100644
--- a/src/mbgl/text/shaping.cpp
+++ b/src/mbgl/text/shaping.cpp
@@ -1,9 +1,9 @@
#include <mbgl/text/shaping.hpp>
-#include <mbgl/style/style_layout.hpp>
+#include <mbgl/style/style_properties.hpp>
namespace mbgl {
-PositionedIcon shapeIcon(const Rect<uint16_t> &image, const StyleLayoutSymbol &layout) {
+PositionedIcon shapeIcon(const Rect<uint16_t>& image, const SymbolLayoutProperties& layout) {
float dx = layout.icon.offset[0];
float dy = layout.icon.offset[1];
float x1 = dx - image.originalW / 2.0f;
diff --git a/src/mbgl/text/shaping.hpp b/src/mbgl/text/shaping.hpp
index c409e6ed0a..32b34cf5be 100644
--- a/src/mbgl/text/shaping.hpp
+++ b/src/mbgl/text/shaping.hpp
@@ -22,9 +22,9 @@ namespace mbgl {
operator bool() const { return image.hasArea(); }
};
- class StyleLayoutSymbol;
+ class SymbolLayoutProperties;
- PositionedIcon shapeIcon(const Rect<uint16_t> &image, const StyleLayoutSymbol &layout);
+ PositionedIcon shapeIcon(const Rect<uint16_t>& image, const SymbolLayoutProperties&);
}
diff --git a/test/api/annotations.cpp b/test/api/annotations.cpp
index 0918d78931..907f0446b6 100644
--- a/test/api/annotations.cpp
+++ b/test/api/annotations.cpp
@@ -48,12 +48,12 @@ TEST(Annotations, LineAnnotation) {
AnnotationSegments segments = {{ {{ { 0, 0 }, { 45, 45 } }} }};
- LineProperties lineProperties;
+ LinePaintProperties lineProperties;
lineProperties.color = {{ 255, 0, 0, 1 }};
lineProperties.width = 5;
StyleProperties styleProperties;
- styleProperties.set<LineProperties>(lineProperties);
+ styleProperties.set<LinePaintProperties>(lineProperties);
map.addShapeAnnotation(ShapeAnnotation(segments, styleProperties));
@@ -70,11 +70,11 @@ TEST(Annotations, FillAnnotation) {
AnnotationSegments segments = {{ {{ { 0, 0 }, { 0, 45 }, { 45, 45 }, { 45, 0 } }} }};
- FillProperties fillProperties;
+ FillPaintProperties fillProperties;
fillProperties.fill_color = {{ 255, 0, 0, 1 }};
StyleProperties styleProperties;
- styleProperties.set<FillProperties>(fillProperties);
+ styleProperties.set<FillPaintProperties>(fillProperties);
map.addShapeAnnotation(ShapeAnnotation(segments, styleProperties));
@@ -109,11 +109,11 @@ TEST(Annotations, NonImmediateAdd) {
AnnotationSegments segments = {{ {{ { 0, 0 }, { 0, 45 }, { 45, 45 }, { 45, 0 } }} }};
- FillProperties fillProperties;
+ FillPaintProperties fillProperties;
fillProperties.fill_color = {{ 255, 0, 0, 1 }};
StyleProperties styleProperties;
- styleProperties.set<FillProperties>(fillProperties);
+ styleProperties.set<FillPaintProperties>(fillProperties);
map.addShapeAnnotation(ShapeAnnotation(segments, styleProperties));
@@ -143,12 +143,12 @@ TEST(Annotations, RemoveShape) {
AnnotationSegments segments = {{ {{ { 0, 0 }, { 45, 45 } }} }};
- LineProperties lineProperties;
+ LinePaintProperties lineProperties;
lineProperties.color = {{ 255, 0, 0, 1 }};
lineProperties.width = 5;
StyleProperties styleProperties;
- styleProperties.set<LineProperties>(lineProperties);
+ styleProperties.set<LinePaintProperties>(lineProperties);
Map map(view, fileSource, MapMode::Still);
map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"), "");