rename stroke=>line, add line painter classes
This commit is contained in:
@@ -58,6 +58,7 @@ public:
|
||||
void parseStyleLayers(const std::vector<LayerDescription>& layers);
|
||||
std::shared_ptr<Bucket> createBucket(const BucketDescription& bucket_desc);
|
||||
std::shared_ptr<Bucket> createFillBucket(const VectorTileLayer& layer, const BucketDescription& bucket_desc);
|
||||
std::shared_ptr<Bucket> createLineBucket(const VectorTileLayer& layer, const BucketDescription& bucket_desc);
|
||||
|
||||
void cancel();
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef LLMR_GEOMETRY_BUCKET
|
||||
#define LLMR_GEOMETRY_BUCKET
|
||||
#ifndef LLMR_RENDERER_BUCKET
|
||||
#define LLMR_RENDERER_BUCKET
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef LLMR_GEOMETRY_FILLBUCKET
|
||||
#define LLMR_GEOMETRY_FILLBUCKET
|
||||
#ifndef LLMR_RENDERER_FILLBUCKET
|
||||
#define LLMR_RENDERER_FILLBUCKET
|
||||
|
||||
#include "bucket.hpp"
|
||||
|
||||
|
||||
29
include/llmr/renderer/line_bucket.hpp
Normal file
29
include/llmr/renderer/line_bucket.hpp
Normal file
@@ -0,0 +1,29 @@
|
||||
#ifndef LLMR_RENDERER_LINEBUCKET
|
||||
#define LLMR_RENDERER_LINEBUCKET
|
||||
|
||||
#include "bucket.hpp"
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace llmr {
|
||||
|
||||
class Style;
|
||||
class LineBuffer;
|
||||
struct pbf;
|
||||
|
||||
class LineBucket : public Bucket {
|
||||
public:
|
||||
LineBucket(const std::shared_ptr<LineBuffer>& buffer);
|
||||
|
||||
virtual void render(Painter& painter, const std::string& layer_name);
|
||||
|
||||
void addGeometry(pbf& data);
|
||||
|
||||
private:
|
||||
std::shared_ptr<LineBuffer> buffer;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -15,7 +15,7 @@ class Style;
|
||||
class LayerDescription;
|
||||
|
||||
class FillBucket;
|
||||
struct FillProperties;
|
||||
class LineBucket;
|
||||
|
||||
class Painter {
|
||||
public:
|
||||
@@ -38,6 +38,7 @@ public:
|
||||
|
||||
void renderBackground();
|
||||
void renderFill(FillBucket& bucket, const std::string& layer_name);
|
||||
void renderLine(LineBucket& bucket, const std::string& layer_name);
|
||||
|
||||
|
||||
void drawClippingMask();
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
#ifndef LLMR_GEOMETRY_STROKEBUCKET
|
||||
#define LLMR_GEOMETRY_STROKEBUCKET
|
||||
|
||||
#include "bucket.hpp"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace llmr {
|
||||
|
||||
class Style;
|
||||
class StrokeBuffer;
|
||||
|
||||
class StrokeBucket : public Bucket {
|
||||
public:
|
||||
virtual void draw(const Style& style, const std::string& layerName);
|
||||
|
||||
private:
|
||||
std::shared_ptr<StrokeBuffer> buffer;
|
||||
|
||||
// hold information on where the vertices are located in the StrokeBuffer
|
||||
uint32_t vertex_start;
|
||||
uint32_t length;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -11,7 +11,7 @@ namespace llmr {
|
||||
class ClassDescription {
|
||||
public:
|
||||
std::map<std::string, FillClass> fill;
|
||||
std::map<std::string, StrokeClass> stroke;
|
||||
std::map<std::string, LineClass> line;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -53,16 +53,16 @@ struct FunctionProperty {
|
||||
};
|
||||
|
||||
|
||||
// StrokeClass is the information we parse from the stylesheet
|
||||
struct StrokeClass {
|
||||
// LineClass is the information we parse from the stylesheet
|
||||
struct LineClass {
|
||||
FunctionProperty<bool> hidden;
|
||||
FunctionProperty<float> width;
|
||||
FunctionProperty<float> offset;
|
||||
Color color = {{ 0, 0, 0, 1 }};
|
||||
};
|
||||
|
||||
// StrokeProperties is the one we resolve this to.
|
||||
struct StrokeProperties {
|
||||
// LineProperties is the one we resolve this to.
|
||||
struct LineProperties {
|
||||
bool hidden = false;
|
||||
float width = 0;
|
||||
float offset = 0;
|
||||
|
||||
@@ -28,7 +28,7 @@ private:
|
||||
static LayerDescription parseLayer(pbf data);
|
||||
static std::pair<std::string, ClassDescription> parseClass(pbf data);
|
||||
static std::pair<std::string, FillClass> parseFillClass(pbf data);
|
||||
static std::pair<std::string, StrokeClass> parseStrokeClass(pbf data);
|
||||
static std::pair<std::string, LineClass> parseLineClass(pbf data);
|
||||
template <typename T> static FunctionProperty<T> parseProperty(pbf data);
|
||||
static Color parseColor(pbf& data);
|
||||
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
std::set<std::string> appliedClasses;
|
||||
struct {
|
||||
std::map<std::string, FillProperties> fills;
|
||||
std::map<std::string, StrokeProperties> strokes;
|
||||
std::map<std::string, LineProperties> lines;
|
||||
} computed;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user