rename Tile to TileData
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#define LLMR_MAP_MAP
|
||||
|
||||
#include <llmr/map/tile.hpp>
|
||||
#include <llmr/map/tile_data.hpp>
|
||||
#include <llmr/map/transform.hpp>
|
||||
#include <llmr/style/style.hpp>
|
||||
#include <llmr/renderer/painter.hpp>
|
||||
@@ -64,8 +65,8 @@ private:
|
||||
bool findLoadedChildren(const Tile::ID& id, int32_t maxCoveringZoom, std::forward_list<Tile::ID>& retain);
|
||||
bool findLoadedParent(const Tile::ID& id, int32_t minCoveringZoom, std::forward_list<Tile::ID>& retain);
|
||||
bool updateTiles();
|
||||
std::shared_ptr<Tile> addTile(const Tile::ID& id);
|
||||
std::shared_ptr<Tile> hasTile(const Tile::ID& id);
|
||||
std::shared_ptr<TileData> addTile(const Tile::ID& id);
|
||||
std::shared_ptr<TileData> hasTile(const Tile::ID& id);
|
||||
|
||||
|
||||
void update();
|
||||
@@ -81,8 +82,8 @@ private:
|
||||
|
||||
float pixel_ratio;
|
||||
|
||||
std::forward_list<std::shared_ptr<Tile>> tiles;
|
||||
std::forward_list<std::shared_ptr<Tile>> historic_tiles;
|
||||
std::forward_list<std::shared_ptr<TileData>> tiles;
|
||||
std::forward_list<std::shared_ptr<TileData>> historic_tiles;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -2,104 +2,19 @@
|
||||
#define LLMR_MAP_TILE
|
||||
|
||||
#include <llmr/util/vec.hpp>
|
||||
#include <llmr/util/mat4.hpp>
|
||||
#include <llmr/util/noncopyable.hpp>
|
||||
#include <llmr/geometry/debug_font_buffer.hpp>
|
||||
#include <llmr/geometry/vao.hpp>
|
||||
#include <llmr/platform/platform.hpp>
|
||||
|
||||
#include <cstdint>
|
||||
#include <forward_list>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <atomic>
|
||||
|
||||
namespace llmr {
|
||||
|
||||
class Style;
|
||||
class Bucket;
|
||||
class LayerDescription;
|
||||
class BucketDescription;
|
||||
class VectorTile;
|
||||
class VectorTileLayer;
|
||||
class FillVertexBuffer;
|
||||
class LineVertexBuffer;
|
||||
class PointVertexBuffer;
|
||||
class TriangleElementsBuffer;
|
||||
class LineElementsBuffer;
|
||||
class PointElementsBuffer;
|
||||
class PlainShader;
|
||||
|
||||
class Tile : public std::enable_shared_from_this<Tile>,
|
||||
private util::noncopyable {
|
||||
class Tile {
|
||||
public:
|
||||
struct exception : std::exception {};
|
||||
struct geometry_too_long_exception : exception {};
|
||||
|
||||
public:
|
||||
typedef std::shared_ptr<Tile> Ptr;
|
||||
|
||||
typedef vec3<int32_t> ID;
|
||||
|
||||
enum state {
|
||||
initial,
|
||||
loading,
|
||||
loaded,
|
||||
parsed,
|
||||
obsolete
|
||||
};
|
||||
|
||||
public:
|
||||
Tile(ID id, const Style& style);
|
||||
~Tile();
|
||||
|
||||
// Start loading the tile.
|
||||
void request();
|
||||
|
||||
// Other functions
|
||||
bool parse();
|
||||
void parseStyleLayers(const VectorTile& tile, const std::vector<LayerDescription>& layers);
|
||||
std::shared_ptr<Bucket> createBucket(const VectorTile& tile, 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);
|
||||
std::shared_ptr<Bucket> createPointBucket(const VectorTileLayer& layer, const BucketDescription& bucket_desc);
|
||||
|
||||
void cancel();
|
||||
|
||||
const std::string toString() const;
|
||||
|
||||
static ID parent(const ID& id, int32_t z);
|
||||
static std::forward_list<ID> children(const ID& id, int32_t z);
|
||||
|
||||
public:
|
||||
const ID id;
|
||||
uint8_t clip_id;
|
||||
std::atomic<state> state;
|
||||
|
||||
// Holds the actual geometries in this tile.
|
||||
DebugFontBuffer debugFontBuffer;
|
||||
VertexArrayObject debugFontArray;
|
||||
|
||||
std::shared_ptr<FillVertexBuffer> fillVertexBuffer;
|
||||
std::shared_ptr<LineVertexBuffer> lineVertexBuffer;
|
||||
std::shared_ptr<PointVertexBuffer> pointVertexBuffer;
|
||||
|
||||
std::shared_ptr<TriangleElementsBuffer> triangleElementsBuffer;
|
||||
std::shared_ptr<LineElementsBuffer> lineElementsBuffer;
|
||||
std::shared_ptr<PointElementsBuffer> pointElementsBuffer;
|
||||
|
||||
// Holds the buckets of this tile.
|
||||
// They contain the location offsets in the buffers stored above
|
||||
std::map<std::string, std::shared_ptr<Bucket>> buckets;
|
||||
|
||||
mat4 matrix;
|
||||
private:
|
||||
// Source data
|
||||
std::string data;
|
||||
const Style& style;
|
||||
platform::Request *req = nullptr;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
103
include/llmr/map/tile_data.hpp
Normal file
103
include/llmr/map/tile_data.hpp
Normal file
@@ -0,0 +1,103 @@
|
||||
#ifndef LLMR_MAP_TILE_DATA
|
||||
#define LLMR_MAP_TILE_DATA
|
||||
|
||||
#include <llmr/map/tile.hpp>
|
||||
#include <llmr/util/vec.hpp>
|
||||
#include <llmr/util/mat4.hpp>
|
||||
#include <llmr/util/noncopyable.hpp>
|
||||
#include <llmr/geometry/debug_font_buffer.hpp>
|
||||
#include <llmr/geometry/vao.hpp>
|
||||
#include <llmr/platform/platform.hpp>
|
||||
|
||||
#include <cstdint>
|
||||
#include <forward_list>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <atomic>
|
||||
|
||||
namespace llmr {
|
||||
|
||||
class Style;
|
||||
class Bucket;
|
||||
class LayerDescription;
|
||||
class BucketDescription;
|
||||
class VectorTile;
|
||||
class VectorTileLayer;
|
||||
class FillVertexBuffer;
|
||||
class LineVertexBuffer;
|
||||
class PointVertexBuffer;
|
||||
class TriangleElementsBuffer;
|
||||
class LineElementsBuffer;
|
||||
class PointElementsBuffer;
|
||||
class PlainShader;
|
||||
|
||||
class TileData : public std::enable_shared_from_this<TileData>,
|
||||
private util::noncopyable {
|
||||
public:
|
||||
struct exception : std::exception {};
|
||||
struct geometry_too_long_exception : exception {};
|
||||
|
||||
public:
|
||||
typedef std::shared_ptr<TileData> Ptr;
|
||||
|
||||
enum state {
|
||||
initial,
|
||||
loading,
|
||||
loaded,
|
||||
parsed,
|
||||
obsolete
|
||||
};
|
||||
|
||||
public:
|
||||
TileData(Tile::ID id, const Style& style);
|
||||
~TileData();
|
||||
|
||||
// Start loading the tile.
|
||||
void request();
|
||||
|
||||
// Other functions
|
||||
bool parse();
|
||||
void parseStyleLayers(const VectorTile& tile, const std::vector<LayerDescription>& layers);
|
||||
std::shared_ptr<Bucket> createBucket(const VectorTile& tile, 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);
|
||||
std::shared_ptr<Bucket> createPointBucket(const VectorTileLayer& layer, const BucketDescription& bucket_desc);
|
||||
|
||||
void cancel();
|
||||
|
||||
const std::string toString() const;
|
||||
|
||||
public:
|
||||
const Tile::ID id;
|
||||
uint8_t clip_id;
|
||||
std::atomic<state> state;
|
||||
|
||||
// Holds the actual geometries in this tile.
|
||||
DebugFontBuffer debugFontBuffer;
|
||||
VertexArrayObject debugFontArray;
|
||||
|
||||
std::shared_ptr<FillVertexBuffer> fillVertexBuffer;
|
||||
std::shared_ptr<LineVertexBuffer> lineVertexBuffer;
|
||||
std::shared_ptr<PointVertexBuffer> pointVertexBuffer;
|
||||
|
||||
std::shared_ptr<TriangleElementsBuffer> triangleElementsBuffer;
|
||||
std::shared_ptr<LineElementsBuffer> lineElementsBuffer;
|
||||
std::shared_ptr<PointElementsBuffer> pointElementsBuffer;
|
||||
|
||||
// Holds the buckets of this tile.
|
||||
// They contain the location offsets in the buffers stored above
|
||||
std::map<std::string, std::shared_ptr<Bucket>> buckets;
|
||||
|
||||
mat4 matrix;
|
||||
private:
|
||||
// Source data
|
||||
std::string data;
|
||||
const Style& style;
|
||||
platform::Request *req = nullptr;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef LLMR_RENDERER_PAINTER
|
||||
#define LLMR_RENDERER_PAINTER
|
||||
|
||||
#include <llmr/map/tile.hpp>
|
||||
#include <llmr/map/tile_data.hpp>
|
||||
#include <llmr/geometry/vao.hpp>
|
||||
#include <llmr/geometry/vertex_buffer.hpp>
|
||||
#include <llmr/util/mat4.hpp>
|
||||
@@ -33,7 +33,7 @@ public:
|
||||
void setup();
|
||||
void clear();
|
||||
void changeMatrix();
|
||||
void render(const std::shared_ptr<Tile>& tile);
|
||||
void render(const std::shared_ptr<TileData>& tile);
|
||||
void renderMatte();
|
||||
void renderBackground();
|
||||
void renderFill(FillBucket& bucket, const std::string& layer_name, const Tile::ID& id);
|
||||
@@ -45,8 +45,8 @@ public:
|
||||
void finishClippingMask();
|
||||
private:
|
||||
void setupShaders();
|
||||
void renderLayers(const std::shared_ptr<Tile>& tile, const std::vector<LayerDescription>& layers);
|
||||
void renderDebug(const std::shared_ptr<Tile>& tile);
|
||||
void renderLayers(const std::shared_ptr<TileData>& tile, const std::vector<LayerDescription>& layers);
|
||||
void renderDebug(const std::shared_ptr<TileData>& tile);
|
||||
|
||||
void useProgram(uint32_t program);
|
||||
void lineWidth(float lineWidth);
|
||||
|
||||
Reference in New Issue
Block a user