This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #928 from mapbox/928-refactor-vend-geometry
refactor VectorTile to vend geometry
- Loading branch information
Showing
16 changed files
with
263 additions
and
443 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#include <mbgl/map/geometry_tile.hpp> | ||
#include <mbgl/style/filter_expression_private.hpp> | ||
|
||
namespace mbgl { | ||
|
||
mapbox::util::optional<Value> GeometryTileFeatureExtractor::getValue(const std::string& key) const { | ||
if (key == "$type") { | ||
return Value(uint64_t(feature.getType())); | ||
} | ||
|
||
return feature.getValue(key); | ||
} | ||
|
||
template bool evaluate(const FilterExpression&, const GeometryTileFeatureExtractor&); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#ifndef MBGL_MAP_GEOMETRY_TILE | ||
#define MBGL_MAP_GEOMETRY_TILE | ||
|
||
#include <mbgl/style/filter_expression.hpp> | ||
#include <mbgl/style/value.hpp> | ||
#include <mbgl/text/glyph.hpp> | ||
#include <mbgl/util/optional.hpp> | ||
#include <mbgl/util/ptr.hpp> | ||
#include <mbgl/util/variant.hpp> | ||
#include <mbgl/util/vec.hpp> | ||
#include <mbgl/util/noncopyable.hpp> | ||
|
||
#include <cstdint> | ||
#include <map> | ||
#include <string> | ||
#include <type_traits> | ||
#include <unordered_map> | ||
#include <vector> | ||
|
||
namespace mbgl { | ||
|
||
enum class FeatureType : uint8_t { | ||
Unknown = 0, | ||
Point = 1, | ||
LineString = 2, | ||
Polygon = 3 | ||
}; | ||
|
||
typedef std::vector<std::vector<Coordinate>> GeometryCollection; | ||
|
||
class GeometryTileFeature : public mbgl::util::noncopyable { | ||
public: | ||
virtual FeatureType getType() const = 0; | ||
virtual mapbox::util::optional<Value> getValue(const std::string& key) const = 0; | ||
virtual GeometryCollection getGeometries() const = 0; | ||
}; | ||
|
||
class GeometryTileLayer : public mbgl::util::noncopyable { | ||
public: | ||
virtual std::size_t featureCount() const = 0; | ||
virtual util::ptr<const GeometryTileFeature> feature(std::size_t i) const = 0; | ||
}; | ||
|
||
class GeometryTile : public mbgl::util::noncopyable { | ||
public: | ||
virtual util::ptr<const GeometryTileLayer> getLayer(const std::string&) const = 0; | ||
}; | ||
|
||
class GeometryTileFeatureExtractor { | ||
public: | ||
GeometryTileFeatureExtractor(const GeometryTileFeature& feature_) | ||
: feature(feature_) {} | ||
|
||
mapbox::util::optional<Value> getValue(const std::string& key) const; | ||
|
||
private: | ||
const GeometryTileFeature& feature; | ||
}; | ||
|
||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.