Add support for expression test
Fix polygon within algorithm Add Unit tests Fix incorrect metrics folder for ios-render-test-runner job
This commit is contained in:
@@ -9,8 +9,16 @@ namespace expression {
|
||||
class GeoJSONFeature : public GeometryTileFeature {
|
||||
public:
|
||||
const Feature& feature;
|
||||
mutable optional<GeometryCollection> geometry;
|
||||
|
||||
GeoJSONFeature(const Feature& feature_) : feature(feature_) {}
|
||||
GeoJSONFeature(const Feature& feature_, const CanonicalTileID& canonical) : feature(feature_) {
|
||||
geometry = convertGeometry(feature.geometry, canonical);
|
||||
// https://github.com/mapbox/geojson-vt-cpp/issues/44
|
||||
if (getType() == FeatureType::Polygon) {
|
||||
geometry = fixupPolygons(*geometry);
|
||||
}
|
||||
}
|
||||
|
||||
FeatureType getType() const override {
|
||||
return apply_visitor(ToFeatureType(), feature.geometry);
|
||||
@@ -24,6 +32,11 @@ public:
|
||||
}
|
||||
return optional<mbgl::Value>();
|
||||
}
|
||||
const GeometryCollection& getGeometries() const override {
|
||||
if (geometry) return *geometry;
|
||||
geometry = GeometryCollection();
|
||||
return *geometry;
|
||||
}
|
||||
};
|
||||
|
||||
EvaluationResult Expression::evaluate(optional<float> zoom,
|
||||
@@ -41,6 +54,17 @@ EvaluationResult Expression::evaluate(optional<float> zoom,
|
||||
return this->evaluate(EvaluationContext(zoom, &f, colorRampParameter).withAvailableImages(&availableImages));
|
||||
}
|
||||
|
||||
EvaluationResult Expression::evaluate(optional<float> zoom,
|
||||
const Feature& feature,
|
||||
optional<double> colorRampParameter,
|
||||
const std::set<std::string>& availableImages,
|
||||
const CanonicalTileID& canonical) const {
|
||||
GeoJSONFeature f(feature, canonical);
|
||||
return this->evaluate(EvaluationContext(zoom, &f, colorRampParameter)
|
||||
.withAvailableImages(&availableImages)
|
||||
.withCanonicalTileID(&canonical));
|
||||
}
|
||||
|
||||
EvaluationResult Expression::evaluate(optional<mbgl::Value> accumulated, const Feature& feature) const {
|
||||
GeoJSONFeature f(feature);
|
||||
return this->evaluate(EvaluationContext(accumulated, &f));
|
||||
|
||||
Reference in New Issue
Block a user