add style object
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include "transform.hpp"
|
||||
#include <llmr/map/tile.hpp>
|
||||
#include "settings.hpp"
|
||||
#include "../style/style.hpp"
|
||||
|
||||
#include <forward_list>
|
||||
|
||||
@@ -24,6 +25,7 @@ public:
|
||||
Map &operator=(const Map&&) = delete;
|
||||
|
||||
void setup();
|
||||
void loadStyle(const uint8_t *data, uint32_t bytes);
|
||||
void loadSettings();
|
||||
void resize(uint32_t width, uint32_t height, uint32_t fb_width, uint32_t fb_height);
|
||||
|
||||
@@ -59,6 +61,7 @@ private:
|
||||
Settings& settings;
|
||||
Transform transform;
|
||||
Painter painter;
|
||||
Style style;
|
||||
|
||||
int32_t min_zoom;
|
||||
int32_t max_zoom;
|
||||
|
||||
@@ -48,10 +48,6 @@ public:
|
||||
void setData(uint8_t *data, uint32_t bytes);
|
||||
bool parse();
|
||||
void parseLayer(const pbf layer);
|
||||
// void parseFeature(const uint8_t *data, uint32_t bytes);
|
||||
|
||||
// void addLineGeometry(pbf& geom);
|
||||
// void addFillGeometry(pbf& geom);
|
||||
|
||||
std::shared_ptr<Bucket> createFillBucket(const pbf data);
|
||||
|
||||
@@ -72,8 +68,6 @@ public:
|
||||
|
||||
std::forward_list<Layer> layers;
|
||||
|
||||
// std::vector<fill_index> fillIndices;
|
||||
|
||||
private:
|
||||
// Source data
|
||||
uint8_t *data;
|
||||
|
||||
@@ -13,7 +13,7 @@ class Settings;
|
||||
class Transform;
|
||||
|
||||
class FillBucket;
|
||||
struct FillStyle;
|
||||
struct FillProperties;
|
||||
|
||||
class Painter {
|
||||
public:
|
||||
@@ -34,7 +34,7 @@ public:
|
||||
void renderDebug(const std::shared_ptr<Tile>& tile);
|
||||
|
||||
void renderBackground();
|
||||
void renderFill(const FillBucket& bucket, const FillStyle& style);
|
||||
void renderFill(const FillBucket& bucket, const FillProperties& style);
|
||||
|
||||
|
||||
void drawClippingMask();
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define LLMR_STYLE_STYLE
|
||||
|
||||
#include <array>
|
||||
#include "../util/pbf.hpp"
|
||||
|
||||
namespace llmr {
|
||||
|
||||
@@ -12,21 +13,22 @@ enum Winding {
|
||||
NonZero = 2
|
||||
};
|
||||
|
||||
enum LineCap {
|
||||
Round = 1
|
||||
};
|
||||
// enum LineCap {
|
||||
// Round = 1
|
||||
// };
|
||||
|
||||
enum LineJoin {
|
||||
Butt = 1,
|
||||
Bevel = 2
|
||||
};
|
||||
// enum LineJoin {
|
||||
// Butt = 1,
|
||||
// Bevel = 2
|
||||
// };
|
||||
|
||||
struct StrokeStyle {
|
||||
|
||||
struct StrokeProperties {
|
||||
Color line_color = {{ 0, 0, 0, 1 }};
|
||||
float line_width = 1;
|
||||
};
|
||||
|
||||
struct FillStyle {
|
||||
struct FillProperties {
|
||||
Winding winding = NonZero;
|
||||
bool antialiasing = true;
|
||||
Color fill_color = {{ 0, 0, 0, 1 }};
|
||||
@@ -36,8 +38,13 @@ struct FillStyle {
|
||||
|
||||
class Style {
|
||||
public:
|
||||
StrokeStyle strokeStyle(const std::string& layer_name) const;
|
||||
FillStyle fillStyle(const std::string& layer_name) const;
|
||||
Style();
|
||||
|
||||
void reset();
|
||||
void load(pbf data);
|
||||
|
||||
// StrokeStyle strokeStyle(const std::string& layer_name) const;
|
||||
// FillProperties fillStyle(const std::string& layer_name) const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user