[core] const consistency
This commit is contained in:
@@ -40,7 +40,7 @@ optional<Value> AnnotationTileFeature::getValue(const std::string& key) const {
|
||||
AnnotationTileLayer::AnnotationTileLayer(std::string name_)
|
||||
: name(std::move(name_)) {}
|
||||
|
||||
util::ptr<GeometryTileLayer> AnnotationTileData::getLayer(const std::string& name) const {
|
||||
util::ptr<const GeometryTileLayer> AnnotationTileData::getLayer(const std::string& name) const {
|
||||
auto it = layers.find(name);
|
||||
if (it != layers.end()) {
|
||||
return it->second;
|
||||
|
||||
@@ -56,7 +56,7 @@ private:
|
||||
|
||||
class AnnotationTileData : public GeometryTileData {
|
||||
public:
|
||||
util::ptr<GeometryTileLayer> getLayer(const std::string&) const override;
|
||||
util::ptr<const GeometryTileLayer> getLayer(const std::string&) const override;
|
||||
|
||||
std::unordered_map<std::string, util::ptr<AnnotationTileLayer>> layers;
|
||||
};
|
||||
|
||||
@@ -40,7 +40,7 @@ private:
|
||||
class GeoJSONTileData : public GeometryTileData {
|
||||
public:
|
||||
GeoJSONTileData(std::shared_ptr<GeoJSONTileLayer>);
|
||||
util::ptr<GeometryTileLayer> getLayer(const std::string&) const override;
|
||||
util::ptr<const GeometryTileLayer> getLayer(const std::string&) const override;
|
||||
|
||||
private:
|
||||
const std::shared_ptr<GeoJSONTileLayer> layer;
|
||||
@@ -136,7 +136,7 @@ util::ptr<const GeometryTileFeature> GeoJSONTileLayer::getFeature(std::size_t i)
|
||||
GeoJSONTileData::GeoJSONTileData(std::shared_ptr<GeoJSONTileLayer> layer_) : layer(std::move(layer_)) {
|
||||
}
|
||||
|
||||
util::ptr<GeometryTileLayer> GeoJSONTileData::getLayer(const std::string&) const {
|
||||
util::ptr<const GeometryTileLayer> GeoJSONTileData::getLayer(const std::string&) const {
|
||||
// We're ignoring the layer name because GeoJSON tiles only have one layer.
|
||||
return layer;
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ std::vector<std::unique_ptr<Layer>> GeometryTile::cloneStyleLayers() const {
|
||||
return result;
|
||||
}
|
||||
|
||||
void GeometryTile::setData(std::unique_ptr<GeometryTileData> data_) {
|
||||
void GeometryTile::setData(std::unique_ptr<const GeometryTileData> data_) {
|
||||
if (!data_) {
|
||||
// This is a 404 response. We're treating these as empty tiles.
|
||||
workRequest.reset();
|
||||
|
||||
@@ -31,7 +31,7 @@ public:
|
||||
~GeometryTile() override;
|
||||
|
||||
void setError(std::exception_ptr err);
|
||||
void setData(std::unique_ptr<GeometryTileData>);
|
||||
void setData(std::unique_ptr<const GeometryTileData>);
|
||||
|
||||
Bucket* getBucket(const style::Layer&) override;
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
class GeometryTileData : private util::noncopyable {
|
||||
public:
|
||||
virtual ~GeometryTileData() = default;
|
||||
virtual util::ptr<GeometryTileLayer> getLayer(const std::string&) const = 0;
|
||||
virtual util::ptr<const GeometryTileLayer> getLayer(const std::string&) const = 0;
|
||||
};
|
||||
|
||||
// classifies an array of rings into polygons with outer rings and holes
|
||||
|
||||
@@ -59,7 +59,7 @@ class VectorTileData : public GeometryTileData {
|
||||
public:
|
||||
VectorTileData(std::shared_ptr<const std::string> data);
|
||||
|
||||
util::ptr<GeometryTileLayer> getLayer(const std::string&) const override;
|
||||
util::ptr<const GeometryTileLayer> getLayer(const std::string&) const override;
|
||||
|
||||
private:
|
||||
std::shared_ptr<const std::string> data;
|
||||
@@ -242,7 +242,7 @@ VectorTileData::VectorTileData(std::shared_ptr<const std::string> data_)
|
||||
: data(std::move(data_)) {
|
||||
}
|
||||
|
||||
util::ptr<GeometryTileLayer> VectorTileData::getLayer(const std::string& name) const {
|
||||
util::ptr<const GeometryTileLayer> VectorTileData::getLayer(const std::string& name) const {
|
||||
if (!parsed) {
|
||||
parsed = true;
|
||||
protozero::pbf_reader tile_pbf(*data);
|
||||
|
||||
@@ -31,7 +31,7 @@ public:
|
||||
|
||||
void parseGeometryTile(TileWorker* worker,
|
||||
std::vector<std::unique_ptr<style::Layer>> layers,
|
||||
std::unique_ptr<GeometryTileData> tileData,
|
||||
std::unique_ptr<const GeometryTileData> tileData,
|
||||
PlacementConfig config,
|
||||
std::function<void(TileParseResult)> callback) {
|
||||
try {
|
||||
@@ -80,7 +80,7 @@ Worker::parseRasterTile(std::unique_ptr<RasterBucket> bucket,
|
||||
std::unique_ptr<AsyncRequest>
|
||||
Worker::parseGeometryTile(TileWorker& worker,
|
||||
std::vector<std::unique_ptr<style::Layer>> layers,
|
||||
std::unique_ptr<GeometryTileData> tileData,
|
||||
std::unique_ptr<const GeometryTileData> tileData,
|
||||
PlacementConfig config,
|
||||
std::function<void(TileParseResult)> callback) {
|
||||
current = (current + 1) % threads.size();
|
||||
|
||||
@@ -41,7 +41,7 @@ public:
|
||||
|
||||
Request parseGeometryTile(TileWorker&,
|
||||
std::vector<std::unique_ptr<style::Layer>>,
|
||||
std::unique_ptr<GeometryTileData>,
|
||||
std::unique_ptr<const GeometryTileData>,
|
||||
PlacementConfig,
|
||||
std::function<void(TileParseResult)> callback);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user