maplibre-gl 3.1.0 → 3.2.0-pre.2
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 -7
- package/build/generate-doc-images.ts +73 -0
- package/build/generate-docs.ts +100 -0
- package/build/generate-struct-arrays.ts +9 -12
- package/dist/maplibre-gl-csp-worker.js +1 -1
- package/dist/maplibre-gl-csp-worker.js.map +1 -1
- package/dist/maplibre-gl-csp.js +1 -1
- package/dist/maplibre-gl-csp.js.map +1 -1
- package/dist/maplibre-gl-dev.js +3303 -3398
- package/dist/maplibre-gl-dev.js.map +1 -1
- package/dist/maplibre-gl.d.ts +3899 -3531
- package/dist/maplibre-gl.js +3 -3
- package/dist/maplibre-gl.js.map +1 -1
- package/package.json +28 -25
- package/src/data/array_types.g.ts +14 -48
- package/src/data/bucket/circle_bucket.ts +11 -14
- package/src/data/bucket/fill_bucket.test.ts +6 -6
- package/src/data/bucket/fill_bucket.ts +10 -12
- package/src/data/bucket/fill_extrusion_bucket.ts +11 -13
- package/src/data/bucket/heatmap_bucket.ts +3 -6
- package/src/data/bucket/line_attributes.ts +1 -2
- package/src/data/bucket/line_attributes_ext.ts +1 -2
- package/src/data/bucket/line_bucket.test.ts +5 -5
- package/src/data/bucket/line_bucket.ts +18 -21
- package/src/data/bucket/pattern_attributes.ts +1 -3
- package/src/data/bucket/pattern_bucket_features.ts +3 -3
- package/src/data/bucket/symbol_bucket.test.ts +5 -5
- package/src/data/bucket/symbol_bucket.ts +12 -15
- package/src/data/bucket.ts +7 -11
- package/src/data/dem_data.test.ts +1 -1
- package/src/data/dem_data.ts +1 -1
- package/src/data/evaluation_feature.ts +4 -5
- package/src/data/extent.ts +1 -4
- package/src/data/feature_index.ts +14 -13
- package/src/data/feature_position_map.test.ts +4 -4
- package/src/data/feature_position_map.ts +1 -1
- package/src/data/index_array_type.ts +0 -1
- package/src/data/load_geometry.test.ts +1 -1
- package/src/data/load_geometry.ts +3 -4
- package/src/data/program_configuration.ts +6 -11
- package/src/data/segment.ts +9 -6
- package/src/geo/edge_insets.test.ts +1 -1
- package/src/geo/edge_insets.ts +36 -26
- package/src/geo/lng_lat.test.ts +1 -1
- package/src/geo/lng_lat.ts +61 -44
- package/src/geo/lng_lat_bounds.test.ts +2 -2
- package/src/geo/lng_lat_bounds.ts +88 -68
- package/src/geo/mercator_coordinate.test.ts +2 -2
- package/src/geo/mercator_coordinate.ts +34 -27
- package/src/geo/transform.test.ts +3 -3
- package/src/geo/transform.ts +58 -79
- package/src/gl/color_mode.ts +1 -3
- package/src/gl/context.ts +12 -11
- package/src/gl/cull_face_mode.ts +1 -3
- package/src/gl/depth_mode.ts +1 -3
- package/src/gl/framebuffer.ts +5 -4
- package/src/gl/index_buffer.ts +5 -4
- package/src/gl/render_pool.test.ts +2 -2
- package/src/gl/render_pool.ts +5 -5
- package/src/gl/state.test.ts +1 -1
- package/src/gl/stencil_mode.ts +1 -3
- package/src/gl/value.ts +1 -1
- package/src/gl/vertex_buffer.test.ts +2 -2
- package/src/gl/vertex_buffer.ts +8 -14
- package/src/index.test.ts +2 -2
- package/src/index.ts +121 -113
- package/src/render/draw_background.ts +7 -9
- package/src/render/draw_circle.ts +13 -15
- package/src/render/draw_collision_debug.ts +11 -13
- package/src/render/draw_custom.ts +6 -8
- package/src/render/draw_debug.test.ts +4 -4
- package/src/render/draw_debug.ts +8 -10
- package/src/render/draw_fill.test.ts +13 -13
- package/src/render/draw_fill.ts +9 -11
- package/src/render/draw_fill_extrusion.ts +10 -12
- package/src/render/draw_heatmap.ts +12 -14
- package/src/render/draw_hillshade.ts +10 -12
- package/src/render/draw_line.ts +9 -9
- package/src/render/draw_raster.ts +9 -11
- package/src/render/draw_symbol.test.ts +16 -16
- package/src/render/draw_symbol.ts +15 -16
- package/src/render/draw_terrain.ts +11 -11
- package/src/render/glyph_atlas.ts +10 -1
- package/src/render/glyph_manager.test.ts +3 -3
- package/src/render/glyph_manager.ts +7 -7
- package/src/render/image_atlas.ts +6 -3
- package/src/render/image_manager.ts +3 -5
- package/src/render/line_atlas.test.ts +1 -1
- package/src/render/line_atlas.ts +19 -14
- package/src/render/painter.ts +85 -65
- package/src/render/program/background_program.ts +2 -2
- package/src/render/program/circle_program.ts +5 -5
- package/src/render/program/clipping_mask_program.ts +1 -1
- package/src/render/program/collision_program.ts +4 -4
- package/src/render/program/debug_program.ts +1 -1
- package/src/render/program/fill_extrusion_program.ts +3 -3
- package/src/render/program/fill_program.ts +3 -3
- package/src/render/program/heatmap_program.ts +5 -5
- package/src/render/program/hillshade_program.ts +7 -7
- package/src/render/program/line_program.ts +6 -6
- package/src/render/program/pattern.ts +3 -3
- package/src/render/program/raster_program.ts +2 -2
- package/src/render/program/symbol_program.ts +2 -2
- package/src/render/program/terrain_program.ts +1 -1
- package/src/render/program.ts +18 -16
- package/src/render/render_to_texture.test.ts +15 -15
- package/src/render/render_to_texture.ts +10 -10
- package/src/render/terrain.test.ts +38 -7
- package/src/render/terrain.ts +103 -67
- package/src/render/texture.ts +5 -4
- package/src/render/uniform_binding.test.ts +1 -1
- package/src/render/uniform_binding.ts +7 -1
- package/src/render/update_pattern_positions_in_program.ts +5 -5
- package/src/render/vertex_array_object.ts +9 -8
- package/src/shaders/encode_attribute.ts +0 -2
- package/src/shaders/shaders.ts +1 -3
- package/src/source/canvas_source.test.ts +6 -6
- package/src/source/canvas_source.ts +46 -60
- package/src/source/geojson_source.test.ts +5 -5
- package/src/source/geojson_source.ts +75 -59
- package/src/source/geojson_source_diff.ts +39 -2
- package/src/source/geojson_worker_source.test.ts +3 -3
- package/src/source/geojson_worker_source.ts +20 -26
- package/src/source/geojson_wrapper.test.ts +3 -3
- package/src/source/geojson_wrapper.ts +2 -4
- package/src/source/image_source.test.ts +9 -8
- package/src/source/image_source.ts +49 -35
- package/src/source/load_tilejson.ts +2 -2
- package/src/source/pixels_to_tile_units.ts +2 -3
- package/src/source/query_features.test.ts +3 -3
- package/src/source/query_features.ts +50 -19
- package/src/source/raster_dem_tile_source.test.ts +3 -3
- package/src/source/raster_dem_tile_source.ts +23 -10
- package/src/source/raster_dem_tile_worker_source.test.ts +2 -2
- package/src/source/raster_dem_tile_worker_source.ts +3 -5
- package/src/source/raster_tile_source.test.ts +3 -3
- package/src/source/raster_tile_source.ts +38 -11
- package/src/source/rtl_text_plugin.ts +4 -1
- package/src/source/source.ts +67 -59
- package/src/source/source_cache.test.ts +7 -7
- package/src/source/source_cache.ts +17 -38
- package/src/source/source_state.ts +2 -5
- package/src/source/terrain_source_cache.test.ts +8 -8
- package/src/source/terrain_source_cache.ts +42 -27
- package/src/source/tile.test.ts +3 -3
- package/src/source/tile.ts +32 -38
- package/src/source/tile_bounds.ts +2 -4
- package/src/source/tile_cache.test.ts +2 -2
- package/src/source/tile_cache.ts +20 -30
- package/src/source/tile_id.ts +11 -2
- package/src/source/vector_tile_source.test.ts +3 -3
- package/src/source/vector_tile_source.ts +34 -24
- package/src/source/vector_tile_worker_source.test.ts +4 -4
- package/src/source/vector_tile_worker_source.ts +11 -23
- package/src/source/video_source.test.ts +5 -5
- package/src/source/video_source.ts +21 -28
- package/src/source/worker.ts +6 -8
- package/src/source/worker_source.ts +6 -8
- package/src/source/worker_tile.test.ts +5 -5
- package/src/source/worker_tile.ts +13 -16
- package/src/style/create_style_layer.ts +31 -26
- package/src/style/evaluation_parameters.ts +5 -4
- package/src/style/format_section_override.test.ts +2 -2
- package/src/style/format_section_override.ts +1 -1
- package/src/style/light.test.ts +2 -2
- package/src/style/light.ts +3 -5
- package/src/style/load_glyph_range.test.ts +1 -1
- package/src/style/load_glyph_range.ts +3 -3
- package/src/style/load_sprite.test.ts +1 -1
- package/src/style/load_sprite.ts +3 -3
- package/src/style/parse_glyph_pbf.ts +1 -1
- package/src/style/pauseable_placement.ts +7 -9
- package/src/style/properties.ts +4 -53
- package/src/style/query_utils.ts +3 -3
- package/src/style/style.test.ts +22 -19
- package/src/style/style.ts +118 -84
- package/src/style/style_glyph.ts +6 -0
- package/src/style/style_image.ts +39 -33
- package/src/style/style_layer/background_style_layer.ts +2 -4
- package/src/style/style_layer/circle_style_layer.ts +7 -6
- package/src/style/style_layer/custom_style_layer.ts +23 -48
- package/src/style/style_layer/fill_extrusion_style_layer.ts +4 -6
- package/src/style/style_layer/fill_style_layer.ts +5 -7
- package/src/style/style_layer/heatmap_style_layer.ts +8 -7
- package/src/style/style_layer/hillshade_style_layer.ts +2 -4
- package/src/style/style_layer/line_style_layer.ts +6 -8
- package/src/style/style_layer/overlap_mode.test.ts +3 -3
- package/src/style/style_layer/overlap_mode.ts +3 -0
- package/src/style/style_layer/raster_style_layer.ts +2 -4
- package/src/style/style_layer/symbol_style_layer.ts +6 -8
- package/src/style/style_layer/typed_style_layer.ts +7 -7
- package/src/style/style_layer.test.ts +5 -5
- package/src/style/style_layer.ts +7 -6
- package/src/style/style_layer_index.test.ts +1 -1
- package/src/style/style_layer_index.ts +3 -5
- package/src/style/zoom_history.ts +1 -3
- package/src/symbol/anchor.test.ts +1 -1
- package/src/symbol/anchor.ts +1 -3
- package/src/symbol/check_max_angle.test.ts +8 -2
- package/src/symbol/check_max_angle.ts +10 -13
- package/src/symbol/clip_line.test.ts +1 -1
- package/src/symbol/clip_line.ts +6 -9
- package/src/symbol/collision_feature.test.ts +2 -2
- package/src/symbol/collision_feature.ts +7 -12
- package/src/symbol/collision_index.test.ts +2 -2
- package/src/symbol/collision_index.ts +5 -11
- package/src/symbol/cross_tile_symbol_index.test.ts +2 -2
- package/src/symbol/cross_tile_symbol_index.ts +5 -7
- package/src/symbol/get_anchors.ts +2 -2
- package/src/symbol/grid_index.test.ts +1 -1
- package/src/symbol/grid_index.ts +4 -5
- package/src/symbol/merge_lines.test.ts +1 -1
- package/src/symbol/merge_lines.ts +1 -1
- package/src/symbol/opacity_state.ts +1 -3
- package/src/symbol/path_interpolator.test.ts +1 -1
- package/src/symbol/path_interpolator.ts +1 -3
- package/src/symbol/placement.ts +9 -9
- package/src/symbol/projection.ts +61 -34
- package/src/symbol/quads.ts +7 -11
- package/src/symbol/shaping.ts +1 -1
- package/src/symbol/symbol_layout.ts +9 -12
- package/src/symbol/symbol_size.ts +1 -1
- package/src/symbol/symbol_style_layer.test.ts +4 -4
- package/src/symbol/transform_text.ts +2 -2
- package/src/types/callback.ts +14 -14
- package/src/types/cancelable.ts +3 -0
- package/src/types/transferable.ts +3 -0
- package/src/ui/anchor.ts +4 -0
- package/src/ui/camera.test.ts +6 -6
- package/src/ui/camera.ts +392 -361
- package/src/ui/control/attribution_control.test.ts +1 -1
- package/src/ui/control/attribution_control.ts +34 -30
- package/src/ui/control/control.ts +14 -20
- package/src/ui/control/fullscreen_control.test.ts +1 -1
- package/src/ui/control/fullscreen_control.ts +21 -26
- package/src/ui/control/geolocate_control.test.ts +5 -5
- package/src/ui/control/geolocate_control.ts +181 -194
- package/src/ui/control/logo_control.ts +20 -16
- package/src/ui/control/navigation_control.test.ts +1 -1
- package/src/ui/control/navigation_control.ts +46 -42
- package/src/ui/control/scale_control.test.ts +1 -1
- package/src/ui/control/scale_control.ts +30 -21
- package/src/ui/control/terrain_control.test.ts +1 -1
- package/src/ui/control/terrain_control.ts +14 -18
- package/src/ui/default_locale.ts +1 -3
- package/src/ui/events.ts +570 -1281
- package/src/ui/handler/box_zoom.test.ts +2 -2
- package/src/ui/handler/box_zoom.ts +16 -11
- package/src/ui/handler/click_zoom.ts +11 -3
- package/src/ui/handler/cooperative_gestures.test.ts +3 -3
- package/src/ui/handler/dblclick_zoom.test.ts +1 -1
- package/src/ui/handler/drag_handler.ts +30 -22
- package/src/ui/handler/drag_move_state_manager.ts +1 -1
- package/src/ui/handler/drag_pan.test.ts +2 -2
- package/src/ui/handler/drag_rotate.test.ts +3 -3
- package/src/ui/handler/keyboard.test.ts +2 -2
- package/src/ui/handler/keyboard.ts +22 -13
- package/src/ui/handler/map_event.test.ts +2 -2
- package/src/ui/handler/map_event.ts +1 -1
- package/src/ui/handler/mouse.ts +1 -1
- package/src/ui/handler/mouse_rotate.test.ts +3 -3
- package/src/ui/handler/scroll_zoom.test.ts +3 -3
- package/src/ui/handler/scroll_zoom.ts +45 -52
- package/src/ui/handler/shim/dblclick_zoom.ts +12 -6
- package/src/ui/handler/shim/drag_pan.ts +34 -14
- package/src/ui/handler/shim/drag_rotate.ts +20 -12
- package/src/ui/handler/shim/two_fingers_touch.ts +24 -18
- package/src/ui/handler/tap_drag_zoom.test.ts +113 -0
- package/src/ui/handler/tap_drag_zoom.ts +18 -10
- package/src/ui/handler/tap_recognizer.ts +1 -1
- package/src/ui/handler/tap_zoom.ts +4 -3
- package/src/ui/handler/touch_pan.ts +3 -2
- package/src/ui/handler/transform-provider.ts +4 -6
- package/src/ui/handler/two_fingers_touch.test.ts +3 -3
- package/src/ui/handler/two_fingers_touch.ts +64 -47
- package/src/ui/handler_inertia.ts +4 -4
- package/src/ui/handler_manager.ts +86 -52
- package/src/ui/hash.test.ts +1 -1
- package/src/ui/hash.ts +21 -28
- package/src/ui/map/isMoving.test.ts +3 -3
- package/src/ui/map/isRotating.test.ts +3 -3
- package/src/ui/map/isZooming.test.ts +3 -3
- package/src/ui/map.test.ts +97 -8
- package/src/ui/map.ts +856 -702
- package/src/ui/map_events.test.ts +1 -1
- package/src/ui/marker.test.ts +35 -15
- package/src/ui/marker.ts +220 -141
- package/src/ui/popup.test.ts +2 -2
- package/src/ui/popup.ts +179 -147
- package/src/util/actor.test.ts +7 -7
- package/src/util/actor.ts +25 -22
- package/src/util/ajax.ts +37 -17
- package/src/util/browser.test.ts +1 -1
- package/src/util/browser.ts +2 -6
- package/src/util/classify_rings.test.ts +1 -1
- package/src/util/classify_rings.ts +1 -1
- package/src/util/color_ramp.ts +0 -2
- package/src/util/config.ts +6 -3
- package/src/util/debug.ts +0 -2
- package/src/util/dictionary_coder.ts +1 -4
- package/src/util/dispatcher.test.ts +3 -3
- package/src/util/dispatcher.ts +4 -9
- package/src/util/dom.ts +1 -1
- package/src/util/evented.ts +23 -18
- package/src/util/find_pole_of_inaccessibility.test.ts +1 -1
- package/src/util/find_pole_of_inaccessibility.ts +4 -5
- package/src/util/global_worker_pool.ts +2 -3
- package/src/util/image.ts +10 -4
- package/src/util/image_request.test.ts +3 -3
- package/src/util/image_request.ts +15 -14
- package/src/util/is_char_in_unicode_block.ts +1 -3
- package/src/util/offscreen_canvas_supported.ts +1 -1
- package/src/util/performance.ts +1 -2
- package/src/util/request_manager.ts +4 -0
- package/src/util/resolve_tokens.test.ts +1 -1
- package/src/util/resolve_tokens.ts +3 -6
- package/src/util/script_detection.ts +1 -4
- package/src/util/smart_wrap.ts +3 -5
- package/src/util/struct_array.ts +18 -14
- package/src/util/style.ts +2 -2
- package/src/util/task_queue.test.ts +1 -1
- package/src/util/task_queue.ts +1 -3
- package/src/util/test/mock_webgl.ts +6 -0
- package/src/util/test/util.ts +2 -2
- package/src/util/throttle.test.ts +1 -1
- package/src/util/throttle.ts +1 -2
- package/src/util/throttled_invoker.ts +1 -5
- package/src/util/transferable_grid_index.test.ts +1 -1
- package/src/util/transferable_grid_index.ts +1 -3
- package/src/util/util.test.ts +1 -14
- package/src/util/util.ts +44 -107
- package/src/util/vectortile_to_geojson.ts +13 -3
- package/src/util/verticalize_punctuation.ts +1 -1
- package/src/util/web_worker.ts +2 -2
- package/src/util/web_worker_transfer.ts +11 -8
- package/src/util/webp_supported.ts +2 -4
- package/src/util/worker_pool.test.ts +1 -1
- package/src/util/worker_pool.ts +4 -5
|
@@ -1,34 +1,57 @@
|
|
|
1
1
|
import {CanonicalTileID} from './tile_id';
|
|
2
2
|
import {Event, ErrorEvent, Evented} from '../util/evented';
|
|
3
|
-
import ImageRequest from '../util/image_request';
|
|
3
|
+
import {ImageRequest} from '../util/image_request';
|
|
4
4
|
import {ResourceType} from '../util/request_manager';
|
|
5
|
-
import EXTENT from '../data/extent';
|
|
5
|
+
import {EXTENT} from '../data/extent';
|
|
6
6
|
import {RasterBoundsArray} from '../data/array_types.g';
|
|
7
7
|
import rasterBoundsAttributes from '../data/raster_bounds_attributes';
|
|
8
|
-
import SegmentVector from '../data/segment';
|
|
9
|
-
import Texture from '../render/texture';
|
|
10
|
-
import MercatorCoordinate from '../geo/mercator_coordinate';
|
|
8
|
+
import {SegmentVector} from '../data/segment';
|
|
9
|
+
import {Texture} from '../render/texture';
|
|
10
|
+
import {MercatorCoordinate} from '../geo/mercator_coordinate';
|
|
11
11
|
|
|
12
12
|
import type {Source} from './source';
|
|
13
13
|
import type {CanvasSourceSpecification} from './canvas_source';
|
|
14
|
-
import type Map from '../ui/map';
|
|
15
|
-
import type Dispatcher from '../util/dispatcher';
|
|
16
|
-
import type Tile from './tile';
|
|
14
|
+
import type {Map} from '../ui/map';
|
|
15
|
+
import type {Dispatcher} from '../util/dispatcher';
|
|
16
|
+
import type {Tile} from './tile';
|
|
17
17
|
import type {Callback} from '../types/callback';
|
|
18
|
-
import type VertexBuffer from '../gl/vertex_buffer';
|
|
18
|
+
import type {VertexBuffer} from '../gl/vertex_buffer';
|
|
19
19
|
import type {
|
|
20
20
|
ImageSourceSpecification,
|
|
21
21
|
VideoSourceSpecification
|
|
22
22
|
} from '@maplibre/maplibre-gl-style-spec';
|
|
23
23
|
import {Cancelable} from '../types/cancelable';
|
|
24
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Four geographical coordinates,
|
|
27
|
+
* represented as arrays of longitude and latitude numbers, which define the corners of the image.
|
|
28
|
+
* The coordinates start at the top left corner of the image and proceed in clockwise order.
|
|
29
|
+
* They do not have to represent a rectangle.
|
|
30
|
+
*/
|
|
25
31
|
export type Coordinates = [[number, number], [number, number], [number, number], [number, number]];
|
|
26
32
|
|
|
33
|
+
/**
|
|
34
|
+
* The options object for the {@link ImageSource#updateImage} method
|
|
35
|
+
*/
|
|
36
|
+
export type UpdateImageOptions = {
|
|
37
|
+
/**
|
|
38
|
+
* Required image URL.
|
|
39
|
+
*/
|
|
40
|
+
url: string;
|
|
41
|
+
/**
|
|
42
|
+
* The image coordinates
|
|
43
|
+
*/
|
|
44
|
+
coordinates?: Coordinates;
|
|
45
|
+
}
|
|
46
|
+
|
|
27
47
|
/**
|
|
28
48
|
* A data source containing an image.
|
|
29
49
|
* (See the [Style Specification](https://maplibre.org/maplibre-style-spec/#sources-image) for detailed documentation of options.)
|
|
30
50
|
*
|
|
51
|
+
* @group Sources
|
|
52
|
+
*
|
|
31
53
|
* @example
|
|
54
|
+
* ```ts
|
|
32
55
|
* // add to map
|
|
33
56
|
* map.addSource('some id', {
|
|
34
57
|
* type: 'image',
|
|
@@ -42,7 +65,7 @@ export type Coordinates = [[number, number], [number, number], [number, number],
|
|
|
42
65
|
* });
|
|
43
66
|
*
|
|
44
67
|
* // update coordinates
|
|
45
|
-
*
|
|
68
|
+
* let mySource = map.getSource('some id');
|
|
46
69
|
* mySource.setCoordinates([
|
|
47
70
|
* [-76.54335737228394, 39.18579907229748],
|
|
48
71
|
* [-76.52803659439087, 39.1838364847587],
|
|
@@ -62,8 +85,9 @@ export type Coordinates = [[number, number], [number, number], [number, number],
|
|
|
62
85
|
* })
|
|
63
86
|
*
|
|
64
87
|
* map.removeSource('some id'); // remove
|
|
88
|
+
* ```
|
|
65
89
|
*/
|
|
66
|
-
class ImageSource extends Evented implements Source {
|
|
90
|
+
export class ImageSource extends Evented implements Source {
|
|
67
91
|
type: string;
|
|
68
92
|
id: string;
|
|
69
93
|
minzoom: number;
|
|
@@ -86,7 +110,7 @@ class ImageSource extends Evented implements Source {
|
|
|
86
110
|
_request: Cancelable;
|
|
87
111
|
|
|
88
112
|
/**
|
|
89
|
-
* @
|
|
113
|
+
* @hidden
|
|
90
114
|
*/
|
|
91
115
|
constructor(id: string, options: ImageSourceSpecification | VideoSourceSpecification | CanvasSourceSpecification, dispatcher: Dispatcher, eventedParent: Evented) {
|
|
92
116
|
super();
|
|
@@ -106,7 +130,7 @@ class ImageSource extends Evented implements Source {
|
|
|
106
130
|
this.options = options;
|
|
107
131
|
}
|
|
108
132
|
|
|
109
|
-
load(newCoordinates?: Coordinates, successCallback?: () => void) {
|
|
133
|
+
load = (newCoordinates?: Coordinates, successCallback?: () => void) => {
|
|
110
134
|
this._loaded = false;
|
|
111
135
|
this.fire(new Event('dataloading', {dataType: 'source'}));
|
|
112
136
|
|
|
@@ -129,7 +153,7 @@ class ImageSource extends Evented implements Source {
|
|
|
129
153
|
this._finishLoading();
|
|
130
154
|
}
|
|
131
155
|
});
|
|
132
|
-
}
|
|
156
|
+
};
|
|
133
157
|
|
|
134
158
|
loaded(): boolean {
|
|
135
159
|
return this._loaded;
|
|
@@ -139,18 +163,10 @@ class ImageSource extends Evented implements Source {
|
|
|
139
163
|
* Updates the image URL and, optionally, the coordinates. To avoid having the image flash after changing,
|
|
140
164
|
* set the `raster-fade-duration` paint property on the raster layer to 0.
|
|
141
165
|
*
|
|
142
|
-
* @param
|
|
143
|
-
* @
|
|
144
|
-
* @param {Array<Array<number>>} [options.coordinates] Four geographical coordinates,
|
|
145
|
-
* represented as arrays of longitude and latitude numbers, which define the corners of the image.
|
|
146
|
-
* The coordinates start at the top left corner of the image and proceed in clockwise order.
|
|
147
|
-
* They do not have to represent a rectangle.
|
|
148
|
-
* @returns {ImageSource} this
|
|
166
|
+
* @param options - The options object.
|
|
167
|
+
* @returns `this`
|
|
149
168
|
*/
|
|
150
|
-
updateImage(options: {
|
|
151
|
-
url: string;
|
|
152
|
-
coordinates?: Coordinates;
|
|
153
|
-
}) {
|
|
169
|
+
updateImage(options: UpdateImageOptions): this {
|
|
154
170
|
if (!options.url) {
|
|
155
171
|
return this;
|
|
156
172
|
}
|
|
@@ -187,13 +203,13 @@ class ImageSource extends Evented implements Source {
|
|
|
187
203
|
/**
|
|
188
204
|
* Sets the image's coordinates and re-renders the map.
|
|
189
205
|
*
|
|
190
|
-
* @param
|
|
206
|
+
* @param coordinates - Four geographical coordinates,
|
|
191
207
|
* represented as arrays of longitude and latitude numbers, which define the corners of the image.
|
|
192
208
|
* The coordinates start at the top left corner of the image and proceed in clockwise order.
|
|
193
209
|
* They do not have to represent a rectangle.
|
|
194
|
-
* @returns
|
|
210
|
+
* @returns `this`
|
|
195
211
|
*/
|
|
196
|
-
setCoordinates(coordinates: Coordinates) {
|
|
212
|
+
setCoordinates(coordinates: Coordinates): this {
|
|
197
213
|
this.coordinates = coordinates;
|
|
198
214
|
|
|
199
215
|
// Calculate which mercator tile is suitable for rendering the video in
|
|
@@ -231,7 +247,7 @@ class ImageSource extends Evented implements Source {
|
|
|
231
247
|
return this;
|
|
232
248
|
}
|
|
233
249
|
|
|
234
|
-
prepare() {
|
|
250
|
+
prepare = () => {
|
|
235
251
|
if (Object.keys(this.tiles).length === 0 || !this.image) {
|
|
236
252
|
return;
|
|
237
253
|
}
|
|
@@ -265,7 +281,7 @@ class ImageSource extends Evented implements Source {
|
|
|
265
281
|
if (newTilesLoaded) {
|
|
266
282
|
this.fire(new Event('data', {dataType: 'source', sourceDataType: 'idle', sourceId: this.id}));
|
|
267
283
|
}
|
|
268
|
-
}
|
|
284
|
+
};
|
|
269
285
|
|
|
270
286
|
loadTile(tile: Tile, callback: Callback<void>) {
|
|
271
287
|
// We have a single tile -- whose coordinates are this.tileID -- that
|
|
@@ -284,13 +300,13 @@ class ImageSource extends Evented implements Source {
|
|
|
284
300
|
}
|
|
285
301
|
}
|
|
286
302
|
|
|
287
|
-
serialize():
|
|
303
|
+
serialize = (): ImageSourceSpecification | VideoSourceSpecification | CanvasSourceSpecification => {
|
|
288
304
|
return {
|
|
289
305
|
type: 'image',
|
|
290
306
|
url: this.options.url,
|
|
291
307
|
coordinates: this.coordinates
|
|
292
308
|
};
|
|
293
|
-
}
|
|
309
|
+
};
|
|
294
310
|
|
|
295
311
|
hasTransition() {
|
|
296
312
|
return false;
|
|
@@ -301,7 +317,7 @@ class ImageSource extends Evented implements Source {
|
|
|
301
317
|
* Given a list of coordinates, get their center as a coordinate.
|
|
302
318
|
*
|
|
303
319
|
* @returns centerpoint
|
|
304
|
-
* @
|
|
320
|
+
* @hidden
|
|
305
321
|
*/
|
|
306
322
|
export function getCoordinatesCenterTileID(coords: Array<MercatorCoordinate>) {
|
|
307
323
|
let minX = Infinity;
|
|
@@ -327,5 +343,3 @@ export function getCoordinatesCenterTileID(coords: Array<MercatorCoordinate>) {
|
|
|
327
343
|
Math.floor((minX + maxX) / 2 * tilesAtZoom),
|
|
328
344
|
Math.floor((minY + maxY) / 2 * tilesAtZoom));
|
|
329
345
|
}
|
|
330
|
-
|
|
331
|
-
export default ImageSource;
|
|
@@ -2,7 +2,7 @@ import {pick, extend} from '../util/util';
|
|
|
2
2
|
|
|
3
3
|
import {getJSON} from '../util/ajax';
|
|
4
4
|
import {ResourceType} from '../util/request_manager';
|
|
5
|
-
import browser from '../util/browser';
|
|
5
|
+
import {browser} from '../util/browser';
|
|
6
6
|
|
|
7
7
|
import type {RequestManager} from '../util/request_manager';
|
|
8
8
|
import type {Callback} from '../types/callback';
|
|
@@ -10,7 +10,7 @@ import type {TileJSON} from '../types/tilejson';
|
|
|
10
10
|
import type {Cancelable} from '../types/cancelable';
|
|
11
11
|
import type {RasterDEMSourceSpecification, RasterSourceSpecification, VectorSourceSpecification} from '@maplibre/maplibre-gl-style-spec';
|
|
12
12
|
|
|
13
|
-
export
|
|
13
|
+
export function loadTileJson(
|
|
14
14
|
options: RasterSourceSpecification | RasterDEMSourceSpecification | VectorSourceSpecification,
|
|
15
15
|
requestManager: RequestManager,
|
|
16
16
|
callback: Callback<TileJSON>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import EXTENT from '../data/extent';
|
|
1
|
+
import {EXTENT} from '../data/extent';
|
|
2
2
|
|
|
3
3
|
import type {OverscaledTileID} from './tile_id';
|
|
4
4
|
|
|
@@ -12,9 +12,8 @@ import type {OverscaledTileID} from './tile_id';
|
|
|
12
12
|
* translation by pixelsToTileUnits(30, 6.5) tile units.
|
|
13
13
|
*
|
|
14
14
|
* @returns value in tile units
|
|
15
|
-
* @private
|
|
16
15
|
*/
|
|
17
|
-
export
|
|
16
|
+
export function pixelsToTileUnits(
|
|
18
17
|
tile: {
|
|
19
18
|
tileID: OverscaledTileID;
|
|
20
19
|
tileSize: number;
|
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
queryRenderedFeatures,
|
|
3
3
|
querySourceFeatures
|
|
4
4
|
} from './query_features';
|
|
5
|
-
import SourceCache from './source_cache';
|
|
6
|
-
import Transform from '../geo/transform';
|
|
5
|
+
import {SourceCache} from './source_cache';
|
|
6
|
+
import {Transform} from '../geo/transform';
|
|
7
7
|
import Point from '@mapbox/point-geometry';
|
|
8
|
-
import Dispatcher from '../util/dispatcher';
|
|
8
|
+
import {Dispatcher} from '../util/dispatcher';
|
|
9
9
|
|
|
10
10
|
describe('QueryFeatures#rendered', () => {
|
|
11
11
|
test('returns empty object if source returns no tiles', () => {
|
|
@@ -1,13 +1,56 @@
|
|
|
1
|
-
import type SourceCache from './source_cache';
|
|
2
|
-
import type StyleLayer from '../style/style_layer';
|
|
3
|
-
import type CollisionIndex from '../symbol/collision_index';
|
|
4
|
-
import type Transform from '../geo/transform';
|
|
1
|
+
import type {SourceCache} from './source_cache';
|
|
2
|
+
import type {StyleLayer} from '../style/style_layer';
|
|
3
|
+
import type {CollisionIndex} from '../symbol/collision_index';
|
|
4
|
+
import type {Transform} from '../geo/transform';
|
|
5
5
|
import type {RetainedQueryData} from '../symbol/placement';
|
|
6
6
|
import type {FilterSpecification} from '@maplibre/maplibre-gl-style-spec';
|
|
7
7
|
import type {MapGeoJSONFeature} from '../util/vectortile_to_geojson';
|
|
8
8
|
import type Point from '@mapbox/point-geometry';
|
|
9
9
|
import {mat4} from 'gl-matrix';
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Options to pass to query the map for the rendered features
|
|
13
|
+
*/
|
|
14
|
+
export type QueryRenderedFeaturesOptions = {
|
|
15
|
+
/**
|
|
16
|
+
* An array of [style layer IDs](https://maplibre.org/maplibre-style-spec/#layer-id) for the query to inspect.
|
|
17
|
+
* Only features within these layers will be returned. If this parameter is undefined, all layers will be checked.
|
|
18
|
+
*/
|
|
19
|
+
layers?: Array<string>;
|
|
20
|
+
/**
|
|
21
|
+
* A [filter](https://maplibre.org/maplibre-style-spec/layers/#filter) to limit query results.
|
|
22
|
+
*/
|
|
23
|
+
filter?: FilterSpecification;
|
|
24
|
+
/**
|
|
25
|
+
* An array of string representing the available images
|
|
26
|
+
*/
|
|
27
|
+
availableImages?: Array<string>;
|
|
28
|
+
/**
|
|
29
|
+
* Whether to check if the [options.filter] conforms to the MapLibre Style Specification. Disabling validation is a performance optimization that should only be used if you have previously validated the values you will be passing to this function.
|
|
30
|
+
*/
|
|
31
|
+
validate?: boolean;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The options object related to the {@link Map#queryRenderedFeatures} method
|
|
36
|
+
*/
|
|
37
|
+
export type QuerySourceFeatureOptions = {
|
|
38
|
+
/**
|
|
39
|
+
* The name of the source layer to query. *For vector tile sources, this parameter is required.* For GeoJSON sources, it is ignored.
|
|
40
|
+
*/
|
|
41
|
+
sourceLayer?: string;
|
|
42
|
+
/**
|
|
43
|
+
* A [filter](https://maplibre.org/maplibre-style-spec/layers/#filter)
|
|
44
|
+
* to limit query results.
|
|
45
|
+
*/
|
|
46
|
+
filter?: FilterSpecification;
|
|
47
|
+
/**
|
|
48
|
+
* Whether to check if the [parameters.filter] conforms to the MapLibre Style Specification. Disabling validation is a performance optimization that should only be used if you have previously validated the values you will be passing to this function.
|
|
49
|
+
* @defaultValue true
|
|
50
|
+
*/
|
|
51
|
+
validate?: boolean;
|
|
52
|
+
}
|
|
53
|
+
|
|
11
54
|
/*
|
|
12
55
|
* Returns a matrix that can be used to convert from tile coordinates to viewport pixel coordinates.
|
|
13
56
|
*/
|
|
@@ -42,11 +85,7 @@ export function queryRenderedFeatures(
|
|
|
42
85
|
styleLayers: {[_: string]: StyleLayer},
|
|
43
86
|
serializedLayers: {[_: string]: any},
|
|
44
87
|
queryGeometry: Array<Point>,
|
|
45
|
-
params:
|
|
46
|
-
filter: FilterSpecification;
|
|
47
|
-
layers: Array<string>;
|
|
48
|
-
availableImages: Array<string>;
|
|
49
|
-
},
|
|
88
|
+
params: QueryRenderedFeaturesOptions,
|
|
50
89
|
transform: Transform
|
|
51
90
|
): { [key: string]: Array<{featureIndex: number; feature: MapGeoJSONFeature}> } {
|
|
52
91
|
|
|
@@ -94,11 +133,7 @@ export function queryRenderedSymbols(styleLayers: {[_: string]: StyleLayer},
|
|
|
94
133
|
serializedLayers: {[_: string]: StyleLayer},
|
|
95
134
|
sourceCaches: {[_: string]: SourceCache},
|
|
96
135
|
queryGeometry: Array<Point>,
|
|
97
|
-
params:
|
|
98
|
-
filter: FilterSpecification;
|
|
99
|
-
layers: Array<string>;
|
|
100
|
-
availableImages: Array<string>;
|
|
101
|
-
},
|
|
136
|
+
params: QueryRenderedFeaturesOptions,
|
|
102
137
|
collisionIndex: CollisionIndex,
|
|
103
138
|
retainedQueryData: {
|
|
104
139
|
[_: number]: RetainedQueryData;
|
|
@@ -166,11 +201,7 @@ export function queryRenderedSymbols(styleLayers: {[_: string]: StyleLayer},
|
|
|
166
201
|
return result;
|
|
167
202
|
}
|
|
168
203
|
|
|
169
|
-
export function querySourceFeatures(sourceCache: SourceCache, params: {
|
|
170
|
-
sourceLayer?: string;
|
|
171
|
-
filter?: FilterSpecification;
|
|
172
|
-
validate?: boolean;
|
|
173
|
-
}) {
|
|
204
|
+
export function querySourceFeatures(sourceCache: SourceCache, params: QuerySourceFeatureOptions) {
|
|
174
205
|
const tiles = sourceCache.getRenderableIds().map((id) => {
|
|
175
206
|
return sourceCache.getTileByID(id);
|
|
176
207
|
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {fakeServer, FakeServer} from 'nise';
|
|
2
|
-
import RasterDEMTileSource from './raster_dem_tile_source';
|
|
2
|
+
import {RasterDEMTileSource} from './raster_dem_tile_source';
|
|
3
3
|
import {OverscaledTileID} from './tile_id';
|
|
4
4
|
import {RequestManager} from '../util/request_manager';
|
|
5
|
-
import Dispatcher from '../util/dispatcher';
|
|
6
|
-
import Tile from './tile';
|
|
5
|
+
import {Dispatcher} from '../util/dispatcher';
|
|
6
|
+
import {Tile} from './tile';
|
|
7
7
|
|
|
8
8
|
function createSource(options, transformCallback?) {
|
|
9
9
|
const source = new RasterDEMTileSource('id', options, {send() {}} as any as Dispatcher, options.eventedParent);
|
|
@@ -1,22 +1,38 @@
|
|
|
1
|
-
import ImageRequest from '../util/image_request';
|
|
1
|
+
import {ImageRequest} from '../util/image_request';
|
|
2
2
|
import {ResourceType} from '../util/request_manager';
|
|
3
3
|
import {extend, isImageBitmap} from '../util/util';
|
|
4
4
|
import {Evented} from '../util/evented';
|
|
5
|
-
import browser from '../util/browser';
|
|
6
|
-
import offscreenCanvasSupported from '../util/offscreen_canvas_supported';
|
|
5
|
+
import {browser} from '../util/browser';
|
|
6
|
+
import {offscreenCanvasSupported} from '../util/offscreen_canvas_supported';
|
|
7
7
|
import {OverscaledTileID} from './tile_id';
|
|
8
|
-
import RasterTileSource from './raster_tile_source';
|
|
8
|
+
import {RasterTileSource} from './raster_tile_source';
|
|
9
9
|
// ensure DEMData is registered for worker transfer on main thread:
|
|
10
10
|
import '../data/dem_data';
|
|
11
11
|
|
|
12
12
|
import type {Source} from './source';
|
|
13
|
-
import type Dispatcher from '../util/dispatcher';
|
|
14
|
-
import type Tile from './tile';
|
|
13
|
+
import type {Dispatcher} from '../util/dispatcher';
|
|
14
|
+
import type {Tile} from './tile';
|
|
15
15
|
import type {Callback} from '../types/callback';
|
|
16
16
|
import type {RasterDEMSourceSpecification} from '@maplibre/maplibre-gl-style-spec';
|
|
17
17
|
import type {ExpiryData} from '../util/ajax';
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
/**
|
|
20
|
+
* A source containing raster DEM tiles (See the [Style Specification](https://maplibre.org/maplibre-style-spec/) for detailed documentation of options.)
|
|
21
|
+
* This source can be used to show hillshading and 3D terrain
|
|
22
|
+
*
|
|
23
|
+
* @group Sources
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* map.addSource('raster-dem-source', {
|
|
28
|
+
* type: 'raster-dem',
|
|
29
|
+
* url: 'https://demotiles.maplibre.org/terrain-tiles/tiles.json',
|
|
30
|
+
* tileSize: 256
|
|
31
|
+
* });
|
|
32
|
+
* ```
|
|
33
|
+
* @see [3D Terrain](https://maplibre.org/maplibre-gl-js/docs/examples/3d-terrain/)
|
|
34
|
+
*/
|
|
35
|
+
export class RasterDEMTileSource extends RasterTileSource implements Source {
|
|
20
36
|
encoding: 'mapbox' | 'terrarium';
|
|
21
37
|
|
|
22
38
|
constructor(id: string, options: RasterDEMSourceSpecification, dispatcher: Dispatcher, eventedParent: Evented) {
|
|
@@ -132,7 +148,4 @@ class RasterDEMTileSource extends RasterTileSource implements Source {
|
|
|
132
148
|
tile.actor.send('removeDEMTile', {uid: tile.uid, source: this.id});
|
|
133
149
|
}
|
|
134
150
|
}
|
|
135
|
-
|
|
136
151
|
}
|
|
137
|
-
|
|
138
|
-
export default RasterDEMTileSource;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import RasterDEMTileWorkerSource from './raster_dem_tile_worker_source';
|
|
2
|
-
import DEMData from '../data/dem_data';
|
|
1
|
+
import {RasterDEMTileWorkerSource} from './raster_dem_tile_worker_source';
|
|
2
|
+
import {DEMData} from '../data/dem_data';
|
|
3
3
|
import {WorkerDEMTileParameters} from './worker_source';
|
|
4
4
|
|
|
5
5
|
describe('loadTile', () => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import DEMData from '../data/dem_data';
|
|
1
|
+
import {DEMData} from '../data/dem_data';
|
|
2
2
|
import {RGBAImage} from '../util/image';
|
|
3
|
-
import type Actor from '../util/actor';
|
|
3
|
+
import type {Actor} from '../util/actor';
|
|
4
4
|
import type {
|
|
5
5
|
WorkerDEMTileParameters,
|
|
6
6
|
WorkerDEMTileCallback,
|
|
@@ -8,7 +8,7 @@ import type {
|
|
|
8
8
|
} from './worker_source';
|
|
9
9
|
import {isImageBitmap} from '../util/util';
|
|
10
10
|
|
|
11
|
-
class RasterDEMTileWorkerSource {
|
|
11
|
+
export class RasterDEMTileWorkerSource {
|
|
12
12
|
actor: Actor;
|
|
13
13
|
loaded: {[_: string]: DEMData};
|
|
14
14
|
offscreenCanvas: OffscreenCanvas;
|
|
@@ -54,5 +54,3 @@ class RasterDEMTileWorkerSource {
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
|
|
58
|
-
export default RasterDEMTileWorkerSource;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import RasterTileSource from './raster_tile_source';
|
|
1
|
+
import {RasterTileSource} from './raster_tile_source';
|
|
2
2
|
import {OverscaledTileID} from './tile_id';
|
|
3
3
|
import {RequestManager} from '../util/request_manager';
|
|
4
|
-
import Dispatcher from '../util/dispatcher';
|
|
4
|
+
import {Dispatcher} from '../util/dispatcher';
|
|
5
5
|
import {fakeServer, FakeServer} from 'nise';
|
|
6
|
-
import Tile from './tile';
|
|
6
|
+
import {Tile} from './tile';
|
|
7
7
|
import {stubAjaxGetImage} from '../util/test/util';
|
|
8
8
|
|
|
9
9
|
function createSource(options, transformCallback?) {
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {extend, pick} from '../util/util';
|
|
2
2
|
|
|
3
|
-
import ImageRequest from '../util/image_request';
|
|
3
|
+
import {ImageRequest} from '../util/image_request';
|
|
4
4
|
|
|
5
5
|
import {ResourceType} from '../util/request_manager';
|
|
6
6
|
import {Event, ErrorEvent, Evented} from '../util/evented';
|
|
7
|
-
import
|
|
8
|
-
import TileBounds from './tile_bounds';
|
|
9
|
-
import Texture from '../render/texture';
|
|
7
|
+
import {loadTileJson} from './load_tilejson';
|
|
8
|
+
import {TileBounds} from './tile_bounds';
|
|
9
|
+
import {Texture} from '../render/texture';
|
|
10
10
|
|
|
11
11
|
import type {Source} from './source';
|
|
12
12
|
import type {OverscaledTileID} from './tile_id';
|
|
13
|
-
import type Map from '../ui/map';
|
|
14
|
-
import type Dispatcher from '../util/dispatcher';
|
|
15
|
-
import type Tile from './tile';
|
|
13
|
+
import type {Map} from '../ui/map';
|
|
14
|
+
import type {Dispatcher} from '../util/dispatcher';
|
|
15
|
+
import type {Tile} from './tile';
|
|
16
16
|
import type {Callback} from '../types/callback';
|
|
17
17
|
import type {Cancelable} from '../types/cancelable';
|
|
18
18
|
import type {
|
|
@@ -20,7 +20,36 @@ import type {
|
|
|
20
20
|
RasterDEMSourceSpecification
|
|
21
21
|
} from '@maplibre/maplibre-gl-style-spec';
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
/**
|
|
24
|
+
* A source containing raster tiles (See the [Style Specification](https://maplibre.org/maplibre-style-spec/) for detailed documentation of options.)
|
|
25
|
+
*
|
|
26
|
+
* @group Sources
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* map.addSource('raster-source', {
|
|
31
|
+
* 'type': 'raster',
|
|
32
|
+
* 'tiles': ['https://stamen-tiles.a.ssl.fastly.net/watercolor/{z}/{x}/{y}.jpg'],
|
|
33
|
+
* 'tileSize': 256,
|
|
34
|
+
* });
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts
|
|
39
|
+
* map.addSource('wms-test-source', {
|
|
40
|
+
* 'type': 'raster',
|
|
41
|
+
* // use the tiles option to specify a WMS tile source URL
|
|
42
|
+
* 'tiles': [
|
|
43
|
+
* 'https://img.nj.gov/imagerywms/Natural2015?bbox={bbox-epsg-3857}&format=image/png&service=WMS&version=1.1.1&request=GetMap&srs=EPSG:3857&transparent=true&width=256&height=256&layers=Natural2015'
|
|
44
|
+
* ],
|
|
45
|
+
* 'tileSize': 256
|
|
46
|
+
* });
|
|
47
|
+
* ```
|
|
48
|
+
* @see [Add a raster tile source](https://maplibre.org/maplibre-gl-js/docs/examples/map-tiles/)
|
|
49
|
+
* @see [Add a WMS source](https://maplibre.org/maplibre-gl-js/docs/examples/wms/)
|
|
50
|
+
* @see [Display a satellite map](https://maplibre.org/maplibre-gl-js/docs/examples/satellite-map/)
|
|
51
|
+
*/
|
|
52
|
+
export class RasterTileSource extends Evented implements Source {
|
|
24
53
|
type: 'raster' | 'raster-dem';
|
|
25
54
|
id: string;
|
|
26
55
|
minzoom: number;
|
|
@@ -61,7 +90,7 @@ class RasterTileSource extends Evented implements Source {
|
|
|
61
90
|
load() {
|
|
62
91
|
this._loaded = false;
|
|
63
92
|
this.fire(new Event('dataloading', {dataType: 'source'}));
|
|
64
|
-
this._tileJSONRequest =
|
|
93
|
+
this._tileJSONRequest = loadTileJson(this._options, this.map._requestManager, (err, tileJSON) => {
|
|
65
94
|
this._tileJSONRequest = null;
|
|
66
95
|
this._loaded = true;
|
|
67
96
|
if (err) {
|
|
@@ -155,5 +184,3 @@ class RasterTileSource extends Evented implements Source {
|
|
|
155
184
|
return false;
|
|
156
185
|
}
|
|
157
186
|
}
|
|
158
|
-
|
|
159
|
-
export default RasterTileSource;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {getArrayBuffer} from '../util/ajax';
|
|
2
|
-
import browser from '../util/browser';
|
|
2
|
+
import {browser} from '../util/browser';
|
|
3
3
|
import {Event, Evented} from '../util/evented';
|
|
4
4
|
import {isWorker} from '../util/util';
|
|
5
5
|
|
|
@@ -16,6 +16,9 @@ export type PluginState = {
|
|
|
16
16
|
pluginURL: string;
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
+
/**
|
|
20
|
+
* An error callback
|
|
21
|
+
*/
|
|
19
22
|
type ErrorCallback = (error?: Error | null) => void;
|
|
20
23
|
type PluginStateSyncCallback = (state: PluginState) => void;
|
|
21
24
|
let _completionCallback = null;
|