#pragma once #include #include #include #include #include #include #include #include #include #include #include #include #include namespace mbgl { enum class FeatureType : uint8_t { Unknown = 0, Point = 1, LineString = 2, Polygon = 3 }; class CanonicalTileID; // Normalized vector tile coordinates. // Each geometry coordinate represents a point in a bidimensional space, // varying from -V...0...+V, where V is the maximum extent applicable. using GeometryCoordinate = Point; class GeometryCoordinates : public std::vector { public: using coordinate_type = int16_t; using std::vector::vector; }; class GeometryCollection : public std::vector { public: using coordinate_type = int16_t; using std::vector::vector; }; class GeometryTileFeature : private util::noncopyable { public: virtual ~GeometryTileFeature() = default; virtual FeatureType getType() const = 0; virtual optional getValue(const std::string& key) const = 0; virtual Feature::property_map getProperties() const { return Feature::property_map(); } virtual optional getID() const { return {}; } virtual GeometryCollection getGeometries() const = 0; }; class GeometryTileLayer : private util::noncopyable { public: virtual ~GeometryTileLayer() = default; virtual std::size_t featureCount() const = 0; virtual util::ptr getFeature(std::size_t) const = 0; virtual std::string getName() const = 0; }; class GeometryTileData : private util::noncopyable { public: virtual ~GeometryTileData() = default; virtual util::ptr getLayer(const std::string&) const = 0; }; // classifies an array of rings into polygons with outer rings and holes std::vector classifyRings(const GeometryCollection&); // Truncate polygon to the largest `maxHoles` inner rings by area. void limitHoles(GeometryCollection&, uint32_t maxHoles); // convert from GeometryTileFeature to Feature (eventually we should eliminate GeometryTileFeature) Feature convertFeature(const GeometryTileFeature&, const CanonicalTileID&); // Fix up possibly-non-V2-compliant polygon geometry using angus clipper. // The result is guaranteed to have correctly wound, strictly simple rings. GeometryCollection fixupPolygons(const GeometryCollection&); } // namespace mbgl