separate bucket render properties and change naming

This commit is contained in:
Konstantin Käfer
2014-06-16 11:49:11 +02:00
parent 610a9e4a63
commit 71d2b230a1
16 changed files with 362 additions and 236 deletions

View File

@@ -41,7 +41,7 @@ public:
FillBucket(FillVertexBuffer& vertexBuffer,
TriangleElementsBuffer& triangleElementsBuffer,
LineElementsBuffer& lineElementsBuffer,
const BucketDescription& bucket_desc);
const BucketFillDescription& properties);
~FillBucket();
virtual void render(Painter& painter, const std::string& layer_name, const Tile::ID& id);
@@ -55,7 +55,7 @@ public:
void drawVertices(OutlineShader& shader);
public:
const BucketGeometryDescription geom_desc;
const BucketFillDescription &properties;
private:
TESSalloc *allocator;

View File

@@ -26,7 +26,7 @@ class VectorTileFeature;
class IconBucket : public Bucket {
public:
IconBucket(IconVertexBuffer& vertexBuffer,
const BucketDescription& bucket_desc);
const BucketIconDescription& properties);
virtual void render(Painter& painter, const std::string& layer_name, const Tile::ID& id);
virtual bool hasData() const;
@@ -37,7 +37,7 @@ public:
void drawIcons(DotShader& shader);
public:
const BucketGeometryDescription geometry;
const BucketIconDescription &properties;
private:

View File

@@ -25,7 +25,7 @@ public:
LineBucket(LineVertexBuffer& vertexBuffer,
TriangleElementsBuffer& triangleElementsBuffer,
PointElementsBuffer& pointElementsBuffer,
const BucketDescription& bucket_desc);
const BucketLineDescription& properties);
virtual void render(Painter& painter, const std::string& layer_name, const Tile::ID& id);
virtual bool hasData() const;
@@ -39,7 +39,7 @@ public:
void drawPoints(LinejoinShader& shader);
public:
const BucketGeometryDescription geometry;
const BucketLineDescription &properties;
private:

View File

@@ -28,7 +28,7 @@ public:
TextBucket(
TextVertexBuffer &vertexBuffer,
TriangleElementsBuffer &triangleElementsBuffer,
const BucketDescription &bucket_desc, Placement &placement);
const BucketTextDescription &properties, Placement &placement);
virtual void render(Painter &painter, const std::string &layer_name, const Tile::ID &id);
virtual bool hasData() const;
@@ -43,7 +43,7 @@ public:
void drawGlyphs(TextShader &shader);
public:
const BucketGeometryDescription &geom_desc;
const BucketTextDescription &properties;
private:
TextVertexBuffer& vertexBuffer;

View File

@@ -82,31 +82,50 @@ inline float verticalAlignmentType(const std::string& alignment) {
else return 0.5;
};
class BucketFillDescription {
public:
};
class BucketGeometryDescription {
class BucketLineDescription {
public:
CapType cap = CapType::None;
JoinType join = JoinType::None;
std::string font;
std::string field;
std::string icon;
float size = 0.0f;
float miter_limit = 2.0f;
float round_limit = 1.0f;
TextPathType path = TextPathType::Horizontal;
float alignment = 0.5;
float vertical_alignment = 0.5;
float line_height = 1.2 * 24;
float max_width = 15.0f * 24;
float letter_spacing = 0;
vec2<float> translate {0, 0};
float padding = 2.0f;
float textMinDistance = 250.0f;
float rotate = 0.0f; // what is this?
float maxAngleDelta = M_PI;
bool alwaysVisible = false;
};
class BucketIconDescription {
public:
uint16_t size = 16;
vec2<float> translate {0, 0};
std::string icon;
};
class BucketTextDescription {
public:
std::string field;
TextPathType path = TextPathType::Horizontal;
std::string font;
float max_size = 16.0f;
float max_width = 15.0f * 24;
float line_height = 1.2f * 24;
float letter_spacing = 0.0f;
float alignment = 0.5f;
float vertical_alignment = 0.5;
vec2<float> translate {0, 0};
float max_angle_delta = M_PI;
float min_distance = 250.0f;
float rotate = 0.0f; // what is this?
float padding = 2.0f;
bool always_visible = false;
};
class BucketRasterDescription {
public:
};
typedef util::variant<BucketFillDescription, BucketLineDescription, BucketIconDescription,
BucketTextDescription, BucketRasterDescription> BucketRenderDescription;
class BucketDescription {
public:
@@ -120,7 +139,7 @@ public:
PropertyFilterExpression filter = std::true_type();
// Specifies how the geometry for this bucket should be created
BucketGeometryDescription geometry;
BucketRenderDescription render;
};
std::ostream& operator<<(std::ostream&, const BucketDescription& bucket);

View File

@@ -10,14 +10,14 @@
namespace llmr {
class TextBucket;
class BucketGeometryDescription;
class BucketTextDescription;
class Placement {
public:
Placement(int8_t zoom);
void addFeature(TextBucket &bucket, const std::vector<Coordinate> &line,
const BucketGeometryDescription &info,
const BucketTextDescription &info,
const GlyphPositions &face,
const Shaping &shaping);