#ifndef LLMR_MAP_VECTOR_TILE #define LLMR_MAP_VECTOR_TILE #include #include #include #include #include #include #include #include namespace llmr { class BucketDescription; class VectorTileLayer; struct pbf; enum class FeatureType { Unknown = 0, Point = 1, LineString = 2, Polygon = 3 }; std::ostream& operator<<(std::ostream&, const FeatureType& type); class VectorTileFeature { public: VectorTileFeature(pbf feature, const VectorTileLayer& layer); uint64_t id = 0; FeatureType type = FeatureType::Unknown; std::map properties; pbf geometry; }; std::ostream& operator<<(std::ostream&, const VectorTileFeature& feature); /* * Allows iterating over the features of a VectorTileLayer using a * BucketDescription as filter. Only features matching the descriptions will * be returned (as pbf). */ class FilteredVectorTileLayer { public: class iterator { public: iterator(const FilteredVectorTileLayer& filter, const pbf& data); void operator++(); bool operator!=(const iterator& other) const; const pbf& operator*() const; private: const FilteredVectorTileLayer& filter; bool valid = false; pbf feature; pbf data; }; public: FilteredVectorTileLayer(const VectorTileLayer& layer, const BucketDescription& bucket_desc); iterator begin() const; iterator end() const; private: const VectorTileLayer& layer; const BucketDescription& bucket_desc; int32_t key = -1; std::set values; }; std::ostream& operator<<(std::ostream&, const GlyphPlacement& placement); class VectorTileLayer { public: VectorTileLayer(pbf data); const pbf data; std::string name; uint32_t extent = 4096; std::vector keys; std::vector values; std::vector faces; std::map> shaping; }; class VectorTileGlyph { public: VectorTileGlyph(); VectorTileGlyph(pbf data); uint32_t id = 0; // A signed distance field of the glyph with a border of 3 pixels. std::string bitmap; // Glyph metrics GlyphMetrics metrics; }; std::ostream& operator<<(std::ostream&, const VectorTileGlyph& glyph); class VectorTileFace { public: VectorTileFace(pbf data); std::string name; std::string family; std::string style; std::vector glyphs; }; std::ostream& operator<<(std::ostream&, const VectorTileFace& face); class VectorTile { public: VectorTile(); VectorTile(pbf data); VectorTile& operator=(VectorTile&& other); std::map layers; std::map faces; }; } #endif