@mapwhit/tilerenderer 1.0.0 → 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/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 +105 -47
- 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 +58 -33
- 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 +53 -33
- 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,22 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const { hillshadeUniforms, hillshadePrepareUniforms } = require('./hillshade_program');
|
|
14
|
-
const { lineUniforms, lineGradientUniforms, linePatternUniforms, lineSDFUniforms } = require('./line_program');
|
|
15
|
-
const { rasterUniforms } = require('./raster_program');
|
|
16
|
-
const { symbolIconUniforms, symbolSDFUniforms } = require('./symbol_program');
|
|
17
|
-
const { backgroundUniforms, backgroundPatternUniforms } = require('./background_program');
|
|
1
|
+
import { backgroundPatternUniforms, backgroundUniforms } from './background_program.js';
|
|
2
|
+
import { circleUniforms } from './circle_program.js';
|
|
3
|
+
import { clippingMaskUniforms } from './clipping_mask_program.js';
|
|
4
|
+
import { collisionUniforms } from './collision_program.js';
|
|
5
|
+
import { debugUniforms } from './debug_program.js';
|
|
6
|
+
import { fillExtrusionPatternUniforms, fillExtrusionUniforms } from './fill_extrusion_program.js';
|
|
7
|
+
import { fillOutlinePatternUniforms, fillOutlineUniforms, fillPatternUniforms, fillUniforms } from './fill_program.js';
|
|
8
|
+
import { heatmapTextureUniforms, heatmapUniforms } from './heatmap_program.js';
|
|
9
|
+
import { hillshadePrepareUniforms, hillshadeUniforms } from './hillshade_program.js';
|
|
10
|
+
import { lineGradientUniforms, linePatternUniforms, lineSDFUniforms, lineUniforms } from './line_program.js';
|
|
11
|
+
import { rasterUniforms } from './raster_program.js';
|
|
12
|
+
import { symbolIconUniforms, symbolSDFUniforms } from './symbol_program.js';
|
|
18
13
|
|
|
19
|
-
const programUniforms = {
|
|
14
|
+
export const programUniforms = {
|
|
20
15
|
fillExtrusion: fillExtrusionUniforms,
|
|
21
16
|
fillExtrusionPattern: fillExtrusionPatternUniforms,
|
|
22
17
|
fill: fillUniforms,
|
|
@@ -42,5 +37,3 @@ const programUniforms = {
|
|
|
42
37
|
background: backgroundUniforms,
|
|
43
38
|
backgroundPattern: backgroundPatternUniforms
|
|
44
39
|
};
|
|
45
|
-
|
|
46
|
-
module.exports = { programUniforms };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { Uniform1f, Uniform1i, Uniform2f, Uniform3f, UniformMatrix4f } from '../uniform_binding.js';
|
|
2
2
|
|
|
3
|
-
const rasterUniforms = (context, locations) => ({
|
|
3
|
+
export const rasterUniforms = (context, locations) => ({
|
|
4
4
|
u_matrix: new UniformMatrix4f(context, locations.u_matrix),
|
|
5
5
|
u_tl_parent: new Uniform2f(context, locations.u_tl_parent),
|
|
6
6
|
u_scale_parent: new Uniform1f(context, locations.u_scale_parent),
|
|
@@ -16,7 +16,7 @@ const rasterUniforms = (context, locations) => ({
|
|
|
16
16
|
u_spin_weights: new Uniform3f(context, locations.u_spin_weights)
|
|
17
17
|
});
|
|
18
18
|
|
|
19
|
-
const rasterUniformValues = (matrix, parentTL, parentScaleBy, fade, layer) => ({
|
|
19
|
+
export const rasterUniformValues = (matrix, parentTL, parentScaleBy, fade, layer) => ({
|
|
20
20
|
u_matrix: matrix,
|
|
21
21
|
u_tl_parent: parentTL,
|
|
22
22
|
u_scale_parent: parentScaleBy,
|
|
@@ -46,5 +46,3 @@ function contrastFactor(contrast) {
|
|
|
46
46
|
function saturationFactor(saturation) {
|
|
47
47
|
return saturation > 0 ? 1 - 1 / (1.001 - saturation) : -saturation;
|
|
48
48
|
}
|
|
49
|
-
|
|
50
|
-
module.exports = { rasterUniforms, rasterUniformValues };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { Uniform1f, Uniform1i, Uniform2f, UniformMatrix4f } from '../uniform_binding.js';
|
|
2
2
|
|
|
3
|
-
const symbolIconUniforms = (context, locations) => ({
|
|
3
|
+
export const symbolIconUniforms = (context, locations) => ({
|
|
4
4
|
u_is_size_zoom_constant: new Uniform1i(context, locations.u_is_size_zoom_constant),
|
|
5
5
|
u_is_size_feature_constant: new Uniform1i(context, locations.u_is_size_feature_constant),
|
|
6
6
|
u_size_t: new Uniform1f(context, locations.u_size_t),
|
|
@@ -19,7 +19,7 @@ const symbolIconUniforms = (context, locations) => ({
|
|
|
19
19
|
u_texture: new Uniform1i(context, locations.u_texture)
|
|
20
20
|
});
|
|
21
21
|
|
|
22
|
-
const symbolSDFUniforms = (context, locations) => ({
|
|
22
|
+
export const symbolSDFUniforms = (context, locations) => ({
|
|
23
23
|
u_is_size_zoom_constant: new Uniform1i(context, locations.u_is_size_zoom_constant),
|
|
24
24
|
u_is_size_feature_constant: new Uniform1i(context, locations.u_is_size_feature_constant),
|
|
25
25
|
u_size_t: new Uniform1f(context, locations.u_size_t),
|
|
@@ -40,7 +40,7 @@ const symbolSDFUniforms = (context, locations) => ({
|
|
|
40
40
|
u_is_halo: new Uniform1f(context, locations.u_is_halo)
|
|
41
41
|
});
|
|
42
42
|
|
|
43
|
-
const symbolIconUniformValues = (
|
|
43
|
+
export const symbolIconUniformValues = (
|
|
44
44
|
functionType,
|
|
45
45
|
size,
|
|
46
46
|
rotateInShader,
|
|
@@ -74,7 +74,7 @@ const symbolIconUniformValues = (
|
|
|
74
74
|
};
|
|
75
75
|
};
|
|
76
76
|
|
|
77
|
-
const symbolSDFUniformValues = (
|
|
77
|
+
export const symbolSDFUniformValues = (
|
|
78
78
|
functionType,
|
|
79
79
|
size,
|
|
80
80
|
rotateInShader,
|
|
@@ -108,5 +108,3 @@ const symbolSDFUniformValues = (
|
|
|
108
108
|
}
|
|
109
109
|
);
|
|
110
110
|
};
|
|
111
|
-
|
|
112
|
-
module.exports = { symbolIconUniforms, symbolSDFUniforms, symbolIconUniformValues, symbolSDFUniformValues };
|
package/src/render/program.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const VertexArrayObject = require('./vertex_array_object');
|
|
1
|
+
import assert from 'assert';
|
|
2
|
+
import shaders from '../shaders/index.js';
|
|
3
|
+
import browser from '../util/browser.js';
|
|
4
|
+
import VertexArrayObject from './vertex_array_object.js';
|
|
6
5
|
|
|
7
6
|
class Program {
|
|
8
7
|
constructor(context, source, configuration, fixedUniforms, showOverdrawInspector) {
|
|
@@ -130,4 +129,4 @@ class Program {
|
|
|
130
129
|
}
|
|
131
130
|
}
|
|
132
131
|
|
|
133
|
-
|
|
132
|
+
export default Program;
|
package/src/render/texture.js
CHANGED
package/src/render/tile_mask.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { CanonicalTileID, OverscaledTileID } from '../source/tile_id.js';
|
|
2
2
|
|
|
3
3
|
// Updates the TileMasks for all renderable tiles. A TileMask describes all regions
|
|
4
4
|
// within that tile that are *not* covered by other renderable tiles.
|
|
@@ -50,7 +50,7 @@ const { OverscaledTileID, CanonicalTileID } = require('../source/tile_id');
|
|
|
50
50
|
// be considered. For example, adding TileID 4/8/13 to renderableTiles won't affect the TileMask for
|
|
51
51
|
// 2/1/3, since it is not a descendant of it.
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
export default function (renderableTiles, context) {
|
|
54
54
|
const sortedRenderables = renderableTiles.sort((a, b) => {
|
|
55
55
|
return a.tileID.isLessThan(b.tileID) ? -1 : b.tileID.isLessThan(a.tileID) ? 1 : 0;
|
|
56
56
|
});
|
|
@@ -73,14 +73,16 @@ module.exports = function (renderableTiles, context) {
|
|
|
73
73
|
);
|
|
74
74
|
tile.setMask(mask, context);
|
|
75
75
|
}
|
|
76
|
-
}
|
|
76
|
+
}
|
|
77
77
|
|
|
78
78
|
function computeTileMasks(rootTile, ref, childArray, lowerBound, mask) {
|
|
79
79
|
// If the reference or any of its children is found in the list, we need to recurse.
|
|
80
80
|
for (let i = 0; i < childArray.length; i++) {
|
|
81
81
|
const childTile = childArray[i];
|
|
82
82
|
// childTile is from a larger wrap than the rootTile so it cannot be a child tile
|
|
83
|
-
if (lowerBound.isLessThan(childTile.tileID))
|
|
83
|
+
if (lowerBound.isLessThan(childTile.tileID)) {
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
84
86
|
// The current tile is masked out, so we don't need to add them to the mask set.
|
|
85
87
|
if (ref.key === childTile.tileID.key) {
|
|
86
88
|
return;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
import { Color } from '@mapwhit/style-expressions';
|
|
2
2
|
|
|
3
|
-
class Uniform {
|
|
3
|
+
export class Uniform {
|
|
4
4
|
constructor(context, location) {
|
|
5
5
|
this.gl = context.gl;
|
|
6
6
|
this.location = location;
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
class Uniform1i extends Uniform {
|
|
10
|
+
export class Uniform1i extends Uniform {
|
|
11
11
|
constructor(context, location) {
|
|
12
12
|
super(context, location);
|
|
13
13
|
this.current = 0;
|
|
@@ -21,7 +21,7 @@ class Uniform1i extends Uniform {
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
class Uniform1f extends Uniform {
|
|
24
|
+
export class Uniform1f extends Uniform {
|
|
25
25
|
constructor(context, location) {
|
|
26
26
|
super(context, location);
|
|
27
27
|
this.current = 0;
|
|
@@ -35,7 +35,7 @@ class Uniform1f extends Uniform {
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
class Uniform2f extends Uniform {
|
|
38
|
+
export class Uniform2f extends Uniform {
|
|
39
39
|
constructor(context, location) {
|
|
40
40
|
super(context, location);
|
|
41
41
|
this.current = [0, 0];
|
|
@@ -49,7 +49,7 @@ class Uniform2f extends Uniform {
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
class Uniform3f extends Uniform {
|
|
52
|
+
export class Uniform3f extends Uniform {
|
|
53
53
|
constructor(context, location) {
|
|
54
54
|
super(context, location);
|
|
55
55
|
this.current = [0, 0, 0];
|
|
@@ -63,7 +63,7 @@ class Uniform3f extends Uniform {
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
class Uniform4f extends Uniform {
|
|
66
|
+
export class Uniform4f extends Uniform {
|
|
67
67
|
constructor(context, location) {
|
|
68
68
|
super(context, location);
|
|
69
69
|
this.current = [0, 0, 0, 0];
|
|
@@ -77,7 +77,7 @@ class Uniform4f extends Uniform {
|
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
class UniformColor extends Uniform {
|
|
80
|
+
export class UniformColor extends Uniform {
|
|
81
81
|
constructor(context, location) {
|
|
82
82
|
super(context, location);
|
|
83
83
|
this.current = Color.transparent;
|
|
@@ -92,7 +92,7 @@ class UniformColor extends Uniform {
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
const emptyMat4 = new Float32Array(16);
|
|
95
|
-
class UniformMatrix4f extends Uniform {
|
|
95
|
+
export class UniformMatrix4f extends Uniform {
|
|
96
96
|
constructor(context, location) {
|
|
97
97
|
super(context, location);
|
|
98
98
|
this.current = emptyMat4;
|
|
@@ -116,14 +116,3 @@ class UniformMatrix4f extends Uniform {
|
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
|
-
|
|
120
|
-
module.exports = {
|
|
121
|
-
Uniform,
|
|
122
|
-
Uniform1i,
|
|
123
|
-
Uniform1f,
|
|
124
|
-
Uniform2f,
|
|
125
|
-
Uniform3f,
|
|
126
|
-
Uniform4f,
|
|
127
|
-
UniformColor,
|
|
128
|
-
UniformMatrix4f
|
|
129
|
-
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import assert from 'assert';
|
|
2
2
|
|
|
3
3
|
class VertexArrayObject {
|
|
4
4
|
constructor() {
|
|
@@ -84,7 +84,9 @@ class VertexArrayObject {
|
|
|
84
84
|
const gl = context.gl;
|
|
85
85
|
|
|
86
86
|
if (context.extVertexArrayObject) {
|
|
87
|
-
if (this.vao)
|
|
87
|
+
if (this.vao) {
|
|
88
|
+
this.destroy();
|
|
89
|
+
}
|
|
88
90
|
this.vao = context.extVertexArrayObject.createVertexArrayOES();
|
|
89
91
|
context.bindVertexArrayOES.set(this.vao);
|
|
90
92
|
numPrevAttributes = 0;
|
|
@@ -152,4 +154,4 @@ class VertexArrayObject {
|
|
|
152
154
|
}
|
|
153
155
|
}
|
|
154
156
|
|
|
155
|
-
|
|
157
|
+
export default VertexArrayObject;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { clamp } from '../util/util.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Packs two numbers, interpreted as 8-bit unsigned integers, into a single
|
|
@@ -7,13 +7,9 @@ const { clamp } = require('../util/util');
|
|
|
7
7
|
*
|
|
8
8
|
* @private
|
|
9
9
|
*/
|
|
10
|
-
function
|
|
10
|
+
export function packUint8ToFloat(a, b) {
|
|
11
11
|
// coerce a and b to 8-bit ints
|
|
12
12
|
a = clamp(Math.floor(a), 0, 255);
|
|
13
13
|
b = clamp(Math.floor(b), 0, 255);
|
|
14
14
|
return 256 * a + b;
|
|
15
15
|
}
|
|
16
|
-
|
|
17
|
-
module.exports = {
|
|
18
|
-
packUint8ToFloat: pack
|
|
19
|
-
};
|
package/src/shaders/index.js
CHANGED
|
@@ -1,103 +1,155 @@
|
|
|
1
|
+
// Import all shader sources
|
|
2
|
+
import preludeFragmentSource from '../../build/min/src/shaders/_prelude.fragment.glsl.js';
|
|
3
|
+
import preludeVertexSource from '../../build/min/src/shaders/_prelude.vertex.glsl.js';
|
|
4
|
+
import backgroundFragmentSource from '../../build/min/src/shaders/background.fragment.glsl.js';
|
|
5
|
+
import backgroundVertexSource from '../../build/min/src/shaders/background.vertex.glsl.js';
|
|
6
|
+
import backgroundPatternFragmentSource from '../../build/min/src/shaders/background_pattern.fragment.glsl.js';
|
|
7
|
+
import backgroundPatternVertexSource from '../../build/min/src/shaders/background_pattern.vertex.glsl.js';
|
|
8
|
+
import circleFragmentSource from '../../build/min/src/shaders/circle.fragment.glsl.js';
|
|
9
|
+
import circleVertexSource from '../../build/min/src/shaders/circle.vertex.glsl.js';
|
|
10
|
+
import clippingMaskFragmentSource from '../../build/min/src/shaders/clipping_mask.fragment.glsl.js';
|
|
11
|
+
import clippingMaskVertexSource from '../../build/min/src/shaders/clipping_mask.vertex.glsl.js';
|
|
12
|
+
import collisionBoxFragmentSource from '../../build/min/src/shaders/collision_box.fragment.glsl.js';
|
|
13
|
+
import collisionBoxVertexSource from '../../build/min/src/shaders/collision_box.vertex.glsl.js';
|
|
14
|
+
import collisionCircleFragmentSource from '../../build/min/src/shaders/collision_circle.fragment.glsl.js';
|
|
15
|
+
import collisionCircleVertexSource from '../../build/min/src/shaders/collision_circle.vertex.glsl.js';
|
|
16
|
+
import debugFragmentSource from '../../build/min/src/shaders/debug.fragment.glsl.js';
|
|
17
|
+
import debugVertexSource from '../../build/min/src/shaders/debug.vertex.glsl.js';
|
|
18
|
+
import fillFragmentSource from '../../build/min/src/shaders/fill.fragment.glsl.js';
|
|
19
|
+
import fillVertexSource from '../../build/min/src/shaders/fill.vertex.glsl.js';
|
|
20
|
+
import fillExtrusionFragmentSource from '../../build/min/src/shaders/fill_extrusion.fragment.glsl.js';
|
|
21
|
+
import fillExtrusionVertexSource from '../../build/min/src/shaders/fill_extrusion.vertex.glsl.js';
|
|
22
|
+
import fillExtrusionPatternFragmentSource from '../../build/min/src/shaders/fill_extrusion_pattern.fragment.glsl.js';
|
|
23
|
+
import fillExtrusionPatternVertexSource from '../../build/min/src/shaders/fill_extrusion_pattern.vertex.glsl.js';
|
|
24
|
+
import fillOutlineFragmentSource from '../../build/min/src/shaders/fill_outline.fragment.glsl.js';
|
|
25
|
+
import fillOutlineVertexSource from '../../build/min/src/shaders/fill_outline.vertex.glsl.js';
|
|
26
|
+
import fillOutlinePatternFragmentSource from '../../build/min/src/shaders/fill_outline_pattern.fragment.glsl.js';
|
|
27
|
+
import fillOutlinePatternVertexSource from '../../build/min/src/shaders/fill_outline_pattern.vertex.glsl.js';
|
|
28
|
+
import fillPatternFragmentSource from '../../build/min/src/shaders/fill_pattern.fragment.glsl.js';
|
|
29
|
+
import fillPatternVertexSource from '../../build/min/src/shaders/fill_pattern.vertex.glsl.js';
|
|
30
|
+
import heatmapFragmentSource from '../../build/min/src/shaders/heatmap.fragment.glsl.js';
|
|
31
|
+
import heatmapVertexSource from '../../build/min/src/shaders/heatmap.vertex.glsl.js';
|
|
32
|
+
import heatmapTextureFragmentSource from '../../build/min/src/shaders/heatmap_texture.fragment.glsl.js';
|
|
33
|
+
import heatmapTextureVertexSource from '../../build/min/src/shaders/heatmap_texture.vertex.glsl.js';
|
|
34
|
+
import hillshadeFragmentSource from '../../build/min/src/shaders/hillshade.fragment.glsl.js';
|
|
35
|
+
import hillshadeVertexSource from '../../build/min/src/shaders/hillshade.vertex.glsl.js';
|
|
36
|
+
import hillshadePrepareFragmentSource from '../../build/min/src/shaders/hillshade_prepare.fragment.glsl.js';
|
|
37
|
+
import hillshadePrepareVertexSource from '../../build/min/src/shaders/hillshade_prepare.vertex.glsl.js';
|
|
38
|
+
import lineFragmentSource from '../../build/min/src/shaders/line.fragment.glsl.js';
|
|
39
|
+
import lineVertexSource from '../../build/min/src/shaders/line.vertex.glsl.js';
|
|
40
|
+
import lineGradientFragmentSource from '../../build/min/src/shaders/line_gradient.fragment.glsl.js';
|
|
41
|
+
import lineGradientVertexSource from '../../build/min/src/shaders/line_gradient.vertex.glsl.js';
|
|
42
|
+
import linePatternFragmentSource from '../../build/min/src/shaders/line_pattern.fragment.glsl.js';
|
|
43
|
+
import linePatternVertexSource from '../../build/min/src/shaders/line_pattern.vertex.glsl.js';
|
|
44
|
+
import lineSDFFragmentSource from '../../build/min/src/shaders/line_sdf.fragment.glsl.js';
|
|
45
|
+
import lineSDFVertexSource from '../../build/min/src/shaders/line_sdf.vertex.glsl.js';
|
|
46
|
+
import rasterFragmentSource from '../../build/min/src/shaders/raster.fragment.glsl.js';
|
|
47
|
+
import rasterVertexSource from '../../build/min/src/shaders/raster.vertex.glsl.js';
|
|
48
|
+
import symbolIconFragmentSource from '../../build/min/src/shaders/symbol_icon.fragment.glsl.js';
|
|
49
|
+
import symbolIconVertexSource from '../../build/min/src/shaders/symbol_icon.vertex.glsl.js';
|
|
50
|
+
import symbolSDFFragmentSource from '../../build/min/src/shaders/symbol_sdf.fragment.glsl.js';
|
|
51
|
+
import symbolSDFVertexSource from '../../build/min/src/shaders/symbol_sdf.vertex.glsl.js';
|
|
52
|
+
|
|
1
53
|
const shaders = {
|
|
2
54
|
prelude: {
|
|
3
|
-
fragmentSource:
|
|
4
|
-
vertexSource:
|
|
55
|
+
fragmentSource: preludeFragmentSource,
|
|
56
|
+
vertexSource: preludeVertexSource
|
|
5
57
|
},
|
|
6
58
|
background: {
|
|
7
|
-
fragmentSource:
|
|
8
|
-
vertexSource:
|
|
59
|
+
fragmentSource: backgroundFragmentSource,
|
|
60
|
+
vertexSource: backgroundVertexSource
|
|
9
61
|
},
|
|
10
62
|
backgroundPattern: {
|
|
11
|
-
fragmentSource:
|
|
12
|
-
vertexSource:
|
|
63
|
+
fragmentSource: backgroundPatternFragmentSource,
|
|
64
|
+
vertexSource: backgroundPatternVertexSource
|
|
13
65
|
},
|
|
14
66
|
circle: {
|
|
15
|
-
fragmentSource:
|
|
16
|
-
vertexSource:
|
|
67
|
+
fragmentSource: circleFragmentSource,
|
|
68
|
+
vertexSource: circleVertexSource
|
|
17
69
|
},
|
|
18
70
|
clippingMask: {
|
|
19
|
-
fragmentSource:
|
|
20
|
-
vertexSource:
|
|
71
|
+
fragmentSource: clippingMaskFragmentSource,
|
|
72
|
+
vertexSource: clippingMaskVertexSource
|
|
21
73
|
},
|
|
22
74
|
heatmap: {
|
|
23
|
-
fragmentSource:
|
|
24
|
-
vertexSource:
|
|
75
|
+
fragmentSource: heatmapFragmentSource,
|
|
76
|
+
vertexSource: heatmapVertexSource
|
|
25
77
|
},
|
|
26
78
|
heatmapTexture: {
|
|
27
|
-
fragmentSource:
|
|
28
|
-
vertexSource:
|
|
79
|
+
fragmentSource: heatmapTextureFragmentSource,
|
|
80
|
+
vertexSource: heatmapTextureVertexSource
|
|
29
81
|
},
|
|
30
82
|
collisionBox: {
|
|
31
|
-
fragmentSource:
|
|
32
|
-
vertexSource:
|
|
83
|
+
fragmentSource: collisionBoxFragmentSource,
|
|
84
|
+
vertexSource: collisionBoxVertexSource
|
|
33
85
|
},
|
|
34
86
|
collisionCircle: {
|
|
35
|
-
fragmentSource:
|
|
36
|
-
vertexSource:
|
|
87
|
+
fragmentSource: collisionCircleFragmentSource,
|
|
88
|
+
vertexSource: collisionCircleVertexSource
|
|
37
89
|
},
|
|
38
90
|
debug: {
|
|
39
|
-
fragmentSource:
|
|
40
|
-
vertexSource:
|
|
91
|
+
fragmentSource: debugFragmentSource,
|
|
92
|
+
vertexSource: debugVertexSource
|
|
41
93
|
},
|
|
42
94
|
fill: {
|
|
43
|
-
fragmentSource:
|
|
44
|
-
vertexSource:
|
|
95
|
+
fragmentSource: fillFragmentSource,
|
|
96
|
+
vertexSource: fillVertexSource
|
|
45
97
|
},
|
|
46
98
|
fillOutline: {
|
|
47
|
-
fragmentSource:
|
|
48
|
-
vertexSource:
|
|
99
|
+
fragmentSource: fillOutlineFragmentSource,
|
|
100
|
+
vertexSource: fillOutlineVertexSource
|
|
49
101
|
},
|
|
50
102
|
fillOutlinePattern: {
|
|
51
|
-
fragmentSource:
|
|
52
|
-
vertexSource:
|
|
103
|
+
fragmentSource: fillOutlinePatternFragmentSource,
|
|
104
|
+
vertexSource: fillOutlinePatternVertexSource
|
|
53
105
|
},
|
|
54
106
|
fillPattern: {
|
|
55
|
-
fragmentSource:
|
|
56
|
-
vertexSource:
|
|
107
|
+
fragmentSource: fillPatternFragmentSource,
|
|
108
|
+
vertexSource: fillPatternVertexSource
|
|
57
109
|
},
|
|
58
110
|
fillExtrusion: {
|
|
59
|
-
fragmentSource:
|
|
60
|
-
vertexSource:
|
|
111
|
+
fragmentSource: fillExtrusionFragmentSource,
|
|
112
|
+
vertexSource: fillExtrusionVertexSource
|
|
61
113
|
},
|
|
62
114
|
fillExtrusionPattern: {
|
|
63
|
-
fragmentSource:
|
|
64
|
-
vertexSource:
|
|
115
|
+
fragmentSource: fillExtrusionPatternFragmentSource,
|
|
116
|
+
vertexSource: fillExtrusionPatternVertexSource
|
|
65
117
|
},
|
|
66
118
|
hillshadePrepare: {
|
|
67
|
-
fragmentSource:
|
|
68
|
-
vertexSource:
|
|
119
|
+
fragmentSource: hillshadePrepareFragmentSource,
|
|
120
|
+
vertexSource: hillshadePrepareVertexSource
|
|
69
121
|
},
|
|
70
122
|
hillshade: {
|
|
71
|
-
fragmentSource:
|
|
72
|
-
vertexSource:
|
|
123
|
+
fragmentSource: hillshadeFragmentSource,
|
|
124
|
+
vertexSource: hillshadeVertexSource
|
|
73
125
|
},
|
|
74
126
|
line: {
|
|
75
|
-
fragmentSource:
|
|
76
|
-
vertexSource:
|
|
127
|
+
fragmentSource: lineFragmentSource,
|
|
128
|
+
vertexSource: lineVertexSource
|
|
77
129
|
},
|
|
78
130
|
lineGradient: {
|
|
79
|
-
fragmentSource:
|
|
80
|
-
vertexSource:
|
|
131
|
+
fragmentSource: lineGradientFragmentSource,
|
|
132
|
+
vertexSource: lineGradientVertexSource
|
|
81
133
|
},
|
|
82
134
|
linePattern: {
|
|
83
|
-
fragmentSource:
|
|
84
|
-
vertexSource:
|
|
135
|
+
fragmentSource: linePatternFragmentSource,
|
|
136
|
+
vertexSource: linePatternVertexSource
|
|
85
137
|
},
|
|
86
138
|
lineSDF: {
|
|
87
|
-
fragmentSource:
|
|
88
|
-
vertexSource:
|
|
139
|
+
fragmentSource: lineSDFFragmentSource,
|
|
140
|
+
vertexSource: lineSDFVertexSource
|
|
89
141
|
},
|
|
90
142
|
raster: {
|
|
91
|
-
fragmentSource:
|
|
92
|
-
vertexSource:
|
|
143
|
+
fragmentSource: rasterFragmentSource,
|
|
144
|
+
vertexSource: rasterVertexSource
|
|
93
145
|
},
|
|
94
146
|
symbolIcon: {
|
|
95
|
-
fragmentSource:
|
|
96
|
-
vertexSource:
|
|
147
|
+
fragmentSource: symbolIconFragmentSource,
|
|
148
|
+
vertexSource: symbolIconVertexSource
|
|
97
149
|
},
|
|
98
150
|
symbolSDF: {
|
|
99
|
-
fragmentSource:
|
|
100
|
-
vertexSource:
|
|
151
|
+
fragmentSource: symbolSDFFragmentSource,
|
|
152
|
+
vertexSource: symbolSDFVertexSource
|
|
101
153
|
}
|
|
102
154
|
};
|
|
103
155
|
|
|
@@ -191,4 +243,4 @@ ${precision} ${type} ${name} = u_${name};
|
|
|
191
243
|
});
|
|
192
244
|
}
|
|
193
245
|
|
|
194
|
-
|
|
246
|
+
export default shaders;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { ErrorEvent, Event, Evented } from '@mapwhit/events';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import EXTENT from '../data/extent.js';
|
|
4
|
+
import browser from '../util/browser.js';
|
|
5
|
+
import GeoJSONWorkerSource from './geojson_worker_source.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* A source containing GeoJSON.
|
|
@@ -76,8 +76,12 @@ class GeoJSONSource extends Evented {
|
|
|
76
76
|
this.data = options.data;
|
|
77
77
|
this._options = Object.assign({}, options);
|
|
78
78
|
|
|
79
|
-
if (options.maxzoom !== undefined)
|
|
80
|
-
|
|
79
|
+
if (options.maxzoom !== undefined) {
|
|
80
|
+
this.maxzoom = options.maxzoom;
|
|
81
|
+
}
|
|
82
|
+
if (options.type) {
|
|
83
|
+
this.type = options.type;
|
|
84
|
+
}
|
|
81
85
|
|
|
82
86
|
const scale = EXTENT / this.tileSize;
|
|
83
87
|
|
|
@@ -212,4 +216,4 @@ class GeoJSONSource extends Evented {
|
|
|
212
216
|
}
|
|
213
217
|
}
|
|
214
218
|
|
|
215
|
-
|
|
219
|
+
export default GeoJSONSource;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import rewind from '@mapwhit/geojson-rewind';
|
|
2
|
+
import geojsonvt from 'geojson-vt';
|
|
3
|
+
import Supercluster from 'supercluster';
|
|
4
|
+
import GeoJSONWrapper from './geojson_wrapper.js';
|
|
5
|
+
import VectorTileWorkerSource from './vector_tile_worker_source.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* The {@link WorkerSource} implementation that supports {@link GeoJSONSource}.
|
|
@@ -73,9 +73,9 @@ class GeoJSONWorkerSource extends VectorTileWorkerSource {
|
|
|
73
73
|
function loadJSON(data) {
|
|
74
74
|
try {
|
|
75
75
|
return typeof data === 'string' ? JSON.parse(data) : data;
|
|
76
|
-
} catch
|
|
76
|
+
} catch {
|
|
77
77
|
throw new Error('Input data is not a valid GeoJSON object.');
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
export default GeoJSONWorkerSource;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import Point from '@mapbox/point-geometry';
|
|
2
|
+
import { VectorTileFeature } from '@mapwhit/vector-tile';
|
|
3
|
+
import EXTENT from '../data/extent.js';
|
|
4
4
|
|
|
5
5
|
const { toGeoJSON } = VectorTileFeature.prototype;
|
|
6
6
|
|
|
@@ -76,7 +76,7 @@ class GeoJSONWrapper {
|
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
|
|
79
|
+
export default GeoJSONWrapper;
|
|
80
80
|
|
|
81
81
|
function makePoint(arr) {
|
|
82
82
|
return new Point(arr[0], arr[1]);
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const Texture = require('../render/texture');
|
|
1
|
+
import { ErrorEvent, Event, Evented } from '@mapwhit/events';
|
|
2
|
+
import { RasterBoundsArray } from '../data/array_types.js';
|
|
3
|
+
import EXTENT from '../data/extent.js';
|
|
4
|
+
import rasterBoundsAttributes from '../data/raster_bounds_attributes.js';
|
|
5
|
+
import SegmentVector from '../data/segment.js';
|
|
6
|
+
import LngLat from '../geo/lng_lat.js';
|
|
7
|
+
import Texture from '../render/texture.js';
|
|
8
|
+
import loadImage from '../util/loader/image.js';
|
|
9
|
+
import { getCoordinatesCenter } from '../util/util.js';
|
|
10
|
+
import { CanonicalTileID } from './tile_id.js';
|
|
12
11
|
|
|
13
12
|
/**
|
|
14
13
|
* A data source containing an image.
|
|
@@ -195,4 +194,4 @@ class ImageSource extends Evented {
|
|
|
195
194
|
}
|
|
196
195
|
}
|
|
197
196
|
|
|
198
|
-
|
|
197
|
+
export default ImageSource;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { pick } from '../util/object.js';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
export default function (tileJSON) {
|
|
4
4
|
return tileJSON.resourceSets ? fromResourseSets(tileJSON) : fromTileJSON(tileJSON);
|
|
5
|
-
}
|
|
5
|
+
}
|
|
6
6
|
|
|
7
7
|
function fromTileJSON(tileJSON) {
|
|
8
8
|
const result = pick(tileJSON, ['tiles', 'minzoom', 'maxzoom', 'attribution', 'bounds']);
|