ol 8.1.1-dev.1694608919656 → 8.1.1-dev.1694687206621

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 (50) hide show
  1. package/Feature.d.ts +2 -2
  2. package/Feature.d.ts.map +1 -1
  3. package/Feature.js +1 -1
  4. package/color.d.ts +1 -1
  5. package/color.d.ts.map +1 -1
  6. package/color.js +12 -11
  7. package/dist/ol.js +2 -2
  8. package/dist/ol.js.map +1 -1
  9. package/format/EsriJSON.d.ts +8 -0
  10. package/format/EsriJSON.d.ts.map +1 -1
  11. package/format/Feature.d.ts +79 -5
  12. package/format/Feature.d.ts.map +1 -1
  13. package/format/Feature.js +151 -11
  14. package/format/GeoJSON.d.ts +11 -0
  15. package/format/GeoJSON.d.ts.map +1 -1
  16. package/format/GeoJSON.js +144 -52
  17. package/format/JSONFeature.d.ts +4 -24
  18. package/format/JSONFeature.d.ts.map +1 -1
  19. package/format/JSONFeature.js +4 -4
  20. package/format/MVT.d.ts.map +1 -1
  21. package/format/MVT.js +3 -2
  22. package/format/TopoJSON.d.ts +8 -0
  23. package/format/TopoJSON.d.ts.map +1 -1
  24. package/geom/SimpleGeometry.d.ts +5 -0
  25. package/geom/SimpleGeometry.d.ts.map +1 -1
  26. package/geom/SimpleGeometry.js +1 -1
  27. package/interaction/DragAndDrop.d.ts +1 -1
  28. package/interaction/Draw.d.ts +2 -2
  29. package/interaction/Modify.d.ts +1 -1
  30. package/interaction/Snap.d.ts +1 -1
  31. package/layer/BaseVector.d.ts +2 -2
  32. package/layer/Graticule.d.ts +2 -1
  33. package/layer/Graticule.d.ts.map +1 -1
  34. package/layer/Heatmap.d.ts +2 -2
  35. package/layer/Heatmap.js +1 -1
  36. package/layer/Vector.d.ts +1 -1
  37. package/layer/VectorImage.d.ts +2 -2
  38. package/layer/WebGLPoints.d.ts +4 -4
  39. package/layer/WebGLPoints.js +2 -2
  40. package/package.json +2 -1
  41. package/render/Feature.d.ts +33 -11
  42. package/render/Feature.d.ts.map +1 -1
  43. package/render/Feature.js +115 -21
  44. package/render/webgl/MixedGeometryBatch.d.ts.map +1 -1
  45. package/render/webgl/MixedGeometryBatch.js +1 -3
  46. package/source/Cluster.d.ts +2 -2
  47. package/source/Vector.d.ts +74 -66
  48. package/source/Vector.d.ts.map +1 -1
  49. package/source/Vector.js +98 -67
  50. package/util.js +1 -1
package/format/GeoJSON.js CHANGED
@@ -3,17 +3,20 @@
3
3
  */
4
4
 
5
5
  import Feature from '../Feature.js';
6
- import GeometryCollection from '../geom/GeometryCollection.js';
7
6
  import JSONFeature from './JSONFeature.js';
8
- import LineString from '../geom/LineString.js';
9
- import MultiLineString from '../geom/MultiLineString.js';
10
- import MultiPoint from '../geom/MultiPoint.js';
11
- import MultiPolygon from '../geom/MultiPolygon.js';
12
- import Point from '../geom/Point.js';
13
- import Polygon from '../geom/Polygon.js';
7
+ import RenderFeature from '../render/Feature.js';
8
+ import {
9
+ createGeometry,
10
+ createRenderFeature,
11
+ transformGeometryWithOptions,
12
+ } from './Feature.js';
13
+ import {
14
+ deflateCoordinatesArray,
15
+ deflateMultiCoordinatesArray,
16
+ } from '../geom/flat/deflate.js';
17
+ import {getLayoutForStride} from '../geom/SimpleGeometry.js';
14
18
  import {get as getProjection} from '../proj.js';
15
19
  import {isEmpty} from '../obj.js';
16
- import {transformGeometryWithOptions} from './Feature.js';
17
20
 
18
21
  /**
19
22
  * @typedef {import("geojson").GeoJSON} GeoJSONObject
@@ -39,6 +42,10 @@ import {transformGeometryWithOptions} from './Feature.js';
39
42
  * the geometry_name field in the feature GeoJSON. If set to `true` the GeoJSON reader
40
43
  * will look for that field to set the geometry name. If both this field is set to `true`
41
44
  * and a `geometryName` is provided, the `geometryName` will take precedence.
45
+ * @property {import("../Feature.js").FeatureClass} [featureClass] Feature class
46
+ * to be used when reading features. The default is {@link module:ol/Feature~Feature}. If performance is
47
+ * the primary concern, and features are not going to be modified or round-tripped through the format,
48
+ * consider using {@link module:ol/render/Feature~RenderFeature}
42
49
  */
43
50
 
44
51
  /**
@@ -70,6 +77,10 @@ class GeoJSON extends JSONFeature {
70
77
  this.defaultFeatureProjection = getProjection(options.featureProjection);
71
78
  }
72
79
 
80
+ if (options.featureClass) {
81
+ this.featureClass = options.featureClass;
82
+ }
83
+
73
84
  /**
74
85
  * Name of the geometry attribute for features.
75
86
  * @type {string|undefined}
@@ -94,7 +105,7 @@ class GeoJSON extends JSONFeature {
94
105
  * @param {Object} object Object.
95
106
  * @param {import("./Feature.js").ReadOptions} [options] Read options.
96
107
  * @protected
97
- * @return {import("../Feature.js").default} Feature.
108
+ * @return {Feature|RenderFeature|Array<RenderFeature>}.default} Feature.
98
109
  */
99
110
  readFeatureFromObject(object, options) {
100
111
  /**
@@ -111,7 +122,18 @@ class GeoJSON extends JSONFeature {
111
122
  };
112
123
  }
113
124
 
114
- const geometry = readGeometry(geoJSONFeature['geometry'], options);
125
+ const geometry = readGeometryInternal(geoJSONFeature['geometry'], options);
126
+ if (this.featureClass === RenderFeature) {
127
+ return createRenderFeature(
128
+ {
129
+ geometry,
130
+ id: geoJSONFeature['id'],
131
+ properties: geoJSONFeature['properties'],
132
+ },
133
+ options
134
+ );
135
+ }
136
+
115
137
  const feature = new Feature();
116
138
  if (this.geometryName_) {
117
139
  feature.setGeometryName(this.geometryName_);
@@ -121,7 +143,7 @@ class GeoJSON extends JSONFeature {
121
143
  ) {
122
144
  feature.setGeometryName(geoJSONFeature['geometry_name']);
123
145
  }
124
- feature.setGeometry(geometry);
146
+ feature.setGeometry(createGeometry(geometry, options));
125
147
 
126
148
  if ('id' in geoJSONFeature) {
127
149
  feature.setId(geoJSONFeature['id']);
@@ -137,11 +159,11 @@ class GeoJSON extends JSONFeature {
137
159
  * @param {Object} object Object.
138
160
  * @param {import("./Feature.js").ReadOptions} [options] Read options.
139
161
  * @protected
140
- * @return {Array<Feature>} Features.
162
+ * @return {Array<Feature|RenderFeature>} Features.
141
163
  */
142
164
  readFeaturesFromObject(object, options) {
143
165
  const geoJSONObject = /** @type {GeoJSONObject} */ (object);
144
- /** @type {Array<import("../Feature.js").default>} */
166
+ /** @type {Array<Feature|RenderFeature|Array<RenderFeature>>} */
145
167
  let features = null;
146
168
  if (geoJSONObject['type'] === 'FeatureCollection') {
147
169
  const geoJSONFeatureCollection = /** @type {GeoJSONFeatureCollection} */ (
@@ -150,12 +172,19 @@ class GeoJSON extends JSONFeature {
150
172
  features = [];
151
173
  const geoJSONFeatures = geoJSONFeatureCollection['features'];
152
174
  for (let i = 0, ii = geoJSONFeatures.length; i < ii; ++i) {
153
- features.push(this.readFeatureFromObject(geoJSONFeatures[i], options));
175
+ const featureObject = this.readFeatureFromObject(
176
+ geoJSONFeatures[i],
177
+ options
178
+ );
179
+ if (!featureObject) {
180
+ continue;
181
+ }
182
+ features.push(featureObject);
154
183
  }
155
184
  } else {
156
185
  features = [this.readFeatureFromObject(object, options)];
157
186
  }
158
- return features;
187
+ return features.flat();
159
188
  }
160
189
 
161
190
  /**
@@ -268,16 +297,14 @@ class GeoJSON extends JSONFeature {
268
297
  /**
269
298
  * @param {GeoJSONGeometry|GeoJSONGeometryCollection} object Object.
270
299
  * @param {import("./Feature.js").ReadOptions} [options] Read options.
271
- * @return {import("../geom/Geometry.js").default} Geometry.
300
+ * @return {import("./Feature.js").GeometryObject} Geometry.
272
301
  */
273
- function readGeometry(object, options) {
302
+ function readGeometryInternal(object, options) {
274
303
  if (!object) {
275
304
  return null;
276
305
  }
277
306
 
278
- /**
279
- * @type {import("../geom/Geometry.js").default}
280
- */
307
+ /** @type {import("./Feature.js").GeometryObject} */
281
308
  let geometry;
282
309
  switch (object['type']) {
283
310
  case 'Point': {
@@ -322,73 +349,132 @@ function readGeometry(object, options) {
322
349
  throw new Error('Unsupported GeoJSON type: ' + object['type']);
323
350
  }
324
351
  }
325
- return transformGeometryWithOptions(geometry, false, options);
352
+ return geometry;
353
+ }
354
+
355
+ /**
356
+ * @param {GeoJSONGeometry|GeoJSONGeometryCollection} object Object.
357
+ * @param {import("./Feature.js").ReadOptions} [options] Read options.
358
+ * @return {import("../geom/Geometry.js").default} Geometry.
359
+ */
360
+ function readGeometry(object, options) {
361
+ const geometryObject = readGeometryInternal(object, options);
362
+ return createGeometry(geometryObject, options);
326
363
  }
327
364
 
328
365
  /**
329
366
  * @param {GeoJSONGeometryCollection} object Object.
330
367
  * @param {import("./Feature.js").ReadOptions} [options] Read options.
331
- * @return {GeometryCollection} Geometry collection.
368
+ * @return {import("./Feature.js").GeometryCollectionObject} Geometry collection.
332
369
  */
333
370
  function readGeometryCollectionGeometry(object, options) {
334
371
  const geometries = object['geometries'].map(
335
372
  /**
336
373
  * @param {GeoJSONGeometry} geometry Geometry.
337
- * @return {import("../geom/Geometry.js").default} geometry Geometry.
374
+ * @return {import("./Feature.js").GeometryObject} geometry Geometry.
338
375
  */
339
376
  function (geometry) {
340
- return readGeometry(geometry, options);
377
+ return readGeometryInternal(geometry, options);
341
378
  }
342
379
  );
343
- return new GeometryCollection(geometries);
380
+ return geometries;
344
381
  }
345
382
 
346
383
  /**
347
- * @param {GeoJSONPoint} object Object.
348
- * @return {Point} Point.
384
+ * @param {GeoJSONPoint} object Input object.
385
+ * @return {import("./Feature.js").GeometryObject} Point geometry.
349
386
  */
350
387
  function readPointGeometry(object) {
351
- return new Point(object['coordinates']);
388
+ const flatCoordinates = object['coordinates'];
389
+ return {
390
+ type: 'Point',
391
+ flatCoordinates,
392
+ layout: getLayoutForStride(flatCoordinates.length),
393
+ };
352
394
  }
353
395
 
354
396
  /**
355
397
  * @param {GeoJSONLineString} object Object.
356
- * @return {LineString} LineString.
398
+ * @return {import("./Feature.js").GeometryObject} LineString geometry.
357
399
  */
358
400
  function readLineStringGeometry(object) {
359
- return new LineString(object['coordinates']);
401
+ const coordinates = object['coordinates'];
402
+ const flatCoordinates = coordinates.flat();
403
+ return {
404
+ type: 'LineString',
405
+ flatCoordinates,
406
+ ends: [flatCoordinates.length],
407
+ layout: getLayoutForStride(coordinates[0].length),
408
+ };
360
409
  }
361
410
 
362
411
  /**
363
412
  * @param {GeoJSONMultiLineString} object Object.
364
- * @return {MultiLineString} MultiLineString.
413
+ * @return {import("./Feature.js").GeometryObject} MultiLineString geometry.
365
414
  */
366
415
  function readMultiLineStringGeometry(object) {
367
- return new MultiLineString(object['coordinates']);
416
+ const coordinates = object['coordinates'];
417
+ const stride = coordinates[0][0].length;
418
+ const flatCoordinates = [];
419
+ const ends = deflateCoordinatesArray(flatCoordinates, 0, coordinates, stride);
420
+ return {
421
+ type: 'MultiLineString',
422
+ flatCoordinates,
423
+ ends,
424
+ layout: getLayoutForStride(stride),
425
+ };
368
426
  }
369
427
 
370
428
  /**
371
429
  * @param {GeoJSONMultiPoint} object Object.
372
- * @return {MultiPoint} MultiPoint.
430
+ * @return {import("./Feature.js").GeometryObject} MultiPoint geometry.
373
431
  */
374
432
  function readMultiPointGeometry(object) {
375
- return new MultiPoint(object['coordinates']);
433
+ const coordinates = object['coordinates'];
434
+ return {
435
+ type: 'MultiPoint',
436
+ flatCoordinates: coordinates.flat(),
437
+ layout: getLayoutForStride(coordinates[0].length),
438
+ };
376
439
  }
377
440
 
378
441
  /**
379
442
  * @param {GeoJSONMultiPolygon} object Object.
380
- * @return {MultiPolygon} MultiPolygon.
443
+ * @return {import("./Feature.js").GeometryObject} MultiPolygon geometry.
381
444
  */
382
445
  function readMultiPolygonGeometry(object) {
383
- return new MultiPolygon(object['coordinates']);
446
+ const coordinates = object['coordinates'];
447
+ const flatCoordinates = [];
448
+ const stride = coordinates[0][0][0].length;
449
+ const endss = deflateMultiCoordinatesArray(
450
+ flatCoordinates,
451
+ 0,
452
+ coordinates,
453
+ stride
454
+ );
455
+ return {
456
+ type: 'MultiPolygon',
457
+ flatCoordinates,
458
+ ends: endss,
459
+ layout: getLayoutForStride(stride),
460
+ };
384
461
  }
385
462
 
386
463
  /**
387
464
  * @param {GeoJSONPolygon} object Object.
388
- * @return {Polygon} Polygon.
465
+ * @return {import("./Feature.js").GeometryObject} Polygon.
389
466
  */
390
467
  function readPolygonGeometry(object) {
391
- return new Polygon(object['coordinates']);
468
+ const coordinates = object['coordinates'];
469
+ const flatCoordinates = [];
470
+ const stride = coordinates[0][0].length;
471
+ const ends = deflateCoordinatesArray(flatCoordinates, 0, coordinates, stride);
472
+ return {
473
+ type: 'Polygon',
474
+ flatCoordinates,
475
+ ends,
476
+ layout: getLayoutForStride(stride),
477
+ };
392
478
  }
393
479
 
394
480
  /**
@@ -398,53 +484,59 @@ function readPolygonGeometry(object) {
398
484
  */
399
485
  function writeGeometry(geometry, options) {
400
486
  geometry = transformGeometryWithOptions(geometry, true, options);
487
+
401
488
  const type = geometry.getType();
402
489
 
403
490
  /** @type {GeoJSONGeometry} */
404
491
  let geoJSON;
405
492
  switch (type) {
406
493
  case 'Point': {
407
- geoJSON = writePointGeometry(/** @type {Point} */ (geometry), options);
494
+ geoJSON = writePointGeometry(
495
+ /** @type {import("../geom/Point.js").default} */ (geometry),
496
+ options
497
+ );
408
498
  break;
409
499
  }
410
500
  case 'LineString': {
411
501
  geoJSON = writeLineStringGeometry(
412
- /** @type {LineString} */ (geometry),
502
+ /** @type {import("../geom/LineString.js").default} */ (geometry),
413
503
  options
414
504
  );
415
505
  break;
416
506
  }
417
507
  case 'Polygon': {
418
508
  geoJSON = writePolygonGeometry(
419
- /** @type {Polygon} */ (geometry),
509
+ /** @type {import("../geom/Polygon.js").default} */ (geometry),
420
510
  options
421
511
  );
422
512
  break;
423
513
  }
424
514
  case 'MultiPoint': {
425
515
  geoJSON = writeMultiPointGeometry(
426
- /** @type {MultiPoint} */ (geometry),
516
+ /** @type {import("../geom/MultiPoint.js").default} */ (geometry),
427
517
  options
428
518
  );
429
519
  break;
430
520
  }
431
521
  case 'MultiLineString': {
432
522
  geoJSON = writeMultiLineStringGeometry(
433
- /** @type {MultiLineString} */ (geometry),
523
+ /** @type {import("../geom/MultiLineString.js").default} */ (geometry),
434
524
  options
435
525
  );
436
526
  break;
437
527
  }
438
528
  case 'MultiPolygon': {
439
529
  geoJSON = writeMultiPolygonGeometry(
440
- /** @type {MultiPolygon} */ (geometry),
530
+ /** @type {import("../geom/MultiPolygon.js").default} */ (geometry),
441
531
  options
442
532
  );
443
533
  break;
444
534
  }
445
535
  case 'GeometryCollection': {
446
536
  geoJSON = writeGeometryCollectionGeometry(
447
- /** @type {GeometryCollection} */ (geometry),
537
+ /** @type {import("../geom/GeometryCollection.js").default} */ (
538
+ geometry
539
+ ),
448
540
  options
449
541
  );
450
542
  break;
@@ -464,7 +556,7 @@ function writeGeometry(geometry, options) {
464
556
  }
465
557
 
466
558
  /**
467
- * @param {GeometryCollection} geometry Geometry.
559
+ * @param {import("../geom/GeometryCollection.js").default} geometry Geometry.
468
560
  * @param {import("./Feature.js").WriteOptions} [options] Write options.
469
561
  * @return {GeoJSONGeometryCollection} GeoJSON geometry collection.
470
562
  */
@@ -481,7 +573,7 @@ function writeGeometryCollectionGeometry(geometry, options) {
481
573
  }
482
574
 
483
575
  /**
484
- * @param {LineString} geometry Geometry.
576
+ * @param {import("../geom/LineString.js").default} geometry Geometry.
485
577
  * @param {import("./Feature.js").WriteOptions} [options] Write options.
486
578
  * @return {GeoJSONGeometry} GeoJSON geometry.
487
579
  */
@@ -493,7 +585,7 @@ function writeLineStringGeometry(geometry, options) {
493
585
  }
494
586
 
495
587
  /**
496
- * @param {MultiLineString} geometry Geometry.
588
+ * @param {import("../geom/MultiLineString.js").default} geometry Geometry.
497
589
  * @param {import("./Feature.js").WriteOptions} [options] Write options.
498
590
  * @return {GeoJSONGeometry} GeoJSON geometry.
499
591
  */
@@ -505,7 +597,7 @@ function writeMultiLineStringGeometry(geometry, options) {
505
597
  }
506
598
 
507
599
  /**
508
- * @param {MultiPoint} geometry Geometry.
600
+ * @param {import("../geom/MultiPoint.js").default} geometry Geometry.
509
601
  * @param {import("./Feature.js").WriteOptions} [options] Write options.
510
602
  * @return {GeoJSONGeometry} GeoJSON geometry.
511
603
  */
@@ -517,7 +609,7 @@ function writeMultiPointGeometry(geometry, options) {
517
609
  }
518
610
 
519
611
  /**
520
- * @param {MultiPolygon} geometry Geometry.
612
+ * @param {import("../geom/MultiPolygon.js").default} geometry Geometry.
521
613
  * @param {import("./Feature.js").WriteOptions} [options] Write options.
522
614
  * @return {GeoJSONGeometry} GeoJSON geometry.
523
615
  */
@@ -533,7 +625,7 @@ function writeMultiPolygonGeometry(geometry, options) {
533
625
  }
534
626
 
535
627
  /**
536
- * @param {Point} geometry Geometry.
628
+ * @param {import("../geom/Point.js").default} geometry Geometry.
537
629
  * @param {import("./Feature.js").WriteOptions} [options] Write options.
538
630
  * @return {GeoJSONGeometry} GeoJSON geometry.
539
631
  */
@@ -545,7 +637,7 @@ function writePointGeometry(geometry, options) {
545
637
  }
546
638
 
547
639
  /**
548
- * @param {Polygon} geometry Geometry.
640
+ * @param {import("../geom/Polygon.js").default} geometry Geometry.
549
641
  * @param {import("./Feature.js").WriteOptions} [options] Write options.
550
642
  * @return {GeoJSONGeometry} GeoJSON geometry.
551
643
  */
@@ -8,42 +8,22 @@ export default JSONFeature;
8
8
  * @abstract
9
9
  */
10
10
  declare class JSONFeature extends FeatureFormat {
11
- /**
12
- * Read a feature. Only works for a single feature. Use `readFeatures` to
13
- * read a feature collection.
14
- *
15
- * @param {ArrayBuffer|Document|Element|Object|string} source Source.
16
- * @param {import("./Feature.js").ReadOptions} [options] Read options.
17
- * @return {import("../Feature.js").default} Feature.
18
- * @api
19
- */
20
- readFeature(source: ArrayBuffer | Document | Element | any | string, options?: import("./Feature.js").ReadOptions | undefined): import("../Feature.js").default;
21
- /**
22
- * Read all features. Works with both a single feature and a feature
23
- * collection.
24
- *
25
- * @param {ArrayBuffer|Document|Element|Object|string} source Source.
26
- * @param {import("./Feature.js").ReadOptions} [options] Read options.
27
- * @return {Array<import("../Feature.js").default>} Features.
28
- * @api
29
- */
30
- readFeatures(source: ArrayBuffer | Document | Element | any | string, options?: import("./Feature.js").ReadOptions | undefined): Array<import("../Feature.js").default>;
31
11
  /**
32
12
  * @abstract
33
13
  * @param {Object} object Object.
34
14
  * @param {import("./Feature.js").ReadOptions} [options] Read options.
35
15
  * @protected
36
- * @return {import("../Feature.js").default} Feature.
16
+ * @return {import("../Feature.js").default|import("../render/Feature.js").default|Array<import("../render/Feature.js").default>} Feature.
37
17
  */
38
- protected readFeatureFromObject(object: any, options?: import("./Feature.js").ReadOptions | undefined): import("../Feature.js").default;
18
+ protected readFeatureFromObject(object: any, options?: import("./Feature.js").ReadOptions | undefined): import("../Feature.js").default | import("../render/Feature.js").default | Array<import("../render/Feature.js").default>;
39
19
  /**
40
20
  * @abstract
41
21
  * @param {Object} object Object.
42
22
  * @param {import("./Feature.js").ReadOptions} [options] Read options.
43
23
  * @protected
44
- * @return {Array<import("../Feature.js").default>} Features.
24
+ * @return {Array<import("../Feature.js").default|import("../render/Feature.js").default>} Features.
45
25
  */
46
- protected readFeaturesFromObject(object: any, options?: import("./Feature.js").ReadOptions | undefined): Array<import("../Feature.js").default>;
26
+ protected readFeaturesFromObject(object: any, options?: import("./Feature.js").ReadOptions | undefined): Array<import("../Feature.js").default | import("../render/Feature.js").default>;
47
27
  /**
48
28
  * @abstract
49
29
  * @param {Object} object Object.
@@ -1 +1 @@
1
- {"version":3,"file":"JSONFeature.d.ts","sourceRoot":"","sources":["JSONFeature.js"],"names":[],"mappings":";AAMA;;;;;;;GAOG;AACH;IAYE;;;;;;;;OAQG;IACH,oBALW,WAAW,GAAC,QAAQ,GAAC,OAAO,SAAQ,MAAM,6DAEzC,OAAO,eAAe,EAAE,OAAO,CAQ1C;IAED;;;;;;;;OAQG;IACH,qBALW,WAAW,GAAC,QAAQ,GAAC,OAAO,SAAQ,MAAM,6DAEzC,MAAM,OAAO,eAAe,EAAE,OAAO,CAAC,CAQjD;IAED;;;;;;OAMG;IACH,wGAFY,OAAO,eAAe,EAAE,OAAO,CAI1C;IAED;;;;;;OAMG;IACH,yGAFY,MAAM,OAAO,eAAe,EAAE,OAAO,CAAC,CA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;IACH,iDAFY,OAAO,uBAAuB,EAAE,OAAO,CAIlD;IAED;;;;;;;OAOG;IACH,sBALW,OAAO,eAAe,EAAE,OAAO,8DAE9B,MAAM,CAKjB;IAED;;;;;OAKG;IACH,4BAJW,OAAO,eAAe,EAAE,OAAO,kEAMzC;IAED;;;;;;;OAOG;IACH,wBALW,MAAM,OAAO,eAAe,EAAE,OAAO,CAAC,8DAErC,MAAM,CAKjB;IAED;;;;;OAKG;IACH,8BAJW,MAAM,OAAO,eAAe,EAAE,OAAO,CAAC,kEAMhD;IAED;;;;;;;OAOG;IACH,wBALW,OAAO,qBAAqB,EAAE,OAAO,8DAEpC,MAAM,CAKjB;IAED;;;;;OAKG;IACH,8BAJW,OAAO,qBAAqB,EAAE,OAAO,kEAM/C;CACF;0BA7LyB,cAAc"}
@@ -30,7 +30,7 @@ class JSONFeature extends FeatureFormat {
30
30
  *
31
31
  * @param {ArrayBuffer|Document|Element|Object|string} source Source.
32
32
  * @param {import("./Feature.js").ReadOptions} [options] Read options.
33
- * @return {import("../Feature.js").default} Feature.
33
+ * @return {import("../Feature.js").FeatureLike|Array<import("../render/Feature.js").default>} Feature.
34
34
  * @api
35
35
  */
36
36
  readFeature(source, options) {
@@ -46,7 +46,7 @@ class JSONFeature extends FeatureFormat {
46
46
  *
47
47
  * @param {ArrayBuffer|Document|Element|Object|string} source Source.
48
48
  * @param {import("./Feature.js").ReadOptions} [options] Read options.
49
- * @return {Array<import("../Feature.js").default>} Features.
49
+ * @return {Array<import("../Feature.js").FeatureLike>} Features.
50
50
  * @api
51
51
  */
52
52
  readFeatures(source, options) {
@@ -61,7 +61,7 @@ class JSONFeature extends FeatureFormat {
61
61
  * @param {Object} object Object.
62
62
  * @param {import("./Feature.js").ReadOptions} [options] Read options.
63
63
  * @protected
64
- * @return {import("../Feature.js").default} Feature.
64
+ * @return {import("../Feature.js").default|import("../render/Feature.js").default|Array<import("../render/Feature.js").default>} Feature.
65
65
  */
66
66
  readFeatureFromObject(object, options) {
67
67
  return abstract();
@@ -72,7 +72,7 @@ class JSONFeature extends FeatureFormat {
72
72
  * @param {Object} object Object.
73
73
  * @param {import("./Feature.js").ReadOptions} [options] Read options.
74
74
  * @protected
75
- * @return {Array<import("../Feature.js").default>} Features.
75
+ * @return {Array<import("../Feature.js").default|import("../render/Feature.js").default>} Features.
76
76
  */
77
77
  readFeaturesFromObject(object, options) {
78
78
  return abstract();
@@ -1 +1 @@
1
- {"version":3,"file":"MVT.d.ts","sourceRoot":"","sources":["MVT.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA;;;;;;;;;;;GAWG;AAEH;;;;;;GAMG;AACH;IACE;;OAEG;IACH,2CAiDC;IApCC;;;OAGG;IACH,sBAEiB;IAEjB;;;OAGG;IACH,sBAAyC;IAEzC;;;OAGG;IACH,mBAAiE;IAEjE;;;OAGG;IACH,gBAAqD;IAErD;;;OAGG;IACH,oBAAqC;IAQvC;;;;;;;;OAQG;IACH,yBAoDC;IAED;;;;;;OAMG;IACH,uBAsEC;IASD;;;;;;;OAOG;IACH,qBALW,WAAW,6DAEV,MAAM,OAAO,eAAe,EAAE,WAAW,CAAC,CAgCrD;IAED;;;;;;OAMG;IACH,uBAJW,QAAQ,GAAC,OAAO,SAAQ,MAAM,GAC7B,OAAO,uBAAuB,EAAE,OAAO,CAKlD;IAED;;;;OAIG;IACH,kBAHW,MAAM,MAAM,CAAC,QAKvB;CACF;0BAvSyD,cAAc"}
1
+ {"version":3,"file":"MVT.d.ts","sourceRoot":"","sources":["MVT.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA;;;;;;;;;;;GAWG;AAEH;;;;;;GAMG;AACH;IACE;;OAEG;IACH,2CAiDC;IApCC;;;OAGG;IACH,sBAEiB;IAEjB;;;OAGG;IACH,sBAAyC;IAEzC;;;OAGG;IACH,mBAAiE;IAEjE;;;OAGG;IACH,gBAAqD;IAErD;;;OAGG;IACH,oBAAqC;IAQvC;;;;;;;;OAQG;IACH,yBAoDC;IAED;;;;;;OAMG;IACH,uBAuEC;IASD;;;;;;;OAOG;IACH,qBALW,WAAW,6DAEV,MAAM,OAAO,eAAe,EAAE,WAAW,CAAC,CAgCrD;IAED;;;;;;OAMG;IACH,uBAJW,QAAQ,GAAC,OAAO,SAAQ,MAAM,GAC7B,OAAO,uBAAuB,EAAE,OAAO,CAKlD;IAED;;;;OAIG;IACH,kBAHW,MAAM,MAAM,CAAC,QAKvB;CACF;0BAxSyD,cAAc"}
package/format/MVT.js CHANGED
@@ -191,6 +191,7 @@ class MVT extends FeatureFormat {
191
191
  geometryType,
192
192
  flatCoordinates,
193
193
  ends,
194
+ 2,
194
195
  values,
195
196
  id
196
197
  );
@@ -412,10 +413,10 @@ function readRawFeature(pbf, layer, i) {
412
413
  * @param {number} type The raw feature's geometry type
413
414
  * @param {number} numEnds Number of ends of the flat coordinates of the
414
415
  * geometry.
415
- * @return {import("../geom/Geometry.js").Type} The geometry type.
416
+ * @return {import("../render/Feature.js").Type} The geometry type.
416
417
  */
417
418
  function getGeometryType(type, numEnds) {
418
- /** @type {import("../geom/Geometry.js").Type} */
419
+ /** @type {import("../render/Feature.js").Type} */
419
420
  let geometryType;
420
421
  if (type === 1) {
421
422
  geometryType = numEnds === 1 ? 'Point' : 'MultiPoint';
@@ -94,6 +94,14 @@ declare class TopoJSON extends JSONFeature {
94
94
  * @type {?Array<string>}
95
95
  */
96
96
  private layers_;
97
+ /**
98
+ * @param {Object} object Object.
99
+ * @param {import("./Feature.js").ReadOptions} [options] Read options.
100
+ * @protected
101
+ * @return {Array<Feature>} Features.
102
+ */
103
+ protected readFeaturesFromObject(object: any, options?: import("./Feature.js").ReadOptions | undefined): Array<Feature>;
97
104
  }
98
105
  import JSONFeature from './JSONFeature.js';
106
+ import Feature from '../Feature.js';
99
107
  //# sourceMappingURL=TopoJSON.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TopoJSON.d.ts","sourceRoot":"","sources":["TopoJSON.js"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FY,MAAM,OAAO,CAAC,CA8DzB;CAUF;wBA7JuB,kBAAkB;oBADtB,eAAe"}
@@ -1,3 +1,8 @@
1
+ /**
2
+ * @param {number} stride Stride.
3
+ * @return {import("./Geometry.js").GeometryLayout} layout Layout.
4
+ */
5
+ export function getLayoutForStride(stride: number): import("./Geometry.js").GeometryLayout;
1
6
  /**
2
7
  * @param {import("./Geometry.js").GeometryLayout} layout Layout.
3
8
  * @return {number} Stride.
@@ -1 +1 @@
1
- {"version":3,"file":"SimpleGeometry.d.ts","sourceRoot":"","sources":["SimpleGeometry.js"],"names":[],"mappings":"AAsTA;;;GAGG;AACH,2CAHW,OAAO,eAAe,EAAE,cAAc,GACrC,MAAM,CAYjB;AAED;;;;;GAKG;AACH,gDALW,cAAc,aACd,OAAO,iBAAiB,EAAE,SAAS,gCAElC,MAAM,MAAM,CAAC,CAgBxB;;AAlVD;;;;;;;GAOG;AACH;IAII;;;OAGG;IACH,kBAFU,OAAO,eAAe,EAAE,cAAc,CAE9B;IAElB;;;OAGG;IACH,kBAFU,MAAM,CAED;IAEf;;;OAGG;IACH,2BAFU,MAAM,MAAM,CAAC,CAEI;IAkB7B;;;OAGG;IACH,kBAFY,UAAQ,GAAG,IAAI,CAI1B;IAED;;;;OAIG;IACH,sBAHY,OAAO,kBAAkB,EAAE,UAAU,CAKhD;IAED;;OAEG;IACH,sBAFY,MAAM,MAAM,CAAC,CAIxB;IAED;;;;OAIG;IACH,qBAHY,OAAO,kBAAkB,EAAE,UAAU,CAOhD;IAED;;;;OAIG;IACH,aAHY,OAAO,eAAe,EAAE,cAAc,CAKjD;IAED;;;;OAIG;IACH,wCAHW,MAAM,GACL,cAAc,CA+BzB;IAED;;;;OAIG;IACH,0DAJW,MAAM,GACL,cAAc,CAKzB;IAED;;OAEG;IACH,aAFY,MAAM,CAIjB;IAED;;;OAGG;IACH,2BAHW,OAAO,eAAe,EAAE,cAAc,mBACtC,MAAM,MAAM,CAAC,QAMvB;IAED;;;;OAIG;IACH,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,eAChD,UAAQ,WACR,MAAM,QAsBhB;CAkGF;qBAjSoB,eAAe"}
@@ -296,7 +296,7 @@ class SimpleGeometry extends Geometry {
296
296
  * @param {number} stride Stride.
297
297
  * @return {import("./Geometry.js").GeometryLayout} layout Layout.
298
298
  */
299
- function getLayoutForStride(stride) {
299
+ export function getLayoutForStride(stride) {
300
300
  let layout;
301
301
  if (stride == 2) {
302
302
  layout = 'XY';
@@ -44,7 +44,7 @@ export type Options = {
44
44
  * source without removing the existing features (append only), instead of
45
45
  * providing the source option listen for the "addfeatures" event.
46
46
  */
47
- source?: import("../source/Vector.js").default<import("../geom/Geometry.js").default> | undefined;
47
+ source?: import("../source/Vector.js").default<import("../Feature.js").default<import("../geom/Geometry.js").default>> | undefined;
48
48
  /**
49
49
  * Target projection. By default, the map's view's projection is used.
50
50
  */
@@ -61,7 +61,7 @@ export type Options = {
61
61
  * Destination source for
62
62
  * the drawn features.
63
63
  */
64
- source?: VectorSource<import("../geom/Geometry.js").default> | undefined;
64
+ source?: VectorSource<Feature<import("../geom/Geometry.js").default>> | undefined;
65
65
  /**
66
66
  * Delay in milliseconds after pointerdown
67
67
  * before the current vertex can be dragged to its exact position.
@@ -141,7 +141,7 @@ export type Options = {
141
141
  * not provided, the interaction's `source` will be used. Tracing requires that the interaction is configured with
142
142
  * either a `traceSource` or a `source`.
143
143
  */
144
- traceSource?: VectorSource<import("../geom/Geometry.js").default> | undefined;
144
+ traceSource?: VectorSource<Feature<import("../geom/Geometry.js").default>> | undefined;
145
145
  /**
146
146
  * Wrap the world horizontally on the sketch
147
147
  * overlay.
@@ -148,7 +148,7 @@ export type Options = {
148
148
  * features to modify. If a vector source is not provided, a feature collection
149
149
  * must be provided with the `features` option.
150
150
  */
151
- source?: VectorSource<import("../geom/Geometry.js").default> | undefined;
151
+ source?: VectorSource<Feature<import("../geom/Geometry.js").default>> | undefined;
152
152
  /**
153
153
  * When configured, point
154
154
  * features will be considered for modification based on their visual appearance, instead of being within
@@ -44,7 +44,7 @@ export type Options = {
44
44
  /**
45
45
  * Snap to features from this source. Either this option or features should be provided
46
46
  */
47
- source?: import("../source/Vector.js").default<import("../geom/Geometry.js").default> | undefined;
47
+ source?: import("../source/Vector.js").default<import("../Feature.js").default<import("../geom/Geometry.js").default>> | undefined;
48
48
  };
49
49
  /**
50
50
  * *
@@ -1,5 +1,5 @@
1
1
  export default BaseVectorLayer;
2
- export type Options<VectorSourceType extends import("../source/Vector.js").default<import("../geom/Geometry.js").default> | import("../source/VectorTile.js").default> = {
2
+ export type Options<VectorSourceType extends import("../source/Vector.js").default<import("../Feature").default<import("../geom/Geometry.js").default>> | import("../source/VectorTile.js").default> = {
3
3
  /**
4
4
  * A CSS class name to set to the layer element.
5
5
  */
@@ -122,7 +122,7 @@ export type Options<VectorSourceType extends import("../source/Vector.js").defau
122
122
  * @extends {Layer<VectorSourceType, RendererType>}
123
123
  * @api
124
124
  */
125
- declare class BaseVectorLayer<VectorSourceType extends import("../source/Vector.js").default<import("../geom/Geometry.js").default> | import("../source/VectorTile.js").default, RendererType extends import("../renderer/canvas/VectorLayer.js").default | import("../renderer/canvas/VectorTileLayer.js").default | import("../renderer/canvas/VectorImageLayer.js").default | import("../renderer/webgl/PointsLayer.js").default> extends Layer<VectorSourceType, RendererType> {
125
+ declare class BaseVectorLayer<VectorSourceType extends import("../source/Vector.js").default<import("../Feature").default<import("../geom/Geometry.js").default>> | import("../source/VectorTile.js").default, RendererType extends import("../renderer/canvas/VectorLayer.js").default | import("../renderer/canvas/VectorTileLayer.js").default | import("../renderer/canvas/VectorImageLayer.js").default | import("../renderer/webgl/PointsLayer.js").default> extends Layer<VectorSourceType, RendererType> {
126
126
  /**
127
127
  * @param {Options<VectorSourceType>} [options] Options.
128
128
  */