[core] Replace {Source,Camera,Composite}Function with PropertyExpression

This commit is contained in:
John Firebaugh
2018-07-13 18:14:12 -07:00
parent 6d7072162b
commit c8edbb0500
53 changed files with 722 additions and 971 deletions

View File

@@ -17,14 +17,20 @@ std::unique_ptr<SymbolSizeBinder> SymbolSizeBinder::create(const float tileZoom,
const style::DataDrivenPropertyValue<float>& sizeProperty,
const float defaultValue) {
return sizeProperty.match(
[&] (const style::CompositeFunction<float>& function) -> std::unique_ptr<SymbolSizeBinder> {
return std::make_unique<CompositeFunctionSymbolSizeBinder>(tileZoom, function, defaultValue);
},
[&] (const style::SourceFunction<float>& function) {
return std::make_unique<SourceFunctionSymbolSizeBinder>(tileZoom, function, defaultValue);
},
[&] (const auto& value) -> std::unique_ptr<SymbolSizeBinder> {
[&] (const Undefined& value) -> std::unique_ptr<SymbolSizeBinder> {
return std::make_unique<ConstantSymbolSizeBinder>(tileZoom, value, defaultValue);
},
[&] (float value) -> std::unique_ptr<SymbolSizeBinder> {
return std::make_unique<ConstantSymbolSizeBinder>(tileZoom, value, defaultValue);
},
[&] (const style::PropertyExpression<float>& expression) -> std::unique_ptr<SymbolSizeBinder> {
if (expression.isFeatureConstant()) {
return std::make_unique<ConstantSymbolSizeBinder>(tileZoom, expression, defaultValue);
} else if (expression.isZoomConstant()) {
return std::make_unique<SourceFunctionSymbolSizeBinder>(tileZoom, expression, defaultValue);
} else {
return std::make_unique<CompositeFunctionSymbolSizeBinder>(tileZoom, expression, defaultValue);
}
}
);
}