#ifndef LLMR_STYLE_PROPERTIES #define LLMR_STYLE_PROPERTIES #include #include #include #include namespace llmr { typedef std::array Color; enum class Winding { EvenOdd = 1, NonZero = 2 }; // enum LineCap { // Round = 1 // }; // enum LineJoin { // Butt = 1, // Bevel = 2 // }; enum class Property { Null = 1, Constant = 2, Stops = 3, Linear = 4 }; namespace functions { float null(float z, const std::vector&); bool null(float z, const std::vector&); float constant(float z, const std::vector& values); bool constant(float z, const std::vector& values); float stops(float z, const std::vector& values); bool stops(float z, const std::vector& values); float linear(float z, const std::vector& values); bool linear(float z, const std::vector& values); float exponential(float z, const std::vector& values); bool exponential(float z, const std::vector& values); } template struct FunctionProperty { typedef T (*fn)(float z, const std::vector& values); fn function; std::vector values; inline FunctionProperty() : function(&functions::null) {} inline FunctionProperty(T value) : function(&functions::constant), values(1, value) {} inline T operator()(float z) const { return function(z, values); } }; struct PointClass { FunctionProperty enabled = true; FunctionProperty size; Color color = {{ 0, 0, 0, 1 }}; FunctionProperty opacity = 1; std::string image; }; struct PointProperties { bool enabled = true; float size = 0; Color color = {{ 0, 0, 0, 1 }}; float opacity = 1.0; std::string image; }; struct LineClass { FunctionProperty enabled = true; FunctionProperty width; FunctionProperty offset; Color color = {{ 0, 0, 0, 1 }}; FunctionProperty opacity = 1; }; struct LineProperties { bool enabled = true; float width = 0; float offset = 0; Color color = {{ 0, 0, 0, 1 }}; float opacity = 1.0; }; struct FillClass { FunctionProperty enabled = true; Winding winding = Winding::NonZero; FunctionProperty antialias = true; Color fill_color = {{ 0, 0, 0, 1 }}; Color stroke_color = {{ 0, 0, 0, std::numeric_limits::infinity() }}; FunctionProperty opacity = 1; std::string image; }; struct FillProperties { bool enabled = true; Winding winding = Winding::NonZero; bool antialias = true; Color fill_color = {{ 0, 0, 0, 1 }}; Color stroke_color = {{ 0, 0, 0, 1 }}; float opacity = 1.0; std::string image; }; struct TextClass { FunctionProperty enabled = true; Color color = {{ 0, 0, 0, 1 }}; Color halo = {{ 1, 1, 1, 0.75 }}; FunctionProperty haloRadius = 0.25f; FunctionProperty size = 12.0f; FunctionProperty rotate = 0.0f; FunctionProperty alwaysVisible = false; }; struct TextProperties { bool enabled = true; Color color = {{ 0, 0, 0, 1 }}; Color halo = {{ 1, 1, 1, 0.75 }}; float haloRadius = 0.25f; float size = 12.0f; float rotate = 0.0f; bool alwaysVisible = false; }; struct BackgroundClass { Color color = {{ 1, 1, 1, 1 }}; }; struct BackgroundProperties { Color color = {{ 1, 1, 1, 1 }}; }; } #endif