ol 9.0.0-dev.1706800368740 → 9.0.0-dev.1706883666326
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/VectorTile.d.ts +2 -2
- package/VectorTile.d.ts.map +1 -1
- package/VectorTile.js +1 -1
- package/dist/ol.js +1 -1
- package/dist/ol.js.map +1 -1
- package/featureloader.d.ts +2 -2
- package/featureloader.d.ts.map +1 -1
- package/featureloader.js +1 -1
- package/format/Feature.d.ts +12 -4
- package/format/Feature.d.ts.map +1 -1
- package/format/Feature.js +7 -2
- package/format/GeoJSON.d.ts +4 -4
- package/format/GeoJSON.js +2 -2
- package/format/JSONFeature.d.ts +12 -2
- package/format/JSONFeature.d.ts.map +1 -1
- package/format/JSONFeature.js +4 -4
- package/format/MVT.d.ts +6 -6
- package/format/MVT.d.ts.map +1 -1
- package/format/MVT.js +4 -4
- package/format/TextFeature.d.ts +9 -0
- package/format/TextFeature.d.ts.map +1 -1
- package/format/XMLFeature.d.ts +9 -0
- package/format/XMLFeature.d.ts.map +1 -1
- package/layer/BaseVector.d.ts +2 -2
- package/layer/VectorTile.d.ts +2 -2
- package/package.json +1 -1
- package/source/OGCVectorTile.d.ts +1 -1
- package/source/Vector.d.ts +57 -57
- package/source/Vector.d.ts.map +1 -1
- package/source/Vector.js +46 -46
- package/source/VectorTile.d.ts +9 -7
- package/source/VectorTile.d.ts.map +1 -1
- package/source/VectorTile.js +5 -3
- package/util.js +1 -1
package/source/Vector.js
CHANGED
|
@@ -76,13 +76,13 @@ export class VectorSourceEvent extends Event {
|
|
|
76
76
|
*/
|
|
77
77
|
|
|
78
78
|
/**
|
|
79
|
-
* @template {import("../Feature.js").FeatureLike}
|
|
79
|
+
* @template {import("../Feature.js").FeatureLike} FeatureType
|
|
80
80
|
* @typedef {Object} Options
|
|
81
81
|
* @property {import("./Source.js").AttributionLike} [attributions] Attributions.
|
|
82
|
-
* @property {Array<
|
|
82
|
+
* @property {Array<FeatureType>|Collection<FeatureType>} [features]
|
|
83
83
|
* Features. If provided as {@link module:ol/Collection~Collection}, the features in the source
|
|
84
84
|
* and the collection will stay in sync.
|
|
85
|
-
* @property {import("../format/Feature.js").default} [format] The feature format used by the XHR
|
|
85
|
+
* @property {import("../format/Feature.js").default<import("../format/Feature.js").FeatureToFeatureClass<FeatureType>>} [format] The feature format used by the XHR
|
|
86
86
|
* feature loader when `url` is set. Required if `url` is set, otherwise ignored.
|
|
87
87
|
* @property {import("../featureloader.js").FeatureLoader} [loader]
|
|
88
88
|
* The loader function used to load features, from a remote source for example.
|
|
@@ -176,11 +176,11 @@ export class VectorSourceEvent extends Event {
|
|
|
176
176
|
*
|
|
177
177
|
* @fires VectorSourceEvent
|
|
178
178
|
* @api
|
|
179
|
-
* @template {import("../Feature.js").FeatureLike} [
|
|
179
|
+
* @template {import("../Feature.js").FeatureLike} [FeatureType=import("../Feature.js").default]
|
|
180
180
|
*/
|
|
181
181
|
class VectorSource extends Source {
|
|
182
182
|
/**
|
|
183
|
-
* @param {Options<
|
|
183
|
+
* @param {Options<FeatureType>} [options] Vector source options.
|
|
184
184
|
*/
|
|
185
185
|
constructor(options) {
|
|
186
186
|
options = options || {};
|
|
@@ -216,7 +216,7 @@ class VectorSource extends Source {
|
|
|
216
216
|
|
|
217
217
|
/**
|
|
218
218
|
* @private
|
|
219
|
-
* @type {import("../format/Feature.js").default
|
|
219
|
+
* @type {import("../format/Feature.js").default<import('../format/Feature.js').FeatureToFeatureClass<FeatureType>>|undefined}
|
|
220
220
|
*/
|
|
221
221
|
this.format_ = options.format;
|
|
222
222
|
|
|
@@ -255,7 +255,7 @@ class VectorSource extends Source {
|
|
|
255
255
|
|
|
256
256
|
/**
|
|
257
257
|
* @private
|
|
258
|
-
* @type {RBush<
|
|
258
|
+
* @type {RBush<FeatureType>}
|
|
259
259
|
*/
|
|
260
260
|
this.featuresRtree_ = useSpatialIndex ? new RBush() : null;
|
|
261
261
|
|
|
@@ -273,7 +273,7 @@ class VectorSource extends Source {
|
|
|
273
273
|
|
|
274
274
|
/**
|
|
275
275
|
* @private
|
|
276
|
-
* @type {!Object<string,
|
|
276
|
+
* @type {!Object<string, FeatureType>}
|
|
277
277
|
*/
|
|
278
278
|
this.nullGeometryFeatures_ = {};
|
|
279
279
|
|
|
@@ -287,7 +287,7 @@ class VectorSource extends Source {
|
|
|
287
287
|
/**
|
|
288
288
|
* A lookup of features by uid (using getUid(feature)).
|
|
289
289
|
* @private
|
|
290
|
-
* @type {!Object<string,
|
|
290
|
+
* @type {!Object<string, FeatureType>}
|
|
291
291
|
*/
|
|
292
292
|
this.uidIndex_ = {};
|
|
293
293
|
|
|
@@ -299,13 +299,13 @@ class VectorSource extends Source {
|
|
|
299
299
|
|
|
300
300
|
/**
|
|
301
301
|
* @private
|
|
302
|
-
* @type {Collection<
|
|
302
|
+
* @type {Collection<FeatureType>|null}
|
|
303
303
|
*/
|
|
304
304
|
this.featuresCollection_ = null;
|
|
305
305
|
|
|
306
|
-
/** @type {Collection<
|
|
306
|
+
/** @type {Collection<FeatureType>} */
|
|
307
307
|
let collection;
|
|
308
|
-
/** @type {Array<
|
|
308
|
+
/** @type {Array<FeatureType>} */
|
|
309
309
|
let features;
|
|
310
310
|
if (Array.isArray(options.features)) {
|
|
311
311
|
features = options.features;
|
|
@@ -333,7 +333,7 @@ class VectorSource extends Source {
|
|
|
333
333
|
* Note: this also applies if an {@link module:ol/Collection~Collection} is used for features,
|
|
334
334
|
* meaning that if a feature with a duplicate id is added in the collection, it will
|
|
335
335
|
* be removed from it right away.
|
|
336
|
-
* @param {
|
|
336
|
+
* @param {FeatureType} feature Feature to add.
|
|
337
337
|
* @api
|
|
338
338
|
*/
|
|
339
339
|
addFeature(feature) {
|
|
@@ -343,7 +343,7 @@ class VectorSource extends Source {
|
|
|
343
343
|
|
|
344
344
|
/**
|
|
345
345
|
* Add a feature without firing a `change` event.
|
|
346
|
-
* @param {
|
|
346
|
+
* @param {FeatureType} feature Feature.
|
|
347
347
|
* @protected
|
|
348
348
|
*/
|
|
349
349
|
addFeatureInternal(feature) {
|
|
@@ -375,7 +375,7 @@ class VectorSource extends Source {
|
|
|
375
375
|
|
|
376
376
|
/**
|
|
377
377
|
* @param {string} featureKey Unique identifier for the feature.
|
|
378
|
-
* @param {
|
|
378
|
+
* @param {FeatureType} feature The feature.
|
|
379
379
|
* @private
|
|
380
380
|
*/
|
|
381
381
|
setupChangeEvents_(featureKey, feature) {
|
|
@@ -395,7 +395,7 @@ class VectorSource extends Source {
|
|
|
395
395
|
|
|
396
396
|
/**
|
|
397
397
|
* @param {string} featureKey Unique identifier for the feature.
|
|
398
|
-
* @param {
|
|
398
|
+
* @param {FeatureType} feature The feature.
|
|
399
399
|
* @return {boolean} The feature is "valid", in the sense that it is also a
|
|
400
400
|
* candidate for insertion into the Rtree.
|
|
401
401
|
* @private
|
|
@@ -433,7 +433,7 @@ class VectorSource extends Source {
|
|
|
433
433
|
|
|
434
434
|
/**
|
|
435
435
|
* Add a batch of features to the source.
|
|
436
|
-
* @param {Array<
|
|
436
|
+
* @param {Array<FeatureType>} features Features to add.
|
|
437
437
|
* @api
|
|
438
438
|
*/
|
|
439
439
|
addFeatures(features) {
|
|
@@ -443,14 +443,14 @@ class VectorSource extends Source {
|
|
|
443
443
|
|
|
444
444
|
/**
|
|
445
445
|
* Add features without firing a `change` event.
|
|
446
|
-
* @param {Array<
|
|
446
|
+
* @param {Array<FeatureType>} features Features.
|
|
447
447
|
* @protected
|
|
448
448
|
*/
|
|
449
449
|
addFeaturesInternal(features) {
|
|
450
450
|
const extents = [];
|
|
451
|
-
/** @type {Array<
|
|
451
|
+
/** @type {Array<FeatureType>} */
|
|
452
452
|
const newFeatures = [];
|
|
453
|
-
/** @type Array<
|
|
453
|
+
/** @type Array<FeatureType> */
|
|
454
454
|
const geometryFeatures = [];
|
|
455
455
|
|
|
456
456
|
for (let i = 0, length = features.length; i < length; i++) {
|
|
@@ -489,7 +489,7 @@ class VectorSource extends Source {
|
|
|
489
489
|
}
|
|
490
490
|
|
|
491
491
|
/**
|
|
492
|
-
* @param {!Collection<
|
|
492
|
+
* @param {!Collection<FeatureType>} collection Collection.
|
|
493
493
|
* @private
|
|
494
494
|
*/
|
|
495
495
|
bindFeaturesCollection_(collection) {
|
|
@@ -497,7 +497,7 @@ class VectorSource extends Source {
|
|
|
497
497
|
this.addEventListener(
|
|
498
498
|
VectorEventType.ADDFEATURE,
|
|
499
499
|
/**
|
|
500
|
-
* @param {VectorSourceEvent<
|
|
500
|
+
* @param {VectorSourceEvent<FeatureType>} evt The vector source event
|
|
501
501
|
*/
|
|
502
502
|
function (evt) {
|
|
503
503
|
if (!modifyingCollection) {
|
|
@@ -510,7 +510,7 @@ class VectorSource extends Source {
|
|
|
510
510
|
this.addEventListener(
|
|
511
511
|
VectorEventType.REMOVEFEATURE,
|
|
512
512
|
/**
|
|
513
|
-
* @param {VectorSourceEvent<
|
|
513
|
+
* @param {VectorSourceEvent<FeatureType>} evt The vector source event
|
|
514
514
|
*/
|
|
515
515
|
function (evt) {
|
|
516
516
|
if (!modifyingCollection) {
|
|
@@ -523,7 +523,7 @@ class VectorSource extends Source {
|
|
|
523
523
|
collection.addEventListener(
|
|
524
524
|
CollectionEventType.ADD,
|
|
525
525
|
/**
|
|
526
|
-
* @param {import("../Collection.js").CollectionEvent<
|
|
526
|
+
* @param {import("../Collection.js").CollectionEvent<FeatureType>} evt The collection event
|
|
527
527
|
*/
|
|
528
528
|
(evt) => {
|
|
529
529
|
if (!modifyingCollection) {
|
|
@@ -536,7 +536,7 @@ class VectorSource extends Source {
|
|
|
536
536
|
collection.addEventListener(
|
|
537
537
|
CollectionEventType.REMOVE,
|
|
538
538
|
/**
|
|
539
|
-
* @param {import("../Collection.js").CollectionEvent<
|
|
539
|
+
* @param {import("../Collection.js").CollectionEvent<FeatureType>} evt The collection event
|
|
540
540
|
*/
|
|
541
541
|
(evt) => {
|
|
542
542
|
if (!modifyingCollection) {
|
|
@@ -596,7 +596,7 @@ class VectorSource extends Source {
|
|
|
596
596
|
* stop and the function will return the same value.
|
|
597
597
|
* Note: this function only iterate through the feature that have a defined geometry.
|
|
598
598
|
*
|
|
599
|
-
* @param {function(
|
|
599
|
+
* @param {function(FeatureType): T} callback Called with each feature
|
|
600
600
|
* on the source. Return a truthy value to stop iteration.
|
|
601
601
|
* @return {T|undefined} The return value from the last call to the callback.
|
|
602
602
|
* @template T
|
|
@@ -621,7 +621,7 @@ class VectorSource extends Source {
|
|
|
621
621
|
* called for all features.
|
|
622
622
|
*
|
|
623
623
|
* @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
|
|
624
|
-
* @param {function(
|
|
624
|
+
* @param {function(FeatureType): T} callback Called with each feature
|
|
625
625
|
* whose goemetry contains the provided coordinate.
|
|
626
626
|
* @return {T|undefined} The return value from the last call to the callback.
|
|
627
627
|
* @template T
|
|
@@ -653,7 +653,7 @@ class VectorSource extends Source {
|
|
|
653
653
|
* features, equivalent to {@link module:ol/source/Vector~VectorSource#forEachFeature #forEachFeature()}.
|
|
654
654
|
*
|
|
655
655
|
* @param {import("../extent.js").Extent} extent Extent.
|
|
656
|
-
* @param {function(
|
|
656
|
+
* @param {function(FeatureType): T} callback Called with each feature
|
|
657
657
|
* whose bounding box intersects the provided extent.
|
|
658
658
|
* @return {T|undefined} The return value from the last call to the callback.
|
|
659
659
|
* @template T
|
|
@@ -677,7 +677,7 @@ class VectorSource extends Source {
|
|
|
677
677
|
* {@link module:ol/source/Vector~VectorSource#forEachFeatureInExtent #forEachFeatureInExtent()} method instead.
|
|
678
678
|
*
|
|
679
679
|
* @param {import("../extent.js").Extent} extent Extent.
|
|
680
|
-
* @param {function(
|
|
680
|
+
* @param {function(FeatureType): T} callback Called with each feature
|
|
681
681
|
* whose geometry intersects the provided extent.
|
|
682
682
|
* @return {T|undefined} The return value from the last call to the callback.
|
|
683
683
|
* @template T
|
|
@@ -687,7 +687,7 @@ class VectorSource extends Source {
|
|
|
687
687
|
return this.forEachFeatureInExtent(
|
|
688
688
|
extent,
|
|
689
689
|
/**
|
|
690
|
-
* @param {
|
|
690
|
+
* @param {FeatureType} feature Feature.
|
|
691
691
|
* @return {T|undefined} The return value from the last call to the callback.
|
|
692
692
|
*/
|
|
693
693
|
function (feature) {
|
|
@@ -709,7 +709,7 @@ class VectorSource extends Source {
|
|
|
709
709
|
* Get the features collection associated with this source. Will be `null`
|
|
710
710
|
* unless the source was configured with `useSpatialIndex` set to `false`, or
|
|
711
711
|
* with an {@link module:ol/Collection~Collection} as `features`.
|
|
712
|
-
* @return {Collection<
|
|
712
|
+
* @return {Collection<FeatureType>|null} The collection of features.
|
|
713
713
|
* @api
|
|
714
714
|
*/
|
|
715
715
|
getFeaturesCollection() {
|
|
@@ -719,7 +719,7 @@ class VectorSource extends Source {
|
|
|
719
719
|
/**
|
|
720
720
|
* Get a snapshot of the features currently on the source in random order. The returned array
|
|
721
721
|
* is a copy, the features are references to the features in the source.
|
|
722
|
-
* @return {Array<
|
|
722
|
+
* @return {Array<FeatureType>} Features.
|
|
723
723
|
* @api
|
|
724
724
|
*/
|
|
725
725
|
getFeatures() {
|
|
@@ -760,7 +760,7 @@ class VectorSource extends Source {
|
|
|
760
760
|
* @param {import("../extent.js").Extent} extent Extent.
|
|
761
761
|
* @param {import("../proj/Projection.js").default} [projection] Include features
|
|
762
762
|
* where `extent` exceeds the x-axis bounds of `projection` and wraps around the world.
|
|
763
|
-
* @return {Array<
|
|
763
|
+
* @return {Array<FeatureType>} Features.
|
|
764
764
|
* @api
|
|
765
765
|
*/
|
|
766
766
|
getFeaturesInExtent(extent, projection) {
|
|
@@ -790,10 +790,10 @@ class VectorSource extends Source {
|
|
|
790
790
|
* `useSpatialIndex` set to `false` and the features in this source are of type
|
|
791
791
|
* {@link module:ol/Feature~Feature}.
|
|
792
792
|
* @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
|
|
793
|
-
* @param {function(
|
|
793
|
+
* @param {function(FeatureType):boolean} [filter] Feature filter function.
|
|
794
794
|
* The filter function will receive one argument, the {@link module:ol/Feature~Feature feature}
|
|
795
795
|
* and it should return a boolean value. By default, no filtering is made.
|
|
796
|
-
* @return {
|
|
796
|
+
* @return {FeatureType} Closest feature.
|
|
797
797
|
* @api
|
|
798
798
|
*/
|
|
799
799
|
getClosestFeatureToCoordinate(coordinate, filter) {
|
|
@@ -814,7 +814,7 @@ class VectorSource extends Source {
|
|
|
814
814
|
this.featuresRtree_.forEachInExtent(
|
|
815
815
|
extent,
|
|
816
816
|
/**
|
|
817
|
-
* @param {
|
|
817
|
+
* @param {FeatureType} feature Feature.
|
|
818
818
|
*/
|
|
819
819
|
function (feature) {
|
|
820
820
|
if (filter(feature)) {
|
|
@@ -865,13 +865,13 @@ class VectorSource extends Source {
|
|
|
865
865
|
* `source.getFeatureById(2)` will return a feature with id `'2'` or `2`.
|
|
866
866
|
*
|
|
867
867
|
* @param {string|number} id Feature identifier.
|
|
868
|
-
* @return {FeatureClassOrArrayOfRenderFeatures<
|
|
868
|
+
* @return {FeatureClassOrArrayOfRenderFeatures<FeatureType>|null} The feature (or `null` if not found).
|
|
869
869
|
* @api
|
|
870
870
|
*/
|
|
871
871
|
getFeatureById(id) {
|
|
872
872
|
const feature = this.idIndex_[id.toString()];
|
|
873
873
|
return feature !== undefined
|
|
874
|
-
? /** @type {FeatureClassOrArrayOfRenderFeatures<
|
|
874
|
+
? /** @type {FeatureClassOrArrayOfRenderFeatures<FeatureType>} */ (
|
|
875
875
|
feature
|
|
876
876
|
)
|
|
877
877
|
: null;
|
|
@@ -881,7 +881,7 @@ class VectorSource extends Source {
|
|
|
881
881
|
* Get a feature by its internal unique identifier (using `getUid`).
|
|
882
882
|
*
|
|
883
883
|
* @param {string} uid Feature identifier.
|
|
884
|
-
* @return {
|
|
884
|
+
* @return {FeatureType|null} The feature (or `null` if not found).
|
|
885
885
|
*/
|
|
886
886
|
getFeatureByUid(uid) {
|
|
887
887
|
const feature = this.uidIndex_[uid];
|
|
@@ -891,7 +891,7 @@ class VectorSource extends Source {
|
|
|
891
891
|
/**
|
|
892
892
|
* Get the format associated with this source.
|
|
893
893
|
*
|
|
894
|
-
* @return {import("../format/Feature.js").default
|
|
894
|
+
* @return {import("../format/Feature.js").default<import('../format/Feature.js').FeatureToFeatureClass<FeatureType>>|undefined} The feature format.
|
|
895
895
|
* @api
|
|
896
896
|
*/
|
|
897
897
|
getFormat() {
|
|
@@ -920,7 +920,7 @@ class VectorSource extends Source {
|
|
|
920
920
|
* @private
|
|
921
921
|
*/
|
|
922
922
|
handleFeatureChange_(event) {
|
|
923
|
-
const feature = /** @type {
|
|
923
|
+
const feature = /** @type {FeatureType} */ (event.target);
|
|
924
924
|
const featureKey = getUid(feature);
|
|
925
925
|
const geometry = feature.getGeometry();
|
|
926
926
|
if (!geometry) {
|
|
@@ -962,7 +962,7 @@ class VectorSource extends Source {
|
|
|
962
962
|
|
|
963
963
|
/**
|
|
964
964
|
* Returns true if the feature is contained within the source.
|
|
965
|
-
* @param {
|
|
965
|
+
* @param {FeatureType} feature Feature.
|
|
966
966
|
* @return {boolean} Has feature.
|
|
967
967
|
* @api
|
|
968
968
|
*/
|
|
@@ -1072,7 +1072,7 @@ class VectorSource extends Source {
|
|
|
1072
1072
|
* Remove a single feature from the source. If you want to remove all features
|
|
1073
1073
|
* at once, use the {@link module:ol/source/Vector~VectorSource#clear #clear()} method
|
|
1074
1074
|
* instead.
|
|
1075
|
-
* @param {
|
|
1075
|
+
* @param {FeatureType} feature Feature to remove.
|
|
1076
1076
|
* @api
|
|
1077
1077
|
*/
|
|
1078
1078
|
removeFeature(feature) {
|
|
@@ -1095,8 +1095,8 @@ class VectorSource extends Source {
|
|
|
1095
1095
|
|
|
1096
1096
|
/**
|
|
1097
1097
|
* Remove feature without firing a `change` event.
|
|
1098
|
-
* @param {
|
|
1099
|
-
* @return {
|
|
1098
|
+
* @param {FeatureType} feature Feature.
|
|
1099
|
+
* @return {FeatureType|undefined} The removed feature
|
|
1100
1100
|
* (or undefined if the feature was not found).
|
|
1101
1101
|
* @protected
|
|
1102
1102
|
*/
|
|
@@ -1122,7 +1122,7 @@ class VectorSource extends Source {
|
|
|
1122
1122
|
/**
|
|
1123
1123
|
* Remove a feature from the id index. Called internally when the feature id
|
|
1124
1124
|
* may have changed.
|
|
1125
|
-
* @param {
|
|
1125
|
+
* @param {FeatureType} feature The feature.
|
|
1126
1126
|
* @return {boolean} Removed the feature from the index.
|
|
1127
1127
|
* @private
|
|
1128
1128
|
*/
|
package/source/VectorTile.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export function defaultLoadFunction(tile: import("../VectorTile.js").default, url: string): void;
|
|
7
7
|
export default VectorTile;
|
|
8
|
-
export type Options = {
|
|
8
|
+
export type Options<FeatureType extends import("../Feature.js").FeatureLike> = {
|
|
9
9
|
/**
|
|
10
10
|
* Attributions.
|
|
11
11
|
*/
|
|
@@ -25,7 +25,7 @@ export type Options = {
|
|
|
25
25
|
/**
|
|
26
26
|
* Feature format for tiles. Used and required by the default.
|
|
27
27
|
*/
|
|
28
|
-
format?: import("../format/Feature.js").default<
|
|
28
|
+
format?: import("../format/Feature.js").default<import("../format/Feature.js").FeatureToFeatureClass<FeatureType>> | undefined;
|
|
29
29
|
/**
|
|
30
30
|
* This source may have overlapping geometries. Setting this
|
|
31
31
|
* to `false` (e.g. for sources with polygons that represent administrative
|
|
@@ -130,12 +130,13 @@ export type Options = {
|
|
|
130
130
|
zDirection?: number | import("../array.js").NearestDirectionFunction | undefined;
|
|
131
131
|
};
|
|
132
132
|
/**
|
|
133
|
+
* @template {import("../Feature.js").FeatureLike} FeatureType
|
|
133
134
|
* @typedef {Object} Options
|
|
134
135
|
* @property {import("./Source.js").AttributionLike} [attributions] Attributions.
|
|
135
136
|
* @property {boolean} [attributionsCollapsible=true] Attributions are collapsible.
|
|
136
137
|
* @property {number} [cacheSize] Initial tile cache size. Will auto-grow to hold at least twice the number of tiles in the viewport.
|
|
137
138
|
* @property {import("../extent.js").Extent} [extent] Extent.
|
|
138
|
-
* @property {import("../format/Feature.js").default} [format] Feature format for tiles. Used and required by the default.
|
|
139
|
+
* @property {import("../format/Feature.js").default<import("../format/Feature.js").FeatureToFeatureClass<FeatureType>>} [format] Feature format for tiles. Used and required by the default.
|
|
139
140
|
* @property {boolean} [overlaps=true] This source may have overlapping geometries. Setting this
|
|
140
141
|
* to `false` (e.g. for sources with polygons that represent administrative
|
|
141
142
|
* boundaries or TopoJSON sources) allows the renderer to optimise fill and
|
|
@@ -205,15 +206,16 @@ export type Options = {
|
|
|
205
206
|
*
|
|
206
207
|
* @fires import("./Tile.js").TileSourceEvent
|
|
207
208
|
* @api
|
|
209
|
+
* @template {import("../Feature.js").FeatureLike} [FeatureType=import("../Feature.js").default]
|
|
208
210
|
*/
|
|
209
|
-
declare class VectorTile extends UrlTile {
|
|
211
|
+
declare class VectorTile<FeatureType extends import("../Feature.js").FeatureLike = import("../Feature.js").default<import("../geom/Geometry.js").default>> extends UrlTile {
|
|
210
212
|
/**
|
|
211
|
-
* @param {!Options} options Vector tile options.
|
|
213
|
+
* @param {!Options<FeatureType>} options Vector tile options.
|
|
212
214
|
*/
|
|
213
|
-
constructor(options: Options);
|
|
215
|
+
constructor(options: Options<FeatureType>);
|
|
214
216
|
/**
|
|
215
217
|
* @private
|
|
216
|
-
* @type {import("../format/Feature.js").default
|
|
218
|
+
* @type {import("../format/Feature.js").default<import("../format/Feature.js").FeatureToFeatureClass<FeatureType>>|null}
|
|
217
219
|
*/
|
|
218
220
|
private format_;
|
|
219
221
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VectorTile.d.ts","sourceRoot":"","sources":["VectorTile.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"VectorTile.d.ts","sourceRoot":"","sources":["VectorTile.js"],"names":[],"mappings":"AA2eA;;;;GAIG;AACH,0CAHW,OAAO,kBAAkB,EAAE,OAAO,OAClC,MAAM,QAqBhB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAhea,OAAO,YAAY,EAAE,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAZjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG;AAEH;;;;;;;;;;;;;GAaG;AACH;IACE;;OAEG;IACH,qBAFY,QAAQ,WAAW,CAAC,EAkE/B;IA7BC;;;OAGG;IACH,gBAAqD;IAErD;;;OAGG;IACH,wBAAkE;IAElE;;;OAGG;IACH,kBAAwE;IAExE;;;OAGG;IACH,qBAFU,cAAc,kBAAkB,EAAE,OAAO,CAEU;IAE7D;;;OAGG;IACH,mBAAoB;IAGtB;;;;;;;;;;;OAWG;IACH,4BAJW,OAAO,cAAc,EAAE,MAAM,GAC5B,MAAM,OAAO,eAAe,EAAE,WAAW,CAAC,CAkCrD;IAED;;OAEG;IACH,eAFY,OAAO,CAIlB;IAgCD;;;;;OAKG;IACH,2BALW,MAAM,cACN,OAAO,oBAAoB,EAAE,OAAO,QACpC,gBAAgB,GACf,MAAM,OAAO,eAAe,EAAE,OAAO,CAAC,CA4FjD;IAED;;;;;;;OAOG;IACH,WAPW,MAAM,KACN,MAAM,KACN,MAAM,cACN,MAAM,cACN,OAAO,uBAAuB,EAAE,OAAO,GACrC,gBAAgB,CAyD5B;CAuEF;iBAlegB,kBAAkB;qBAEd,yBAAyB;oBAE1B,cAAc;6BACL,wBAAwB"}
|
package/source/VectorTile.js
CHANGED
|
@@ -22,12 +22,13 @@ import {loadFeaturesXhr} from '../featureloader.js';
|
|
|
22
22
|
import {toSize} from '../size.js';
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
|
+
* @template {import("../Feature.js").FeatureLike} FeatureType
|
|
25
26
|
* @typedef {Object} Options
|
|
26
27
|
* @property {import("./Source.js").AttributionLike} [attributions] Attributions.
|
|
27
28
|
* @property {boolean} [attributionsCollapsible=true] Attributions are collapsible.
|
|
28
29
|
* @property {number} [cacheSize] Initial tile cache size. Will auto-grow to hold at least twice the number of tiles in the viewport.
|
|
29
30
|
* @property {import("../extent.js").Extent} [extent] Extent.
|
|
30
|
-
* @property {import("../format/Feature.js").default} [format] Feature format for tiles. Used and required by the default.
|
|
31
|
+
* @property {import("../format/Feature.js").default<import("../format/Feature.js").FeatureToFeatureClass<FeatureType>>} [format] Feature format for tiles. Used and required by the default.
|
|
31
32
|
* @property {boolean} [overlaps=true] This source may have overlapping geometries. Setting this
|
|
32
33
|
* to `false` (e.g. for sources with polygons that represent administrative
|
|
33
34
|
* boundaries or TopoJSON sources) allows the renderer to optimise fill and
|
|
@@ -98,10 +99,11 @@ import {toSize} from '../size.js';
|
|
|
98
99
|
*
|
|
99
100
|
* @fires import("./Tile.js").TileSourceEvent
|
|
100
101
|
* @api
|
|
102
|
+
* @template {import("../Feature.js").FeatureLike} [FeatureType=import("../Feature.js").default]
|
|
101
103
|
*/
|
|
102
104
|
class VectorTile extends UrlTile {
|
|
103
105
|
/**
|
|
104
|
-
* @param {!Options} options Vector tile options.
|
|
106
|
+
* @param {!Options<FeatureType>} options Vector tile options.
|
|
105
107
|
*/
|
|
106
108
|
constructor(options) {
|
|
107
109
|
const projection = options.projection || 'EPSG:3857';
|
|
@@ -140,7 +142,7 @@ class VectorTile extends UrlTile {
|
|
|
140
142
|
|
|
141
143
|
/**
|
|
142
144
|
* @private
|
|
143
|
-
* @type {import("../format/Feature.js").default
|
|
145
|
+
* @type {import("../format/Feature.js").default<import("../format/Feature.js").FeatureToFeatureClass<FeatureType>>|null}
|
|
144
146
|
*/
|
|
145
147
|
this.format_ = options.format ? options.format : null;
|
|
146
148
|
|
package/util.js
CHANGED