ol 10.7.1 → 10.7.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.
Files changed (268) hide show
  1. package/Collection.d.ts +1 -3
  2. package/Collection.d.ts.map +1 -1
  3. package/Feature.d.ts +6 -15
  4. package/Feature.d.ts.map +1 -1
  5. package/Feature.js +3 -6
  6. package/Geolocation.d.ts +1 -3
  7. package/Geolocation.d.ts.map +1 -1
  8. package/ImageTile.d.ts +2 -12
  9. package/ImageTile.d.ts.map +1 -1
  10. package/ImageTile.js +5 -32
  11. package/Map.d.ts +7 -27
  12. package/Map.d.ts.map +1 -1
  13. package/Map.js +3 -29
  14. package/Object.d.ts +18 -15
  15. package/Object.d.ts.map +1 -1
  16. package/Object.js +6 -9
  17. package/Overlay.d.ts +1 -3
  18. package/Overlay.d.ts.map +1 -1
  19. package/VectorRenderTile.d.ts +0 -4
  20. package/VectorRenderTile.d.ts.map +1 -1
  21. package/VectorRenderTile.js +0 -2
  22. package/View.d.ts +1 -40
  23. package/View.d.ts.map +1 -1
  24. package/View.js +0 -94
  25. package/colorlike.js +8 -4
  26. package/control/Control.d.ts +1 -3
  27. package/control/Control.d.ts.map +1 -1
  28. package/control/OverviewMap.d.ts +1 -5
  29. package/control/OverviewMap.d.ts.map +1 -1
  30. package/coordinate.d.ts +0 -8
  31. package/coordinate.d.ts.map +1 -1
  32. package/coordinate.js +1 -31
  33. package/dist/ol.d.ts +0 -24
  34. package/dist/ol.d.ts.map +1 -1
  35. package/dist/ol.js +1 -1
  36. package/dist/ol.js.map +1 -1
  37. package/dom.d.ts +0 -15
  38. package/dom.d.ts.map +1 -1
  39. package/dom.js +0 -6
  40. package/featureloader.d.ts +2 -6
  41. package/featureloader.d.ts.map +1 -1
  42. package/format/EsriJSON.d.ts +1 -3
  43. package/format/EsriJSON.d.ts.map +1 -1
  44. package/format/Feature.d.ts +1 -3
  45. package/format/Feature.d.ts.map +1 -1
  46. package/format/GeoJSON.d.ts +2 -6
  47. package/format/GeoJSON.d.ts.map +1 -1
  48. package/format/JSONFeature.d.ts +1 -3
  49. package/format/JSONFeature.d.ts.map +1 -1
  50. package/format/KML.d.ts +0 -9
  51. package/format/KML.d.ts.map +1 -1
  52. package/format/KML.js +0 -7
  53. package/format/TextFeature.d.ts +1 -3
  54. package/format/TextFeature.d.ts.map +1 -1
  55. package/format/TopoJSON.d.ts +1 -3
  56. package/format/TopoJSON.d.ts.map +1 -1
  57. package/format/WKB.d.ts +1 -3
  58. package/format/WKB.d.ts.map +1 -1
  59. package/format/XMLFeature.d.ts +1 -3
  60. package/format/XMLFeature.d.ts.map +1 -1
  61. package/geom/Geometry.d.ts +1 -3
  62. package/geom/Geometry.d.ts.map +1 -1
  63. package/interaction/DragAndDrop.d.ts +2 -6
  64. package/interaction/DragAndDrop.d.ts.map +1 -1
  65. package/interaction/Draw.d.ts +3 -9
  66. package/interaction/Draw.d.ts.map +1 -1
  67. package/interaction/Interaction.d.ts +1 -3
  68. package/interaction/Interaction.d.ts.map +1 -1
  69. package/interaction/Link.js +2 -2
  70. package/interaction/Modify.d.ts +28 -76
  71. package/interaction/Modify.d.ts.map +1 -1
  72. package/interaction/Modify.js +54 -248
  73. package/interaction/Select.d.ts +18 -10
  74. package/interaction/Select.d.ts.map +1 -1
  75. package/interaction/Select.js +89 -54
  76. package/interaction/Snap.d.ts +12 -18
  77. package/interaction/Snap.d.ts.map +1 -1
  78. package/interaction/Translate.d.ts +2 -6
  79. package/interaction/Translate.d.ts.map +1 -1
  80. package/layer/Base.d.ts +8 -19
  81. package/layer/Base.d.ts.map +1 -1
  82. package/layer/Base.js +3 -6
  83. package/layer/BaseImage.d.ts +1 -3
  84. package/layer/BaseImage.d.ts.map +1 -1
  85. package/layer/BaseTile.d.ts +1 -3
  86. package/layer/BaseTile.d.ts.map +1 -1
  87. package/layer/BaseVector.d.ts +1 -3
  88. package/layer/BaseVector.d.ts.map +1 -1
  89. package/layer/Flow.d.ts +2 -2
  90. package/layer/Graticule.d.ts +1 -5
  91. package/layer/Graticule.d.ts.map +1 -1
  92. package/layer/Group.d.ts +2 -8
  93. package/layer/Group.d.ts.map +1 -1
  94. package/layer/Heatmap.d.ts +2 -23
  95. package/layer/Heatmap.d.ts.map +1 -1
  96. package/layer/Heatmap.js +0 -29
  97. package/layer/Layer.d.ts +8 -17
  98. package/layer/Layer.d.ts.map +1 -1
  99. package/layer/Layer.js +2 -5
  100. package/layer/Tile.d.ts +1 -1
  101. package/layer/Vector.d.ts +2 -2
  102. package/layer/Vector.d.ts.map +1 -1
  103. package/layer/VectorImage.d.ts +2 -2
  104. package/layer/VectorImage.d.ts.map +1 -1
  105. package/layer/VectorTile.d.ts +2 -2
  106. package/layer/VectorTile.d.ts.map +1 -1
  107. package/layer/WebGLPoints.d.ts +1 -3
  108. package/layer/WebGLPoints.d.ts.map +1 -1
  109. package/layer/WebGLTile.d.ts +3 -3
  110. package/layer/WebGLTile.d.ts.map +1 -1
  111. package/layer/WebGLVector.d.ts +2 -4
  112. package/layer/WebGLVector.d.ts.map +1 -1
  113. package/layer/WebGLVectorTile.d.ts +2 -2
  114. package/layer/WebGLVectorTile.d.ts.map +1 -1
  115. package/package.json +3 -4
  116. package/proj/proj4.d.ts +6 -43
  117. package/proj/proj4.d.ts.map +1 -1
  118. package/proj/proj4.js +28 -89
  119. package/proj.js +2 -2
  120. package/render/canvas/Builder.d.ts.map +1 -1
  121. package/render/canvas/Builder.js +1 -8
  122. package/render/canvas/Executor.d.ts.map +1 -1
  123. package/render/canvas/Executor.js +3 -49
  124. package/render/canvas/ExecutorGroup.d.ts.map +1 -1
  125. package/render/canvas/ExecutorGroup.js +5 -41
  126. package/render/canvas/Immediate.d.ts +0 -2
  127. package/render/canvas/Immediate.d.ts.map +1 -1
  128. package/render/canvas/Immediate.js +4 -28
  129. package/render/canvas/LineStringBuilder.d.ts +0 -1
  130. package/render/canvas/LineStringBuilder.d.ts.map +1 -1
  131. package/render/canvas/LineStringBuilder.js +5 -15
  132. package/render/canvas/PolygonBuilder.d.ts +0 -2
  133. package/render/canvas/PolygonBuilder.d.ts.map +1 -1
  134. package/render/canvas/PolygonBuilder.js +6 -72
  135. package/render/canvas/style.d.ts.map +1 -1
  136. package/render/canvas/style.js +37 -118
  137. package/render/canvas.d.ts +2 -22
  138. package/render/canvas.d.ts.map +1 -1
  139. package/render/canvas.js +0 -9
  140. package/render/webgl/bufferUtil.d.ts.map +1 -1
  141. package/render/webgl/bufferUtil.js +31 -1
  142. package/renderer/Composite.js +4 -4
  143. package/renderer/canvas/ImageLayer.d.ts +1 -6
  144. package/renderer/canvas/ImageLayer.d.ts.map +1 -1
  145. package/renderer/canvas/ImageLayer.js +0 -14
  146. package/renderer/canvas/TileLayer.d.ts +1 -1
  147. package/renderer/canvas/VectorLayer.d.ts +1 -8
  148. package/renderer/canvas/VectorLayer.d.ts.map +1 -1
  149. package/renderer/canvas/VectorLayer.js +14 -55
  150. package/renderer/canvas/VectorTileLayer.d.ts +1 -1
  151. package/renderer/canvas/VectorTileLayer.d.ts.map +1 -1
  152. package/renderer/canvas/VectorTileLayer.js +0 -2
  153. package/renderer/webgl/TileLayerBase.js +1 -1
  154. package/reproj/Tile.d.ts +2 -7
  155. package/reproj/Tile.d.ts.map +1 -1
  156. package/reproj/Tile.js +6 -12
  157. package/source/Cluster.d.ts +2 -8
  158. package/source/Cluster.d.ts.map +1 -1
  159. package/source/DataTile.d.ts +0 -15
  160. package/source/DataTile.d.ts.map +1 -1
  161. package/source/DataTile.js +0 -9
  162. package/source/GeoTIFF.d.ts +2 -7
  163. package/source/GeoTIFF.d.ts.map +1 -1
  164. package/source/GeoTIFF.js +10 -15
  165. package/source/ImageArcGISRest.d.ts +0 -10
  166. package/source/ImageArcGISRest.d.ts.map +1 -1
  167. package/source/ImageArcGISRest.js +0 -8
  168. package/source/ImageMapGuide.d.ts +0 -10
  169. package/source/ImageMapGuide.d.ts.map +1 -1
  170. package/source/ImageMapGuide.js +0 -8
  171. package/source/ImageStatic.d.ts +0 -5
  172. package/source/ImageStatic.d.ts.map +1 -1
  173. package/source/ImageStatic.js +0 -2
  174. package/source/ImageTile.d.ts +1 -5
  175. package/source/ImageTile.d.ts.map +1 -1
  176. package/source/ImageTile.js +0 -5
  177. package/source/ImageWMS.d.ts +0 -10
  178. package/source/ImageWMS.d.ts.map +1 -1
  179. package/source/ImageWMS.js +0 -10
  180. package/source/OGCMapTile.d.ts +0 -5
  181. package/source/OGCMapTile.d.ts.map +1 -1
  182. package/source/OGCMapTile.js +0 -2
  183. package/source/OSM.d.ts +0 -5
  184. package/source/OSM.d.ts.map +1 -1
  185. package/source/OSM.js +19 -5
  186. package/source/SentinelHub.d.ts +0 -1
  187. package/source/SentinelHub.d.ts.map +1 -1
  188. package/source/SentinelHub.js +0 -5
  189. package/source/Source.d.ts +1 -3
  190. package/source/Source.d.ts.map +1 -1
  191. package/source/TileArcGISRest.d.ts +1 -6
  192. package/source/TileArcGISRest.d.ts.map +1 -1
  193. package/source/TileArcGISRest.js +0 -2
  194. package/source/TileDebug.d.ts +1 -1
  195. package/source/TileImage.d.ts +0 -10
  196. package/source/TileImage.d.ts.map +1 -1
  197. package/source/TileImage.js +3 -16
  198. package/source/TileWMS.d.ts +1 -1
  199. package/source/UrlTile.d.ts +1 -1
  200. package/source/Vector.d.ts +8 -18
  201. package/source/Vector.d.ts.map +1 -1
  202. package/source/Vector.js +3 -3
  203. package/source/WMTS.d.ts +0 -5
  204. package/source/WMTS.d.ts.map +1 -1
  205. package/source/WMTS.js +0 -2
  206. package/source/XYZ.d.ts +0 -5
  207. package/source/XYZ.d.ts.map +1 -1
  208. package/source/XYZ.js +0 -2
  209. package/source/Zoomify.d.ts +2 -7
  210. package/source/Zoomify.d.ts.map +1 -1
  211. package/source/Zoomify.js +3 -5
  212. package/source/arcgisRest.d.ts +0 -5
  213. package/source/arcgisRest.d.ts.map +1 -1
  214. package/source/arcgisRest.js +0 -5
  215. package/source/mapguide.d.ts +0 -4
  216. package/source/mapguide.d.ts.map +1 -1
  217. package/source/mapguide.js +0 -5
  218. package/source/mapserver.d.ts +1 -5
  219. package/source/mapserver.d.ts.map +1 -1
  220. package/source/mapserver.js +0 -4
  221. package/source/ogcTileUtil.d.ts +12 -20
  222. package/source/ogcTileUtil.d.ts.map +1 -1
  223. package/source/ogcTileUtil.js +15 -27
  224. package/source/static.d.ts +0 -5
  225. package/source/static.d.ts.map +1 -1
  226. package/source/static.js +0 -4
  227. package/source/wms.d.ts +0 -5
  228. package/source/wms.d.ts.map +1 -1
  229. package/source/wms.js +0 -5
  230. package/style/Circle.d.ts +14 -0
  231. package/style/Circle.d.ts.map +1 -1
  232. package/style/Circle.js +11 -0
  233. package/style/Fill.js +1 -1
  234. package/style/Icon.d.ts +0 -19
  235. package/style/Icon.d.ts.map +1 -1
  236. package/style/Icon.js +2 -55
  237. package/style/IconImage.d.ts +5 -14
  238. package/style/IconImage.d.ts.map +1 -1
  239. package/style/IconImage.js +18 -28
  240. package/style/IconImageCache.d.ts +8 -4
  241. package/style/IconImageCache.d.ts.map +1 -1
  242. package/style/IconImageCache.js +13 -11
  243. package/style/RegularShape.d.ts +0 -12
  244. package/style/RegularShape.d.ts.map +1 -1
  245. package/style/RegularShape.js +4 -36
  246. package/style/Stroke.d.ts +0 -25
  247. package/style/Stroke.d.ts.map +1 -1
  248. package/style/Stroke.js +0 -28
  249. package/style/Style.d.ts +1 -1
  250. package/style/flat.d.ts +2 -2
  251. package/style/flat.js +1 -1
  252. package/tilegrid/TileGrid.d.ts +0 -5
  253. package/tilegrid/TileGrid.d.ts.map +1 -1
  254. package/tilegrid/TileGrid.js +0 -8
  255. package/util.js +1 -1
  256. package/worker/webgl.js +1 -1
  257. package/geom/flat/lineoffset.d.ts +0 -45
  258. package/geom/flat/lineoffset.d.ts.map +0 -1
  259. package/geom/flat/lineoffset.js +0 -173
  260. package/source/GeoZarr.d.ts +0 -163
  261. package/source/GeoZarr.d.ts.map +0 -1
  262. package/source/GeoZarr.js +0 -472
  263. package/source/OGCMap.d.ts +0 -180
  264. package/source/OGCMap.d.ts.map +0 -1
  265. package/source/OGCMap.js +0 -227
  266. package/source/ogcMapUtil.d.ts +0 -88
  267. package/source/ogcMapUtil.d.ts.map +0 -1
  268. package/source/ogcMapUtil.js +0 -121
package/source/OGCMap.js DELETED
@@ -1,227 +0,0 @@
1
- /**
2
- * @module ol/source/OGCMap
3
- */
4
-
5
- import {decode} from '../Image.js';
6
- import ImageSource, {defaultImageLoadFunction} from './Image.js';
7
- import {createLoader} from './ogcMapUtil.js';
8
-
9
- /**
10
- * @typedef {Object} Options
11
- * @property {import("./Source.js").AttributionLike} [attributions] Attributions.
12
- * @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that
13
- * you must provide a `crossOrigin` value if you want to access pixel data with the Canvas renderer.
14
- * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.
15
- * @property {ReferrerPolicy} [referrerPolicy] The `referrerPolicy` property for loaded images.
16
- * @property {boolean} [hidpi=true] Use the `ol/Map#pixelRatio` value when requesting
17
- * the image from the remote server.
18
- * @property {import("../Image.js").LoadFunction} [imageLoadFunction] Optional function to load an image given a URL.
19
- * @property {boolean} [interpolate=true] Use interpolated values when resampling. By default,
20
- * linear interpolation is used when resampling. Set to false to use the nearest neighbor instead.
21
- * @property {Object<string,*>} [params] OGC Maps request parameters.
22
- * No param is required by default. `width`, `height`, `bbox`, `crs` and `bbox-crs` will be set dynamically.
23
- * @property {import("../proj.js").ProjectionLike} [projection] Projection. Default is the view projection.
24
- * @property {number} [ratio=1.5] Ratio. `1` means image requests are the size of the map viewport, `2` means
25
- * twice the width and height of the map viewport, and so on. Must be `1` or higher.
26
- * @property {Array<number>} [resolutions] Resolutions.
27
- * If specified, requests will be made for these resolutions only.
28
- * @property {string} [url] OGC Maps service URL.
29
- */
30
-
31
- /**
32
- * @classdesc
33
- * Source for OGC Maps servers providing single, untiled images.
34
- *
35
- * @fires module:ol/source/Image.ImageSourceEvent
36
- * @api
37
- */
38
- class OGCMap extends ImageSource {
39
- /**
40
- * @param {Options} [options] OGCMapOptions options.
41
- */
42
- constructor(options) {
43
- options = options ? options : {};
44
-
45
- super({
46
- attributions: options.attributions,
47
- interpolate: options.interpolate,
48
- projection: options.projection,
49
- resolutions: options.resolutions,
50
- });
51
-
52
- /**
53
- * @private
54
- * @type {?string}
55
- */
56
- this.crossOrigin_ =
57
- options.crossOrigin !== undefined ? options.crossOrigin : null;
58
-
59
- /**
60
- * @private
61
- * @type {ReferrerPolicy}
62
- */
63
- this.referrerPolicy_ = options.referrerPolicy;
64
-
65
- /**
66
- * @private
67
- * @type {string|undefined}
68
- */
69
- this.url_ = options.url;
70
-
71
- /**
72
- * @private
73
- * @type {import("../Image.js").LoadFunction}
74
- */
75
- this.imageLoadFunction_ =
76
- options.imageLoadFunction !== undefined
77
- ? options.imageLoadFunction
78
- : defaultImageLoadFunction;
79
-
80
- /**
81
- * @private
82
- * @type {!Object}
83
- */
84
- this.params_ = Object.assign({}, options.params);
85
-
86
- /**
87
- * @private
88
- * @type {boolean}
89
- */
90
- this.hidpi_ = options.hidpi !== undefined ? options.hidpi : true;
91
-
92
- /**
93
- * @private
94
- * @type {number}
95
- */
96
- this.renderedRevision_ = 0;
97
-
98
- /**
99
- * @private
100
- * @type {number}
101
- */
102
- this.ratio_ = options.ratio !== undefined ? options.ratio : 1.5;
103
-
104
- /**
105
- * @private
106
- * @type {import("../proj/Projection.js").default}
107
- */
108
- this.loaderProjection_ = null;
109
- }
110
-
111
- /**
112
- * Get the user-provided params, i.e. those passed to the constructor through
113
- * the "params" option, and possibly updated using the updateParams method.
114
- * @return {Object} Params.
115
- * @api
116
- */
117
- getParams() {
118
- return this.params_;
119
- }
120
-
121
- /**
122
- * @param {import("../extent.js").Extent} extent Extent.
123
- * @param {number} resolution Resolution.
124
- * @param {number} pixelRatio Pixel ratio.
125
- * @param {import("../proj/Projection.js").default} projection Projection.
126
- * @return {import("../Image.js").default} Single image.
127
- * @override
128
- */
129
- getImageInternal(extent, resolution, pixelRatio, projection) {
130
- if (this.url_ === undefined) {
131
- return null;
132
- }
133
- if (!this.loader || this.loaderProjection_ !== projection) {
134
- // Lazily create loader to pick up the view projection and to allow `params` updates
135
- this.loaderProjection_ = projection;
136
- this.loader = createLoader({
137
- crossOrigin: this.crossOrigin_,
138
- referrerPolicy: this.referrerPolicy_,
139
- params: this.params_,
140
- projection: projection,
141
- hidpi: this.hidpi_,
142
- url: this.url_,
143
- ratio: this.ratio_,
144
- load: (image, src) => {
145
- this.image.setImage(image);
146
- this.imageLoadFunction_(this.image, src);
147
- return decode(image);
148
- },
149
- });
150
- }
151
-
152
- return super.getImageInternal(extent, resolution, pixelRatio, projection);
153
- }
154
-
155
- /**
156
- * Return the image load function of the source.
157
- * @return {import("../Image.js").LoadFunction} The image load function.
158
- * @api
159
- */
160
- getImageLoadFunction() {
161
- return this.imageLoadFunction_;
162
- }
163
-
164
- /**
165
- * Return the URL used for this OGC Maps source.
166
- * @return {string|undefined} URL.
167
- * @api
168
- */
169
- getUrl() {
170
- return this.url_;
171
- }
172
-
173
- /**
174
- * Set the image load function of the source.
175
- * @param {import("../Image.js").LoadFunction} imageLoadFunction Image load function.
176
- * @api
177
- */
178
- setImageLoadFunction(imageLoadFunction) {
179
- this.imageLoadFunction_ = imageLoadFunction;
180
- this.changed();
181
- }
182
-
183
- /**
184
- * Set the URL to use for requests.
185
- * @param {string|undefined} url URL.
186
- * @api
187
- */
188
- setUrl(url) {
189
- if (url != this.url_) {
190
- this.url_ = url;
191
- this.loader = null;
192
- this.changed();
193
- }
194
- }
195
-
196
- /**
197
- * Set the user-provided params.
198
- * @param {Object} params Params.
199
- * @api
200
- */
201
- setParams(params) {
202
- this.params_ = Object.assign({}, params);
203
- // Reset loader to pick up new params
204
- this.loader = null;
205
- this.changed();
206
- }
207
-
208
- /**
209
- * Update the user-provided params.
210
- * @param {Object} params Params.
211
- * @api
212
- */
213
- updateParams(params) {
214
- Object.assign(this.params_, params);
215
- this.changed();
216
- }
217
-
218
- /**
219
- * @override
220
- */
221
- changed() {
222
- this.image = null;
223
- super.changed();
224
- }
225
- }
226
-
227
- export default OGCMap;
@@ -1,88 +0,0 @@
1
- /**
2
- * @param {string} baseUrl Base URL.
3
- * @param {import("../extent.js").Extent} extent Extent.
4
- * @param {import("../size.js").Size} size Size.
5
- * @param {import("../proj/Projection.js").default} projection Projection.
6
- * @param {Object} params OGC Map params. Will be modified in place.
7
- * @return {string} Request URL.
8
- */
9
- export function getRequestUrl(baseUrl: string, extent: import("../extent.js").Extent, size: import("../size.js").Size, projection: import("../proj/Projection.js").default, params: any): string;
10
- /**
11
- * @param {import("../extent").Extent} extent Extent.
12
- * @param {number} resolution Resolution.
13
- * @param {number} pixelRatio pixel ratio.
14
- * @param {import("../proj.js").Projection} projection Projection.
15
- * @param {string} url OGC Map service url.
16
- * @param {Object} params OGC Map params.
17
- * @return {string} Image src.
18
- */
19
- export function getImageSrc(extent: import("../extent").Extent, resolution: number, pixelRatio: number, projection: import("../proj.js").Projection, url: string, params: any): string;
20
- /**
21
- * @typedef {Object} LoaderOptions
22
- * @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that
23
- * you must provide a `crossOrigin` value if you want to access pixel data with the Canvas renderer.
24
- * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.
25
- * @property {ReferrerPolicy} [referrerPolicy] The `referrerPolicy` property for loaded images.
26
- * @property {boolean} [hidpi=true] Use the `ol/Map#pixelRatio` value when requesting
27
- * the image from the remote server.
28
- * @property {Object<string,*>} [params] OGC Map request parameters.
29
- * No param is required by default. `width`, `height`, `bbox`, `crs` and `bbox-crs` will be set dynamically.
30
- * @property {import("../proj.js").ProjectionLike} [projection] Projection. Default is 'EPSG:3857'.
31
- * @property {number} [ratio=1.5] Ratio. `1` means image requests are the size of the map viewport, `2` means
32
- * twice the width and height of the map viewport, and so on. Must be `1` or higher.
33
- * @property {string} url OGC Map service URL.
34
- * @property {function(HTMLImageElement, string): Promise<import('../DataTile.js').ImageLike>} [load] Function
35
- * to perform loading of the image. Receives the created `HTMLImageElement` and the desired `src` as argument and
36
- * returns a promise resolving to the loaded or decoded image. Default is {@link module:ol/Image.decode}.
37
- */
38
- /**
39
- * Creates a loader for OGC Map images.
40
- * @param {LoaderOptions} options Loader options.
41
- * @return {import("../Image.js").ImageObjectPromiseLoader} Loader.
42
- * @api
43
- */
44
- export function createLoader(options: LoaderOptions): import("../Image.js").ImageObjectPromiseLoader;
45
- export type LoaderOptions = {
46
- /**
47
- * The `crossOrigin` attribute for loaded images. Note that
48
- * you must provide a `crossOrigin` value if you want to access pixel data with the Canvas renderer.
49
- * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.
50
- */
51
- crossOrigin?: string | null | undefined;
52
- /**
53
- * The `referrerPolicy` property for loaded images.
54
- */
55
- referrerPolicy?: ReferrerPolicy | undefined;
56
- /**
57
- * Use the `ol/Map#pixelRatio` value when requesting
58
- * the image from the remote server.
59
- */
60
- hidpi?: boolean | undefined;
61
- /**
62
- * OGC Map request parameters.
63
- * No param is required by default. `width`, `height`, `bbox`, `crs` and `bbox-crs` will be set dynamically.
64
- */
65
- params?: {
66
- [x: string]: any;
67
- } | undefined;
68
- /**
69
- * Projection. Default is 'EPSG:3857'.
70
- */
71
- projection?: import("../proj.js").ProjectionLike;
72
- /**
73
- * Ratio. `1` means image requests are the size of the map viewport, `2` means
74
- * twice the width and height of the map viewport, and so on. Must be `1` or higher.
75
- */
76
- ratio?: number | undefined;
77
- /**
78
- * OGC Map service URL.
79
- */
80
- url: string;
81
- /**
82
- * Function
83
- * to perform loading of the image. Receives the created `HTMLImageElement` and the desired `src` as argument and
84
- * returns a promise resolving to the loaded or decoded image. Default is {@link module :ol/Image.decode}.
85
- */
86
- load?: ((arg0: HTMLImageElement, arg1: string) => Promise<import("../DataTile.js").ImageLike>) | undefined;
87
- };
88
- //# sourceMappingURL=ogcMapUtil.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ogcMapUtil.d.ts","sourceRoot":"","sources":["ogcMapUtil.js"],"names":[],"mappings":"AAYA;;;;;;;GAOG;AACH,uCAPW,MAAM,UACN,OAAO,cAAc,EAAE,MAAM,QAC7B,OAAO,YAAY,EAAE,IAAI,cACzB,OAAO,uBAAuB,EAAE,OAAO,gBAEtC,MAAM,CAejB;AAED;;;;;;;;GAQG;AACH,oCARW,OAAO,WAAW,EAAE,MAAM,cAC1B,MAAM,cACN,MAAM,cACN,OAAO,YAAY,EAAE,UAAU,OAC/B,MAAM,gBAEL,MAAM,CAwBjB;AAED;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;;GAKG;AACH,sCAJW,aAAa,GACZ,OAAO,aAAa,EAAE,wBAAwB,CA8BzD;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA1Ca,OAAO,YAAY,EAAE,cAAc;;;;;;;;;SAGnC,MAAM;;;;;;mBACG,gBAAgB,QAAE,MAAM,KAAG,OAAO,CAAC,OAAO,gBAAgB,EAAE,SAAS,CAAC"}
@@ -1,121 +0,0 @@
1
- /**
2
- * @module ol/source/ogcMapUtil
3
- */
4
-
5
- import {decode} from '../Image.js';
6
- import {getHeight, getWidth} from '../extent.js';
7
- import {round} from '../math.js';
8
- import {get as getProjection} from '../proj.js';
9
- import {appendParams} from '../uri.js';
10
- import {getRequestExtent} from './Image.js';
11
- import {DECIMALS} from './common.js';
12
-
13
- /**
14
- * @param {string} baseUrl Base URL.
15
- * @param {import("../extent.js").Extent} extent Extent.
16
- * @param {import("../size.js").Size} size Size.
17
- * @param {import("../proj/Projection.js").default} projection Projection.
18
- * @param {Object} params OGC Map params. Will be modified in place.
19
- * @return {string} Request URL.
20
- */
21
- export function getRequestUrl(baseUrl, extent, size, projection, params) {
22
- params['width'] = size[0];
23
- params['height'] = size[1];
24
-
25
- const axisOrientation = projection.getAxisOrientation();
26
- params['crs'] = projection.getCode();
27
- params['bbox-crs'] = projection.getCode();
28
- const bbox = axisOrientation.startsWith('ne')
29
- ? [extent[1], extent[0], extent[3], extent[2]]
30
- : extent;
31
- params['bbox'] = bbox.join(',');
32
-
33
- return appendParams(baseUrl, params);
34
- }
35
-
36
- /**
37
- * @param {import("../extent").Extent} extent Extent.
38
- * @param {number} resolution Resolution.
39
- * @param {number} pixelRatio pixel ratio.
40
- * @param {import("../proj.js").Projection} projection Projection.
41
- * @param {string} url OGC Map service url.
42
- * @param {Object} params OGC Map params.
43
- * @return {string} Image src.
44
- */
45
- export function getImageSrc(
46
- extent,
47
- resolution,
48
- pixelRatio,
49
- projection,
50
- url,
51
- params,
52
- ) {
53
- params = Object.assign({}, params);
54
-
55
- const imageResolution = resolution / pixelRatio;
56
-
57
- const imageSize = [
58
- round(getWidth(extent) / imageResolution, DECIMALS),
59
- round(getHeight(extent) / imageResolution, DECIMALS),
60
- ];
61
-
62
- if (pixelRatio !== 1) {
63
- params['mm-per-pixel'] = 0.28 / pixelRatio;
64
- }
65
-
66
- return getRequestUrl(url, extent, imageSize, projection, params);
67
- }
68
-
69
- /**
70
- * @typedef {Object} LoaderOptions
71
- * @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that
72
- * you must provide a `crossOrigin` value if you want to access pixel data with the Canvas renderer.
73
- * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.
74
- * @property {ReferrerPolicy} [referrerPolicy] The `referrerPolicy` property for loaded images.
75
- * @property {boolean} [hidpi=true] Use the `ol/Map#pixelRatio` value when requesting
76
- * the image from the remote server.
77
- * @property {Object<string,*>} [params] OGC Map request parameters.
78
- * No param is required by default. `width`, `height`, `bbox`, `crs` and `bbox-crs` will be set dynamically.
79
- * @property {import("../proj.js").ProjectionLike} [projection] Projection. Default is 'EPSG:3857'.
80
- * @property {number} [ratio=1.5] Ratio. `1` means image requests are the size of the map viewport, `2` means
81
- * twice the width and height of the map viewport, and so on. Must be `1` or higher.
82
- * @property {string} url OGC Map service URL.
83
- * @property {function(HTMLImageElement, string): Promise<import('../DataTile.js').ImageLike>} [load] Function
84
- * to perform loading of the image. Receives the created `HTMLImageElement` and the desired `src` as argument and
85
- * returns a promise resolving to the loaded or decoded image. Default is {@link module:ol/Image.decode}.
86
- */
87
-
88
- /**
89
- * Creates a loader for OGC Map images.
90
- * @param {LoaderOptions} options Loader options.
91
- * @return {import("../Image.js").ImageObjectPromiseLoader} Loader.
92
- * @api
93
- */
94
- export function createLoader(options) {
95
- const hidpi = options.hidpi === undefined ? true : options.hidpi;
96
- const projection = getProjection(options.projection || 'EPSG:3857');
97
- const ratio = options.ratio || 1.5;
98
- const load = options.load || decode;
99
- const crossOrigin = options.crossOrigin ?? null;
100
-
101
- return (extent, resolution, pixelRatio) => {
102
- extent = getRequestExtent(extent, resolution, pixelRatio, ratio);
103
- if (pixelRatio !== 1 && !hidpi) {
104
- pixelRatio = 1;
105
- }
106
- const src = getImageSrc(
107
- extent,
108
- resolution,
109
- pixelRatio,
110
- projection,
111
- options.url,
112
- options.params,
113
- );
114
- const image = new Image();
115
- image.crossOrigin = crossOrigin;
116
- if (options.referrerPolicy !== undefined) {
117
- image.referrerPolicy = options.referrerPolicy;
118
- }
119
- return load(image, src).then((image) => ({image, extent, pixelRatio}));
120
- };
121
- }