#pragma once #include #include namespace mbgl { namespace style { namespace conversion { template <> struct Converter { template optional operator()(const V& value, Error& error) const { GeoJSONOptions options; const auto maxzoomValue = objectMember(value, "maxzoom"); if (maxzoomValue) { if (toNumber(*maxzoomValue)) { options.maxzoom = static_cast(*toNumber(*maxzoomValue)); } else { error = { "GeoJSON source maxzoom value must be a number" }; return {}; } } const auto bufferValue = objectMember(value, "buffer"); if (bufferValue) { if (toNumber(*bufferValue)) { options.buffer = static_cast(*toNumber(*bufferValue)); } else { error = { "GeoJSON source buffer value must be a number" }; return {}; } } const auto toleranceValue = objectMember(value, "tolerance"); if (toleranceValue) { if (toNumber(*toleranceValue)) { options.tolerance = static_cast(*toNumber(*toleranceValue)); } else { error = { "GeoJSON source tolerance value must be a number" }; return {}; } } const auto clusterValue = objectMember(value, "cluster"); if (clusterValue) { if (toBool(*clusterValue)) { options.cluster = *toBool(*clusterValue); } else { error = { "GeoJSON source cluster value must be a boolean" }; return {}; } } const auto clusterMaxZoomValue = objectMember(value, "clusterMaxZoom"); if (clusterMaxZoomValue) { if (toNumber(*clusterMaxZoomValue)) { options.clusterMaxZoom = static_cast(*toNumber(*clusterMaxZoomValue)); } else { error = { "GeoJSON source clusterMaxZoom value must be a number" }; return {}; } } const auto clusterRadiusValue = objectMember(value, "clusterRadius"); if (clusterRadiusValue) { if (toNumber(*clusterRadiusValue)) { options.clusterRadius = static_cast(*toNumber(*clusterRadiusValue)); } else { error = { "GeoJSON source clusterRadius value must be a number" }; return {}; } } return { options }; } }; } // namespace conversion } // namespace style } // namespace mbgl