diff options
author | Gali Nelle <galinelle.mapbox@gmail.com> | 2020-03-25 17:35:44 +0200 |
---|---|---|
committer | galinelle <paolo.angelelli@mapbox.com> | 2020-04-08 14:00:26 +0300 |
commit | 9a55c282fecfdd76b1acdf64cef0ce2ed99472ef (patch) | |
tree | d2c412ef6ac4782d28cea66b761deeb5fff10cc3 /scripts | |
parent | 7f53cec17b047a1804952a8da543dc10321e1dae (diff) | |
download | qtlocation-mapboxgl-9a55c282fecfdd76b1acdf64cef0ce2ed99472ef.tar.gz |
Add LocationIndicatorLayer
New key is "G" in mbgl-glfw, cycling between no puck, centered
in the viewport and positioned in Tokyo.
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/generate-style-code.js | 4 | ||||
-rw-r--r-- | scripts/style-spec.js | 183 |
2 files changed, 184 insertions, 3 deletions
diff --git a/scripts/generate-style-code.js b/scripts/generate-style-code.js index 804d4a243f..08fd1fba19 100755 --- a/scripts/generate-style-code.js +++ b/scripts/generate-style-code.js @@ -64,7 +64,7 @@ global.evaluatedType = function (property) { case 'boolean': return 'bool'; case 'number': - return 'float'; + return /location$/.test(property.name) ? 'double' : 'float'; case 'resolvedImage': return 'expression::Image'; case 'formatted': @@ -77,7 +77,7 @@ global.evaluatedType = function (property) { return `Color`; case 'array': if (property.length) { - return `std::array<${evaluatedType({type: property.value})}, ${property.length}>`; + return `std::array<${evaluatedType({type: property.value, name: property.name})}, ${property.length}>`; } else { return `std::vector<${evaluatedType({type: property.value, name: property.name})}>`; } diff --git a/scripts/style-spec.js b/scripts/style-spec.js index 8a9c9d4144..c0acbebd91 100644 --- a/scripts/style-spec.js +++ b/scripts/style-spec.js @@ -1 +1,182 @@ -var spec = module.exports = require('../mapbox-gl-js/src/style-spec/reference/v8'); +const referenceSpec = require('../mapbox-gl-js/src/style-spec/reference/v8'); + +referenceSpec.layer.type.values["location-indicator"] = {}; +referenceSpec["layout_location-indicator"] = { + "top-image": { + "type": "resolvedImage", + "property-type": "data-constant", + "expression": { + "interpolated": false, + "parameters": [ + "zoom" + ] + }, + "doc": "Name of image in sprite to use as the top of the location indicator." + }, + "bearing-image": { + "type": "resolvedImage", + "property-type": "data-constant", + "expression": { + "interpolated": false, + "parameters": [ + "zoom" + ] + }, + "doc": "Name of image in sprite to use as the middle of the location indicator." + }, + "shadow-image": { + "type": "resolvedImage", + "property-type": "data-constant", + "expression": { + "interpolated": false, + "parameters": [ + "zoom" + ] + }, + "doc": "Name of image in sprite to use as the background of the location indicator." + }, + "perspective-compensation": { + "type": "number", + "default": "0.85", + "property-type": "data-constant", + "expression": { + "interpolated": true, + "parameters": [ + "zoom" + ] + }, + "doc": "The amount of the perspective compensation, between 0 and 1. A value of 1 produces a location indicator of constant width across the screen. A value of 0 makes it scale naturally according to the viewing projection." + }, + "bearing": { + "type": "number", + "default": "0", + "default": 0, + "period": 360, + "units": "degrees", + "property-type": "data-constant", + "expression": { + "interpolated": false, + "parameters": [ ] + }, + "transition": false, + "doc": "The bearing of the location indicator." + }, + "image-tilt-displacement": { + "type": "number", + "property-type": "data-constant", + "default": "0", + "units": "pixels", + "expression": { + "interpolated": true, + "parameters": [ + "zoom" + ] + }, + "doc": "The displacement off the center of the top image and the shadow image when the pitch of the map is greater than 0. This helps producing a three-dimensional appearence." + } +}; + +referenceSpec["paint_location-indicator"] = { + "location": { + "type": "array", + "default": [ + 0.0, + 0.0, + 0.0 + ], + "length": 3, + "value": "number", + "property-type": "data-constant", + "expression": { + "interpolated": true, + "parameters": [] + }, + "transition": true, + "doc": "An array of [latitude, longitude, altitude] position of the location indicator." + }, + "accuracy-radius": { + "type": "number", + "units": "meters", + "default": 0, + "property-type": "data-constant", + "expression": { + "interpolated": true, + "parameters": [ + "zoom" + ] + }, + "transition": true, + "doc": "The accuracy, in meters, of the position source used to retrieve the position of the location indicator." + }, + "top-image-size": { + "type": "number", + "units": "pixels", + "property-type": "data-constant", + "default": 0, + "expression": { + "interpolated": true, + "parameters": [ + "zoom" + ] + }, + "transition": true, + "doc": "The size of the top image, in pixels." + }, + "bearing-image-size": { + "type": "number", + "units": "pixels", + "property-type": "data-constant", + "default": 0, + "expression": { + "interpolated": true, + "parameters": [ + "zoom" + ] + }, + "transition": true, + "doc": "The size of the bearing image, in pixels." + }, + "shadow-image-size": { + "type": "number", + "units": "pixels", + "property-type": "data-constant", + "default": 0, + "expression": { + "interpolated": true, + "parameters": [ + "zoom" + ] + }, + "transition": true, + "doc": "The size of the shadow image, in pixels." + }, + "accuracy-radius-color": { + "type": "color", + "property-type": "data-constant", + "default": "#ffffff", + "expression": { + "interpolated": true, + "parameters": [ + "zoom" + ] + }, + "transition": true, + "doc": "The color for drawing the accuracy radius, as a circle. To adjust transparency, set the alpha component of the color accordingly." + + }, + "accuracy-radius-border-color": { + "type": "color", + "property-type": "data-constant", + "default": "#ffffff", + "expression": { + "interpolated": true, + "parameters": [ + "zoom" + ] + }, + "transition": true, + "doc": "The color for drawing the accuracy radius border. To adjust transparency, set the alpha component of the color accordingly." + } +}; + +var spec = module.exports = referenceSpec |