#ifndef MBGL_SYMBOL_LAYER #define MBGL_SYMBOL_LAYER #include #include #include namespace mbgl { class SpriteAtlas; class SymbolLayoutProperties { public: LayoutProperty placement { PlacementType::Point }; LayoutProperty spacing { 250.0f }; LayoutProperty avoidEdges { false }; class IconProperties { public: LayoutProperty allowOverlap { false }; LayoutProperty ignorePlacement { false }; LayoutProperty optional { false }; LayoutProperty rotationAlignment { RotationAlignmentType::Viewport }; LayoutProperty size { 1.0f }; LayoutProperty image { "" }; LayoutProperty rotate { 0.0f }; LayoutProperty padding { 2.0f }; LayoutProperty keepUpright { false }; LayoutProperty> offset { {{ 0, 0 }} }; } icon; class TextProperties { public: LayoutProperty rotationAlignment { RotationAlignmentType::Viewport }; LayoutProperty field { "" }; LayoutProperty font { "Open Sans Regular, Arial Unicode MS Regular" }; LayoutProperty size { 16.0f }; LayoutProperty maxWidth { 15.0f /* em */ }; LayoutProperty lineHeight { 1.2f /* em */ }; LayoutProperty letterSpacing { 0.0f /* em */ }; LayoutProperty justify { TextJustifyType::Center }; LayoutProperty anchor { TextAnchorType::Center }; LayoutProperty maxAngle { 45.0f /* degrees */ }; LayoutProperty rotate { 0.0f }; LayoutProperty padding { 2.0f }; LayoutProperty keepUpright { true }; LayoutProperty transform { TextTransformType::None }; LayoutProperty> offset { {{ 0, 0 }} }; LayoutProperty allowOverlap { false }; LayoutProperty ignorePlacement { false }; LayoutProperty optional { false }; } text; // Special case. float iconMaxSize = 1.0f; float textMaxSize = 16.0f; }; class SymbolPaintProperties { public: class PaintProperties { public: PaintProperties(float size_) : size(size_) {} PaintProperty opacity { 1.0f }; PaintProperty color { {{ 0, 0, 0, 1 }} }; PaintProperty haloColor { {{ 0, 0, 0, 0 }} }; PaintProperty haloWidth { 0.0f }; PaintProperty haloBlur { 0.0f }; PaintProperty> translate { {{ 0, 0 }} }; PaintProperty translateAnchor { TranslateAnchorType::Map }; // Special case float size; bool isVisible() const { return opacity > 0 && (color.value[3] > 0 || haloColor.value[3] > 0) && size > 0; } }; PaintProperties icon { 1.0f }; PaintProperties text { 16.0f }; }; class SymbolLayer : public StyleLayer { public: std::unique_ptr 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 createBucket(StyleBucketParameters&) const override; SymbolLayoutProperties layout; SymbolPaintProperties paint; SpriteAtlas* spriteAtlas = nullptr; }; } // namespace mbgl #endif