@mapwhit/tilerenderer 1.0.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/min/package.json +2 -1
- package/build/min/src/shaders/_prelude.fragment.glsl.js +1 -1
- package/build/min/src/shaders/_prelude.vertex.glsl.js +1 -1
- package/build/min/src/shaders/background.fragment.glsl.js +1 -1
- package/build/min/src/shaders/background.vertex.glsl.js +1 -1
- package/build/min/src/shaders/background_pattern.fragment.glsl.js +1 -1
- package/build/min/src/shaders/background_pattern.vertex.glsl.js +1 -1
- package/build/min/src/shaders/circle.fragment.glsl.js +1 -1
- package/build/min/src/shaders/circle.vertex.glsl.js +1 -1
- package/build/min/src/shaders/clipping_mask.fragment.glsl.js +1 -1
- package/build/min/src/shaders/clipping_mask.vertex.glsl.js +1 -1
- package/build/min/src/shaders/collision_box.fragment.glsl.js +1 -1
- package/build/min/src/shaders/collision_box.vertex.glsl.js +1 -1
- package/build/min/src/shaders/collision_circle.fragment.glsl.js +1 -1
- package/build/min/src/shaders/collision_circle.vertex.glsl.js +1 -1
- package/build/min/src/shaders/debug.fragment.glsl.js +1 -1
- package/build/min/src/shaders/debug.vertex.glsl.js +1 -1
- package/build/min/src/shaders/fill.fragment.glsl.js +1 -1
- package/build/min/src/shaders/fill.vertex.glsl.js +1 -1
- package/build/min/src/shaders/fill_extrusion.fragment.glsl.js +1 -1
- package/build/min/src/shaders/fill_extrusion.vertex.glsl.js +1 -1
- package/build/min/src/shaders/fill_extrusion_pattern.fragment.glsl.js +1 -1
- package/build/min/src/shaders/fill_extrusion_pattern.vertex.glsl.js +1 -1
- package/build/min/src/shaders/fill_outline.fragment.glsl.js +1 -1
- package/build/min/src/shaders/fill_outline.vertex.glsl.js +1 -1
- package/build/min/src/shaders/fill_outline_pattern.fragment.glsl.js +1 -1
- package/build/min/src/shaders/fill_outline_pattern.vertex.glsl.js +1 -1
- package/build/min/src/shaders/fill_pattern.fragment.glsl.js +1 -1
- package/build/min/src/shaders/fill_pattern.vertex.glsl.js +1 -1
- package/build/min/src/shaders/heatmap.fragment.glsl.js +1 -1
- package/build/min/src/shaders/heatmap.vertex.glsl.js +1 -1
- package/build/min/src/shaders/heatmap_texture.fragment.glsl.js +1 -1
- package/build/min/src/shaders/heatmap_texture.vertex.glsl.js +1 -1
- package/build/min/src/shaders/hillshade.fragment.glsl.js +1 -1
- package/build/min/src/shaders/hillshade.vertex.glsl.js +1 -1
- package/build/min/src/shaders/hillshade_prepare.fragment.glsl.js +1 -1
- package/build/min/src/shaders/hillshade_prepare.vertex.glsl.js +1 -1
- package/build/min/src/shaders/line.fragment.glsl.js +1 -1
- package/build/min/src/shaders/line.vertex.glsl.js +1 -1
- package/build/min/src/shaders/line_gradient.fragment.glsl.js +1 -1
- package/build/min/src/shaders/line_gradient.vertex.glsl.js +1 -1
- package/build/min/src/shaders/line_pattern.fragment.glsl.js +1 -1
- package/build/min/src/shaders/line_pattern.vertex.glsl.js +1 -1
- package/build/min/src/shaders/line_sdf.fragment.glsl.js +1 -1
- package/build/min/src/shaders/line_sdf.vertex.glsl.js +1 -1
- package/build/min/src/shaders/raster.fragment.glsl.js +1 -1
- package/build/min/src/shaders/raster.vertex.glsl.js +1 -1
- package/build/min/src/shaders/symbol_icon.fragment.glsl.js +1 -1
- package/build/min/src/shaders/symbol_icon.vertex.glsl.js +1 -1
- package/build/min/src/shaders/symbol_sdf.fragment.glsl.js +1 -1
- package/build/min/src/shaders/symbol_sdf.vertex.glsl.js +1 -1
- package/package.json +3 -2
- package/src/data/array_types.js +54 -81
- package/src/data/bucket/circle_attributes.js +2 -4
- package/src/data/bucket/circle_bucket.js +19 -13
- package/src/data/bucket/fill_attributes.js +2 -4
- package/src/data/bucket/fill_bucket.js +38 -24
- package/src/data/bucket/fill_extrusion_attributes.js +2 -4
- package/src/data/bucket/fill_extrusion_bucket.js +56 -34
- package/src/data/bucket/heatmap_bucket.js +2 -7
- package/src/data/bucket/line_attributes.js +2 -4
- package/src/data/bucket/line_bucket.js +207 -159
- package/src/data/bucket/pattern_attributes.js +2 -4
- package/src/data/bucket/pattern_bucket_features.js +5 -7
- package/src/data/bucket/symbol_attributes.js +12 -26
- package/src/data/bucket/symbol_bucket.js +111 -221
- package/src/data/bucket/symbol_buffers.js +62 -0
- package/src/data/bucket/symbol_collision_buffers.js +33 -0
- package/src/data/bucket.js +2 -6
- package/src/data/dem_data.js +11 -7
- package/src/data/extent.js +1 -1
- package/src/data/feature_index.js +35 -20
- package/src/data/index_array_type.js +1 -6
- package/src/data/load_geometry.js +6 -9
- package/src/data/pos_attributes.js +2 -3
- package/src/data/program_configuration.js +44 -26
- package/src/data/raster_bounds_attributes.js +2 -2
- package/src/data/segment.js +4 -3
- package/src/geo/coordinate.js +1 -1
- package/src/geo/lng_lat.js +3 -3
- package/src/geo/lng_lat_bounds.js +8 -4
- package/src/geo/transform.js +69 -30
- package/src/gl/color_mode.js +2 -2
- package/src/gl/context.js +28 -29
- package/src/gl/cull_face_mode.js +1 -1
- package/src/gl/depth_mode.js +1 -1
- package/src/gl/framebuffer.js +8 -4
- package/src/gl/index_buffer.js +2 -2
- package/src/gl/stencil_mode.js +1 -1
- package/src/gl/value.js +33 -68
- package/src/gl/vertex_buffer.js +2 -2
- package/src/index.js +49 -25
- package/src/render/draw_background.js +14 -9
- package/src/render/draw_circle.js +11 -8
- package/src/render/draw_collision_debug.js +11 -8
- package/src/render/draw_debug.js +16 -14
- package/src/render/draw_fill.js +19 -12
- package/src/render/draw_fill_extrusion.js +12 -9
- package/src/render/draw_heatmap.js +17 -12
- package/src/render/draw_hillshade.js +12 -9
- package/src/render/draw_line.js +30 -16
- package/src/render/draw_raster.js +17 -13
- package/src/render/draw_symbol.js +22 -17
- package/src/render/glyph_atlas.js +9 -5
- package/src/render/glyph_manager.js +1 -1
- package/src/render/image_atlas.js +4 -7
- package/src/render/image_manager.js +6 -9
- package/src/render/line_atlas.js +2 -2
- package/src/render/painter.js +65 -47
- package/src/render/program/background_program.js +6 -13
- package/src/render/program/circle_program.js +4 -6
- package/src/render/program/clipping_mask_program.js +3 -5
- package/src/render/program/collision_program.js +4 -6
- package/src/render/program/debug_program.js +3 -5
- package/src/render/program/fill_extrusion_program.js +8 -14
- package/src/render/program/fill_program.js +10 -21
- package/src/render/program/heatmap_program.js +8 -14
- package/src/render/program/hillshade_program.js +10 -16
- package/src/render/program/line_program.js +11 -22
- package/src/render/program/pattern.js +5 -7
- package/src/render/program/program_uniforms.js +13 -20
- package/src/render/program/raster_program.js +3 -5
- package/src/render/program/symbol_program.js +5 -7
- package/src/render/program.js +5 -6
- package/src/render/texture.js +1 -1
- package/src/render/tile_mask.js +6 -4
- package/src/render/uniform_binding.js +9 -20
- package/src/render/vertex_array_object.js +5 -3
- package/src/shaders/encode_attribute.js +2 -6
- package/src/shaders/index.js +103 -51
- package/src/source/geojson_source.js +11 -7
- package/src/source/geojson_worker_source.js +7 -7
- package/src/source/geojson_wrapper.js +4 -4
- package/src/source/image_source.js +11 -12
- package/src/source/load_tilejson.js +3 -3
- package/src/source/pixels_to_tile_units.js +3 -3
- package/src/source/query_features.js +13 -10
- package/src/source/raster_dem_tile_source.js +12 -10
- package/src/source/raster_tile_source.js +13 -9
- package/src/source/resources/glyphs.js +2 -3
- package/src/source/resources/index.js +2 -4
- package/src/source/rtl_text_plugin.js +8 -8
- package/src/source/source.js +9 -15
- package/src/source/source_cache.js +114 -49
- package/src/source/source_state.js +37 -14
- package/src/source/tile.js +38 -23
- package/src/source/tile_bounds.js +15 -8
- package/src/source/tile_cache.js +2 -2
- package/src/source/tile_id.js +30 -23
- package/src/source/vector_tile_source.js +10 -8
- package/src/source/vector_tile_worker_source.js +4 -4
- package/src/source/worker_tile.js +24 -22
- package/src/style/create_style_layer.js +11 -11
- package/src/style/evaluation_parameters.js +4 -6
- package/src/style/light.js +5 -5
- package/src/style/load_sprite.js +6 -6
- package/src/style/parse_glyph_pbf.js +21 -17
- package/src/style/pauseable_placement.js +3 -4
- package/src/style/properties.js +21 -44
- package/src/style/query_utils.js +4 -10
- package/src/style/style.js +64 -34
- package/src/style/style_layer/background_style_layer.js +3 -4
- package/src/style/style_layer/background_style_layer_properties.js +2 -2
- package/src/style/style_layer/circle_style_layer.js +12 -9
- package/src/style/style_layer/circle_style_layer_properties.js +2 -2
- package/src/style/style_layer/fill_extrusion_style_layer.js +16 -13
- package/src/style/style_layer/fill_extrusion_style_layer_properties.js +2 -2
- package/src/style/style_layer/fill_style_layer.js +6 -7
- package/src/style/style_layer/fill_style_layer_properties.js +2 -2
- package/src/style/style_layer/heatmap_style_layer.js +5 -6
- package/src/style/style_layer/heatmap_style_layer_properties.js +2 -2
- package/src/style/style_layer/hillshade_style_layer.js +3 -4
- package/src/style/style_layer/hillshade_style_layer_properties.js +2 -2
- package/src/style/style_layer/line_style_layer.js +10 -11
- package/src/style/style_layer/line_style_layer_properties.js +5 -5
- package/src/style/style_layer/raster_style_layer.js +3 -4
- package/src/style/style_layer/raster_style_layer_properties.js +2 -2
- package/src/style/style_layer/symbol_style_layer.js +7 -8
- package/src/style/style_layer/symbol_style_layer_properties.js +2 -2
- package/src/style/style_layer.js +21 -20
- package/src/style/style_layer_index.js +2 -2
- package/src/style/zoom_history.js +1 -1
- package/src/style-spec/error/parsing_error.js +1 -1
- package/src/style-spec/error/validation_error.js +5 -3
- package/src/style-spec/feature_filter/convert.js +17 -9
- package/src/style-spec/feature_filter/index.js +13 -9
- package/src/style-spec/util/eval_support.js +2 -2
- package/src/style-spec/util/ref_properties.js +1 -1
- package/src/symbol/anchor.js +2 -2
- package/src/symbol/check_max_angle.js +13 -5
- package/src/symbol/clip_line.js +2 -3
- package/src/symbol/collision_feature.js +8 -4
- package/src/symbol/collision_index.js +5 -7
- package/src/symbol/cross_tile_symbol_index.js +5 -5
- package/src/symbol/get_anchors.js +15 -8
- package/src/symbol/grid_index.js +5 -3
- package/src/symbol/mergelines.js +2 -2
- package/src/symbol/opacity_state.js +1 -1
- package/src/symbol/placement.js +25 -20
- package/src/symbol/projection.js +29 -28
- package/src/symbol/quads.js +10 -12
- package/src/symbol/shaping.js +27 -19
- package/src/symbol/symbol_layout.js +17 -21
- package/src/symbol/symbol_size.js +13 -12
- package/src/symbol/transform_text.js +3 -3
- package/src/ui/camera.js +34 -18
- package/src/ui/map.js +54 -34
- package/src/util/async.js +11 -5
- package/src/util/browser.js +1 -1
- package/src/util/callback.js +3 -9
- package/src/util/classify_rings.js +13 -8
- package/src/util/color_ramp.js +3 -3
- package/src/util/config.js +4 -4
- package/src/util/dictionary_coder.js +2 -3
- package/src/util/dom.js +7 -3
- package/src/util/find_pole_of_inaccessibility.js +29 -14
- package/src/util/group_layers.js +1 -1
- package/src/util/image.js +3 -8
- package/src/util/interpolate.js +1 -1
- package/src/util/intersection_tests.js +80 -42
- package/src/util/is_char_in_unicode_block.js +1 -1
- package/src/util/key.js +7 -3
- package/src/util/loader/image.js +1 -1
- package/src/util/object.js +25 -23
- package/src/util/script_detection.js +212 -91
- package/src/util/struct_array.js +8 -40
- package/src/util/task_queue.js +11 -7
- package/src/util/throttle.js +2 -2
- package/src/util/tile_cover.js +8 -5
- package/src/util/token.js +1 -1
- package/src/util/unique_id.js +2 -2
- package/src/util/util.js +21 -29
- package/src/util/vectortile_to_geojson.js +4 -2
- package/src/util/verticalize_punctuation.js +3 -7
- package/src/util/warn.js +4 -4
- package/src/util/web_worker.js +3 -3
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const { DataDrivenProperty } = require('../properties');
|
|
1
|
+
import Point from '@mapbox/point-geometry';
|
|
2
|
+
import LineBucket from '../../data/bucket/line_bucket.js';
|
|
3
|
+
import renderColorRamp from '../../util/color_ramp.js';
|
|
4
|
+
import { polygonIntersectsBufferedMultiLine } from '../../util/intersection_tests.js';
|
|
5
|
+
import EvaluationParameters from '../evaluation_parameters.js';
|
|
6
|
+
import { DataDrivenProperty } from '../properties.js';
|
|
7
|
+
import { getMaximumPaintValue, translate, translateDistance } from '../query_utils.js';
|
|
8
|
+
import StyleLayer from '../style_layer.js';
|
|
9
|
+
import properties from './line_style_layer_properties.js';
|
|
11
10
|
|
|
12
11
|
class LineFloorwidthProperty extends DataDrivenProperty {
|
|
13
12
|
possiblyEvaluate(value, parameters) {
|
|
@@ -95,7 +94,7 @@ class LineStyleLayer extends StyleLayer {
|
|
|
95
94
|
}
|
|
96
95
|
}
|
|
97
96
|
|
|
98
|
-
|
|
97
|
+
export default LineStyleLayer;
|
|
99
98
|
|
|
100
99
|
function getLineWidth(lineWidth, lineGapWidth) {
|
|
101
100
|
if (lineGapWidth > 0) {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// This file is generated. Edit layer-properties.js.ejs, then run `make generate-style-code`.
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
Properties,
|
|
3
|
+
import {
|
|
5
4
|
ColorRampProperty,
|
|
6
5
|
CrossFadedDataDrivenProperty,
|
|
7
6
|
CrossFadedProperty,
|
|
8
7
|
DataConstantProperty,
|
|
9
|
-
DataDrivenProperty
|
|
10
|
-
|
|
8
|
+
DataDrivenProperty,
|
|
9
|
+
Properties
|
|
10
|
+
} from '../properties.js';
|
|
11
11
|
|
|
12
12
|
const layout = new Properties({
|
|
13
13
|
'line-cap': new DataConstantProperty({
|
|
@@ -101,4 +101,4 @@ const paint = new Properties({
|
|
|
101
101
|
})
|
|
102
102
|
});
|
|
103
103
|
|
|
104
|
-
|
|
104
|
+
export default { paint, layout };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const properties = require('./raster_style_layer_properties');
|
|
1
|
+
import StyleLayer from '../style_layer.js';
|
|
2
|
+
import properties from './raster_style_layer_properties.js';
|
|
4
3
|
|
|
5
4
|
class RasterStyleLayer extends StyleLayer {
|
|
6
5
|
constructor(layer) {
|
|
@@ -8,4 +7,4 @@ class RasterStyleLayer extends StyleLayer {
|
|
|
8
7
|
}
|
|
9
8
|
}
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
export default RasterStyleLayer;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// This file is generated. Edit layer-properties.js.ejs, then run `make generate-style-code`.
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { DataConstantProperty, Properties } from '../properties.js';
|
|
4
4
|
|
|
5
5
|
const paint = new Properties({
|
|
6
6
|
'raster-opacity': new DataConstantProperty({
|
|
@@ -52,4 +52,4 @@ const paint = new Properties({
|
|
|
52
52
|
})
|
|
53
53
|
});
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
export default { paint };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const properties = require('./symbol_style_layer_properties');
|
|
1
|
+
import { isExpression } from '@mapwhit/style-expressions';
|
|
2
|
+
import assert from 'assert';
|
|
3
|
+
import SymbolBucket from '../../data/bucket/symbol_bucket.js';
|
|
4
|
+
import resolveTokens from '../../util/token.js';
|
|
5
|
+
import StyleLayer from '../style_layer.js';
|
|
6
|
+
import properties from './symbol_style_layer_properties.js';
|
|
8
7
|
|
|
9
8
|
class SymbolStyleLayer extends StyleLayer {
|
|
10
9
|
constructor(layer) {
|
|
@@ -63,4 +62,4 @@ class SymbolStyleLayer extends StyleLayer {
|
|
|
63
62
|
}
|
|
64
63
|
}
|
|
65
64
|
|
|
66
|
-
|
|
65
|
+
export default SymbolStyleLayer;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// This file is generated. Edit layer-properties.js.ejs, then run `make generate-style-code`.
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { DataConstantProperty, DataDrivenProperty, Properties } from '../properties.js';
|
|
4
4
|
|
|
5
5
|
const layout = new Properties({
|
|
6
6
|
'symbol-placement': new DataConstantProperty({
|
|
@@ -291,4 +291,4 @@ const paint = new Properties({
|
|
|
291
291
|
})
|
|
292
292
|
});
|
|
293
293
|
|
|
294
|
-
|
|
294
|
+
export default { paint, layout };
|
package/src/style/style_layer.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const featureFilter = require('../style-spec/feature_filter');
|
|
7
|
-
const createKey = require('../util/key');
|
|
1
|
+
import { Evented } from '@mapwhit/events';
|
|
2
|
+
import { supportsPropertyExpression } from '@mapwhit/style-expressions';
|
|
3
|
+
import featureFilter from '../style-spec/feature_filter/index.js';
|
|
4
|
+
import createKey from '../util/key.js';
|
|
5
|
+
import { Layout, PossiblyEvaluatedPropertyValue, Transitionable } from './properties.js';
|
|
8
6
|
|
|
9
7
|
const keyProperties = ['type', 'minzoom', 'maxzoom', 'filter', 'layout'];
|
|
10
8
|
const TRANSITION_SUFFIX = '-transition';
|
|
@@ -160,21 +158,20 @@ class StyleLayer extends Evented {
|
|
|
160
158
|
this._transitionablePaint.setTransition(name.slice(0, -TRANSITION_SUFFIX.length), value || undefined);
|
|
161
159
|
return false;
|
|
162
160
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
const prop = this._transitionablePaint._values[name];
|
|
167
|
-
const newCrossFadedValue =
|
|
168
|
-
prop.property.specification['property-type'] === 'cross-faded-data-driven' && !prop.value.value && value;
|
|
169
|
-
const wasDataDriven = this._transitionablePaint._values[name].value.isDataDriven();
|
|
161
|
+
const transitionable = this._transitionablePaint._values[name];
|
|
162
|
+
const isCrossFadedProperty = transitionable.property.specification['property-type'] === 'cross-faded-data-driven';
|
|
163
|
+
const wasDataDriven = transitionable.value.isDataDriven();
|
|
170
164
|
this._transitionablePaint.setValue(name, value);
|
|
171
|
-
const isDataDriven = this._transitionablePaint._values[name].value.isDataDriven();
|
|
172
165
|
this._handleSpecialPaintPropertyUpdate(name);
|
|
173
|
-
|
|
166
|
+
const isDataDriven = this._transitionablePaint._values[name].value.isDataDriven();
|
|
167
|
+
if (isDataDriven !== wasDataDriven || (wasDataDriven && isDataDriven) || isCrossFadedProperty) {
|
|
174
168
|
// reset transitioning in progress
|
|
175
169
|
this._untransitioned(name);
|
|
176
170
|
}
|
|
177
|
-
|
|
171
|
+
// if a cross-faded value is changed, we need to make sure the new icons get added to each tile's iconAtlas
|
|
172
|
+
// so a call to _updateLayer is necessary, and we return true from this function so it gets called in
|
|
173
|
+
// Style#setPaintProperty
|
|
174
|
+
return isDataDriven || wasDataDriven || isCrossFadedProperty;
|
|
178
175
|
}
|
|
179
176
|
|
|
180
177
|
_untransitioned(name) {
|
|
@@ -188,8 +185,12 @@ class StyleLayer extends Evented {
|
|
|
188
185
|
}
|
|
189
186
|
|
|
190
187
|
isHidden(zoom) {
|
|
191
|
-
if (this.minzoom && zoom < this.minzoom)
|
|
192
|
-
|
|
188
|
+
if (this.minzoom && zoom < this.minzoom) {
|
|
189
|
+
return true;
|
|
190
|
+
}
|
|
191
|
+
if (this.maxzoom && zoom >= this.maxzoom) {
|
|
192
|
+
return true;
|
|
193
|
+
}
|
|
193
194
|
return this.visibility === 'none';
|
|
194
195
|
}
|
|
195
196
|
|
|
@@ -253,4 +254,4 @@ class StyleLayer extends Evented {
|
|
|
253
254
|
}
|
|
254
255
|
}
|
|
255
256
|
|
|
256
|
-
|
|
257
|
+
export default StyleLayer;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import groupBySource from '../util/group_layers.js';
|
|
2
2
|
|
|
3
3
|
class StyleLayerIndex {
|
|
4
4
|
#layers = new Map();
|
|
@@ -27,4 +27,4 @@ class StyleLayerIndex {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
export default StyleLayerIndex;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
export default class ValidationError {
|
|
2
2
|
constructor(key, value, message, identifier) {
|
|
3
3
|
this.message = (key ? `${key}: ` : '') + message;
|
|
4
|
-
if (identifier)
|
|
4
|
+
if (identifier) {
|
|
5
|
+
this.identifier = identifier;
|
|
6
|
+
}
|
|
5
7
|
|
|
6
8
|
if (value?.__line__) {
|
|
7
9
|
this.line = value.__line__;
|
|
8
10
|
}
|
|
9
11
|
}
|
|
10
|
-
}
|
|
12
|
+
}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
module.exports = convertFilter;
|
|
1
|
+
import { isExpressionFilter } from './index.js';
|
|
4
2
|
|
|
5
3
|
/**
|
|
6
4
|
* Convert the given legacy filter to (the JSON representation of) an
|
|
7
5
|
* equivalent expression
|
|
8
6
|
* @private
|
|
9
7
|
*/
|
|
10
|
-
function convertFilter(filter) {
|
|
8
|
+
export default function convertFilter(filter) {
|
|
11
9
|
return _convertFilter(filter, {});
|
|
12
10
|
}
|
|
13
11
|
|
|
@@ -64,9 +62,13 @@ function _convertFilter(filter, expectedTypes) {
|
|
|
64
62
|
return filter;
|
|
65
63
|
}
|
|
66
64
|
|
|
67
|
-
if (!filter)
|
|
65
|
+
if (!filter) {
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
68
|
const op = filter[0];
|
|
69
|
-
if (filter.length <= 1)
|
|
69
|
+
if (filter.length <= 1) {
|
|
70
|
+
return op !== 'any';
|
|
71
|
+
}
|
|
70
72
|
|
|
71
73
|
let converted;
|
|
72
74
|
|
|
@@ -115,8 +117,12 @@ function runtimeTypeChecks(expectedTypes) {
|
|
|
115
117
|
const get = property === '$id' ? ['id'] : ['get', property];
|
|
116
118
|
conditions.push(['==', ['typeof', get], expectedTypes[property]]);
|
|
117
119
|
}
|
|
118
|
-
if (conditions.length === 0)
|
|
119
|
-
|
|
120
|
+
if (conditions.length === 0) {
|
|
121
|
+
return true;
|
|
122
|
+
}
|
|
123
|
+
if (conditions.length === 1) {
|
|
124
|
+
return conditions[0];
|
|
125
|
+
}
|
|
120
126
|
return ['all'].concat(conditions);
|
|
121
127
|
}
|
|
122
128
|
|
|
@@ -155,7 +161,9 @@ function convertComparisonOp(property, value, op, expectedTypes) {
|
|
|
155
161
|
}
|
|
156
162
|
|
|
157
163
|
function convertInOp(property, values, negate = false) {
|
|
158
|
-
if (values.length === 0)
|
|
164
|
+
if (values.length === 0) {
|
|
165
|
+
return negate;
|
|
166
|
+
}
|
|
159
167
|
|
|
160
168
|
let get;
|
|
161
169
|
if (property === '$type') {
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
module.exports = createFilter;
|
|
1
|
+
import { createExpression, findGlobalStateRefs } from '@mapwhit/style-expressions';
|
|
4
2
|
|
|
5
3
|
createFilter.isExpressionFilter = isExpressionFilter;
|
|
6
4
|
createFilter.addGlobalStateRefs = addGlobalStateRefs;
|
|
7
5
|
|
|
8
|
-
function isExpressionFilter(filter) {
|
|
6
|
+
export function isExpressionFilter(filter) {
|
|
9
7
|
if (filter === true || filter === false) {
|
|
10
8
|
return true;
|
|
11
9
|
}
|
|
@@ -65,7 +63,7 @@ const filterSpec = {
|
|
|
65
63
|
* @param {Array} filter mapbox gl filter
|
|
66
64
|
* @returns {Function} filter-evaluating function
|
|
67
65
|
*/
|
|
68
|
-
function createFilter(filter) {
|
|
66
|
+
export default function createFilter(filter) {
|
|
69
67
|
if (filter === null || filter === undefined) {
|
|
70
68
|
return addGlobalStateRefs(() => true);
|
|
71
69
|
}
|
|
@@ -84,7 +82,7 @@ function createFilter(filter) {
|
|
|
84
82
|
);
|
|
85
83
|
}
|
|
86
84
|
|
|
87
|
-
function addGlobalStateRefs(filter, getGlobalStateRefs = () => new Set()) {
|
|
85
|
+
export function addGlobalStateRefs(filter, getGlobalStateRefs = () => new Set()) {
|
|
88
86
|
filter.getGlobalStateRefs = getGlobalStateRefs;
|
|
89
87
|
return filter;
|
|
90
88
|
}
|
|
@@ -95,9 +93,13 @@ function compare(a, b) {
|
|
|
95
93
|
}
|
|
96
94
|
|
|
97
95
|
function convertFilter(filter) {
|
|
98
|
-
if (!filter || filter.length === 0)
|
|
96
|
+
if (!filter || filter.length === 0) {
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
99
|
const [op, ...args] = filter;
|
|
100
|
-
if (filter.length <= 1)
|
|
100
|
+
if (filter.length <= 1) {
|
|
101
|
+
return op !== 'any';
|
|
102
|
+
}
|
|
101
103
|
switch (op) {
|
|
102
104
|
case '!=':
|
|
103
105
|
return convertNegation(convertComparisonOp('==', ...args));
|
|
@@ -158,7 +160,9 @@ function convertInOp([property, ...values]) {
|
|
|
158
160
|
}
|
|
159
161
|
|
|
160
162
|
function isUniformLarge(values) {
|
|
161
|
-
if (values.length < 200)
|
|
163
|
+
if (values.length < 200) {
|
|
164
|
+
return false;
|
|
165
|
+
}
|
|
162
166
|
const type = typeof values[0];
|
|
163
167
|
return values.every(v => typeof v === type);
|
|
164
168
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export default ['type', 'source', 'source-layer', 'minzoom', 'maxzoom', 'filter', 'layout'];
|
package/src/symbol/anchor.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import Point from '@mapbox/point-geometry';
|
|
2
2
|
|
|
3
3
|
class Anchor extends Point {
|
|
4
4
|
constructor(x, y, angle, segment) {
|
|
@@ -14,4 +14,4 @@ class Anchor extends Point {
|
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
export default Anchor;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
export default checkMaxAngle;
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Labels placed around really sharp angles aren't readable. Check if any
|
|
@@ -15,7 +15,9 @@ module.exports = checkMaxAngle;
|
|
|
15
15
|
*/
|
|
16
16
|
function checkMaxAngle(line, anchor, labelLength, windowSize, maxAngle) {
|
|
17
17
|
// horizontal labels always pass
|
|
18
|
-
if (anchor.segment === undefined)
|
|
18
|
+
if (anchor.segment === undefined) {
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
19
21
|
|
|
20
22
|
let p = anchor;
|
|
21
23
|
let index = anchor.segment + 1;
|
|
@@ -26,7 +28,9 @@ function checkMaxAngle(line, anchor, labelLength, windowSize, maxAngle) {
|
|
|
26
28
|
index--;
|
|
27
29
|
|
|
28
30
|
// there isn't enough room for the label after the beginning of the line
|
|
29
|
-
if (index < 0)
|
|
31
|
+
if (index < 0) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
30
34
|
|
|
31
35
|
anchorDistance -= line[index].dist(p);
|
|
32
36
|
p = line[index];
|
|
@@ -46,7 +50,9 @@ function checkMaxAngle(line, anchor, labelLength, windowSize, maxAngle) {
|
|
|
46
50
|
const next = line[index + 1];
|
|
47
51
|
|
|
48
52
|
// there isn't enough room for the label before the end of the line
|
|
49
|
-
if (!next)
|
|
53
|
+
if (!next) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
50
56
|
|
|
51
57
|
let angleDelta = prev.angleTo(current) - current.angleTo(next);
|
|
52
58
|
// restrict angle to -pi..pi range
|
|
@@ -64,7 +70,9 @@ function checkMaxAngle(line, anchor, labelLength, windowSize, maxAngle) {
|
|
|
64
70
|
}
|
|
65
71
|
|
|
66
72
|
// the sum of angles within the window area exceeds the maximum allowed value. check fails.
|
|
67
|
-
if (recentAngleDelta > maxAngle)
|
|
73
|
+
if (recentAngleDelta > maxAngle) {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
68
76
|
|
|
69
77
|
index++;
|
|
70
78
|
anchorDistance += current.dist(next);
|
package/src/symbol/clip_line.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import Point from '@mapbox/point-geometry';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* A CollisionFeature represents the area of the tile covered by a single label.
|
|
@@ -174,8 +174,12 @@ class CollisionFeature {
|
|
|
174
174
|
let boxDistanceToAnchor = labelStartDistance + boxOffset;
|
|
175
175
|
|
|
176
176
|
// make the distance between pitch padding boxes bigger
|
|
177
|
-
if (boxOffset < 0)
|
|
178
|
-
|
|
177
|
+
if (boxOffset < 0) {
|
|
178
|
+
boxDistanceToAnchor += boxOffset;
|
|
179
|
+
}
|
|
180
|
+
if (boxOffset > labelLength) {
|
|
181
|
+
boxDistanceToAnchor += boxOffset - labelLength;
|
|
182
|
+
}
|
|
179
183
|
|
|
180
184
|
if (boxDistanceToAnchor < anchorDistance) {
|
|
181
185
|
// The line doesn't extend far enough back for this box, skip it
|
|
@@ -227,4 +231,4 @@ class CollisionFeature {
|
|
|
227
231
|
}
|
|
228
232
|
}
|
|
229
233
|
|
|
230
|
-
|
|
234
|
+
export default CollisionFeature;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const projection = require('../symbol/projection');
|
|
1
|
+
import Point from '@mapbox/point-geometry';
|
|
2
|
+
import * as projection from '../symbol/projection.js';
|
|
3
|
+
import * as intersectionTests from '../util/intersection_tests.js';
|
|
4
|
+
import Grid from './grid_index.js';
|
|
7
5
|
|
|
8
6
|
// When a symbol crosses the edge that causes it to be included in
|
|
9
7
|
// collision detection, it will cause changes in the symbols around
|
|
@@ -382,4 +380,4 @@ function markCollisionCircleUsed(collisionCircles, index, used) {
|
|
|
382
380
|
collisionCircles[index + 4] = used ? 1 : 0;
|
|
383
381
|
}
|
|
384
382
|
|
|
385
|
-
|
|
383
|
+
export default CollisionIndex;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const { SymbolInstanceArray } = require('../data/array_types');
|
|
1
|
+
import EXTENT from '../data/extent.js';
|
|
4
2
|
|
|
5
3
|
/*
|
|
6
4
|
The CrossTileSymbolIndex generally works on the assumption that
|
|
@@ -240,7 +238,9 @@ class CrossTileSymbolIndex {
|
|
|
240
238
|
|
|
241
239
|
for (const tile of tiles) {
|
|
242
240
|
const symbolBucket = tile.getBucket(styleLayer);
|
|
243
|
-
if (!symbolBucket || styleLayer.id !== symbolBucket.
|
|
241
|
+
if (!symbolBucket || styleLayer.id !== symbolBucket.layers[0].id) {
|
|
242
|
+
continue;
|
|
243
|
+
}
|
|
244
244
|
|
|
245
245
|
if (!symbolBucket.bucketInstanceId) {
|
|
246
246
|
symbolBucket.bucketInstanceId = ++this.maxBucketInstanceId;
|
|
@@ -269,4 +269,4 @@ class CrossTileSymbolIndex {
|
|
|
269
269
|
}
|
|
270
270
|
}
|
|
271
271
|
|
|
272
|
-
|
|
272
|
+
export default CrossTileSymbolIndex;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const checkMaxAngle = require('./check_max_angle');
|
|
5
|
-
|
|
6
|
-
module.exports = { getAnchors, getCenterAnchor };
|
|
1
|
+
import Anchor from '../symbol/anchor.js';
|
|
2
|
+
import interpolate from '../util/interpolate.js';
|
|
3
|
+
import checkMaxAngle from './check_max_angle.js';
|
|
7
4
|
|
|
8
5
|
function getLineLength(line) {
|
|
9
6
|
let lineLength = 0;
|
|
@@ -24,7 +21,7 @@ function getShapedLabelLength(shapedText, shapedIcon) {
|
|
|
24
21
|
);
|
|
25
22
|
}
|
|
26
23
|
|
|
27
|
-
function getCenterAnchor(line, maxAngle, shapedText, shapedIcon, glyphSize, boxScale) {
|
|
24
|
+
export function getCenterAnchor(line, maxAngle, shapedText, shapedIcon, glyphSize, boxScale) {
|
|
28
25
|
const angleWindowSize = getAngleWindowSize(shapedText, glyphSize, boxScale);
|
|
29
26
|
const labelLength = getShapedLabelLength(shapedText, shapedIcon) * boxScale;
|
|
30
27
|
|
|
@@ -55,7 +52,17 @@ function getCenterAnchor(line, maxAngle, shapedText, shapedIcon, glyphSize, boxS
|
|
|
55
52
|
}
|
|
56
53
|
}
|
|
57
54
|
|
|
58
|
-
function getAnchors(
|
|
55
|
+
export function getAnchors(
|
|
56
|
+
line,
|
|
57
|
+
spacing,
|
|
58
|
+
maxAngle,
|
|
59
|
+
shapedText,
|
|
60
|
+
shapedIcon,
|
|
61
|
+
glyphSize,
|
|
62
|
+
boxScale,
|
|
63
|
+
overscaling,
|
|
64
|
+
tileExtent
|
|
65
|
+
) {
|
|
59
66
|
// Resample a line to get anchor points for labels and check that each
|
|
60
67
|
// potential label passes text-max-angle check and has enough froom to fit
|
|
61
68
|
// on the line.
|
package/src/symbol/grid_index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { clamp } from '../util/util.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* GridIndex is a data structure for testing the intersection of
|
|
@@ -266,7 +266,9 @@ class GridIndex {
|
|
|
266
266
|
for (let x = cx1; x <= cx2; x++) {
|
|
267
267
|
for (let y = cy1; y <= cy2; y++) {
|
|
268
268
|
const cellIndex = xCellCount * y + x;
|
|
269
|
-
if (fn.call(this, x1, y1, x2, y2, cellIndex, ...args))
|
|
269
|
+
if (fn.call(this, x1, y1, x2, y2, cellIndex, ...args)) {
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
270
272
|
}
|
|
271
273
|
}
|
|
272
274
|
|
|
@@ -280,7 +282,7 @@ class GridIndex {
|
|
|
280
282
|
}
|
|
281
283
|
}
|
|
282
284
|
|
|
283
|
-
|
|
285
|
+
export default GridIndex;
|
|
284
286
|
|
|
285
287
|
function circlesCollide(x1, y1, r1, x2, y2, r2) {
|
|
286
288
|
const dx = x2 - x1;
|
package/src/symbol/mergelines.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
export default function (features) {
|
|
2
2
|
const leftIndex = new Map();
|
|
3
3
|
const rightIndex = new Map();
|
|
4
4
|
const mergedFeatures = [];
|
|
@@ -73,4 +73,4 @@ module.exports = function (features) {
|
|
|
73
73
|
const { x, y } = geom.at(onRight ? -1 : 0);
|
|
74
74
|
return `${text}:${x}:${y}`;
|
|
75
75
|
}
|
|
76
|
-
}
|
|
76
|
+
}
|