ol 7.5.1 → 8.0.0-dev.1692053484481
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/DataTile.d.ts +2 -2
- package/DataTile.d.ts.map +1 -1
- package/DataTile.js +3 -2
- package/Image.d.ts +139 -40
- package/Image.d.ts.map +1 -1
- package/Image.js +194 -96
- package/ImageCanvas.d.ts +2 -2
- package/ImageCanvas.d.ts.map +1 -1
- package/ImageCanvas.js +2 -2
- package/Object.d.ts +7 -0
- package/Object.d.ts.map +1 -1
- package/Object.js +8 -0
- package/dist/ol.js +2 -2
- package/dist/ol.js.map +1 -1
- package/expr/cpu.d.ts +71 -0
- package/expr/cpu.d.ts.map +1 -0
- package/expr/cpu.js +312 -0
- package/expr/expression.d.ts +97 -0
- package/expr/expression.d.ts.map +1 -0
- package/expr/expression.js +373 -0
- package/has.d.ts +5 -0
- package/has.d.ts.map +1 -1
- package/has.js +6 -0
- package/index.d.ts +1 -2
- package/index.js +1 -1
- package/layer/Base.d.ts +12 -8
- package/layer/Base.d.ts.map +1 -1
- package/layer/Base.js +12 -8
- package/layer/BaseVector.d.ts.map +1 -1
- package/layer/BaseVector.js +67 -33
- package/layer/Heatmap.d.ts.map +1 -1
- package/layer/Heatmap.js +16 -55
- package/layer/Layer.d.ts +2 -2
- package/layer/Layer.d.ts.map +1 -1
- package/layer/Layer.js +1 -1
- package/layer/WebGLPoints.d.ts +7 -12
- package/layer/WebGLPoints.d.ts.map +1 -1
- package/layer/WebGLPoints.js +7 -12
- package/package.json +1 -1
- package/render/Feature.d.ts +8 -0
- package/render/Feature.d.ts.map +1 -1
- package/render/Feature.js +9 -0
- package/render/canvas/Immediate.d.ts.map +1 -1
- package/render/canvas/Immediate.js +5 -3
- package/render/canvas/TextBuilder.js +2 -2
- package/render/canvas/style.d.ts +69 -0
- package/render/canvas/style.d.ts.map +1 -0
- package/render/canvas/style.js +1192 -0
- package/render/canvas.js +1 -1
- package/render/webgl/VectorStyleRenderer.d.ts.map +1 -1
- package/render/webgl/VectorStyleRenderer.js +4 -0
- package/renderer/Layer.d.ts +2 -2
- package/renderer/Layer.d.ts.map +1 -1
- package/renderer/Layer.js +1 -1
- package/renderer/canvas/ImageLayer.d.ts +4 -4
- package/renderer/canvas/ImageLayer.d.ts.map +1 -1
- package/renderer/canvas/ImageLayer.js +17 -12
- package/renderer/canvas/Layer.d.ts +2 -2
- package/renderer/canvas/Layer.d.ts.map +1 -1
- package/renderer/canvas/Layer.js +1 -1
- package/renderer/canvas/VectorImageLayer.d.ts.map +1 -1
- package/renderer/canvas/VectorImageLayer.js +3 -2
- package/renderer/webgl/VectorLayer.d.ts +1 -2
- package/renderer/webgl/VectorLayer.d.ts.map +1 -1
- package/reproj/Image.d.ts +5 -5
- package/reproj/Image.d.ts.map +1 -1
- package/reproj/Image.js +6 -6
- package/reproj.d.ts +2 -2
- package/reproj.d.ts.map +1 -1
- package/reproj.js +1 -1
- package/resolution.d.ts +13 -0
- package/resolution.d.ts.map +1 -0
- package/resolution.js +18 -0
- package/source/Image.d.ts +44 -7
- package/source/Image.d.ts.map +1 -1
- package/source/Image.js +97 -8
- package/source/ImageArcGISRest.d.ts +0 -23
- package/source/ImageArcGISRest.d.ts.map +1 -1
- package/source/ImageArcGISRest.js +18 -120
- package/source/ImageMapGuide.d.ts +0 -24
- package/source/ImageMapGuide.d.ts.map +1 -1
- package/source/ImageMapGuide.js +21 -113
- package/source/ImageStatic.d.ts +2 -27
- package/source/ImageStatic.d.ts.map +1 -1
- package/source/ImageStatic.js +20 -70
- package/source/ImageWMS.d.ts +2 -46
- package/source/ImageWMS.d.ts.map +1 -1
- package/source/ImageWMS.js +43 -201
- package/source/{Stamen.d.ts → StadiaMaps.d.ts} +17 -7
- package/source/StadiaMaps.d.ts.map +1 -0
- package/source/{Stamen.js → StadiaMaps.js} +85 -38
- package/source/TileArcGISRest.d.ts.map +1 -1
- package/source/TileArcGISRest.js +11 -22
- package/source/TileWMS.d.ts +0 -1
- package/source/TileWMS.d.ts.map +1 -1
- package/source/TileWMS.js +43 -106
- package/source/arcgisRest.d.ts +88 -0
- package/source/arcgisRest.d.ts.map +1 -0
- package/source/arcgisRest.js +131 -0
- package/source/common.d.ts +5 -0
- package/source/common.d.ts.map +1 -1
- package/source/common.js +6 -0
- package/source/mapguide.d.ts +52 -0
- package/source/mapguide.d.ts.map +1 -0
- package/source/mapguide.js +116 -0
- package/source/static.d.ts +45 -0
- package/source/static.d.ts.map +1 -0
- package/source/static.js +44 -0
- package/source/wms.d.ts +109 -1
- package/source/wms.d.ts.map +1 -1
- package/source/wms.js +170 -0
- package/source.d.ts +5 -1
- package/source.d.ts.map +1 -1
- package/source.js +5 -1
- package/style/flat.d.ts +332 -173
- package/style/flat.d.ts.map +1 -1
- package/style/flat.js +176 -248
- package/style/literal.d.ts +27 -72
- package/style/literal.d.ts.map +1 -1
- package/style/literal.js +14 -35
- package/util.d.ts.map +1 -1
- package/util.js +1 -1
- package/webgl/Helper.d.ts +7 -2
- package/webgl/Helper.d.ts.map +1 -1
- package/webgl/Helper.js +16 -27
- package/webgl/ShaderBuilder.d.ts +4 -14
- package/webgl/ShaderBuilder.d.ts.map +1 -1
- package/webgl/ShaderBuilder.js +72 -72
- package/webgl/styleparser.d.ts +3 -9
- package/webgl/styleparser.d.ts.map +1 -1
- package/webgl/styleparser.js +503 -88
- package/ImageBase.d.ts +0 -65
- package/ImageBase.d.ts.map +0 -1
- package/ImageBase.js +0 -98
- package/source/Stamen.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImageStatic.d.ts","sourceRoot":"","sources":["ImageStatic.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ImageStatic.d.ts","sourceRoot":"","sources":["ImageStatic.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;iBAiBc,OAAO,cAAc,EAAE,MAAM;;;;;;;;;;;;;iBAK7B,OAAO,YAAY,EAAE,cAAc;;;;SACnC,MAAM;;AAZpB;;;;;;;;;;;;;GAaG;AAEH;;;;GAIG;AACH;IACE;;OAEG;IACH,qBAFW,OAAO,EAuDjB;IAtCC;;;OAGG;IACH,aAAuB;IAEvB;;;OAGG;IACH,qBAAuC;IA8BzC;;;;OAIG;IACH,kBAHY,OAAO,cAAc,EAAE,MAAM,CAKxC;IAgBD;;;;OAIG;IACH,UAHY,MAAM,CAKjB;CACF;wBApHmD,YAAY"}
|
package/source/ImageStatic.js
CHANGED
|
@@ -4,11 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
import EventType from '../events/EventType.js';
|
|
6
6
|
import ImageSource, {defaultImageLoadFunction} from './Image.js';
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import {createCanvasContext2D} from '../dom.js';
|
|
10
|
-
import {getHeight, getWidth, intersects} from '../extent.js';
|
|
7
|
+
import ImageWrapper, {decode} from '../Image.js';
|
|
8
|
+
import {createLoader} from './static.js';
|
|
11
9
|
import {get as getProjection} from '../proj.js';
|
|
10
|
+
import {intersects} from '../extent.js';
|
|
12
11
|
|
|
13
12
|
/**
|
|
14
13
|
* @typedef {Object} Options
|
|
@@ -16,14 +15,12 @@ import {get as getProjection} from '../proj.js';
|
|
|
16
15
|
* @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that
|
|
17
16
|
* you must provide a `crossOrigin` value if you want to access pixel data with the Canvas renderer.
|
|
18
17
|
* See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.
|
|
19
|
-
* @property {import("../extent.js").Extent}
|
|
18
|
+
* @property {import("../extent.js").Extent} imageExtent Extent of the image in map coordinates.
|
|
20
19
|
* This is the [left, bottom, right, top] map coordinates of your image.
|
|
21
20
|
* @property {import("../Image.js").LoadFunction} [imageLoadFunction] Optional function to load an image given a URL.
|
|
22
21
|
* @property {boolean} [interpolate=true] Use interpolated values when resampling. By default,
|
|
23
22
|
* linear interpolation is used when resampling. Set to false to use the nearest neighbor instead.
|
|
24
23
|
* @property {import("../proj.js").ProjectionLike} [projection] Projection. Default is the view projection.
|
|
25
|
-
* @property {import("../size.js").Size} [imageSize] Size of the image in pixels. Usually the image size is auto-detected, so this
|
|
26
|
-
* only needs to be set if auto-detection fails for some reason.
|
|
27
24
|
* @property {string} url Image URL.
|
|
28
25
|
*/
|
|
29
26
|
|
|
@@ -67,23 +64,25 @@ class Static extends ImageSource {
|
|
|
67
64
|
* @private
|
|
68
65
|
* @type {import("../Image.js").default}
|
|
69
66
|
*/
|
|
70
|
-
this.
|
|
67
|
+
this.image = null;
|
|
68
|
+
|
|
69
|
+
this.image = new ImageWrapper(
|
|
71
70
|
this.imageExtent_,
|
|
72
71
|
undefined,
|
|
73
72
|
1,
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
73
|
+
createLoader({
|
|
74
|
+
url: options.url,
|
|
75
|
+
imageExtent: options.imageExtent,
|
|
76
|
+
crossOrigin,
|
|
77
|
+
load: (image, src) => {
|
|
78
|
+
this.image.setImage(image);
|
|
79
|
+
imageLoadFunction(this.image, src);
|
|
80
|
+
return decode(image);
|
|
81
|
+
},
|
|
82
|
+
})
|
|
78
83
|
);
|
|
79
84
|
|
|
80
|
-
|
|
81
|
-
* @private
|
|
82
|
-
* @type {import("../size.js").Size|null}
|
|
83
|
-
*/
|
|
84
|
-
this.imageSize_ = options.imageSize ? options.imageSize : null;
|
|
85
|
-
|
|
86
|
-
this.image_.addEventListener(
|
|
85
|
+
this.image.addEventListener(
|
|
87
86
|
EventType.CHANGE,
|
|
88
87
|
this.handleImageChange.bind(this)
|
|
89
88
|
);
|
|
@@ -106,8 +105,8 @@ class Static extends ImageSource {
|
|
|
106
105
|
* @return {import("../Image.js").default} Single image.
|
|
107
106
|
*/
|
|
108
107
|
getImageInternal(extent, resolution, pixelRatio, projection) {
|
|
109
|
-
if (intersects(extent, this.
|
|
110
|
-
return this.
|
|
108
|
+
if (intersects(extent, this.image.getExtent())) {
|
|
109
|
+
return this.image;
|
|
111
110
|
}
|
|
112
111
|
return null;
|
|
113
112
|
}
|
|
@@ -120,55 +119,6 @@ class Static extends ImageSource {
|
|
|
120
119
|
getUrl() {
|
|
121
120
|
return this.url_;
|
|
122
121
|
}
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* @param {import("../events/Event.js").default} evt Event.
|
|
126
|
-
*/
|
|
127
|
-
handleImageChange(evt) {
|
|
128
|
-
if (this.image_.getState() == ImageState.LOADED) {
|
|
129
|
-
const imageExtent = this.image_.getExtent();
|
|
130
|
-
const image = this.image_.getImage();
|
|
131
|
-
let imageWidth, imageHeight;
|
|
132
|
-
if (this.imageSize_) {
|
|
133
|
-
imageWidth = this.imageSize_[0];
|
|
134
|
-
imageHeight = this.imageSize_[1];
|
|
135
|
-
} else {
|
|
136
|
-
imageWidth = image.width;
|
|
137
|
-
imageHeight = image.height;
|
|
138
|
-
}
|
|
139
|
-
const extentWidth = getWidth(imageExtent);
|
|
140
|
-
const extentHeight = getHeight(imageExtent);
|
|
141
|
-
const xResolution = extentWidth / imageWidth;
|
|
142
|
-
const yResolution = extentHeight / imageHeight;
|
|
143
|
-
let targetWidth = imageWidth;
|
|
144
|
-
let targetHeight = imageHeight;
|
|
145
|
-
if (xResolution > yResolution) {
|
|
146
|
-
targetWidth = Math.round(extentWidth / yResolution);
|
|
147
|
-
} else {
|
|
148
|
-
targetHeight = Math.round(extentHeight / xResolution);
|
|
149
|
-
}
|
|
150
|
-
if (targetWidth !== imageWidth || targetHeight !== imageHeight) {
|
|
151
|
-
const context = createCanvasContext2D(targetWidth, targetHeight);
|
|
152
|
-
if (!this.getInterpolate()) {
|
|
153
|
-
context.imageSmoothingEnabled = false;
|
|
154
|
-
}
|
|
155
|
-
const canvas = context.canvas;
|
|
156
|
-
context.drawImage(
|
|
157
|
-
image,
|
|
158
|
-
0,
|
|
159
|
-
0,
|
|
160
|
-
imageWidth,
|
|
161
|
-
imageHeight,
|
|
162
|
-
0,
|
|
163
|
-
0,
|
|
164
|
-
canvas.width,
|
|
165
|
-
canvas.height
|
|
166
|
-
);
|
|
167
|
-
this.image_.setImage(canvas);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
super.handleImageChange(evt);
|
|
171
|
-
}
|
|
172
122
|
}
|
|
173
123
|
|
|
174
124
|
export default Static;
|
package/source/ImageWMS.d.ts
CHANGED
|
@@ -45,8 +45,7 @@ export type Options = {
|
|
|
45
45
|
projection?: import("../proj.js").ProjectionLike;
|
|
46
46
|
/**
|
|
47
47
|
* Ratio. `1` means image requests are the size of the map viewport, `2` means
|
|
48
|
-
* twice the width and height of the map viewport, and so on. Must be `1` or
|
|
49
|
-
* higher.
|
|
48
|
+
* twice the width and height of the map viewport, and so on. Must be `1` or higher.
|
|
50
49
|
*/
|
|
51
50
|
ratio?: number | undefined;
|
|
52
51
|
/**
|
|
@@ -79,8 +78,7 @@ export type Options = {
|
|
|
79
78
|
* and `CRS` (`SRS` for WMS version < 1.3.0) will be set dynamically.
|
|
80
79
|
* @property {import("../proj.js").ProjectionLike} [projection] Projection. Default is the view projection.
|
|
81
80
|
* @property {number} [ratio=1.5] Ratio. `1` means image requests are the size of the map viewport, `2` means
|
|
82
|
-
* twice the width and height of the map viewport, and so on. Must be `1` or
|
|
83
|
-
* higher.
|
|
81
|
+
* twice the width and height of the map viewport, and so on. Must be `1` or higher.
|
|
84
82
|
* @property {Array<number>} [resolutions] Resolutions.
|
|
85
83
|
* If specified, requests will be made for these resolutions only.
|
|
86
84
|
* @property {string} [url] WMS service URL.
|
|
@@ -97,11 +95,6 @@ declare class ImageWMS extends ImageSource {
|
|
|
97
95
|
* @param {Options} [options] ImageWMS options.
|
|
98
96
|
*/
|
|
99
97
|
constructor(options?: Options | undefined);
|
|
100
|
-
/**
|
|
101
|
-
* @private
|
|
102
|
-
* @type {CanvasRenderingContext2D}
|
|
103
|
-
*/
|
|
104
|
-
private context_;
|
|
105
98
|
/**
|
|
106
99
|
* @private
|
|
107
100
|
* @type {?string}
|
|
@@ -122,11 +115,6 @@ declare class ImageWMS extends ImageSource {
|
|
|
122
115
|
* @type {!Object}
|
|
123
116
|
*/
|
|
124
117
|
private params_;
|
|
125
|
-
/**
|
|
126
|
-
* @private
|
|
127
|
-
* @type {boolean}
|
|
128
|
-
*/
|
|
129
|
-
private v13_;
|
|
130
118
|
/**
|
|
131
119
|
* @private
|
|
132
120
|
* @type {import("./wms.js").ServerType}
|
|
@@ -137,16 +125,6 @@ declare class ImageWMS extends ImageSource {
|
|
|
137
125
|
* @type {boolean}
|
|
138
126
|
*/
|
|
139
127
|
private hidpi_;
|
|
140
|
-
/**
|
|
141
|
-
* @private
|
|
142
|
-
* @type {import("../Image.js").default}
|
|
143
|
-
*/
|
|
144
|
-
private image_;
|
|
145
|
-
/**
|
|
146
|
-
* @private
|
|
147
|
-
* @type {import("../size.js").Size}
|
|
148
|
-
*/
|
|
149
|
-
private imageSize_;
|
|
150
128
|
/**
|
|
151
129
|
* @private
|
|
152
130
|
* @type {number}
|
|
@@ -194,30 +172,12 @@ declare class ImageWMS extends ImageSource {
|
|
|
194
172
|
* @api
|
|
195
173
|
*/
|
|
196
174
|
getParams(): any;
|
|
197
|
-
/**
|
|
198
|
-
* @param {import("../extent.js").Extent} extent Extent.
|
|
199
|
-
* @param {number} resolution Resolution.
|
|
200
|
-
* @param {number} pixelRatio Pixel ratio.
|
|
201
|
-
* @param {import("../proj/Projection.js").default} projection Projection.
|
|
202
|
-
* @return {import("../Image.js").default} Single image.
|
|
203
|
-
*/
|
|
204
|
-
getImageInternal(extent: import("../extent.js").Extent, resolution: number, pixelRatio: number, projection: import("../proj/Projection.js").default): import("../Image.js").default;
|
|
205
175
|
/**
|
|
206
176
|
* Return the image load function of the source.
|
|
207
177
|
* @return {import("../Image.js").LoadFunction} The image load function.
|
|
208
178
|
* @api
|
|
209
179
|
*/
|
|
210
180
|
getImageLoadFunction(): import("../Image.js").LoadFunction;
|
|
211
|
-
/**
|
|
212
|
-
* @param {import("../extent.js").Extent} extent Extent.
|
|
213
|
-
* @param {import("../size.js").Size} size Size.
|
|
214
|
-
* @param {number} pixelRatio Pixel ratio.
|
|
215
|
-
* @param {import("../proj/Projection.js").default} projection Projection.
|
|
216
|
-
* @param {Object} params Params.
|
|
217
|
-
* @return {string} Request URL.
|
|
218
|
-
* @private
|
|
219
|
-
*/
|
|
220
|
-
private getRequestUrl_;
|
|
221
181
|
/**
|
|
222
182
|
* Return the URL used for this WMS source.
|
|
223
183
|
* @return {string|undefined} URL.
|
|
@@ -242,10 +202,6 @@ declare class ImageWMS extends ImageSource {
|
|
|
242
202
|
* @api
|
|
243
203
|
*/
|
|
244
204
|
updateParams(params: any): void;
|
|
245
|
-
/**
|
|
246
|
-
* @private
|
|
247
|
-
*/
|
|
248
|
-
private updateV13_;
|
|
249
205
|
}
|
|
250
206
|
import ImageSource from './Image.js';
|
|
251
207
|
//# sourceMappingURL=ImageWMS.d.ts.map
|
package/source/ImageWMS.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImageWMS.d.ts","sourceRoot":"","sources":["ImageWMS.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"ImageWMS.d.ts","sourceRoot":"","sources":["ImageWMS.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA4Cc,OAAO,YAAY,EAAE,cAAc;;;;;;;;;;;;;;;;AAlBjD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH;;;;;;GAMG;AACH;IACE;;OAEG;IACH,2CA6DC;IAnDC;;;OAGG;IACH,qBACgE;IAEhE;;;OAGG;IACH,aAAuB;IAEvB;;;OAGG;IACH,2BAG8B;IAE9B;;;OAGG;IACH,gBAA6B;IAE7B;;;OAGG;IACH,oBAAqC;IAErC;;;OAGG;IACH,eAAgE;IAEhE;;;OAGG;IACH,0BAA0B;IAE1B;;;OAGG;IACH,eAA+D;IAGjE;;;;;;;;;;;;;OAaG;IACH,8BAVW,OAAO,kBAAkB,EAAE,UAAU,cACrC,MAAM,cACN,OAAO,YAAY,EAAE,cAAc,gBAKlC,MAAM,GAAC,SAAS,CAiD3B;IAED;;;;;;;;;;;;;OAaG;IACH,6DAHY,MAAM,GAAC,SAAS,CAmC3B;IAED;;;;;OAKG;IACH,iBAEC;IAkCD;;;;OAIG;IACH,wBAHY,OAAO,aAAa,EAAE,YAAY,CAK7C;IAED;;;;OAIG;IACH,UAHY,MAAM,GAAC,SAAS,CAK3B;IAED;;;;OAIG;IACH,wCAHW,OAAO,aAAa,EAAE,YAAY,QAM5C;IAED;;;;OAIG;IACH,YAHW,MAAM,GAAC,SAAS,QAS1B;IAED;;;;OAIG;IACH,gCAGC;CAMF;wBAzUmD,YAAY"}
|
package/source/ImageWMS.js
CHANGED
|
@@ -2,31 +2,22 @@
|
|
|
2
2
|
* @module ol/source/ImageWMS
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import EventType from '../events/EventType.js';
|
|
6
5
|
import ImageSource, {defaultImageLoadFunction} from './Image.js';
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
6
|
+
import {DECIMALS} from './common.js';
|
|
7
|
+
import {
|
|
8
|
+
DEFAULT_VERSION,
|
|
9
|
+
createLoader,
|
|
10
|
+
getRequestParams,
|
|
11
|
+
getRequestUrl,
|
|
12
|
+
} from './wms.js';
|
|
9
13
|
import {appendParams} from '../uri.js';
|
|
10
|
-
import {assert} from '../asserts.js';
|
|
11
14
|
import {calculateSourceResolution} from '../reproj.js';
|
|
12
|
-
import {ceil, floor, round} from '../math.js';
|
|
13
15
|
import {compareVersions} from '../string.js';
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
getForViewAndSize,
|
|
18
|
-
getHeight,
|
|
19
|
-
getWidth,
|
|
20
|
-
} from '../extent.js';
|
|
21
|
-
import {createCanvasContext2D} from '../dom.js';
|
|
16
|
+
import {decode} from '../Image.js';
|
|
17
|
+
import {floor} from '../math.js';
|
|
18
|
+
import {getForViewAndSize} from '../extent.js';
|
|
22
19
|
import {get as getProjection, transform} from '../proj.js';
|
|
23
20
|
|
|
24
|
-
/**
|
|
25
|
-
* Number of decimal digits to consider in integer values when rounding.
|
|
26
|
-
* @type {number}
|
|
27
|
-
*/
|
|
28
|
-
const DECIMALS = 4;
|
|
29
|
-
|
|
30
21
|
/**
|
|
31
22
|
* @const
|
|
32
23
|
* @type {import("../size.js").Size}
|
|
@@ -53,8 +44,7 @@ const GETFEATUREINFO_IMAGE_SIZE = [101, 101];
|
|
|
53
44
|
* and `CRS` (`SRS` for WMS version < 1.3.0) will be set dynamically.
|
|
54
45
|
* @property {import("../proj.js").ProjectionLike} [projection] Projection. Default is the view projection.
|
|
55
46
|
* @property {number} [ratio=1.5] Ratio. `1` means image requests are the size of the map viewport, `2` means
|
|
56
|
-
* twice the width and height of the map viewport, and so on. Must be `1` or
|
|
57
|
-
* higher.
|
|
47
|
+
* twice the width and height of the map viewport, and so on. Must be `1` or higher.
|
|
58
48
|
* @property {Array<number>} [resolutions] Resolutions.
|
|
59
49
|
* If specified, requests will be made for these resolutions only.
|
|
60
50
|
* @property {string} [url] WMS service URL.
|
|
@@ -81,12 +71,6 @@ class ImageWMS extends ImageSource {
|
|
|
81
71
|
resolutions: options.resolutions,
|
|
82
72
|
});
|
|
83
73
|
|
|
84
|
-
/**
|
|
85
|
-
* @private
|
|
86
|
-
* @type {CanvasRenderingContext2D}
|
|
87
|
-
*/
|
|
88
|
-
this.context_ = createCanvasContext2D(1, 1);
|
|
89
|
-
|
|
90
74
|
/**
|
|
91
75
|
* @private
|
|
92
76
|
* @type {?string}
|
|
@@ -113,14 +97,7 @@ class ImageWMS extends ImageSource {
|
|
|
113
97
|
* @private
|
|
114
98
|
* @type {!Object}
|
|
115
99
|
*/
|
|
116
|
-
this.params_ =
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* @private
|
|
120
|
-
* @type {boolean}
|
|
121
|
-
*/
|
|
122
|
-
this.v13_ = true;
|
|
123
|
-
this.updateV13_();
|
|
100
|
+
this.params_ = options.params;
|
|
124
101
|
|
|
125
102
|
/**
|
|
126
103
|
* @private
|
|
@@ -134,18 +111,6 @@ class ImageWMS extends ImageSource {
|
|
|
134
111
|
*/
|
|
135
112
|
this.hidpi_ = options.hidpi !== undefined ? options.hidpi : true;
|
|
136
113
|
|
|
137
|
-
/**
|
|
138
|
-
* @private
|
|
139
|
-
* @type {import("../Image.js").default}
|
|
140
|
-
*/
|
|
141
|
-
this.image_ = null;
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* @private
|
|
145
|
-
* @type {import("../size.js").Size}
|
|
146
|
-
*/
|
|
147
|
-
this.imageSize_ = [0, 0];
|
|
148
|
-
|
|
149
114
|
/**
|
|
150
115
|
* @private
|
|
151
116
|
* @type {number}
|
|
@@ -198,24 +163,24 @@ class ImageWMS extends ImageSource {
|
|
|
198
163
|
);
|
|
199
164
|
|
|
200
165
|
const baseParams = {
|
|
201
|
-
'SERVICE': 'WMS',
|
|
202
|
-
'VERSION': DEFAULT_VERSION,
|
|
203
|
-
'REQUEST': 'GetFeatureInfo',
|
|
204
|
-
'FORMAT': 'image/png',
|
|
205
|
-
'TRANSPARENT': true,
|
|
206
166
|
'QUERY_LAYERS': this.params_['LAYERS'],
|
|
207
167
|
};
|
|
208
|
-
Object.assign(
|
|
168
|
+
Object.assign(
|
|
169
|
+
baseParams,
|
|
170
|
+
getRequestParams(this.params_, 'GetFeatureInfo'),
|
|
171
|
+
params
|
|
172
|
+
);
|
|
209
173
|
|
|
210
174
|
const x = floor((coordinate[0] - extent[0]) / resolution, DECIMALS);
|
|
211
175
|
const y = floor((extent[3] - coordinate[1]) / resolution, DECIMALS);
|
|
212
|
-
baseParams[
|
|
213
|
-
baseParams[
|
|
176
|
+
const v13 = compareVersions(baseParams['VERSION'], '1.3') >= 0;
|
|
177
|
+
baseParams[v13 ? 'I' : 'X'] = x;
|
|
178
|
+
baseParams[v13 ? 'J' : 'Y'] = y;
|
|
214
179
|
|
|
215
|
-
return
|
|
180
|
+
return getRequestUrl(
|
|
181
|
+
this.url_,
|
|
216
182
|
extent,
|
|
217
183
|
GETFEATUREINFO_IMAGE_SIZE,
|
|
218
|
-
1,
|
|
219
184
|
sourceProjectionObj || projectionObj,
|
|
220
185
|
baseParams
|
|
221
186
|
);
|
|
@@ -290,86 +255,25 @@ class ImageWMS extends ImageSource {
|
|
|
290
255
|
if (this.url_ === undefined) {
|
|
291
256
|
return null;
|
|
292
257
|
}
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
const marginWidth = ceil(((this.ratio_ - 1) * viewWidth) / 2, DECIMALS);
|
|
310
|
-
const requestWidth = viewWidth + 2 * marginWidth;
|
|
311
|
-
const marginHeight = ceil(((this.ratio_ - 1) * viewHeight) / 2, DECIMALS);
|
|
312
|
-
const requestHeight = viewHeight + 2 * marginHeight;
|
|
313
|
-
const requestExtent = getForViewAndSize(center, imageResolution, 0, [
|
|
314
|
-
requestWidth,
|
|
315
|
-
requestHeight,
|
|
316
|
-
]);
|
|
317
|
-
|
|
318
|
-
const image = this.image_;
|
|
319
|
-
if (
|
|
320
|
-
image &&
|
|
321
|
-
this.renderedRevision_ == this.getRevision() &&
|
|
322
|
-
image.getResolution() == resolution &&
|
|
323
|
-
image.getPixelRatio() == pixelRatio &&
|
|
324
|
-
containsExtent(image.getExtent(), viewExtent)
|
|
325
|
-
) {
|
|
326
|
-
return image;
|
|
258
|
+
if (!this.loader) {
|
|
259
|
+
// Lazily create loader to pick up the view projection and to allow `params` updates
|
|
260
|
+
this.loader = createLoader({
|
|
261
|
+
crossOrigin: this.crossOrigin_,
|
|
262
|
+
params: this.params_,
|
|
263
|
+
projection: projection,
|
|
264
|
+
serverType: this.serverType_,
|
|
265
|
+
hidpi: this.hidpi_,
|
|
266
|
+
url: this.url_,
|
|
267
|
+
ratio: this.ratio_,
|
|
268
|
+
load: (image, src) => {
|
|
269
|
+
this.image.setImage(image);
|
|
270
|
+
this.imageLoadFunction_(this.image, src);
|
|
271
|
+
return decode(image);
|
|
272
|
+
},
|
|
273
|
+
});
|
|
327
274
|
}
|
|
328
275
|
|
|
329
|
-
|
|
330
|
-
'SERVICE': 'WMS',
|
|
331
|
-
'VERSION': DEFAULT_VERSION,
|
|
332
|
-
'REQUEST': 'GetMap',
|
|
333
|
-
'FORMAT': 'image/png',
|
|
334
|
-
'TRANSPARENT': true,
|
|
335
|
-
};
|
|
336
|
-
Object.assign(params, this.params_);
|
|
337
|
-
|
|
338
|
-
this.imageSize_[0] = round(
|
|
339
|
-
getWidth(requestExtent) / imageResolution,
|
|
340
|
-
DECIMALS
|
|
341
|
-
);
|
|
342
|
-
this.imageSize_[1] = round(
|
|
343
|
-
getHeight(requestExtent) / imageResolution,
|
|
344
|
-
DECIMALS
|
|
345
|
-
);
|
|
346
|
-
|
|
347
|
-
const url = this.getRequestUrl_(
|
|
348
|
-
requestExtent,
|
|
349
|
-
this.imageSize_,
|
|
350
|
-
pixelRatio,
|
|
351
|
-
projection,
|
|
352
|
-
params
|
|
353
|
-
);
|
|
354
|
-
|
|
355
|
-
this.image_ = new ImageWrapper(
|
|
356
|
-
requestExtent,
|
|
357
|
-
resolution,
|
|
358
|
-
pixelRatio,
|
|
359
|
-
url,
|
|
360
|
-
this.crossOrigin_,
|
|
361
|
-
this.imageLoadFunction_,
|
|
362
|
-
this.context_
|
|
363
|
-
);
|
|
364
|
-
|
|
365
|
-
this.renderedRevision_ = this.getRevision();
|
|
366
|
-
|
|
367
|
-
this.image_.addEventListener(
|
|
368
|
-
EventType.CHANGE,
|
|
369
|
-
this.handleImageChange.bind(this)
|
|
370
|
-
);
|
|
371
|
-
|
|
372
|
-
return this.image_;
|
|
276
|
+
return super.getImageInternal(extent, resolution, pixelRatio, projection);
|
|
373
277
|
}
|
|
374
278
|
|
|
375
279
|
/**
|
|
@@ -381,62 +285,6 @@ class ImageWMS extends ImageSource {
|
|
|
381
285
|
return this.imageLoadFunction_;
|
|
382
286
|
}
|
|
383
287
|
|
|
384
|
-
/**
|
|
385
|
-
* @param {import("../extent.js").Extent} extent Extent.
|
|
386
|
-
* @param {import("../size.js").Size} size Size.
|
|
387
|
-
* @param {number} pixelRatio Pixel ratio.
|
|
388
|
-
* @param {import("../proj/Projection.js").default} projection Projection.
|
|
389
|
-
* @param {Object} params Params.
|
|
390
|
-
* @return {string} Request URL.
|
|
391
|
-
* @private
|
|
392
|
-
*/
|
|
393
|
-
getRequestUrl_(extent, size, pixelRatio, projection, params) {
|
|
394
|
-
assert(this.url_ !== undefined, 9); // `url` must be configured or set using `#setUrl()`
|
|
395
|
-
|
|
396
|
-
params[this.v13_ ? 'CRS' : 'SRS'] = projection.getCode();
|
|
397
|
-
|
|
398
|
-
if (!('STYLES' in this.params_)) {
|
|
399
|
-
params['STYLES'] = '';
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
if (pixelRatio != 1) {
|
|
403
|
-
switch (this.serverType_) {
|
|
404
|
-
case 'geoserver':
|
|
405
|
-
const dpi = (90 * pixelRatio + 0.5) | 0;
|
|
406
|
-
if ('FORMAT_OPTIONS' in params) {
|
|
407
|
-
params['FORMAT_OPTIONS'] += ';dpi:' + dpi;
|
|
408
|
-
} else {
|
|
409
|
-
params['FORMAT_OPTIONS'] = 'dpi:' + dpi;
|
|
410
|
-
}
|
|
411
|
-
break;
|
|
412
|
-
case 'mapserver':
|
|
413
|
-
params['MAP_RESOLUTION'] = 90 * pixelRatio;
|
|
414
|
-
break;
|
|
415
|
-
case 'carmentaserver':
|
|
416
|
-
case 'qgis':
|
|
417
|
-
params['DPI'] = 90 * pixelRatio;
|
|
418
|
-
break;
|
|
419
|
-
default: // Unknown `serverType` configured
|
|
420
|
-
assert(false, 8);
|
|
421
|
-
break;
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
params['WIDTH'] = size[0];
|
|
426
|
-
params['HEIGHT'] = size[1];
|
|
427
|
-
|
|
428
|
-
const axisOrientation = projection.getAxisOrientation();
|
|
429
|
-
let bbox;
|
|
430
|
-
if (this.v13_ && axisOrientation.substr(0, 2) == 'ne') {
|
|
431
|
-
bbox = [extent[1], extent[0], extent[3], extent[2]];
|
|
432
|
-
} else {
|
|
433
|
-
bbox = extent;
|
|
434
|
-
}
|
|
435
|
-
params['BBOX'] = bbox.join(',');
|
|
436
|
-
|
|
437
|
-
return appendParams(/** @type {string} */ (this.url_), params);
|
|
438
|
-
}
|
|
439
|
-
|
|
440
288
|
/**
|
|
441
289
|
* Return the URL used for this WMS source.
|
|
442
290
|
* @return {string|undefined} URL.
|
|
@@ -452,7 +300,6 @@ class ImageWMS extends ImageSource {
|
|
|
452
300
|
* @api
|
|
453
301
|
*/
|
|
454
302
|
setImageLoadFunction(imageLoadFunction) {
|
|
455
|
-
this.image_ = null;
|
|
456
303
|
this.imageLoadFunction_ = imageLoadFunction;
|
|
457
304
|
this.changed();
|
|
458
305
|
}
|
|
@@ -465,7 +312,7 @@ class ImageWMS extends ImageSource {
|
|
|
465
312
|
setUrl(url) {
|
|
466
313
|
if (url != this.url_) {
|
|
467
314
|
this.url_ = url;
|
|
468
|
-
this.
|
|
315
|
+
this.loader = null;
|
|
469
316
|
this.changed();
|
|
470
317
|
}
|
|
471
318
|
}
|
|
@@ -477,17 +324,12 @@ class ImageWMS extends ImageSource {
|
|
|
477
324
|
*/
|
|
478
325
|
updateParams(params) {
|
|
479
326
|
Object.assign(this.params_, params);
|
|
480
|
-
this.updateV13_();
|
|
481
|
-
this.image_ = null;
|
|
482
327
|
this.changed();
|
|
483
328
|
}
|
|
484
329
|
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
updateV13_() {
|
|
489
|
-
const version = this.params_['VERSION'] || DEFAULT_VERSION;
|
|
490
|
-
this.v13_ = compareVersions(version, '1.3') >= 0;
|
|
330
|
+
changed() {
|
|
331
|
+
this.image = null;
|
|
332
|
+
super.changed();
|
|
491
333
|
}
|
|
492
334
|
}
|
|
493
335
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export default
|
|
1
|
+
export default StadiaMaps;
|
|
2
2
|
export type Options = {
|
|
3
3
|
/**
|
|
4
4
|
* Initial tile cache size. Will auto-grow to hold at least the number of tiles in the viewport.
|
|
@@ -10,7 +10,7 @@ export type Options = {
|
|
|
10
10
|
*/
|
|
11
11
|
interpolate?: boolean | undefined;
|
|
12
12
|
/**
|
|
13
|
-
* Layer name.
|
|
13
|
+
* Layer name. Valid values: `alidade_smooth`, `alidade_smooth_dark`, `stadia_outdoors`, `stamen_terrain`, `stamen_terrain_background`, `stamen_terrain_labels`, `stamen_terrain_lines`, `stamen_toner_background`, `stamen_toner`, `stamen_toner_labels`, `stamen_toner_lines`, `stamen_toner_lite`, `stamen_watercolor`, and `osm_bright`.
|
|
14
14
|
*/
|
|
15
15
|
layer: string;
|
|
16
16
|
/**
|
|
@@ -53,13 +53,21 @@ export type Options = {
|
|
|
53
53
|
* zoom levels. See {@link module :ol/tilegrid/TileGrid~TileGrid#getZForResolution}.
|
|
54
54
|
*/
|
|
55
55
|
zDirection?: number | import("../array.js").NearestDirectionFunction | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* Stadia Maps API key. Not required for localhost or most public web deployments. See https://docs.stadiamaps.com/authentication/ for details.
|
|
58
|
+
*/
|
|
59
|
+
apiKey: string;
|
|
60
|
+
/**
|
|
61
|
+
* Use retina tiles (if available; not available for Stamen Watercolor).
|
|
62
|
+
*/
|
|
63
|
+
retina: boolean;
|
|
56
64
|
};
|
|
57
65
|
/**
|
|
58
66
|
* @typedef {Object} Options
|
|
59
67
|
* @property {number} [cacheSize] Initial tile cache size. Will auto-grow to hold at least the number of tiles in the viewport.
|
|
60
68
|
* @property {boolean} [interpolate=true] Use interpolated values when resampling. By default,
|
|
61
69
|
* linear interpolation is used when resampling. Set to false to use the nearest neighbor instead.
|
|
62
|
-
* @property {string} layer Layer name.
|
|
70
|
+
* @property {string} layer Layer name. Valid values: `alidade_smooth`, `alidade_smooth_dark`, `stadia_outdoors`, `stamen_terrain`, `stamen_terrain_background`, `stamen_terrain_labels`, `stamen_terrain_lines`, `stamen_toner_background`, `stamen_toner`, `stamen_toner_labels`, `stamen_toner_lines`, `stamen_toner_lite`, `stamen_watercolor`, and `osm_bright`.
|
|
63
71
|
* @property {number} [minZoom] Minimum zoom.
|
|
64
72
|
* @property {number} [maxZoom] Maximum zoom.
|
|
65
73
|
* @property {number} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels).
|
|
@@ -78,17 +86,19 @@ export type Options = {
|
|
|
78
86
|
* @property {number|import("../array.js").NearestDirectionFunction} [zDirection=0]
|
|
79
87
|
* Choose whether to use tiles with a higher or lower zoom level when between integer
|
|
80
88
|
* zoom levels. See {@link module:ol/tilegrid/TileGrid~TileGrid#getZForResolution}.
|
|
89
|
+
* @property {string} apiKey Stadia Maps API key. Not required for localhost or most public web deployments. See https://docs.stadiamaps.com/authentication/ for details.
|
|
90
|
+
* @property {boolean} retina Use retina tiles (if available; not available for Stamen Watercolor).
|
|
81
91
|
*/
|
|
82
92
|
/**
|
|
83
93
|
* @classdesc
|
|
84
|
-
* Layer source for the
|
|
94
|
+
* Layer source for the Stadia Maps tile server.
|
|
85
95
|
* @api
|
|
86
96
|
*/
|
|
87
|
-
declare class
|
|
97
|
+
declare class StadiaMaps extends XYZ {
|
|
88
98
|
/**
|
|
89
|
-
* @param {Options} options
|
|
99
|
+
* @param {Options} options StadiaMaps options.
|
|
90
100
|
*/
|
|
91
101
|
constructor(options: Options);
|
|
92
102
|
}
|
|
93
103
|
import XYZ from './XYZ.js';
|
|
94
|
-
//# sourceMappingURL=
|
|
104
|
+
//# sourceMappingURL=StadiaMaps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StadiaMaps.d.ts","sourceRoot":"","sources":["StadiaMaps.js"],"names":[],"mappings":";;;;;;;;;;;;;;WAoHc,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAmBN,MAAM;;;;YACN,OAAO;;AAzBrB;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH;;;;GAIG;AACH;IACE;;OAEG;IACH,qBAFW,OAAO,EAsDjB;CACF;gBArMe,UAAU"}
|