move to raster buckets & tile parser handling raster decoding

This commit is contained in:
Justin R. Miller
2014-04-09 11:38:42 -07:00
parent 482ac31fde
commit e5713f31a6
9 changed files with 95 additions and 40 deletions

View File

@@ -8,7 +8,7 @@ namespace llmr {
class TileParser {
public:
TileParser(const std::string& data, TileData& tile, const Style& style, GlyphAtlas& glyphAtlas);
TileParser(const std::string& data, TileData& tile, const Style& style, GlyphAtlas& glyphAtlas, bool is_raster = false);
private:
bool obsolete() const;
@@ -19,10 +19,12 @@ private:
std::unique_ptr<Bucket> createLineBucket(const VectorTileLayer& layer, const BucketDescription& bucket_desc);
std::unique_ptr<Bucket> createPointBucket(const VectorTileLayer& layer, const BucketDescription& bucket_desc);
std::unique_ptr<Bucket> createTextBucket(const VectorTileLayer& layer, const BucketDescription& bucket_desc);
std::unique_ptr<Bucket> createRasterBucket(const BucketDescription& bucket_desc);
template <class Bucket> void addBucketFeatures(Bucket& bucket, const VectorTileLayer& layer, const BucketDescription& bucket_desc);
private:
const VectorTile data;
const VectorTile vector_data;
const std::string raster_data;
TileData& tile;
const Style& style;
GlyphAtlas& glyphAtlas;

View File

@@ -28,6 +28,7 @@ class FillBucket;
class LineBucket;
class PointBucket;
class TextBucket;
class RasterBucket;
class Painter : private util::noncopyable {
public:
@@ -42,6 +43,7 @@ public:
void renderLine(LineBucket& bucket, const std::string& layer_name, const Tile::ID& id);
void renderPoint(PointBucket& bucket, const std::string& layer_name, const Tile::ID& id);
void renderText(TextBucket& bucket, const std::string& layer_name, const Tile::ID& id);
void renderRaster(const std::string& layer_name, const std::shared_ptr<TileData>& tile_data);
void resize(int width, int height);
@@ -52,7 +54,6 @@ public:
bool needsAnimation() const;
private:
void setupShaders();
void renderRaster(const std::string& layer_name, const std::shared_ptr<TileData>& tile_data);
void renderLayers(const std::shared_ptr<TileData>& tile, const std::vector<LayerDescription>& layers);
void renderLayer(const std::shared_ptr<TileData>& tile_data, const LayerDescription& layer_desc);
void renderDebug(const std::shared_ptr<TileData>& tile);

View File

@@ -0,0 +1,20 @@
#ifndef LLMR_RENDERER_RASTERBUCKET
#define LLMR_RENDERER_RASTERBUCKET
#include <llmr/renderer/bucket.hpp>
#include <llmr/style/bucket_description.hpp>
namespace llmr {
class BucketDescription;
class RasterBucket : public Bucket {
public:
RasterBucket(const BucketDescription& bucket_desc);
virtual void render(Painter& painter, const std::string& layer_name, const Tile::ID& id);
};
}
#endif

View File

@@ -14,7 +14,8 @@ enum class BucketType {
Fill = 1,
Line = 2,
Point = 3,
Text = 4
Text = 4,
Raster = 5
};
enum class CapType {
@@ -42,6 +43,7 @@ inline BucketType bucketType(const std::string& type) {
else if (type == "line") return BucketType::Line;
else if (type == "point") return BucketType::Point;
else if (type == "text") return BucketType::Text;
else if (type == "raster") return BucketType::Raster;
else return BucketType::None;
}