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
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module ol/expr/expression
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import {ascending} from '../array.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @fileoverview This module includes types and functions for parsing array encoded expressions.
|
|
9
|
+
* The result of parsing an encoded expression is one of the specific expression classes.
|
|
10
|
+
* During parsing, information is added to the parsing context about the data accessed by the
|
|
11
|
+
* expression.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
let numTypes = 0;
|
|
15
|
+
export const NoneType = 0;
|
|
16
|
+
export const BooleanType = 1 << numTypes++;
|
|
17
|
+
export const NumberType = 1 << numTypes++;
|
|
18
|
+
export const StringType = 1 << numTypes++;
|
|
19
|
+
export const ColorType = 1 << numTypes++;
|
|
20
|
+
export const NumberArrayType = 1 << numTypes++;
|
|
21
|
+
export const AnyType = Math.pow(2, numTypes) - 1;
|
|
22
|
+
|
|
23
|
+
const typeNames = {
|
|
24
|
+
[BooleanType]: 'boolean',
|
|
25
|
+
[NumberType]: 'number',
|
|
26
|
+
[StringType]: 'string',
|
|
27
|
+
[ColorType]: 'color',
|
|
28
|
+
[NumberArrayType]: 'number[]',
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const namedTypes = Object.keys(typeNames).map(Number).sort(ascending);
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Get a string representation for a type.
|
|
35
|
+
* @param {number} type The type.
|
|
36
|
+
* @return {string} The type name.
|
|
37
|
+
*/
|
|
38
|
+
export function typeName(type) {
|
|
39
|
+
const names = [];
|
|
40
|
+
for (const namedType of namedTypes) {
|
|
41
|
+
if (includesType(type, namedType)) {
|
|
42
|
+
names.push(typeNames[namedType]);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (names.length === 0) {
|
|
46
|
+
return 'untyped';
|
|
47
|
+
}
|
|
48
|
+
if (names.length < 3) {
|
|
49
|
+
return names.join(' or ');
|
|
50
|
+
}
|
|
51
|
+
return names.slice(0, -1).join(', ') + ', or ' + names[names.length - 1];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* @param {number} broad The broad type.
|
|
56
|
+
* @param {number} specific The specific type.
|
|
57
|
+
* @return {boolean} The broad type includes the specific type.
|
|
58
|
+
*/
|
|
59
|
+
export function includesType(broad, specific) {
|
|
60
|
+
return (broad & specific) === specific;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* @param {number} oneType One type.
|
|
65
|
+
* @param {number} otherType Another type.
|
|
66
|
+
* @return {boolean} The set of types overlap (share a common specific type)
|
|
67
|
+
*/
|
|
68
|
+
export function overlapsType(oneType, otherType) {
|
|
69
|
+
return !!(oneType & otherType);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* @param {number} type The type.
|
|
74
|
+
* @param {number} expected The expected type.
|
|
75
|
+
* @return {boolean} The given type is exactly the expected type.
|
|
76
|
+
*/
|
|
77
|
+
export function isType(type, expected) {
|
|
78
|
+
return type === expected;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* @typedef {boolean|number|string|Array<number>} LiteralValue
|
|
83
|
+
*/
|
|
84
|
+
|
|
85
|
+
export class LiteralExpression {
|
|
86
|
+
/**
|
|
87
|
+
* @param {number} type The value type.
|
|
88
|
+
* @param {LiteralValue} value The literal value.
|
|
89
|
+
*/
|
|
90
|
+
constructor(type, value) {
|
|
91
|
+
this.type = type;
|
|
92
|
+
this.value = value;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export class CallExpression {
|
|
97
|
+
/**
|
|
98
|
+
* @param {number} type The return type.
|
|
99
|
+
* @param {string} operator The operator.
|
|
100
|
+
* @param {...Expression} args The arguments.
|
|
101
|
+
*/
|
|
102
|
+
constructor(type, operator, ...args) {
|
|
103
|
+
this.type = type;
|
|
104
|
+
this.operator = operator;
|
|
105
|
+
this.args = args;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* @typedef {LiteralExpression|CallExpression} Expression
|
|
111
|
+
*/
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* @typedef {Object} ParsingContext
|
|
115
|
+
* @property {Set<string>} variables Variables referenced with the 'var' operator.
|
|
116
|
+
* @property {Set<string>} properties Properties referenced with the 'get' operator.
|
|
117
|
+
*/
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* @return {ParsingContext} A new parsing context.
|
|
121
|
+
*/
|
|
122
|
+
export function newParsingContext() {
|
|
123
|
+
return {
|
|
124
|
+
variables: new Set(),
|
|
125
|
+
properties: new Set(),
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* @typedef {LiteralValue|Array} EncodedExpression
|
|
131
|
+
*/
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* @param {EncodedExpression} encoded The encoded expression.
|
|
135
|
+
* @param {ParsingContext} context The parsing context.
|
|
136
|
+
* @return {Expression} The parsed expression result.
|
|
137
|
+
*/
|
|
138
|
+
export function parse(encoded, context) {
|
|
139
|
+
switch (typeof encoded) {
|
|
140
|
+
case 'boolean': {
|
|
141
|
+
return new LiteralExpression(BooleanType, encoded);
|
|
142
|
+
}
|
|
143
|
+
case 'number': {
|
|
144
|
+
return new LiteralExpression(NumberType, encoded);
|
|
145
|
+
}
|
|
146
|
+
case 'string': {
|
|
147
|
+
return new LiteralExpression(StringType, encoded);
|
|
148
|
+
}
|
|
149
|
+
default: {
|
|
150
|
+
// pass
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (!Array.isArray(encoded)) {
|
|
155
|
+
throw new Error('Expression must be an array or a primitive value');
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if (encoded.length === 0) {
|
|
159
|
+
throw new Error('Empty expression');
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
if (typeof encoded[0] === 'string') {
|
|
163
|
+
return parseCallExpression(encoded, context);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
for (const item of encoded) {
|
|
167
|
+
if (typeof item !== 'number') {
|
|
168
|
+
throw new Error('Expected an array of numbers');
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
let type = NumberArrayType;
|
|
173
|
+
if (encoded.length === 3 || encoded.length === 4) {
|
|
174
|
+
type |= ColorType;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
return new LiteralExpression(type, encoded);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* @type {Object<string, string>}
|
|
182
|
+
*/
|
|
183
|
+
export const Ops = {
|
|
184
|
+
Get: 'get',
|
|
185
|
+
Var: 'var',
|
|
186
|
+
Resolution: 'resolution',
|
|
187
|
+
Equal: '==',
|
|
188
|
+
NotEqual: '!=',
|
|
189
|
+
GreaterThan: '>',
|
|
190
|
+
GreaterThanOrEqualTo: '>=',
|
|
191
|
+
LessThan: '<',
|
|
192
|
+
LessThanOrEqualTo: '<=',
|
|
193
|
+
Multiply: '*',
|
|
194
|
+
Divide: '/',
|
|
195
|
+
Add: '+',
|
|
196
|
+
Subtract: '-',
|
|
197
|
+
Clamp: 'clamp',
|
|
198
|
+
Mod: '%',
|
|
199
|
+
Pow: '^',
|
|
200
|
+
Abs: 'abs',
|
|
201
|
+
Floor: 'floor',
|
|
202
|
+
Ceil: 'ceil',
|
|
203
|
+
Round: 'round',
|
|
204
|
+
Sin: 'sin',
|
|
205
|
+
Cos: 'cos',
|
|
206
|
+
Atan: 'atan',
|
|
207
|
+
Sqrt: 'sqrt',
|
|
208
|
+
Match: 'match',
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* @typedef {function(Array, ParsingContext):Expression} Parser
|
|
213
|
+
*/
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* @type {Object<string, Parser>}
|
|
217
|
+
*/
|
|
218
|
+
const parsers = {
|
|
219
|
+
[Ops.Get]: createParser(withGetArgs, AnyType),
|
|
220
|
+
[Ops.Var]: createParser(withVarArgs, AnyType),
|
|
221
|
+
[Ops.Resolution]: createParser(withNoArgs, NumberType),
|
|
222
|
+
[Ops.Equal]: createParser(withArgs(2, 2, AnyType), BooleanType),
|
|
223
|
+
[Ops.NotEqual]: createParser(withArgs(2, 2, AnyType), BooleanType),
|
|
224
|
+
[Ops.GreaterThan]: createParser(withArgs(2, 2, AnyType), BooleanType),
|
|
225
|
+
[Ops.GreaterThanOrEqualTo]: createParser(
|
|
226
|
+
withArgs(2, 2, AnyType),
|
|
227
|
+
BooleanType
|
|
228
|
+
),
|
|
229
|
+
[Ops.LessThan]: createParser(withArgs(2, 2, AnyType), BooleanType),
|
|
230
|
+
[Ops.LessThanOrEqualTo]: createParser(withArgs(2, 2, AnyType), BooleanType),
|
|
231
|
+
[Ops.Multiply]: createParser(withArgs(2, Infinity, NumberType), NumberType),
|
|
232
|
+
[Ops.Divide]: createParser(withArgs(2, 2, NumberType), NumberType),
|
|
233
|
+
[Ops.Add]: createParser(withArgs(2, Infinity, NumberType), NumberType),
|
|
234
|
+
[Ops.Subtract]: createParser(withArgs(2, 2, NumberType), NumberType),
|
|
235
|
+
[Ops.Clamp]: createParser(withArgs(3, 3, NumberType), NumberType),
|
|
236
|
+
[Ops.Mod]: createParser(withArgs(2, 2, NumberType), NumberType),
|
|
237
|
+
[Ops.Pow]: createParser(withArgs(2, 2, NumberType), NumberType),
|
|
238
|
+
[Ops.Abs]: createParser(withArgs(1, 1, NumberType), NumberType),
|
|
239
|
+
[Ops.Floor]: createParser(withArgs(1, 1, NumberType), NumberType),
|
|
240
|
+
[Ops.Ceil]: createParser(withArgs(1, 1, NumberType), NumberType),
|
|
241
|
+
[Ops.Round]: createParser(withArgs(1, 1, NumberType), NumberType),
|
|
242
|
+
[Ops.Sin]: createParser(withArgs(1, 1, NumberType), NumberType),
|
|
243
|
+
[Ops.Cos]: createParser(withArgs(1, 1, NumberType), NumberType),
|
|
244
|
+
[Ops.Atan]: createParser(withArgs(1, 2, NumberType), NumberType),
|
|
245
|
+
[Ops.Sqrt]: createParser(withArgs(1, 1, NumberType), NumberType),
|
|
246
|
+
[Ops.Match]: createParser(
|
|
247
|
+
withArgs(4, Infinity, StringType | NumberType),
|
|
248
|
+
AnyType
|
|
249
|
+
),
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* @typedef {function(Array, ParsingContext):Array<Expression>} ArgValidator
|
|
254
|
+
*/
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* @type ArgValidator
|
|
258
|
+
*/
|
|
259
|
+
function withGetArgs(encoded, context) {
|
|
260
|
+
if (encoded.length !== 2) {
|
|
261
|
+
throw new Error('Expected 1 argument for get operation');
|
|
262
|
+
}
|
|
263
|
+
const arg = parse(encoded[1], context);
|
|
264
|
+
if (!(arg instanceof LiteralExpression)) {
|
|
265
|
+
throw new Error('Expected a literal argument for get operation');
|
|
266
|
+
}
|
|
267
|
+
if (typeof arg.value !== 'string') {
|
|
268
|
+
throw new Error('Expected a string argument for get operation');
|
|
269
|
+
}
|
|
270
|
+
context.properties.add(arg.value);
|
|
271
|
+
return [arg];
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* @type ArgValidator
|
|
276
|
+
*/
|
|
277
|
+
function withVarArgs(encoded, context) {
|
|
278
|
+
if (encoded.length !== 2) {
|
|
279
|
+
throw new Error('Expected 1 argument for var operation');
|
|
280
|
+
}
|
|
281
|
+
const arg = parse(encoded[1], context);
|
|
282
|
+
if (!(arg instanceof LiteralExpression)) {
|
|
283
|
+
throw new Error('Expected a literal argument for var operation');
|
|
284
|
+
}
|
|
285
|
+
if (typeof arg.value !== 'string') {
|
|
286
|
+
throw new Error('Expected a string argument for get operation');
|
|
287
|
+
}
|
|
288
|
+
context.variables.add(arg.value);
|
|
289
|
+
return [arg];
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* @type ArgValidator
|
|
294
|
+
*/
|
|
295
|
+
function withNoArgs(encoded, context) {
|
|
296
|
+
const operation = encoded[0];
|
|
297
|
+
if (encoded.length !== 1) {
|
|
298
|
+
throw new Error(`Expected no arguments for ${operation} operation`);
|
|
299
|
+
}
|
|
300
|
+
return [];
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* @param {number} minArgs The minimum number of arguments.
|
|
305
|
+
* @param {number} maxArgs The maximum number of arguments.
|
|
306
|
+
* @param {number} argType The argument type.
|
|
307
|
+
* @return {ArgValidator} The argument validator
|
|
308
|
+
*/
|
|
309
|
+
function withArgs(minArgs, maxArgs, argType) {
|
|
310
|
+
return function (encoded, context) {
|
|
311
|
+
const operation = encoded[0];
|
|
312
|
+
const argCount = encoded.length - 1;
|
|
313
|
+
if (minArgs === maxArgs) {
|
|
314
|
+
if (argCount !== minArgs) {
|
|
315
|
+
const plural = minArgs === 1 ? '' : 's';
|
|
316
|
+
throw new Error(
|
|
317
|
+
`Expected ${minArgs} argument${plural} for operation ${operation}, got ${argCount}`
|
|
318
|
+
);
|
|
319
|
+
}
|
|
320
|
+
} else if (argCount < minArgs || argCount > maxArgs) {
|
|
321
|
+
throw new Error(
|
|
322
|
+
`Expected ${minArgs} to ${maxArgs} arguments for operation ${operation}, got ${argCount}`
|
|
323
|
+
);
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* @type {Array<Expression>}
|
|
328
|
+
*/
|
|
329
|
+
const args = new Array(argCount);
|
|
330
|
+
for (let i = 0; i < argCount; ++i) {
|
|
331
|
+
const expression = parse(encoded[i + 1], context);
|
|
332
|
+
if (!overlapsType(argType, expression.type)) {
|
|
333
|
+
const gotType = typeName(argType);
|
|
334
|
+
const expectedType = typeName(expression.type);
|
|
335
|
+
throw new Error(
|
|
336
|
+
`Unexpected type for argument ${i} of ${operation} operation` +
|
|
337
|
+
` : got ${gotType} but expected ${expectedType}`
|
|
338
|
+
);
|
|
339
|
+
}
|
|
340
|
+
args[i] = expression;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
return args;
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* @param {ArgValidator} argValidator The argument validator.
|
|
349
|
+
* @param {number} returnType The return type.
|
|
350
|
+
* @return {Parser} The parser.
|
|
351
|
+
*/
|
|
352
|
+
function createParser(argValidator, returnType) {
|
|
353
|
+
return function (encoded, context) {
|
|
354
|
+
const operator = encoded[0];
|
|
355
|
+
const args = argValidator(encoded, context);
|
|
356
|
+
return new CallExpression(returnType, operator, ...args);
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
/**
|
|
361
|
+
* @param {Array} encoded The encoded expression.
|
|
362
|
+
* @param {ParsingContext} context The parsing context.
|
|
363
|
+
* @return {Expression} The parsed expression.
|
|
364
|
+
*/
|
|
365
|
+
function parseCallExpression(encoded, context) {
|
|
366
|
+
const operator = encoded[0];
|
|
367
|
+
|
|
368
|
+
const parser = parsers[operator];
|
|
369
|
+
if (!parser) {
|
|
370
|
+
throw new Error(`Unknown operator: ${operator}`);
|
|
371
|
+
}
|
|
372
|
+
return parser(encoded, context);
|
|
373
|
+
}
|
package/has.d.ts
CHANGED
|
@@ -42,6 +42,11 @@ export const WORKER_OFFSCREEN_CANVAS: boolean;
|
|
|
42
42
|
* @type {boolean}
|
|
43
43
|
*/
|
|
44
44
|
export const IMAGE_DECODE: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* createImageBitmap() is supported.
|
|
47
|
+
* @type {boolean}
|
|
48
|
+
*/
|
|
49
|
+
export const CREATE_IMAGE_BITMAP: boolean;
|
|
45
50
|
/**
|
|
46
51
|
* @type {boolean}
|
|
47
52
|
*/
|
package/has.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"has.d.ts","sourceRoot":"","sources":["has.js"],"names":[],"mappings":"AASA;;;GAGG;AACH,sBAFU,OAAO,CAE6B;AAE9C;;;GAGG;AACH,qBAFU,OAAO,CAEoD;AAErE;;;GAGG;AACH,gCAFU,OAAO,CAKqC;AAEtD;;;GAGG;AACH,qBAFU,OAAO,CAEmD;AAEpE;;;GAGG;AACH,kBAFU,OAAO,CAE2B;AAE5C;;;;;;GAMG;AACH,iCAHU,MAAM,CAIiD;AAEjE;;;;GAIG;AACH,sCAFU,OAAO,CAKmB;AAEpC;;;GAGG;AACH,2BAFU,OAAO,CAGwC;AAEzD;;GAEG;AACH,sCAFU,OAAO,CAiBZ"}
|
|
1
|
+
{"version":3,"file":"has.d.ts","sourceRoot":"","sources":["has.js"],"names":[],"mappings":"AASA;;;GAGG;AACH,sBAFU,OAAO,CAE6B;AAE9C;;;GAGG;AACH,qBAFU,OAAO,CAEoD;AAErE;;;GAGG;AACH,gCAFU,OAAO,CAKqC;AAEtD;;;GAGG;AACH,qBAFU,OAAO,CAEmD;AAEpE;;;GAGG;AACH,kBAFU,OAAO,CAE2B;AAE5C;;;;;;GAMG;AACH,iCAHU,MAAM,CAIiD;AAEjE;;;;GAIG;AACH,sCAFU,OAAO,CAKmB;AAEpC;;;GAGG;AACH,2BAFU,OAAO,CAGwC;AAEzD;;;GAGG;AACH,kCAFU,OAAO,CAE0D;AAE3E;;GAEG;AACH,sCAFU,OAAO,CAiBZ"}
|
package/has.js
CHANGED
|
@@ -67,6 +67,12 @@ export const WORKER_OFFSCREEN_CANVAS =
|
|
|
67
67
|
export const IMAGE_DECODE =
|
|
68
68
|
typeof Image !== 'undefined' && Image.prototype.decode;
|
|
69
69
|
|
|
70
|
+
/**
|
|
71
|
+
* createImageBitmap() is supported.
|
|
72
|
+
* @type {boolean}
|
|
73
|
+
*/
|
|
74
|
+
export const CREATE_IMAGE_BITMAP = typeof createImageBitmap === 'function';
|
|
75
|
+
|
|
70
76
|
/**
|
|
71
77
|
* @type {boolean}
|
|
72
78
|
*/
|
package/index.d.ts
CHANGED
|
@@ -4,8 +4,6 @@ export { default as Disposable } from "./Disposable.js";
|
|
|
4
4
|
export { default as Feature } from "./Feature.js";
|
|
5
5
|
export { default as Geolocation } from "./Geolocation.js";
|
|
6
6
|
export { default as Graticule } from "./layer/Graticule.js";
|
|
7
|
-
export { default as Image } from "./Image.js";
|
|
8
|
-
export { default as ImageBase } from "./ImageBase.js";
|
|
9
7
|
export { default as ImageCanvas } from "./ImageCanvas.js";
|
|
10
8
|
export { default as ImageTile } from "./ImageTile.js";
|
|
11
9
|
export { default as Kinetic } from "./Kinetic.js";
|
|
@@ -23,5 +21,6 @@ export { default as TileRange } from "./TileRange.js";
|
|
|
23
21
|
export { default as VectorRenderTile } from "./VectorRenderTile.js";
|
|
24
22
|
export { default as VectorTile } from "./VectorTile.js";
|
|
25
23
|
export { default as View } from "./View.js";
|
|
24
|
+
export { default as Image, default as ImageWrapper } from "./Image.js";
|
|
26
25
|
export { getUid, VERSION } from "./util.js";
|
|
27
26
|
//# sourceMappingURL=index.d.ts.map
|
package/index.js
CHANGED
|
@@ -9,7 +9,7 @@ export {default as Feature} from './Feature.js';
|
|
|
9
9
|
export {default as Geolocation} from './Geolocation.js';
|
|
10
10
|
export {default as Graticule} from './layer/Graticule.js';
|
|
11
11
|
export {default as Image} from './Image.js';
|
|
12
|
-
export {default as
|
|
12
|
+
export {default as ImageWrapper} from './Image.js';
|
|
13
13
|
export {default as ImageCanvas} from './ImageCanvas.js';
|
|
14
14
|
export {default as ImageTile} from './ImageTile.js';
|
|
15
15
|
export {default as Kinetic} from './Kinetic.js';
|
package/layer/Base.d.ts
CHANGED
|
@@ -88,7 +88,7 @@ export type Options = {
|
|
|
88
88
|
* @property {boolean} [visible=true] Visibility.
|
|
89
89
|
* @property {import("../extent.js").Extent} [extent] The bounding extent for layer rendering. The layer will not be
|
|
90
90
|
* rendered outside of this extent.
|
|
91
|
-
* @property {number} [zIndex] The z-index for layer rendering. At rendering time, the layers
|
|
91
|
+
* @property {number | undefined} [zIndex] The z-index for layer rendering. At rendering time, the layers
|
|
92
92
|
* will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed
|
|
93
93
|
* for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`
|
|
94
94
|
* method was used.
|
|
@@ -186,28 +186,32 @@ declare class BaseLayer extends BaseObject {
|
|
|
186
186
|
*/
|
|
187
187
|
getExtent(): import("../extent.js").Extent | undefined;
|
|
188
188
|
/**
|
|
189
|
-
* Return the maximum resolution of the layer.
|
|
189
|
+
* Return the maximum resolution of the layer. Returns Infinity if
|
|
190
|
+
* the layer has no maximum resolution set.
|
|
190
191
|
* @return {number} The maximum resolution of the layer.
|
|
191
192
|
* @observable
|
|
192
193
|
* @api
|
|
193
194
|
*/
|
|
194
195
|
getMaxResolution(): number;
|
|
195
196
|
/**
|
|
196
|
-
* Return the minimum resolution of the layer.
|
|
197
|
+
* Return the minimum resolution of the layer. Returns 0 if
|
|
198
|
+
* the layer has no minimum resolution set.
|
|
197
199
|
* @return {number} The minimum resolution of the layer.
|
|
198
200
|
* @observable
|
|
199
201
|
* @api
|
|
200
202
|
*/
|
|
201
203
|
getMinResolution(): number;
|
|
202
204
|
/**
|
|
203
|
-
* Return the minimum zoom level of the layer.
|
|
205
|
+
* Return the minimum zoom level of the layer. Returns -Infinity if
|
|
206
|
+
* the layer has no minimum zoom set.
|
|
204
207
|
* @return {number} The minimum zoom level of the layer.
|
|
205
208
|
* @observable
|
|
206
209
|
* @api
|
|
207
210
|
*/
|
|
208
211
|
getMinZoom(): number;
|
|
209
212
|
/**
|
|
210
|
-
* Return the maximum zoom level of the layer.
|
|
213
|
+
* Return the maximum zoom level of the layer. Returns Infinity if
|
|
214
|
+
* the layer has no maximum zoom set.
|
|
211
215
|
* @return {number} The maximum zoom level of the layer.
|
|
212
216
|
* @observable
|
|
213
217
|
* @api
|
|
@@ -235,12 +239,12 @@ declare class BaseLayer extends BaseObject {
|
|
|
235
239
|
getVisible(): boolean;
|
|
236
240
|
/**
|
|
237
241
|
* Return the Z-index of the layer, which is used to order layers before
|
|
238
|
-
* rendering.
|
|
239
|
-
* @return {number} The Z-index of the layer.
|
|
242
|
+
* rendering. Returns undefined if the layer is unmanaged.
|
|
243
|
+
* @return {number|undefined} The Z-index of the layer.
|
|
240
244
|
* @observable
|
|
241
245
|
* @api
|
|
242
246
|
*/
|
|
243
|
-
getZIndex(): number;
|
|
247
|
+
getZIndex(): number | undefined;
|
|
244
248
|
/**
|
|
245
249
|
* Sets the background color.
|
|
246
250
|
* @param {BackgroundColor} [background] Background color.
|
package/layer/Base.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Base.d.ts","sourceRoot":"","sources":["Base.js"],"names":[],"mappings":";;;;8BAYa,MAAM,WAAU,MAAM,KAAE,MAAM,CAAA;wCAK9B,OAAO,oBAAoB,EAAE,KAAK,GAAC,eAAe,GAAC,sBAAsB,GAAC,gBAAgB,GACtG,sBAA2B,GAAC,gBAAgB,GAAC,gBAAgB,GAAC,gBAAgB,GAAC,eAAe;;;;2CAKlF,OAAO,eAAe,EAAE,WAAW,CAAC,OAAO,eAAe,EAAE,UAAU,EAAE,OAAO,oBAAoB,EAAE,OAAO,EAAE,MAAM,CAAC,GACjI,OAAW,eAAe,EAAE,WAAW,CAAC,yBAAyB,EAAE,OAAO,WAAW,EAAE,WAAW,EAAE,MAAM,CAAC,GAC3G,OAAW,eAAe,EAAE,mBAAmB,CAAC,OAAO,eAAe,EAAE,UAAU,GAAC,yBAAyB,EAAE,MAAM,CAAC
|
|
1
|
+
{"version":3,"file":"Base.d.ts","sourceRoot":"","sources":["Base.js"],"names":[],"mappings":";;;;8BAYa,MAAM,WAAU,MAAM,KAAE,MAAM,CAAA;wCAK9B,OAAO,oBAAoB,EAAE,KAAK,GAAC,eAAe,GAAC,sBAAsB,GAAC,gBAAgB,GACtG,sBAA2B,GAAC,gBAAgB,GAAC,gBAAgB,GAAC,gBAAgB,GAAC,eAAe;;;;2CAKlF,OAAO,eAAe,EAAE,WAAW,CAAC,OAAO,eAAe,EAAE,UAAU,EAAE,OAAO,oBAAoB,EAAE,OAAO,EAAE,MAAM,CAAC,GACjI,OAAW,eAAe,EAAE,WAAW,CAAC,yBAAyB,EAAE,OAAO,WAAW,EAAE,WAAW,EAAE,MAAM,CAAC,GAC3G,OAAW,eAAe,EAAE,mBAAmB,CAAC,OAAO,eAAe,EAAE,UAAU,GAAC,yBAAyB,EAAE,MAAM,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;aAUxG,MAAM,GAAG,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA1BhC;;;;;GAKG;AAEH;;;GAGG;AAEH;;;;;GAKG;AAEH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH;;;;;;;;;GASG;AACH;IACE;;OAEG;IACH,qBAFW,OAAO,EAkEjB;IA7DC;;OAEG;IACH,IAFU,qBAAqB,OAAO,WAAW,EAAE,SAAS,CAAC,CAEtD;IAEP;;OAEG;IACH,MAFU,qBAAqB,OAAO,WAAW,EAAE,SAAS,CAAC,CAEpD;IAET;;OAEG;IACH,IAFU,qBAAqB,IAAI,CAAC,CAE7B;IAEP;;;OAGG;IACH,oBAAqC;IA2BrC;;;OAGG;IACH,mBACwE;IAKxE;;;OAGG;IACH,eAAkB;IAGpB;;;OAGG;IACH,iBAFY,eAAe,GAAC,KAAK,CAIhC;IAED;;OAEG;IACH,gBAFY,MAAM,CAIjB;IAED;;;;;;OAMG;IACH,8CAFY,OAAO,YAAY,EAAE,KAAK,CAsBrC;IAED;;;;;OAKG;IACH,wJAFY,MAAM,OAAO,YAAY,EAAE,OAAO,CAAC,CAI9C;IAED;;;;;OAKG;IACH,wEAFY,MAAM,OAAO,YAAY,EAAE,KAAK,CAAC,CAI5C;IAED;;;;;;OAMG;IACH,aAJY,OAAO,cAAc,EAAE,MAAM,GAAC,SAAS,CAQlD;IAED;;;;;;OAMG;IACH,oBAJY,MAAM,CAMjB;IAED;;;;;;OAMG;IACH,oBAJY,MAAM,CAMjB;IAED;;;;;;OAMG;IACH,cAJY,MAAM,CAMjB;IAED;;;;;;OAMG;IACH,cAJY,MAAM,CAMjB;IAED;;;;;OAKG;IACH,cAJY,MAAM,CAMjB;IAED;;;OAGG;IACH,kBAFY,OAAO,qBAAqB,EAAE,KAAK,CAI9C;IAED;;;;;;OAMG;IACH,cAJY,OAAO,CAMlB;IAED;;;;;;OAMG;IACH,aAJY,MAAM,GAAC,SAAS,CAM3B;IAED;;;OAGG;IACH,8DAGC;IAED;;;;;;OAMG;IACH,kBAJW,OAAO,cAAc,EAAE,MAAM,GAAC,SAAS,QAMjD;IAED;;;;;OAKG;IACH,gCAJW,MAAM,QAMhB;IAED;;;;;OAKG;IACH,gCAJW,MAAM,QAMhB;IAED;;;;;;;OAOG;IACH,oBAJW,MAAM,QAMhB;IAED;;;;;;;OAOG;IACH,oBAJW,MAAM,QAMhB;IAED;;;;;OAKG;IACH,oBAJW,MAAM,QAOhB;IAED;;;;;OAKG;IACH,oBAJW,OAAO,QAMjB;IAED;;;;;;OAMG;IACH,kBAJW,MAAM,QAMhB;CAYF;uBA5YsB,cAAc"}
|
package/layer/Base.js
CHANGED
|
@@ -33,7 +33,7 @@ import {clamp} from '../math.js';
|
|
|
33
33
|
* @property {boolean} [visible=true] Visibility.
|
|
34
34
|
* @property {import("../extent.js").Extent} [extent] The bounding extent for layer rendering. The layer will not be
|
|
35
35
|
* rendered outside of this extent.
|
|
36
|
-
* @property {number} [zIndex] The z-index for layer rendering. At rendering time, the layers
|
|
36
|
+
* @property {number | undefined} [zIndex] The z-index for layer rendering. At rendering time, the layers
|
|
37
37
|
* will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed
|
|
38
38
|
* for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`
|
|
39
39
|
* method was used.
|
|
@@ -208,7 +208,8 @@ class BaseLayer extends BaseObject {
|
|
|
208
208
|
}
|
|
209
209
|
|
|
210
210
|
/**
|
|
211
|
-
* Return the maximum resolution of the layer.
|
|
211
|
+
* Return the maximum resolution of the layer. Returns Infinity if
|
|
212
|
+
* the layer has no maximum resolution set.
|
|
212
213
|
* @return {number} The maximum resolution of the layer.
|
|
213
214
|
* @observable
|
|
214
215
|
* @api
|
|
@@ -218,7 +219,8 @@ class BaseLayer extends BaseObject {
|
|
|
218
219
|
}
|
|
219
220
|
|
|
220
221
|
/**
|
|
221
|
-
* Return the minimum resolution of the layer.
|
|
222
|
+
* Return the minimum resolution of the layer. Returns 0 if
|
|
223
|
+
* the layer has no minimum resolution set.
|
|
222
224
|
* @return {number} The minimum resolution of the layer.
|
|
223
225
|
* @observable
|
|
224
226
|
* @api
|
|
@@ -228,7 +230,8 @@ class BaseLayer extends BaseObject {
|
|
|
228
230
|
}
|
|
229
231
|
|
|
230
232
|
/**
|
|
231
|
-
* Return the minimum zoom level of the layer.
|
|
233
|
+
* Return the minimum zoom level of the layer. Returns -Infinity if
|
|
234
|
+
* the layer has no minimum zoom set.
|
|
232
235
|
* @return {number} The minimum zoom level of the layer.
|
|
233
236
|
* @observable
|
|
234
237
|
* @api
|
|
@@ -238,7 +241,8 @@ class BaseLayer extends BaseObject {
|
|
|
238
241
|
}
|
|
239
242
|
|
|
240
243
|
/**
|
|
241
|
-
* Return the maximum zoom level of the layer.
|
|
244
|
+
* Return the maximum zoom level of the layer. Returns Infinity if
|
|
245
|
+
* the layer has no maximum zoom set.
|
|
242
246
|
* @return {number} The maximum zoom level of the layer.
|
|
243
247
|
* @observable
|
|
244
248
|
* @api
|
|
@@ -278,13 +282,13 @@ class BaseLayer extends BaseObject {
|
|
|
278
282
|
|
|
279
283
|
/**
|
|
280
284
|
* Return the Z-index of the layer, which is used to order layers before
|
|
281
|
-
* rendering.
|
|
282
|
-
* @return {number} The Z-index of the layer.
|
|
285
|
+
* rendering. Returns undefined if the layer is unmanaged.
|
|
286
|
+
* @return {number|undefined} The Z-index of the layer.
|
|
283
287
|
* @observable
|
|
284
288
|
* @api
|
|
285
289
|
*/
|
|
286
290
|
getZIndex() {
|
|
287
|
-
return /** @type {number} */ (this.get(LayerProperty.Z_INDEX));
|
|
291
|
+
return /** @type {number|undefined} */ (this.get(LayerProperty.Z_INDEX));
|
|
288
292
|
}
|
|
289
293
|
|
|
290
294
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseVector.d.ts","sourceRoot":"","sources":["BaseVector.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"BaseVector.d.ts","sourceRoot":"","sources":["BaseVector.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6EA;;;;;;;;;;;GAWG;AACH;IACE;;OAEG;IACH,6DA0DC;IA/CC;;;OAGG;IACH,mBAC6D;IAE7D;;;OAGG;IACH,sBACiE;IAEjE;;;;OAIG;IACH,eAAkB;IAElB;;;;OAIG;IACH,uBAA+B;IAI/B;;;OAGG;IACH,8BAGW;IAEX;;;OAGG;IACH,gCAGW;IAGb;;OAEG;IACH,gBAFY,OAAO,CAIlB;IAoBD;;OAEG;IACH,mBAFY,MAAM,GAAC,SAAS,CAI3B;IAED;;;OAGG;IACH,yBAHqB,OAAO,eAAe,EAAE,OAAO,QAAE,OAAO,eAAe,EAAE,OAAO,KAAG,MAAM,GAAC,IAAI,GAAC,SAAS,CAO5G;IAED;;;;;OAKG;IACH,YAHY,OAAO,mBAAmB,EAAE,SAAS,GAAC,IAAI,GAAC,SAAS,CAK/D;IAED;;;;OAIG;IACH,oBAHY,OAAO,mBAAmB,EAAE,aAAa,GAAC,SAAS,CAK9D;IAED;;;OAGG;IACH,2BAHY,OAAO,CAKlB;IAED;;;OAGG;IACH,6BAHY,OAAO,CAKlB;IAED;;;OAGG;IACH,4BAFW,OAAO,WAAW,EAAE,UAAU,QAOxC;IAED;;;OAGG;IACH,4BAHW,OAAO,cAAc,EAAE,aAAa,GAAC,IAAI,GAAC,SAAS,QAK7D;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,4HAKC;CACF;kBAjRiB,YAAY"}
|