@mapwhit/tilerenderer 0.52.1 → 1.1.0
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/README.md +7 -0
- package/build/min/package.json +2 -1
- package/build/min/src/shaders/_prelude.fragment.glsl.js +2 -2
- package/build/min/src/shaders/_prelude.vertex.glsl.js +2 -2
- package/build/min/src/shaders/background.fragment.glsl.js +2 -2
- package/build/min/src/shaders/background.vertex.glsl.js +1 -1
- package/build/min/src/shaders/background_pattern.fragment.glsl.js +2 -2
- package/build/min/src/shaders/background_pattern.vertex.glsl.js +1 -1
- package/build/min/src/shaders/circle.fragment.glsl.js +2 -2
- package/build/min/src/shaders/circle.vertex.glsl.js +2 -2
- 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 +2 -2
- package/build/min/src/shaders/fill.vertex.glsl.js +2 -2
- package/build/min/src/shaders/fill_extrusion.fragment.glsl.js +2 -2
- package/build/min/src/shaders/fill_extrusion.vertex.glsl.js +2 -2
- package/build/min/src/shaders/fill_extrusion_pattern.fragment.glsl.js +2 -2
- package/build/min/src/shaders/fill_extrusion_pattern.vertex.glsl.js +2 -2
- package/build/min/src/shaders/fill_outline.fragment.glsl.js +2 -2
- package/build/min/src/shaders/fill_outline.vertex.glsl.js +2 -2
- package/build/min/src/shaders/fill_outline_pattern.fragment.glsl.js +2 -2
- package/build/min/src/shaders/fill_outline_pattern.vertex.glsl.js +2 -2
- package/build/min/src/shaders/fill_pattern.fragment.glsl.js +2 -2
- package/build/min/src/shaders/fill_pattern.vertex.glsl.js +2 -2
- package/build/min/src/shaders/heatmap.fragment.glsl.js +2 -2
- package/build/min/src/shaders/heatmap.vertex.glsl.js +2 -2
- package/build/min/src/shaders/heatmap_texture.fragment.glsl.js +2 -2
- package/build/min/src/shaders/heatmap_texture.vertex.glsl.js +1 -1
- package/build/min/src/shaders/hillshade.fragment.glsl.js +2 -2
- package/build/min/src/shaders/hillshade.vertex.glsl.js +1 -1
- package/build/min/src/shaders/hillshade_prepare.fragment.glsl.js +2 -2
- package/build/min/src/shaders/hillshade_prepare.vertex.glsl.js +1 -1
- package/build/min/src/shaders/line.fragment.glsl.js +2 -2
- package/build/min/src/shaders/line.vertex.glsl.js +2 -2
- package/build/min/src/shaders/line_gradient.fragment.glsl.js +2 -2
- package/build/min/src/shaders/line_gradient.vertex.glsl.js +2 -2
- package/build/min/src/shaders/line_pattern.fragment.glsl.js +2 -2
- package/build/min/src/shaders/line_pattern.vertex.glsl.js +2 -2
- package/build/min/src/shaders/line_sdf.fragment.glsl.js +2 -2
- package/build/min/src/shaders/line_sdf.vertex.glsl.js +2 -2
- package/build/min/src/shaders/raster.fragment.glsl.js +2 -2
- package/build/min/src/shaders/raster.vertex.glsl.js +1 -1
- package/build/min/src/shaders/symbol_icon.fragment.glsl.js +2 -2
- package/build/min/src/shaders/symbol_icon.vertex.glsl.js +2 -2
- package/build/min/src/shaders/symbol_sdf.fragment.glsl.js +2 -2
- package/build/min/src/shaders/symbol_sdf.vertex.glsl.js +2 -2
- package/package.json +5 -4
- package/src/data/array_types.js +55 -117
- package/src/data/bucket/circle_attributes.js +2 -4
- package/src/data/bucket/circle_bucket.js +19 -16
- package/src/data/bucket/fill_attributes.js +2 -4
- package/src/data/bucket/fill_bucket.js +38 -27
- package/src/data/bucket/fill_extrusion_attributes.js +2 -4
- package/src/data/bucket/fill_extrusion_bucket.js +56 -37
- package/src/data/bucket/heatmap_bucket.js +2 -11
- package/src/data/bucket/line_attributes.js +2 -4
- package/src/data/bucket/line_bucket.js +208 -163
- package/src/data/bucket/pattern_attributes.js +2 -4
- package/src/data/bucket/pattern_bucket_features.js +7 -9
- package/src/data/bucket/symbol_attributes.js +12 -26
- package/src/data/bucket/symbol_bucket.js +174 -323
- package/src/data/bucket/symbol_buffers.js +62 -0
- package/src/data/bucket/symbol_collision_buffers.js +33 -0
- package/src/data/bucket.js +26 -25
- package/src/data/dem_data.js +11 -10
- package/src/data/extent.js +1 -1
- package/src/data/feature_index.js +38 -28
- 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 +47 -38
- package/src/data/raster_bounds_attributes.js +2 -2
- package/src/data/segment.js +4 -7
- 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 +17 -12
- package/src/render/draw_circle.js +15 -12
- package/src/render/draw_collision_debug.js +11 -8
- package/src/render/draw_debug.js +16 -14
- package/src/render/draw_fill.js +27 -20
- package/src/render/draw_fill_extrusion.js +20 -17
- package/src/render/draw_heatmap.js +21 -16
- package/src/render/draw_hillshade.js +12 -9
- package/src/render/draw_line.js +36 -22
- package/src/render/draw_raster.js +22 -18
- package/src/render/draw_symbol.js +38 -33
- package/src/render/glyph_atlas.js +9 -8
- package/src/render/glyph_manager.js +2 -3
- package/src/render/image_atlas.js +4 -11
- package/src/render/image_manager.js +39 -28
- package/src/render/line_atlas.js +2 -2
- package/src/render/painter.js +78 -61
- package/src/render/program/background_program.js +6 -13
- package/src/render/program/circle_program.js +8 -10
- 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 +9 -15
- package/src/render/program/fill_program.js +10 -21
- package/src/render/program/heatmap_program.js +9 -15
- package/src/render/program/hillshade_program.js +16 -22
- package/src/render/program/line_program.js +14 -25
- package/src/render/program/pattern.js +5 -7
- package/src/render/program/program_uniforms.js +13 -20
- package/src/render/program/raster_program.js +9 -11
- 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 +25 -30
- package/src/source/geojson_worker_source.js +46 -74
- package/src/source/geojson_wrapper.js +13 -5
- package/src/source/image_source.js +17 -28
- package/src/source/load_tilejson.js +3 -3
- package/src/source/pixels_to_tile_units.js +3 -3
- package/src/source/query_features.js +17 -15
- package/src/source/raster_dem_tile_source.js +54 -71
- package/src/source/raster_tile_source.js +14 -15
- package/src/source/resources/glyphs.js +4 -5
- package/src/source/resources/index.js +4 -12
- package/src/source/rtl_text_plugin.js +62 -35
- package/src/source/source.js +14 -22
- package/src/source/source_cache.js +221 -179
- package/src/source/source_state.js +125 -13
- package/src/source/tile.js +67 -66
- package/src/source/tile_bounds.js +36 -29
- package/src/source/tile_cache.js +2 -2
- package/src/source/tile_id.js +30 -26
- package/src/source/vector_tile_source.js +23 -21
- package/src/source/vector_tile_worker_source.js +22 -26
- package/src/source/worker_tile.js +139 -134
- 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 +7 -9
- package/src/style/properties.js +21 -51
- package/src/style/query_utils.js +7 -13
- package/src/style/style.js +314 -221
- 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 +25 -20
- package/src/style/style_layer/circle_style_layer_properties.js +2 -2
- package/src/style/style_layer/fill_extrusion_style_layer.js +55 -37
- package/src/style/style_layer/fill_extrusion_style_layer_properties.js +2 -2
- package/src/style/style_layer/fill_style_layer.js +11 -12
- package/src/style/style_layer/fill_style_layer_properties.js +2 -2
- package/src/style/style_layer/heatmap_style_layer.js +6 -7
- package/src/style/style_layer/heatmap_style_layer_properties.js +2 -2
- package/src/style/style_layer/hillshade_style_layer.js +4 -5
- package/src/style/style_layer/hillshade_style_layer_properties.js +2 -2
- package/src/style/style_layer/line_style_layer.js +33 -30
- 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 +20 -21
- package/src/style/style_layer/symbol_style_layer_properties.js +2 -2
- package/src/style/style_layer.js +66 -47
- package/src/style/style_layer_index.js +17 -42
- 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 -6
- 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 +7 -10
- 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 -5
- package/src/symbol/placement.js +28 -23
- package/src/symbol/projection.js +29 -28
- package/src/symbol/quads.js +14 -16
- package/src/symbol/shaping.js +27 -19
- package/src/symbol/symbol_layout.js +24 -28
- package/src/symbol/symbol_size.js +13 -12
- package/src/symbol/transform_text.js +4 -4
- package/src/ui/camera.js +34 -18
- package/src/ui/map.js +102 -44
- 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 +41 -0
- package/src/util/image.js +3 -13
- 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 +25 -0
- package/src/util/loader/image.js +1 -1
- package/src/util/object.js +33 -76
- 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
- package/src/worker.js +1 -4
- package/src/source/resources/images.js +0 -68
- package/src/source/worker.js +0 -110
- package/src/source/worker_source.js +0 -14
- package/src/style-spec/deref.js +0 -51
- package/src/style-spec/group_by_layout.js +0 -46
- package/src/util/actor.js +0 -108
- package/src/util/dispatcher.js +0 -65
- package/src/util/global_worker_pool.js +0 -15
- package/src/util/transfer_registry.js +0 -168
- package/src/util/web_worker_transfer.js +0 -43
- package/src/util/worker_pool.js +0 -41
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PlacedSymbolArray,
|
|
3
|
+
StructArrayLayout3f12 as SymbolDynamicLayoutArray,
|
|
4
|
+
StructArrayLayout4i4ui16 as SymbolLayoutArray,
|
|
5
|
+
StructArrayLayout1ul4 as SymbolOpacityArray,
|
|
6
|
+
StructArrayLayout3ui6 as TriangleIndexArray
|
|
7
|
+
} from '../array_types.js';
|
|
8
|
+
import SegmentVector from '../segment.js';
|
|
9
|
+
import { dynamicLayoutAttributes, symbolLayoutAttributes } from './symbol_attributes.js';
|
|
10
|
+
|
|
11
|
+
// Opacity arrays are frequently updated but don't contain a lot of information, so we pack them
|
|
12
|
+
// tight. Each Uint32 is actually four duplicate Uint8s for the four corners of a glyph
|
|
13
|
+
// 7 bits are for the current opacity, and the lowest bit is the target opacity
|
|
14
|
+
|
|
15
|
+
// actually defined in symbol_attributes.js
|
|
16
|
+
// const placementOpacityAttributes = [
|
|
17
|
+
// { name: 'a_fade_opacity', components: 1, type: 'Uint32' }
|
|
18
|
+
// ];
|
|
19
|
+
const shaderOpacityAttributes = [{ name: 'a_fade_opacity', components: 1, type: 'Uint8', offset: 0 }];
|
|
20
|
+
|
|
21
|
+
export default class SymbolBuffers {
|
|
22
|
+
constructor(programConfigurations) {
|
|
23
|
+
this.layoutVertexArray = new SymbolLayoutArray();
|
|
24
|
+
this.indexArray = new TriangleIndexArray();
|
|
25
|
+
this.programConfigurations = programConfigurations;
|
|
26
|
+
this.segments = new SegmentVector();
|
|
27
|
+
this.dynamicLayoutVertexArray = new SymbolDynamicLayoutArray();
|
|
28
|
+
this.opacityVertexArray = new SymbolOpacityArray();
|
|
29
|
+
this.placedSymbolArray = new PlacedSymbolArray();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
upload(context, dynamicIndexBuffer, upload, update) {
|
|
33
|
+
if (upload) {
|
|
34
|
+
this.layoutVertexBuffer = context.createVertexBuffer(this.layoutVertexArray, symbolLayoutAttributes.members);
|
|
35
|
+
this.indexBuffer = context.createIndexBuffer(this.indexArray, dynamicIndexBuffer);
|
|
36
|
+
this.dynamicLayoutVertexBuffer = context.createVertexBuffer(
|
|
37
|
+
this.dynamicLayoutVertexArray,
|
|
38
|
+
dynamicLayoutAttributes.members,
|
|
39
|
+
true
|
|
40
|
+
);
|
|
41
|
+
this.opacityVertexBuffer = context.createVertexBuffer(this.opacityVertexArray, shaderOpacityAttributes, true);
|
|
42
|
+
// This is a performance hack so that we can write to opacityVertexArray with uint32s
|
|
43
|
+
// even though the shaders read uint8s
|
|
44
|
+
this.opacityVertexBuffer.itemSize = 1;
|
|
45
|
+
}
|
|
46
|
+
if (upload || update) {
|
|
47
|
+
this.programConfigurations.upload(context);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
destroy() {
|
|
52
|
+
if (!this.layoutVertexBuffer) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
this.layoutVertexBuffer.destroy();
|
|
56
|
+
this.indexBuffer.destroy();
|
|
57
|
+
this.programConfigurations.destroy();
|
|
58
|
+
this.segments.destroy();
|
|
59
|
+
this.dynamicLayoutVertexBuffer.destroy();
|
|
60
|
+
this.opacityVertexBuffer.destroy();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { StructArrayLayout2ub4 as CollisionVertexArray } from '../array_types.js';
|
|
2
|
+
import SegmentVector from '../segment.js';
|
|
3
|
+
import { collisionVertexAttributes } from './symbol_attributes.js';
|
|
4
|
+
|
|
5
|
+
export default class CollisionBuffers {
|
|
6
|
+
constructor(LayoutArray, layoutAttributes, IndexArray) {
|
|
7
|
+
this.layoutVertexArray = new LayoutArray();
|
|
8
|
+
this.layoutAttributes = layoutAttributes;
|
|
9
|
+
this.indexArray = new IndexArray();
|
|
10
|
+
this.segments = new SegmentVector();
|
|
11
|
+
this.collisionVertexArray = new CollisionVertexArray();
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
upload(context) {
|
|
15
|
+
this.layoutVertexBuffer = context.createVertexBuffer(this.layoutVertexArray, this.layoutAttributes);
|
|
16
|
+
this.indexBuffer = context.createIndexBuffer(this.indexArray);
|
|
17
|
+
this.collisionVertexBuffer = context.createVertexBuffer(
|
|
18
|
+
this.collisionVertexArray,
|
|
19
|
+
collisionVertexAttributes.members,
|
|
20
|
+
true
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
destroy() {
|
|
25
|
+
if (!this.layoutVertexBuffer) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
this.layoutVertexBuffer.destroy();
|
|
29
|
+
this.indexBuffer.destroy();
|
|
30
|
+
this.segments.destroy();
|
|
31
|
+
this.collisionVertexBuffer.destroy();
|
|
32
|
+
}
|
|
33
|
+
}
|
package/src/data/bucket.js
CHANGED
|
@@ -11,43 +11,44 @@
|
|
|
11
11
|
* properties and the zoom level to populate the attributes needed for
|
|
12
12
|
* data-driven styling.
|
|
13
13
|
*
|
|
14
|
-
* Buckets are designed to be built
|
|
15
|
-
*
|
|
16
|
-
* bucket's vertex, index, and attribute data is stored in `bucket.arrays:
|
|
17
|
-
* ArrayGroup`. When a bucket's data is serialized and sent back to the main
|
|
18
|
-
* thread, is gets deserialized (using `new Bucket(serializedBucketData)`, with
|
|
19
|
-
* the array data now stored in `bucket.buffers: BufferGroup`. BufferGroups
|
|
20
|
-
* hold the same data as ArrayGroups, but are tuned for consumption by WebGL.
|
|
14
|
+
* Buckets are designed to be built when tile is loaded and then converted (uploaded)
|
|
15
|
+
* to tune bucket's vertex, index, and attribute data for consumption by WebGL.
|
|
21
16
|
*
|
|
22
17
|
* @private
|
|
23
18
|
*/
|
|
24
19
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
// style may have changed between creating a bucket when tile was loaded and rendering it
|
|
21
|
+
export function updateBuckets(buckets, style) {
|
|
22
|
+
if (!style._changed) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
28
25
|
// Guard against the case where the map's style has been set to null while
|
|
29
26
|
// this bucket has been parsing.
|
|
30
|
-
if (!style)
|
|
27
|
+
if (!style) {
|
|
28
|
+
for (const bucket of buckets.values()) {
|
|
29
|
+
bucket.destroy();
|
|
30
|
+
}
|
|
31
|
+
buckets.clear();
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const updatedAlready = new Set();
|
|
36
|
+
for (const [id, bucket] of buckets) {
|
|
37
|
+
if (updatedAlready.has(id)) {
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
updatedAlready.add(id);
|
|
31
41
|
|
|
32
|
-
|
|
33
|
-
const layers = bucket.layerIds.map(id => style.getLayer(id)).filter(Boolean);
|
|
42
|
+
const layers = bucket.layers.map(({ id }) => style.getLayer(id)).filter(Boolean);
|
|
34
43
|
|
|
35
44
|
if (layers.length === 0) {
|
|
45
|
+
bucket.destroy();
|
|
46
|
+
buckets.delete(id);
|
|
36
47
|
continue;
|
|
37
48
|
}
|
|
38
49
|
|
|
39
|
-
//
|
|
40
|
-
// want to waste time serializing/copying them from the worker)
|
|
50
|
+
// swap out the layers in the bucket with the current style layers
|
|
41
51
|
bucket.layers = layers;
|
|
42
|
-
bucket.stateDependentLayers = layers.filter(
|
|
43
|
-
for (const layer of layers) {
|
|
44
|
-
output[layer.id] = bucket;
|
|
45
|
-
}
|
|
52
|
+
bucket.stateDependentLayers = layers.filter(layer => layer.isStateDependent());
|
|
46
53
|
}
|
|
47
|
-
|
|
48
|
-
return output;
|
|
49
54
|
}
|
|
50
|
-
|
|
51
|
-
module.exports = {
|
|
52
|
-
deserialize
|
|
53
|
-
};
|
package/src/data/dem_data.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const warn = require('../util/warn');
|
|
4
|
-
const { register } = require('../util/transfer_registry');
|
|
1
|
+
import { RGBAImage } from '../util/image.js';
|
|
2
|
+
import warn from '../util/warn.js';
|
|
5
3
|
|
|
6
4
|
// DEMData is a data structure for decoding, backfilling, and storing elevation data for processing in the hillshade shaders
|
|
7
5
|
// data can be populated either from a pngraw image tile or from serliazed data sent back from a worker. When data is initially
|
|
@@ -16,7 +14,9 @@ const { register } = require('../util/transfer_registry');
|
|
|
16
14
|
class DEMData {
|
|
17
15
|
constructor(uid, data, encoding) {
|
|
18
16
|
this.uid = uid;
|
|
19
|
-
if (data.height !== data.width)
|
|
17
|
+
if (data.height !== data.width) {
|
|
18
|
+
throw new RangeError('DEM tiles must be square');
|
|
19
|
+
}
|
|
20
20
|
if (encoding && encoding !== 'mapbox' && encoding !== 'terrarium') {
|
|
21
21
|
warn.once(`"${encoding}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);
|
|
22
22
|
return;
|
|
@@ -64,8 +64,9 @@ class DEMData {
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
_idx(x, y) {
|
|
67
|
-
if (x < -1 || x >= this.dim + 1 || y < -1 || y >= this.dim + 1)
|
|
67
|
+
if (x < -1 || x >= this.dim + 1 || y < -1 || y >= this.dim + 1) {
|
|
68
68
|
throw new RangeError('out of range source coordinates for DEM data');
|
|
69
|
+
}
|
|
69
70
|
return (y + 1) * this.stride + (x + 1);
|
|
70
71
|
}
|
|
71
72
|
|
|
@@ -86,7 +87,9 @@ class DEMData {
|
|
|
86
87
|
}
|
|
87
88
|
|
|
88
89
|
backfillBorder(borderTile, dx, dy) {
|
|
89
|
-
if (this.dim !== borderTile.dim)
|
|
90
|
+
if (this.dim !== borderTile.dim) {
|
|
91
|
+
throw new Error('dem dimension mismatch');
|
|
92
|
+
}
|
|
90
93
|
|
|
91
94
|
let xMin = dx * this.dim;
|
|
92
95
|
let xMax = dx * this.dim + this.dim;
|
|
@@ -121,6 +124,4 @@ class DEMData {
|
|
|
121
124
|
}
|
|
122
125
|
}
|
|
123
126
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
module.exports = DEMData;
|
|
127
|
+
export default DEMData;
|
package/src/data/extent.js
CHANGED
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const EvaluationParameters = require('../style/evaluation_parameters');
|
|
12
|
-
const { polygonIntersectsBox } = require('../util/intersection_tests');
|
|
13
|
-
|
|
14
|
-
const { FeatureIndexArray } = require('./array_types');
|
|
1
|
+
import Grid from 'grid-index';
|
|
2
|
+
import EvaluationParameters from '../style/evaluation_parameters.js';
|
|
3
|
+
import featureFilter from '../style-spec/feature_filter/index.js';
|
|
4
|
+
import dictionaryCoder from '../util/dictionary_coder.js';
|
|
5
|
+
import { polygonIntersectsBox } from '../util/intersection_tests.js';
|
|
6
|
+
import { arraysIntersect } from '../util/object.js';
|
|
7
|
+
import GeoJSONFeature from '../util/vectortile_to_geojson.js';
|
|
8
|
+
import { FeatureIndexArray } from './array_types.js';
|
|
9
|
+
import EXTENT from './extent.js';
|
|
10
|
+
import loadGeometry from './load_geometry.js';
|
|
15
11
|
|
|
16
12
|
class FeatureIndex {
|
|
17
13
|
constructor(tileID, grid = new Grid(EXTENT, 16, 0), featureIndexArray = new FeatureIndexArray()) {
|
|
@@ -37,7 +33,7 @@ class FeatureIndex {
|
|
|
37
33
|
|
|
38
34
|
loadVTLayers() {
|
|
39
35
|
if (!this.vtLayers) {
|
|
40
|
-
this.vtLayers =
|
|
36
|
+
this.vtLayers = this.vectorTile?.layers;
|
|
41
37
|
this.sourceLayerCoder = dictionaryCoder(this.vtLayers ? Object.keys(this.vtLayers) : ['_geojsonTileLayer']);
|
|
42
38
|
}
|
|
43
39
|
return this.vtLayers;
|
|
@@ -88,7 +84,9 @@ class FeatureIndex {
|
|
|
88
84
|
const index = matching[k];
|
|
89
85
|
|
|
90
86
|
// don't check the same feature more than once
|
|
91
|
-
if (index === previousIndex)
|
|
87
|
+
if (index === previousIndex) {
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
92
90
|
previousIndex = index;
|
|
93
91
|
|
|
94
92
|
const match = this.featureIndexArray.get(index);
|
|
@@ -139,13 +137,17 @@ class FeatureIndex {
|
|
|
139
137
|
intersectionTest
|
|
140
138
|
) {
|
|
141
139
|
const layerIDs = this.bucketLayerIDs[bucketIndex];
|
|
142
|
-
if (filterLayerIDs && !arraysIntersect(filterLayerIDs, layerIDs))
|
|
140
|
+
if (filterLayerIDs && !arraysIntersect(filterLayerIDs, layerIDs)) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
143
|
|
|
144
144
|
const sourceLayerName = this.sourceLayerCoder.decode(sourceLayerIndex);
|
|
145
145
|
const sourceLayer = this.vtLayers[sourceLayerName];
|
|
146
146
|
const feature = sourceLayer.feature(featureIndex);
|
|
147
147
|
|
|
148
|
-
if (!filter(new EvaluationParameters(this.tileID.overscaledZ), feature))
|
|
148
|
+
if (!filter(new EvaluationParameters(this.tileID.overscaledZ), feature)) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
149
151
|
|
|
150
152
|
const { x, y, z } = this.tileID.canonical;
|
|
151
153
|
for (const layerID of layerIDs) {
|
|
@@ -153,8 +155,10 @@ class FeatureIndex {
|
|
|
153
155
|
continue;
|
|
154
156
|
}
|
|
155
157
|
|
|
156
|
-
const styleLayer = styleLayers
|
|
157
|
-
if (!styleLayer)
|
|
158
|
+
const styleLayer = styleLayers.get(layerID);
|
|
159
|
+
if (!styleLayer) {
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
158
162
|
|
|
159
163
|
const intersectionZ = !intersectionTest || intersectionTest(feature, styleLayer);
|
|
160
164
|
if (!intersectionZ) {
|
|
@@ -163,7 +167,7 @@ class FeatureIndex {
|
|
|
163
167
|
}
|
|
164
168
|
|
|
165
169
|
const geojsonFeature = new GeoJSONFeature(feature, z, x, y);
|
|
166
|
-
geojsonFeature.layer = styleLayer
|
|
170
|
+
geojsonFeature.layer = styleLayer;
|
|
167
171
|
const layerResult = (result[layerID] ??= []);
|
|
168
172
|
layerResult.push({ featureIndex, feature: geojsonFeature, intersectionZ });
|
|
169
173
|
}
|
|
@@ -192,9 +196,7 @@ class FeatureIndex {
|
|
|
192
196
|
}
|
|
193
197
|
}
|
|
194
198
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
module.exports = FeatureIndex;
|
|
199
|
+
export default FeatureIndex;
|
|
198
200
|
|
|
199
201
|
function getBounds(geometry) {
|
|
200
202
|
let minX = Number.POSITIVE_INFINITY;
|
|
@@ -202,10 +204,18 @@ function getBounds(geometry) {
|
|
|
202
204
|
let maxX = Number.NEGATIVE_INFINITY;
|
|
203
205
|
let maxY = Number.NEGATIVE_INFINITY;
|
|
204
206
|
for (const { x, y } of geometry) {
|
|
205
|
-
if (x < minX)
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
if (
|
|
207
|
+
if (x < minX) {
|
|
208
|
+
minX = x;
|
|
209
|
+
}
|
|
210
|
+
if (x > maxX) {
|
|
211
|
+
maxX = x;
|
|
212
|
+
}
|
|
213
|
+
if (y < minY) {
|
|
214
|
+
minY = y;
|
|
215
|
+
}
|
|
216
|
+
if (y > maxY) {
|
|
217
|
+
maxY = y;
|
|
218
|
+
}
|
|
209
219
|
}
|
|
210
220
|
return { minX, minY, maxX, maxY };
|
|
211
221
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
export { LineIndexArray, LineStripIndexArray, TriangleIndexArray } from './array_types.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* An index array stores Uint16 indices of vertexes in a corresponding vertex array. We use
|
|
@@ -7,8 +7,3 @@ const { LineIndexArray, TriangleIndexArray, LineStripIndexArray } = require('./a
|
|
|
7
7
|
* forming a line strip.
|
|
8
8
|
* @private
|
|
9
9
|
*/
|
|
10
|
-
module.exports = {
|
|
11
|
-
LineIndexArray,
|
|
12
|
-
TriangleIndexArray,
|
|
13
|
-
LineStripIndexArray
|
|
14
|
-
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const EXTENT = require('./extent');
|
|
1
|
+
import warn from '../util/warn.js';
|
|
2
|
+
import EXTENT from './extent.js';
|
|
4
3
|
|
|
5
4
|
// These bounds define the minimum and maximum supported coordinate values.
|
|
6
5
|
// While visible coordinates are within [0, EXTENT], tiles may theoretically
|
|
@@ -21,13 +20,11 @@ const bounds = createBounds(16);
|
|
|
21
20
|
* @param {VectorTileFeature} feature
|
|
22
21
|
* @private
|
|
23
22
|
*/
|
|
24
|
-
|
|
23
|
+
export default function loadGeometry(feature) {
|
|
25
24
|
const scale = EXTENT / feature.extent;
|
|
26
25
|
const geometry = feature.loadGeometry();
|
|
27
|
-
for (
|
|
28
|
-
const ring
|
|
29
|
-
for (let p = 0; p < ring.length; p++) {
|
|
30
|
-
const point = ring[p];
|
|
26
|
+
for (const ring of geometry) {
|
|
27
|
+
for (const point of ring) {
|
|
31
28
|
// round here because mapbox-gl-native uses integers to represent
|
|
32
29
|
// points and we need to do the same to avoid renering differences.
|
|
33
30
|
point.x = Math.round(point.x * scale);
|
|
@@ -39,4 +36,4 @@ module.exports = function loadGeometry(feature) {
|
|
|
39
36
|
}
|
|
40
37
|
}
|
|
41
38
|
return geometry;
|
|
42
|
-
}
|
|
39
|
+
}
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
module.exports = createLayout([{ name: 'a_pos', type: 'Int16', components: 2 }]);
|
|
1
|
+
import { createLayout } from '../util/struct_array.js';
|
|
2
|
+
export default createLayout([{ name: 'a_pos', type: 'Int16', components: 2 }]);
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { supportsPropertyExpression } from '@mapwhit/style-expressions';
|
|
2
|
+
import { Uniform1f, Uniform4f, UniformColor } from '../render/uniform_binding.js';
|
|
3
|
+
import { packUint8ToFloat } from '../shaders/encode_attribute.js';
|
|
4
|
+
import EvaluationParameters from '../style/evaluation_parameters.js';
|
|
5
|
+
import { PossiblyEvaluatedPropertyValue } from '../style/properties.js';
|
|
6
|
+
import {
|
|
7
|
+
PatternLayoutArray,
|
|
6
8
|
StructArrayLayout1f4,
|
|
7
9
|
StructArrayLayout2f8,
|
|
8
|
-
StructArrayLayout4f16
|
|
9
|
-
|
|
10
|
-
} = require('./array_types');
|
|
11
|
-
const EvaluationParameters = require('../style/evaluation_parameters');
|
|
12
|
-
const { Uniform1f, UniformColor, Uniform4f } = require('../render/uniform_binding');
|
|
10
|
+
StructArrayLayout4f16
|
|
11
|
+
} from './array_types.js';
|
|
13
12
|
|
|
14
13
|
function packColor(color) {
|
|
15
14
|
return [packUint8ToFloat(255 * color.r, 255 * color.g), packUint8ToFloat(255 * color.b, 255 * color.a)];
|
|
@@ -97,8 +96,12 @@ class CrossFadedConstantBinder {
|
|
|
97
96
|
|
|
98
97
|
setUniforms(context, uniform, globals, currentValue, uniformName) {
|
|
99
98
|
const pos = this.patternPositions;
|
|
100
|
-
if (uniformName === 'u_pattern_to' && pos.patternTo)
|
|
101
|
-
|
|
99
|
+
if (uniformName === 'u_pattern_to' && pos.patternTo) {
|
|
100
|
+
uniform.set(pos.patternTo);
|
|
101
|
+
}
|
|
102
|
+
if (uniformName === 'u_pattern_from' && pos.patternFrom) {
|
|
103
|
+
uniform.set(pos.patternFrom);
|
|
104
|
+
}
|
|
102
105
|
}
|
|
103
106
|
|
|
104
107
|
getBinding(context, location) {
|
|
@@ -351,7 +354,9 @@ class CrossFadedCompositeBinder {
|
|
|
351
354
|
const imageMid = imagePositions[mid];
|
|
352
355
|
const imageMax = imagePositions[max];
|
|
353
356
|
|
|
354
|
-
if (!imageMin || !imageMid || !imageMax)
|
|
357
|
+
if (!imageMin || !imageMid || !imageMax) {
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
355
360
|
|
|
356
361
|
for (let i = start; i < length; i++) {
|
|
357
362
|
zoomInArray.emplaceBack(
|
|
@@ -394,7 +399,9 @@ class CrossFadedCompositeBinder {
|
|
|
394
399
|
const imageMid = imagePositions[mid];
|
|
395
400
|
const imageMax = imagePositions[max];
|
|
396
401
|
|
|
397
|
-
if (!imageMin || !imageMid || !imageMax)
|
|
402
|
+
if (!imageMin || !imageMid || !imageMax) {
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
398
405
|
for (let i = start; i < end; i++) {
|
|
399
406
|
zoomInArray.emplace(
|
|
400
407
|
i,
|
|
@@ -439,8 +446,12 @@ class CrossFadedCompositeBinder {
|
|
|
439
446
|
}
|
|
440
447
|
|
|
441
448
|
destroy() {
|
|
442
|
-
if (this.zoomOutPaintVertexBuffer)
|
|
443
|
-
|
|
449
|
+
if (this.zoomOutPaintVertexBuffer) {
|
|
450
|
+
this.zoomOutPaintVertexBuffer.destroy();
|
|
451
|
+
}
|
|
452
|
+
if (this.zoomInPaintVertexBuffer) {
|
|
453
|
+
this.zoomInPaintVertexBuffer.destroy();
|
|
454
|
+
}
|
|
444
455
|
}
|
|
445
456
|
|
|
446
457
|
setUniforms(context, uniform) {
|
|
@@ -472,7 +483,7 @@ class CrossFadedCompositeBinder {
|
|
|
472
483
|
*
|
|
473
484
|
* @private
|
|
474
485
|
*/
|
|
475
|
-
class ProgramConfiguration {
|
|
486
|
+
export default class ProgramConfiguration {
|
|
476
487
|
constructor() {
|
|
477
488
|
this.binders = {};
|
|
478
489
|
this.cacheKey = '';
|
|
@@ -486,9 +497,11 @@ class ProgramConfiguration {
|
|
|
486
497
|
const self = new ProgramConfiguration();
|
|
487
498
|
const keys = [];
|
|
488
499
|
|
|
489
|
-
for (const property in layer.
|
|
490
|
-
if (!filterProperties(property))
|
|
491
|
-
|
|
500
|
+
for (const property in layer._paint._values) {
|
|
501
|
+
if (!filterProperties(property)) {
|
|
502
|
+
continue;
|
|
503
|
+
}
|
|
504
|
+
const value = layer._paint.get(property);
|
|
492
505
|
if (
|
|
493
506
|
!(value instanceof PossiblyEvaluatedPropertyValue) ||
|
|
494
507
|
!supportsPropertyExpression(value.property.specification)
|
|
@@ -575,7 +588,9 @@ class ProgramConfiguration {
|
|
|
575
588
|
let dirty = false;
|
|
576
589
|
for (const id in featureStates) {
|
|
577
590
|
const posArray = this._idMap[id];
|
|
578
|
-
if (!posArray)
|
|
591
|
+
if (!posArray) {
|
|
592
|
+
continue;
|
|
593
|
+
}
|
|
579
594
|
|
|
580
595
|
const featureState = featureStates[id];
|
|
581
596
|
for (const pos of posArray) {
|
|
@@ -583,10 +598,12 @@ class ProgramConfiguration {
|
|
|
583
598
|
|
|
584
599
|
for (const property in this.binders) {
|
|
585
600
|
const binder = this.binders[property];
|
|
586
|
-
if (binder instanceof ConstantBinder || binder instanceof CrossFadedConstantBinder)
|
|
601
|
+
if (binder instanceof ConstantBinder || binder instanceof CrossFadedConstantBinder) {
|
|
602
|
+
continue;
|
|
603
|
+
}
|
|
587
604
|
if (binder.expression.isStateDependent === true) {
|
|
588
605
|
//AHM: Remove after https://github.com/mapbox/mapbox-gl-js/issues/6255
|
|
589
|
-
const value = layer.
|
|
606
|
+
const value = layer._paint.get(property);
|
|
590
607
|
binder.expression = value.value;
|
|
591
608
|
binder.updatePaintArray(pos.start, pos.end, feature, featureState, options);
|
|
592
609
|
dirty = true;
|
|
@@ -640,7 +657,9 @@ class ProgramConfiguration {
|
|
|
640
657
|
if (binder instanceof CrossFadedCompositeBinder) {
|
|
641
658
|
const patternVertexBuffer =
|
|
642
659
|
crossfade.fromScale === 2 ? binder.zoomInPaintVertexBuffer : binder.zoomOutPaintVertexBuffer;
|
|
643
|
-
if (patternVertexBuffer)
|
|
660
|
+
if (patternVertexBuffer) {
|
|
661
|
+
buffers.push(patternVertexBuffer);
|
|
662
|
+
}
|
|
644
663
|
} else if (
|
|
645
664
|
(binder instanceof SourceExpressionBinder || binder instanceof CompositeExpressionBinder) &&
|
|
646
665
|
binder.paintVertexBuffer
|
|
@@ -677,7 +696,7 @@ class ProgramConfiguration {
|
|
|
677
696
|
}
|
|
678
697
|
}
|
|
679
698
|
|
|
680
|
-
class ProgramConfigurationSet {
|
|
699
|
+
export class ProgramConfigurationSet {
|
|
681
700
|
constructor(layoutAttributes, layers, zoom, filterProperties = () => true) {
|
|
682
701
|
this.programConfigurations = {};
|
|
683
702
|
for (const layer of layers) {
|
|
@@ -707,7 +726,9 @@ class ProgramConfigurationSet {
|
|
|
707
726
|
}
|
|
708
727
|
|
|
709
728
|
upload(context) {
|
|
710
|
-
if (!this.needsUpload)
|
|
729
|
+
if (!this.needsUpload) {
|
|
730
|
+
return;
|
|
731
|
+
}
|
|
711
732
|
for (const layerId in this.programConfigurations) {
|
|
712
733
|
this.programConfigurations[layerId].upload(context);
|
|
713
734
|
}
|
|
@@ -776,15 +797,3 @@ function layoutType(property, type, binderType) {
|
|
|
776
797
|
const layoutException = getLayoutException(property);
|
|
777
798
|
return layoutException?.[binderType] || defaultLayouts[type][binderType];
|
|
778
799
|
}
|
|
779
|
-
|
|
780
|
-
register('ConstantBinder', ConstantBinder);
|
|
781
|
-
register('CrossFadedConstantBinder', CrossFadedConstantBinder);
|
|
782
|
-
register('SourceExpressionBinder', SourceExpressionBinder);
|
|
783
|
-
register('CrossFadedCompositeBinder', CrossFadedCompositeBinder);
|
|
784
|
-
register('CompositeExpressionBinder', CompositeExpressionBinder);
|
|
785
|
-
register('ProgramConfiguration', ProgramConfiguration, { omit: ['_buffers'] });
|
|
786
|
-
register('ProgramConfigurationSet', ProgramConfigurationSet);
|
|
787
|
-
|
|
788
|
-
ProgramConfiguration.ProgramConfigurationSet = ProgramConfigurationSet;
|
|
789
|
-
|
|
790
|
-
module.exports = ProgramConfiguration;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { createLayout } from '../util/struct_array.js';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
export default createLayout([
|
|
4
4
|
{ name: 'a_pos', type: 'Int16', components: 2 },
|
|
5
5
|
{ name: 'a_texture_pos', type: 'Int16', components: 2 }
|
|
6
6
|
]);
|
package/src/data/segment.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const { register } = require('../util/transfer_registry');
|
|
1
|
+
import warn from '../util/warn.js';
|
|
4
2
|
|
|
5
3
|
class SegmentVector {
|
|
6
4
|
constructor(segments = []) {
|
|
@@ -8,10 +6,11 @@ class SegmentVector {
|
|
|
8
6
|
}
|
|
9
7
|
|
|
10
8
|
prepareSegment(numVertices, layoutVertexArray, indexArray) {
|
|
11
|
-
if (numVertices > SegmentVector.MAX_VERTEX_ARRAY_LENGTH)
|
|
9
|
+
if (numVertices > SegmentVector.MAX_VERTEX_ARRAY_LENGTH) {
|
|
12
10
|
warn.once(
|
|
13
11
|
`Max vertices per segment is ${SegmentVector.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${numVertices}`
|
|
14
12
|
);
|
|
13
|
+
}
|
|
15
14
|
let segment = this.segments.at(-1);
|
|
16
15
|
if (!segment || segment.vertexLength + numVertices > SegmentVector.MAX_VERTEX_ARRAY_LENGTH) {
|
|
17
16
|
segment = {
|
|
@@ -58,6 +57,4 @@ class SegmentVector {
|
|
|
58
57
|
*/
|
|
59
58
|
SegmentVector.MAX_VERTEX_ARRAY_LENGTH = 2 ** 16 - 1;
|
|
60
59
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
module.exports = SegmentVector;
|
|
60
|
+
export default SegmentVector;
|
package/src/geo/coordinate.js
CHANGED
package/src/geo/lng_lat.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { wrap } from '../util/util.js';
|
|
2
|
+
import LngLatBounds from './lng_lat_bounds.js';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* A `LngLat` object represents a given longitude and latitude coordinate, measured in degrees.
|
|
@@ -80,7 +81,6 @@ class LngLat {
|
|
|
80
81
|
const earthCircumferenceInMetersAtEquator = 40075017;
|
|
81
82
|
const latAccuracy = (360 * radius) / earthCircumferenceInMetersAtEquator;
|
|
82
83
|
const lngAccuracy = latAccuracy / Math.cos((Math.PI / 180) * this.lat);
|
|
83
|
-
const LngLatBounds = require('./lng_lat_bounds');
|
|
84
84
|
|
|
85
85
|
return new LngLatBounds(
|
|
86
86
|
new LngLat(this.lng - lngAccuracy, this.lat - latAccuracy),
|
|
@@ -126,4 +126,4 @@ class LngLat {
|
|
|
126
126
|
* var v2 = [-122.420679, 37.772537];
|
|
127
127
|
*/
|
|
128
128
|
|
|
129
|
-
|
|
129
|
+
export default LngLat;
|