ol 7.0.0-dev.1658948040055 → 7.0.0-dev.1658965458421

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/src/format/KML.js CHANGED
@@ -37,7 +37,7 @@ import {
37
37
  } from '../xml.js';
38
38
  import {asArray} from '../color.js';
39
39
  import {assert} from '../asserts.js';
40
- import {extend, includes} from '../array.js';
40
+ import {extend} from '../array.js';
41
41
  import {get as getProjection} from '../proj.js';
42
42
  import {
43
43
  readBoolean,
@@ -631,7 +631,7 @@ class KML extends XMLFeature {
631
631
  * @return {import("../Feature.js").default} Feature.
632
632
  */
633
633
  readFeatureFromNode(node, opt_options) {
634
- if (!includes(NAMESPACE_URIS, node.namespaceURI)) {
634
+ if (!NAMESPACE_URIS.includes(node.namespaceURI)) {
635
635
  return null;
636
636
  }
637
637
  const feature = this.readPlacemark_(node, [
@@ -651,7 +651,7 @@ class KML extends XMLFeature {
651
651
  * @return {Array<import("../Feature.js").default>} Features.
652
652
  */
653
653
  readFeaturesFromNode(node, opt_options) {
654
- if (!includes(NAMESPACE_URIS, node.namespaceURI)) {
654
+ if (!NAMESPACE_URIS.includes(node.namespaceURI)) {
655
655
  return [];
656
656
  }
657
657
  let features;
@@ -730,14 +730,14 @@ class KML extends XMLFeature {
730
730
  */
731
731
  readNameFromNode(node) {
732
732
  for (let n = node.firstElementChild; n; n = n.nextElementSibling) {
733
- if (includes(NAMESPACE_URIS, n.namespaceURI) && n.localName == 'name') {
733
+ if (NAMESPACE_URIS.includes(n.namespaceURI) && n.localName == 'name') {
734
734
  return readString(n);
735
735
  }
736
736
  }
737
737
  for (let n = node.firstElementChild; n; n = n.nextElementSibling) {
738
738
  const localName = n.localName;
739
739
  if (
740
- includes(NAMESPACE_URIS, n.namespaceURI) &&
740
+ NAMESPACE_URIS.includes(n.namespaceURI) &&
741
741
  (localName == 'Document' ||
742
742
  localName == 'Folder' ||
743
743
  localName == 'Placemark' ||
@@ -803,7 +803,7 @@ class KML extends XMLFeature {
803
803
  const networkLinks = [];
804
804
  for (let n = node.firstElementChild; n; n = n.nextElementSibling) {
805
805
  if (
806
- includes(NAMESPACE_URIS, n.namespaceURI) &&
806
+ NAMESPACE_URIS.includes(n.namespaceURI) &&
807
807
  n.localName == 'NetworkLink'
808
808
  ) {
809
809
  const obj = pushParseAndPop({}, NETWORK_LINK_PARSERS, n, []);
@@ -813,7 +813,7 @@ class KML extends XMLFeature {
813
813
  for (let n = node.firstElementChild; n; n = n.nextElementSibling) {
814
814
  const localName = n.localName;
815
815
  if (
816
- includes(NAMESPACE_URIS, n.namespaceURI) &&
816
+ NAMESPACE_URIS.includes(n.namespaceURI) &&
817
817
  (localName == 'Document' || localName == 'Folder' || localName == 'kml')
818
818
  ) {
819
819
  extend(networkLinks, this.readNetworkLinksFromNode(n));
@@ -867,7 +867,7 @@ class KML extends XMLFeature {
867
867
  readRegionFromNode(node) {
868
868
  const regions = [];
869
869
  for (let n = node.firstElementChild; n; n = n.nextElementSibling) {
870
- if (includes(NAMESPACE_URIS, n.namespaceURI) && n.localName == 'Region') {
870
+ if (NAMESPACE_URIS.includes(n.namespaceURI) && n.localName == 'Region') {
871
871
  const obj = pushParseAndPop({}, REGION_PARSERS, n, []);
872
872
  regions.push(obj);
873
873
  }
@@ -875,7 +875,7 @@ class KML extends XMLFeature {
875
875
  for (let n = node.firstElementChild; n; n = n.nextElementSibling) {
876
876
  const localName = n.localName;
877
877
  if (
878
- includes(NAMESPACE_URIS, n.namespaceURI) &&
878
+ NAMESPACE_URIS.includes(n.namespaceURI) &&
879
879
  (localName == 'Document' || localName == 'Folder' || localName == 'kml')
880
880
  ) {
881
881
  extend(regions, this.readRegionFromNode(n));
@@ -4,7 +4,7 @@
4
4
  import GML2 from './GML2.js';
5
5
  import XMLFeature from './XMLFeature.js';
6
6
  import {assign} from '../obj.js';
7
- import {extend, includes} from '../array.js';
7
+ import {extend} from '../array.js';
8
8
  import {makeArrayPusher, makeStructureNS, pushParseAndPop} from '../xml.js';
9
9
 
10
10
  /**
@@ -100,7 +100,7 @@ class WMSGetFeatureInfo extends XMLFeature {
100
100
  const toRemove = layerIdentifier;
101
101
  const layerName = layerElement.localName.replace(toRemove, '');
102
102
 
103
- if (this.layers_ && !includes(this.layers_, layerName)) {
103
+ if (this.layers_ && !this.layers_.includes(layerName)) {
104
104
  continue;
105
105
  }
106
106
 
@@ -32,7 +32,7 @@ import {
32
32
  squaredDistanceToSegment,
33
33
  } from '../coordinate.js';
34
34
  import {createEditingStyle} from '../style/Style.js';
35
- import {equals, includes} from '../array.js';
35
+ import {equals} from '../array.js';
36
36
  import {fromCircle} from '../geom/Polygon.js';
37
37
  import {
38
38
  fromUserCoordinate,
@@ -1190,7 +1190,7 @@ class Modify extends PointerInteraction {
1190
1190
  );
1191
1191
  if (
1192
1192
  geometry.getType() === 'Point' &&
1193
- includes(this.features_.getArray(), feature)
1193
+ this.features_.getArray().includes(feature)
1194
1194
  ) {
1195
1195
  hitPointGeometry = geometry;
1196
1196
  const coordinate = geometry.getFlatCoordinates().slice(0, 2);
@@ -4,12 +4,13 @@
4
4
  import Collection from '../Collection.js';
5
5
  import CollectionEventType from '../CollectionEventType.js';
6
6
  import Event from '../events/Event.js';
7
+ import Feature from '../Feature.js';
7
8
  import Interaction from './Interaction.js';
8
9
  import VectorLayer from '../layer/Vector.js';
9
10
  import {TRUE} from '../functions.js';
10
11
  import {clear} from '../obj.js';
11
12
  import {createEditingStyle} from '../style/Style.js';
12
- import {extend, includes} from '../array.js';
13
+ import {extend} from '../array.js';
13
14
  import {getUid} from '../util.js';
14
15
  import {never, shiftKeyOnly, singleClick} from '../events/condition.js';
15
16
 
@@ -26,11 +27,9 @@ const SelectEventType = {
26
27
  };
27
28
 
28
29
  /**
29
- * A function that takes an {@link module:ol/Feature~Feature} or
30
- * {@link module:ol/render/Feature~RenderFeature} and an
31
- * {@link module:ol/layer/Layer~Layer} and returns `true` if the feature may be
30
+ * A function that takes an {@link module:ol/Feature~Feature} and returns `true` if the feature may be
32
31
  * selected or `false` otherwise.
33
- * @typedef {function(import("../Feature.js").FeatureLike, import("../layer/Layer.js").default<import("../source/Source").default>):boolean} FilterFunction
32
+ * @typedef {function(import("../Feature.js").default, import("../layer/Layer.js").default<import("../source/Source").default>):boolean} FilterFunction
34
33
  */
35
34
 
36
35
  /**
@@ -258,7 +257,7 @@ class Select extends Interaction {
258
257
  } else {
259
258
  const layers = options.layers;
260
259
  layerFilter = function (layer) {
261
- return includes(layers, layer);
260
+ return layers.includes(layer);
262
261
  };
263
262
  }
264
263
  } else {
@@ -281,7 +280,7 @@ class Select extends Interaction {
281
280
  }
282
281
 
283
282
  /**
284
- * @param {import("../Feature.js").FeatureLike} feature Feature.
283
+ * @param {import("../Feature.js").default} feature Feature.
285
284
  * @param {import("../layer/Layer.js").default} layer Layer.
286
285
  * @private
287
286
  */
@@ -310,7 +309,7 @@ class Select extends Interaction {
310
309
  /**
311
310
  * Returns the associated {@link module:ol/layer/Vector~VectorLayer vector layer} of
312
311
  * a selected feature.
313
- * @param {import("../Feature.js").FeatureLike} feature Feature
312
+ * @param {import("../Feature.js").default} feature Feature
314
313
  * @return {import('../layer/Vector.js').default} Layer.
315
314
  * @api
316
315
  */
@@ -451,7 +450,7 @@ class Select extends Interaction {
451
450
  }
452
451
 
453
452
  /**
454
- * @param {import("../Feature.js").FeatureLike} feature Feature.
453
+ * @param {import("../Feature.js").default} feature Feature.
455
454
  * @private
456
455
  */
457
456
  removeFeatureLayerAssociation_(feature) {
@@ -475,8 +474,17 @@ class Select extends Interaction {
475
474
  const set = !add && !remove && !toggle;
476
475
  const map = mapBrowserEvent.map;
477
476
  const features = this.getFeatures();
477
+
478
+ /**
479
+ * @type {Array<import("../Feature.js").default>}
480
+ */
478
481
  const deselected = [];
482
+
483
+ /**
484
+ * @type {Array<import("../Feature.js").default>}
485
+ */
479
486
  const selected = [];
487
+
480
488
  if (set) {
481
489
  // Replace the currently selected feature(s) with the feature(s) at the
482
490
  // pixel, or clear the selected feature(s) if there is no feature at
@@ -490,11 +498,12 @@ class Select extends Interaction {
490
498
  * @return {boolean|undefined} Continue to iterate over the features.
491
499
  */
492
500
  function (feature, layer) {
493
- if (this.filter_(feature, layer)) {
494
- this.addFeatureLayerAssociation_(feature, layer);
495
- selected.push(feature);
496
- return !this.multi_;
501
+ if (!(feature instanceof Feature) || !this.filter_(feature, layer)) {
502
+ return;
497
503
  }
504
+ this.addFeatureLayerAssociation_(feature, layer);
505
+ selected.push(feature);
506
+ return !this.multi_;
498
507
  }.bind(this),
499
508
  {
500
509
  layerFilter: this.layerFilter_,
@@ -525,19 +534,20 @@ class Select extends Interaction {
525
534
  * @return {boolean|undefined} Continue to iterate over the features.
526
535
  */
527
536
  function (feature, layer) {
528
- if (this.filter_(feature, layer)) {
529
- if ((add || toggle) && !includes(features.getArray(), feature)) {
530
- this.addFeatureLayerAssociation_(feature, layer);
531
- selected.push(feature);
532
- } else if (
533
- (remove || toggle) &&
534
- includes(features.getArray(), feature)
535
- ) {
536
- deselected.push(feature);
537
- this.removeFeatureLayerAssociation_(feature);
538
- }
539
- return !this.multi_;
537
+ if (!(feature instanceof Feature) || !this.filter_(feature, layer)) {
538
+ return;
539
+ }
540
+ if ((add || toggle) && !features.getArray().includes(feature)) {
541
+ this.addFeatureLayerAssociation_(feature, layer);
542
+ selected.push(feature);
543
+ } else if (
544
+ (remove || toggle) &&
545
+ features.getArray().includes(feature)
546
+ ) {
547
+ deselected.push(feature);
548
+ this.removeFeatureLayerAssociation_(feature);
540
549
  }
550
+ return !this.multi_;
541
551
  }.bind(this),
542
552
  {
543
553
  layerFilter: this.layerFilter_,
@@ -7,7 +7,6 @@ import InteractionProperty from './Property.js';
7
7
  import PointerInteraction from './Pointer.js';
8
8
  import {TRUE} from '../functions.js';
9
9
  import {always} from '../events/condition.js';
10
- import {includes} from '../array.js';
11
10
 
12
11
  /**
13
12
  * @enum {string}
@@ -182,7 +181,7 @@ class Translate extends PointerInteraction {
182
181
  } else {
183
182
  const layers = options.layers;
184
183
  layerFilter = function (layer) {
185
- return includes(layers, layer);
184
+ return layers.includes(layer);
186
185
  };
187
186
  }
188
187
  } else {
@@ -347,7 +346,7 @@ class Translate extends PointerInteraction {
347
346
  pixel,
348
347
  function (feature, layer) {
349
348
  if (this.filter_(feature, layer)) {
350
- if (!this.features_ || includes(this.features_.getArray(), feature)) {
349
+ if (!this.features_ || this.features_.getArray().includes(feature)) {
351
350
  return feature;
352
351
  }
353
352
  }
@@ -9,7 +9,6 @@ import {DEFAULT_TILE_SIZE} from '../tilegrid/common.js';
9
9
  import {Versions} from '../format/IIIFInfo.js';
10
10
  import {assert} from '../asserts.js';
11
11
  import {getTopLeft} from '../extent.js';
12
- import {includes} from '../array.js';
13
12
  import {toSize} from '../size.js';
14
13
 
15
14
  /**
@@ -119,11 +118,11 @@ class IIIF extends TileImage {
119
118
  const supportsArbitraryTiling =
120
119
  supports != undefined &&
121
120
  Array.isArray(supports) &&
122
- (includes(supports, 'regionByPx') || includes(supports, 'regionByPct')) &&
123
- (includes(supports, 'sizeByWh') ||
124
- includes(supports, 'sizeByH') ||
125
- includes(supports, 'sizeByW') ||
126
- includes(supports, 'sizeByPct'));
121
+ (supports.includes('regionByPx') || supports.includes('regionByPct')) &&
122
+ (supports.includes('sizeByWh') ||
123
+ supports.includes('sizeByH') ||
124
+ supports.includes('sizeByW') ||
125
+ supports.includes('sizeByPct'));
127
126
 
128
127
  let tileWidth, tileHeight, maxZoom;
129
128
 
@@ -278,10 +277,10 @@ class IIIF extends TileImage {
278
277
  regionParam = 'full';
279
278
  } else if (
280
279
  !supportsArbitraryTiling ||
281
- includes(supports, 'regionByPx')
280
+ supports.includes('regionByPx')
282
281
  ) {
283
282
  regionParam = regionX + ',' + regionY + ',' + regionW + ',' + regionH;
284
- } else if (includes(supports, 'regionByPct')) {
283
+ } else if (supports.includes('regionByPct')) {
285
284
  const pctX = formatPercentage((regionX / width) * 100),
286
285
  pctY = formatPercentage((regionY / height) * 100),
287
286
  pctW = formatPercentage((regionW / width) * 100),
@@ -290,16 +289,16 @@ class IIIF extends TileImage {
290
289
  }
291
290
  if (
292
291
  version == Versions.VERSION3 &&
293
- (!supportsArbitraryTiling || includes(supports, 'sizeByWh'))
292
+ (!supportsArbitraryTiling || supports.includes('sizeByWh'))
294
293
  ) {
295
294
  sizeParam = sizeW + ',' + sizeH;
296
- } else if (!supportsArbitraryTiling || includes(supports, 'sizeByW')) {
295
+ } else if (!supportsArbitraryTiling || supports.includes('sizeByW')) {
297
296
  sizeParam = sizeW + ',';
298
- } else if (includes(supports, 'sizeByH')) {
297
+ } else if (supports.includes('sizeByH')) {
299
298
  sizeParam = ',' + sizeH;
300
- } else if (includes(supports, 'sizeByWh')) {
299
+ } else if (supports.includes('sizeByWh')) {
301
300
  sizeParam = sizeW + ',' + sizeH;
302
- } else if (includes(supports, 'sizeByPct')) {
301
+ } else if (supports.includes('sizeByPct')) {
303
302
  sizeParam = 'pct:' + formatPercentage(100 / scale);
304
303
  }
305
304
  } else {
@@ -9,7 +9,7 @@ import {containsExtent} from '../extent.js';
9
9
  import {createFromCapabilitiesMatrixSet} from '../tilegrid/WMTS.js';
10
10
  import {createFromTileUrlFunctions, expandUrl} from '../tileurlfunction.js';
11
11
  import {equivalent, get as getProjection, transformExtent} from '../proj.js';
12
- import {find, findIndex, includes} from '../array.js';
12
+ import {find, findIndex} from '../array.js';
13
13
 
14
14
  /**
15
15
  * Request encoding. One of 'KVP', 'REST'.
@@ -566,7 +566,7 @@ export function optionsFromCapabilities(wmtsCap, config) {
566
566
  requestEncoding = encodings[0];
567
567
  }
568
568
  if (requestEncoding === 'KVP') {
569
- if (includes(encodings, 'KVP')) {
569
+ if (encodings.includes('KVP')) {
570
570
  urls.push(/** @type {string} */ (gets[i]['href']));
571
571
  }
572
572
  } else {
package/util.js CHANGED
@@ -31,5 +31,5 @@ export function getUid(obj) {
31
31
  * OpenLayers version.
32
32
  * @type {string}
33
33
  */
34
- export var VERSION = '7.0.0-dev.1658948040055';
34
+ export var VERSION = '7.0.0-dev.1658965458421';
35
35
  //# sourceMappingURL=util.js.map