azure-maps-control 2.2.6 → 2.3.0
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/dist/atlas-core-bare-snr.js +566 -259
- package/dist/atlas-core-bare.js +576 -269
- package/dist/atlas-core-bare.min.js +1 -1
- package/dist/atlas-core-snr.js +600 -436
- package/dist/atlas-core.js +610 -446
- package/dist/atlas-core.min.js +1 -1
- package/dist/atlas.css +6 -3
- package/dist/atlas.js +610 -446
- package/dist/atlas.min.css +1 -1
- package/dist/atlas.min.js +1 -1
- package/package.json +3 -2
- package/thirdpartynotices.txt +0 -0
- package/typings/index.d.ts +13 -0
|
@@ -265,7 +265,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
265
265
|
return Url;
|
|
266
266
|
}());
|
|
267
267
|
|
|
268
|
-
var version = "2.
|
|
268
|
+
var version = "2.3.0";
|
|
269
269
|
|
|
270
270
|
/**
|
|
271
271
|
* A helper class that provides methods for getting various forms of the map controls current version.
|
|
@@ -645,7 +645,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
645
645
|
* Build the outermost container for the control, applies styling including any listeners for auto styling.
|
|
646
646
|
*/
|
|
647
647
|
ControlBase.prototype.buildContainer = function (map, style, ariaLabel, tagName) {
|
|
648
|
-
var _this = this;
|
|
649
648
|
this._map = map;
|
|
650
649
|
this._container = document.createElement(tagName || "div");
|
|
651
650
|
this._container.classList.add("azure-maps-control-container");
|
|
@@ -654,11 +653,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
654
653
|
}
|
|
655
654
|
// Set the style or add the auto listener.
|
|
656
655
|
if (style.toLowerCase() === exports.ControlStyle.auto) {
|
|
657
|
-
this._map
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
}
|
|
661
|
-
});
|
|
656
|
+
if (this._map) {
|
|
657
|
+
this._map.events.add("stylechanged", this._onStyleChange);
|
|
658
|
+
}
|
|
662
659
|
}
|
|
663
660
|
else {
|
|
664
661
|
this._container.classList.add(style);
|
|
@@ -4436,6 +4433,12 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
4436
4433
|
_this.hasFocus = false;
|
|
4437
4434
|
_this.styleButtons = new Dictionary();
|
|
4438
4435
|
_this.styleIcons = new Dictionary();
|
|
4436
|
+
// we need to rely on this to avoid potentially redundant thumbnail requests and .blob calls
|
|
4437
|
+
_this.thumbnailCache = {
|
|
4438
|
+
assumedConfiguration: undefined,
|
|
4439
|
+
response: new Dictionary(),
|
|
4440
|
+
blob: new Dictionary()
|
|
4441
|
+
};
|
|
4439
4442
|
/**
|
|
4440
4443
|
* Callback handler for the style changing.
|
|
4441
4444
|
*/
|
|
@@ -4449,6 +4452,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
4449
4452
|
if (!_this.styleOpsGrid) {
|
|
4450
4453
|
return;
|
|
4451
4454
|
}
|
|
4455
|
+
// do not recreate the styleOpsGrid if it is initialized and configuration object reference has not changed
|
|
4456
|
+
if (_this.styleOpsGrid.children.length > 0 && _this.thumbnailCache.assumedConfiguration === definitions) {
|
|
4457
|
+
return;
|
|
4458
|
+
}
|
|
4459
|
+
_this.thumbnailCache.assumedConfiguration = definitions;
|
|
4452
4460
|
Array.from(_this.styleOpsGrid.children).forEach(function (element) { return element.remove(); });
|
|
4453
4461
|
_this.styleButtons.clear();
|
|
4454
4462
|
_this.populateOpsGridFromDefinitions(definitions);
|
|
@@ -4554,6 +4562,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
4554
4562
|
_super.prototype.onRemove.call(this);
|
|
4555
4563
|
this.styleOpsGrid = null;
|
|
4556
4564
|
this.styleButtons.clear();
|
|
4565
|
+
this.thumbnailCache.response.clear();
|
|
4566
|
+
this.thumbnailCache.blob.clear();
|
|
4567
|
+
this.thumbnailCache.assumedConfiguration = undefined;
|
|
4557
4568
|
this.map.events.remove("stylechanged", this.onStyleChange);
|
|
4558
4569
|
this.map.events.remove("mapconfigurationchanged", this.onMapConfigurationChange);
|
|
4559
4570
|
};
|
|
@@ -4613,7 +4624,18 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
4613
4624
|
styleOptionButton.setAttribute("type", "button");
|
|
4614
4625
|
var styleIconImage = new Image();
|
|
4615
4626
|
fetchIconPromise
|
|
4616
|
-
.then(function (response) {
|
|
4627
|
+
.then(function (response) {
|
|
4628
|
+
if (_this.thumbnailCache.blob.has(response.url)) {
|
|
4629
|
+
return _this.thumbnailCache.blob.get(response.url);
|
|
4630
|
+
}
|
|
4631
|
+
else {
|
|
4632
|
+
// we need the response.clone() to allow reading over body multiple times since response objects are cached
|
|
4633
|
+
// and can be reused across multiple invocations
|
|
4634
|
+
var blobPromise = response.clone().blob();
|
|
4635
|
+
_this.thumbnailCache.blob.set(response.url, blobPromise);
|
|
4636
|
+
return blobPromise;
|
|
4637
|
+
}
|
|
4638
|
+
})
|
|
4617
4639
|
.then(function (blob) {
|
|
4618
4640
|
var iconUrl = URL.createObjectURL(blob);
|
|
4619
4641
|
styleIconImage.src = iconUrl;
|
|
@@ -4721,7 +4743,14 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
4721
4743
|
if (mapServiceOptions.transformRequest) {
|
|
4722
4744
|
merge_1(requestParams, mapServiceOptions.transformRequest(requestParams.url, "Thumbnail"));
|
|
4723
4745
|
}
|
|
4724
|
-
var fetchThumbnailPromise
|
|
4746
|
+
var fetchThumbnailPromise;
|
|
4747
|
+
if (_this.thumbnailCache.response.has(requestParams.url)) {
|
|
4748
|
+
fetchThumbnailPromise = Promise.resolve(_this.thumbnailCache.response.get(requestParams.url));
|
|
4749
|
+
}
|
|
4750
|
+
else {
|
|
4751
|
+
fetchThumbnailPromise = fetch(requestParams.url, { headers: requestParams.headers });
|
|
4752
|
+
_this.thumbnailCache.response.set(requestParams.url, fetchThumbnailPromise);
|
|
4753
|
+
}
|
|
4725
4754
|
// Add button for each style
|
|
4726
4755
|
var styleOptionButton = _this.buildSelectStyleBtn(style.name, definitions, fetchThumbnailPromise);
|
|
4727
4756
|
_this.styleOpsGrid.appendChild(styleOptionButton);
|
|
@@ -9999,7 +10028,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
9999
10028
|
};
|
|
10000
10029
|
ZoomControl.prototype.updateZoomButtonsState = function () {
|
|
10001
10030
|
var zoomInDisabled = this.map.getCamera().zoom >= this.map._getMap().getMaxZoom();
|
|
10002
|
-
// small values need special handling, since depending on the height of the map view
|
|
10031
|
+
// small values need special handling, since depending on the height of the map view
|
|
10003
10032
|
// the actual zoom we can zoom out to can be above or below 0 when the entire map fits the height into the view
|
|
10004
10033
|
// use web mercator bounds to check if entire latitude range is visible
|
|
10005
10034
|
var reachedLatitudeBoundaries = BoundingBox.getSouth(this.map.getCamera().bounds) <= -WEBMERCATOR_MAXLAT
|
|
@@ -10011,7 +10040,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
10011
10040
|
}
|
|
10012
10041
|
if (this.zoomOutButton && this.zoomOutButton.disabled != zoomOutDisabled) {
|
|
10013
10042
|
this.zoomOutButton.disabled = zoomOutDisabled;
|
|
10014
|
-
this.
|
|
10043
|
+
this.zoomOutButton.setAttribute("aria-label", zoomInDisabled ? "Zoom Out disabled" : "Zoom Out");
|
|
10015
10044
|
}
|
|
10016
10045
|
};
|
|
10017
10046
|
ZoomControl.prototype.constructZoomInButton = function (map) {
|
|
@@ -10283,19 +10312,24 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
10283
10312
|
* Get reference to Mapbox Map
|
|
10284
10313
|
* @internal
|
|
10285
10314
|
*/
|
|
10286
|
-
Source.prototype._setMap = function (map) {
|
|
10315
|
+
Source.prototype._setMap = function (map, shouldInvokeEvent) {
|
|
10316
|
+
if (shouldInvokeEvent === void 0) { shouldInvokeEvent = true; }
|
|
10287
10317
|
if (map == null || map === undefined) {
|
|
10288
10318
|
var temp = this.map;
|
|
10289
10319
|
delete this.map;
|
|
10290
|
-
|
|
10291
|
-
|
|
10292
|
-
temp
|
|
10320
|
+
if (shouldInvokeEvent) {
|
|
10321
|
+
this._invokeEvent("sourceremoved", this);
|
|
10322
|
+
if (temp) {
|
|
10323
|
+
temp.events.invoke("sourceremoved", this);
|
|
10324
|
+
}
|
|
10293
10325
|
}
|
|
10294
10326
|
}
|
|
10295
10327
|
else {
|
|
10296
10328
|
this.map = map;
|
|
10297
|
-
|
|
10298
|
-
|
|
10329
|
+
if (shouldInvokeEvent) {
|
|
10330
|
+
this._invokeEvent("sourceadded", this);
|
|
10331
|
+
this.map.events.invoke("sourceadded", this);
|
|
10332
|
+
}
|
|
10299
10333
|
}
|
|
10300
10334
|
};
|
|
10301
10335
|
return Source;
|
|
@@ -10616,6 +10650,27 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
10616
10650
|
}
|
|
10617
10651
|
return geoJsonSource;
|
|
10618
10652
|
};
|
|
10653
|
+
DataSource.prototype._isDeepEqual = function (other) {
|
|
10654
|
+
if (this.constructor !== other.constructor) {
|
|
10655
|
+
return false;
|
|
10656
|
+
}
|
|
10657
|
+
var source = this._buildSource();
|
|
10658
|
+
var otherSource = other._buildSource();
|
|
10659
|
+
return source.type === otherSource.type &&
|
|
10660
|
+
// no data comparison since it is costly and not needed. If geojson data is different, but other source properties are same, we treat it as an update.
|
|
10661
|
+
//source.data === otherSource.data &&
|
|
10662
|
+
source.maxzoom === otherSource.maxzoom &&
|
|
10663
|
+
source.cluster === otherSource.cluster &&
|
|
10664
|
+
source.clusterRadius === otherSource.clusterRadius &&
|
|
10665
|
+
source.tolerance === otherSource.tolerance &&
|
|
10666
|
+
source.lineMetrics === otherSource.lineMetrics &&
|
|
10667
|
+
JSON.stringify(source.clusterProperties) === JSON.stringify(otherSource.clusterProperties) &&
|
|
10668
|
+
source.buffer === otherSource.buffer &&
|
|
10669
|
+
source.clusterMinPoints === otherSource.clusterMinPoints &&
|
|
10670
|
+
source.generateId === otherSource.generateId &&
|
|
10671
|
+
source.promoteId === otherSource.promoteId &&
|
|
10672
|
+
source.filter === otherSource.filter;
|
|
10673
|
+
};
|
|
10619
10674
|
/**
|
|
10620
10675
|
* @internal
|
|
10621
10676
|
*/
|
|
@@ -10897,6 +10952,26 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
10897
10952
|
}
|
|
10898
10953
|
return vectorSource;
|
|
10899
10954
|
};
|
|
10955
|
+
/**
|
|
10956
|
+
* @internal
|
|
10957
|
+
*/
|
|
10958
|
+
VectorTileSource.prototype._isDeepEqual = function (other) {
|
|
10959
|
+
if (this.constructor !== other.constructor) {
|
|
10960
|
+
return false;
|
|
10961
|
+
}
|
|
10962
|
+
var source = this._buildSource();
|
|
10963
|
+
var otherSource = other._buildSource();
|
|
10964
|
+
return source.type === otherSource.type &&
|
|
10965
|
+
source.url === otherSource.url &&
|
|
10966
|
+
((source.tiles === undefined && otherSource.tiles === undefined) ||
|
|
10967
|
+
(source.tiles && otherSource.tiles && source.tiles.length === otherSource.tiles.length && source.tiles.every(function (value, idx) { return value === otherSource.tiles[idx]; }))) &&
|
|
10968
|
+
source.minzoom === otherSource.minzoom &&
|
|
10969
|
+
source.maxzoom === otherSource.maxzoom &&
|
|
10970
|
+
source.bounds === otherSource.bounds &&
|
|
10971
|
+
source.attribution === otherSource.attribution &&
|
|
10972
|
+
source.promoteId === otherSource.promoteId &&
|
|
10973
|
+
source.scheme === otherSource.scheme;
|
|
10974
|
+
};
|
|
10900
10975
|
return VectorTileSource;
|
|
10901
10976
|
}(Source));
|
|
10902
10977
|
|
|
@@ -11188,11 +11263,41 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
11188
11263
|
/**
|
|
11189
11264
|
* @internal
|
|
11190
11265
|
* Specifies whether to create focusable indicators for the bubbles.
|
|
11266
|
+
* The default highlighting style is provided if the source is DataSource with Shape:
|
|
11267
|
+
* ```ts
|
|
11268
|
+
* const datasource = new DataSource('bubble-source');
|
|
11269
|
+
* datasource.setShapes([new Shape(new Point([-122.335, 47.62]))]);
|
|
11270
|
+
* this.map.sources.add(datasource);
|
|
11271
|
+
* const layer = new BubbleLayer(datasource, 'bubble', {
|
|
11272
|
+
* radius: 10,
|
|
11273
|
+
* color: 'cyan',
|
|
11274
|
+
* createIndicators: true,
|
|
11275
|
+
* });
|
|
11276
|
+
* ```
|
|
11277
|
+
*
|
|
11278
|
+
* For other sources, you can provide the accessibilityIdKey option to specify the property name of the feature to use as the accessibility id.
|
|
11279
|
+
* ```ts
|
|
11280
|
+
* const vtSource = new VectorTileSource("indoorTiles", { tiles, // provide your tile urls });
|
|
11281
|
+
* this.map.sources.add(vtSource);
|
|
11282
|
+
* const layer = new BubbleLayer(vtSource, 'bubble', {
|
|
11283
|
+
* createIndicators: true,
|
|
11284
|
+
* accessibilityIdKey: '{add your ID here}'
|
|
11285
|
+
* });
|
|
11286
|
+
* ```
|
|
11287
|
+
*
|
|
11288
|
+
* If you want to customize the highlighting style, you can use the focusin/focusout events to change the style of the bubble.
|
|
11289
|
+
* ```ts
|
|
11290
|
+
* this.map.events.add('focusin', 'bubble', (e) => { handle the style highlight });
|
|
11291
|
+
* ```
|
|
11191
11292
|
*
|
|
11192
11293
|
* Note: We treat this as an internal option for now because we hadn't fully decided the default styling for the indicators.
|
|
11193
11294
|
* Once we decide, we will make this a public option or remove it.
|
|
11194
11295
|
*/
|
|
11195
11296
|
_this.createIndicators = false;
|
|
11297
|
+
/**
|
|
11298
|
+
* @internal
|
|
11299
|
+
*/
|
|
11300
|
+
_this.accessibilityIdKey = undefined;
|
|
11196
11301
|
return _this;
|
|
11197
11302
|
}
|
|
11198
11303
|
return BubbleLayerOptions;
|
|
@@ -11265,6 +11370,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
11265
11370
|
}
|
|
11266
11371
|
return ar;
|
|
11267
11372
|
};
|
|
11373
|
+
var __spreadArray = (window && window.__spreadArray) || function (to, from) {
|
|
11374
|
+
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
11375
|
+
to[j] = from[i];
|
|
11376
|
+
return to;
|
|
11377
|
+
};
|
|
11268
11378
|
/**
|
|
11269
11379
|
* Renders Point objects as scalable circles (bubbles).
|
|
11270
11380
|
*/
|
|
@@ -11279,45 +11389,60 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
11279
11389
|
function BubbleLayer(source, id, options) {
|
|
11280
11390
|
var _this = _super.call(this, id) || this;
|
|
11281
11391
|
_this.accessibleIndicator = [];
|
|
11282
|
-
|
|
11283
|
-
|
|
11392
|
+
/** @internal */
|
|
11393
|
+
_this._setAccessibleIndicator = function () { return __awaiter$1(_this, void 0, void 0, function () {
|
|
11394
|
+
var renderedShapes, accessibilityIdKey, createIndicator, insertHiddenBefore, insertHiddenInFront, attach;
|
|
11284
11395
|
var _this = this;
|
|
11285
11396
|
return __generator$1(this, function (_a) {
|
|
11286
11397
|
this.accessibleIndicator.forEach(function (indicator) { return indicator.remove(); });
|
|
11287
11398
|
this.accessibleIndicator = [];
|
|
11288
|
-
|
|
11289
|
-
|
|
11290
|
-
|
|
11291
|
-
var
|
|
11399
|
+
renderedShapes = this.map.layers.getRenderedShapes(this.map.getCamera().bounds, this);
|
|
11400
|
+
accessibilityIdKey = this.options.accessibilityIdKey || (this._getDataSource() ? Shape._shapeIdPropName : undefined);
|
|
11401
|
+
createIndicator = function (renderedShapes, idx) {
|
|
11402
|
+
var curRenderedShape = renderedShapes[idx];
|
|
11403
|
+
var bubbleFeature = curRenderedShape instanceof Shape ? curRenderedShape.toJson() : curRenderedShape;
|
|
11404
|
+
var indicator = new AccessibleIndicator({ positionInSet: idx + 1, setSize: renderedShapes.length });
|
|
11292
11405
|
var element = indicator.getElement();
|
|
11293
|
-
var _a = __read$3(_this.map.positionsToPixels([bubbleFeature.
|
|
11406
|
+
var _a = __read$3(_this.map.positionsToPixels([_this.getFirstCoordinate(bubbleFeature.geometry.coordinates)]), 1), pixel = _a[0];
|
|
11294
11407
|
element.addEventListener('focusin', function (event) {
|
|
11295
|
-
_this.accessibleIndicator.filter(function (
|
|
11408
|
+
_this.accessibleIndicator.filter(function (i) { return i !== indicator; }).forEach(function (indicator) { return indicator.remove(); });
|
|
11296
11409
|
// insert previous and next popups
|
|
11297
11410
|
if (idx - 1 >= 0) {
|
|
11298
|
-
insertHiddenBefore(indicator, createIndicator(
|
|
11411
|
+
insertHiddenBefore(indicator, createIndicator(renderedShapes, idx - 1));
|
|
11412
|
+
}
|
|
11413
|
+
if (idx + 1 < renderedShapes.length) {
|
|
11414
|
+
attach(createIndicator(renderedShapes, idx + 1));
|
|
11299
11415
|
}
|
|
11300
|
-
if
|
|
11301
|
-
|
|
11416
|
+
// if we are on boundaries: add the first / last indicator
|
|
11417
|
+
// to maintain indicators on full page navigation cycle
|
|
11418
|
+
if (idx >= 2 && idx == renderedShapes.length - 1) {
|
|
11419
|
+
insertHiddenInFront(createIndicator(renderedShapes, 0));
|
|
11420
|
+
}
|
|
11421
|
+
if (idx == 0 && renderedShapes.length >= 2) {
|
|
11422
|
+
attach(createIndicator(renderedShapes, renderedShapes.length - 1));
|
|
11423
|
+
}
|
|
11424
|
+
if (accessibilityIdKey !== undefined) {
|
|
11425
|
+
_this.map._getMap().setPaintProperty(_this.id, 'circle-stroke-color', ['case', ['==', ['get', accessibilityIdKey], bubbleFeature.properties[accessibilityIdKey]], '#000000', _this.options.strokeColor]);
|
|
11302
11426
|
}
|
|
11303
|
-
_this.map._getMap().setPaintProperty(_this.id, 'circle-stroke-color', ['case', ['==', ['get', '_azureMapsShapeId'], bubbleFeature.data.id], '#000000', _this.options.strokeColor]);
|
|
11304
11427
|
var focusEvent = {
|
|
11305
11428
|
target: element,
|
|
11306
11429
|
type: 'focusin',
|
|
11307
11430
|
map: _this.map,
|
|
11308
|
-
shape:
|
|
11431
|
+
shape: curRenderedShape,
|
|
11309
11432
|
originalEvent: event,
|
|
11310
11433
|
pixel: pixel
|
|
11311
11434
|
};
|
|
11312
11435
|
_this._invokeEvent('focusin', focusEvent);
|
|
11313
11436
|
});
|
|
11314
11437
|
element.addEventListener('focusout', function (event) {
|
|
11315
|
-
|
|
11438
|
+
if (accessibilityIdKey !== undefined) {
|
|
11439
|
+
_this.map._getMap().setPaintProperty(_this.id, 'circle-stroke-color', ['case', ['==', ['get', accessibilityIdKey], bubbleFeature.properties[accessibilityIdKey]], _this.options.strokeColor, _this.options.strokeColor]);
|
|
11440
|
+
}
|
|
11316
11441
|
var focusEvent = {
|
|
11317
11442
|
target: element,
|
|
11318
11443
|
type: 'focusout',
|
|
11319
11444
|
map: _this.map,
|
|
11320
|
-
shape:
|
|
11445
|
+
shape: curRenderedShape,
|
|
11321
11446
|
originalEvent: event,
|
|
11322
11447
|
pixel: pixel
|
|
11323
11448
|
};
|
|
@@ -11332,14 +11457,20 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
11332
11457
|
var baseElement = base.getElement();
|
|
11333
11458
|
baseElement.parentElement.insertBefore(elementToSwapIn, baseElement);
|
|
11334
11459
|
};
|
|
11460
|
+
insertHiddenInFront = function (toInsert) {
|
|
11461
|
+
toInsert.attach(_this.map);
|
|
11462
|
+
var elementToSwapIn = toInsert.getElement();
|
|
11463
|
+
var parent = elementToSwapIn.parentElement;
|
|
11464
|
+
parent.insertBefore(elementToSwapIn, parent.firstElementChild);
|
|
11465
|
+
};
|
|
11335
11466
|
attach = function (popup) {
|
|
11336
11467
|
popup.attach(_this.map);
|
|
11337
11468
|
};
|
|
11338
|
-
if (
|
|
11339
|
-
attach(createIndicator(
|
|
11469
|
+
if (renderedShapes.length > 0) {
|
|
11470
|
+
attach(createIndicator(renderedShapes, 0));
|
|
11340
11471
|
}
|
|
11341
|
-
if (
|
|
11342
|
-
attach(createIndicator(
|
|
11472
|
+
if (renderedShapes.length > 1) {
|
|
11473
|
+
attach(createIndicator(renderedShapes, renderedShapes.length - 1));
|
|
11343
11474
|
}
|
|
11344
11475
|
return [2 /*return*/];
|
|
11345
11476
|
});
|
|
@@ -11392,18 +11523,71 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
11392
11523
|
this.options = newOptions;
|
|
11393
11524
|
};
|
|
11394
11525
|
BubbleLayer.prototype.onAdd = function (map) {
|
|
11526
|
+
var _this = this;
|
|
11395
11527
|
_super.prototype.onAdd.call(this, map);
|
|
11396
11528
|
if (this.options.createIndicators) {
|
|
11397
|
-
map
|
|
11398
|
-
map.events.
|
|
11529
|
+
// Wait for map idle for the first time to ensure `layer.getRenderedShapes` return correct shapes.
|
|
11530
|
+
map.events.addOnce('idle', this._setAccessibleIndicator);
|
|
11531
|
+
// The rendered shapes may be changed when map is moved. Update the indicators when map is moved.
|
|
11532
|
+
map.events.add('moveend', this._setAccessibleIndicator);
|
|
11533
|
+
var dataSource = this._getDataSource();
|
|
11534
|
+
if (dataSource) {
|
|
11535
|
+
// The rendered shapes may be changed when data is added. Update the indicators when data is added.
|
|
11536
|
+
map.events.add('dataadded', dataSource, function () {
|
|
11537
|
+
// Wait for map idle to ensure `layer.getRenderedShapes` return correct shapes.
|
|
11538
|
+
map.events.addOnce('idle', _this._setAccessibleIndicator);
|
|
11539
|
+
});
|
|
11540
|
+
}
|
|
11541
|
+
else {
|
|
11542
|
+
var sourceId_1 = typeof this.options.source === 'string' ? this.options.source : this.options.source.getId();
|
|
11543
|
+
map.events.add('sourcedata', function (mapDataEvent) {
|
|
11544
|
+
var _a;
|
|
11545
|
+
// There's chances that mapDataEvent.isSourceLoaded doesn't update correctly when using flyTo, thus we check by using map.isSourceLoaded.
|
|
11546
|
+
if (((_a = mapDataEvent.source) === null || _a === void 0 ? void 0 : _a.getId()) === sourceId_1 && map._getMap().isSourceLoaded(sourceId_1)) {
|
|
11547
|
+
// Source event will be fired multiple times, and we are only interested when the source is loaded.
|
|
11548
|
+
// Thus design a cache key that only changed when camera & style properties are changed.
|
|
11549
|
+
var curCacheKey = _this._getSourceDataEventCacheKey();
|
|
11550
|
+
if (curCacheKey !== _this.sourceDataEventCacheKey) {
|
|
11551
|
+
_this._setAccessibleIndicator();
|
|
11552
|
+
_this.sourceDataEventCacheKey = curCacheKey;
|
|
11553
|
+
}
|
|
11554
|
+
}
|
|
11555
|
+
});
|
|
11556
|
+
}
|
|
11399
11557
|
}
|
|
11400
11558
|
};
|
|
11401
11559
|
BubbleLayer.prototype.onRemove = function () {
|
|
11402
|
-
_super.prototype.onRemove.call(this);
|
|
11403
11560
|
if (this.options.createIndicators) {
|
|
11404
|
-
this.map.events.remove('idle', this.
|
|
11405
|
-
this.map.events.remove('moveend', this.
|
|
11561
|
+
this.map.events.remove('idle', this._setAccessibleIndicator);
|
|
11562
|
+
this.map.events.remove('moveend', this._setAccessibleIndicator);
|
|
11563
|
+
var dataSource = this._getDataSource();
|
|
11564
|
+
if (dataSource) {
|
|
11565
|
+
this.map.events.remove('dataadded', dataSource, this._setAccessibleIndicator);
|
|
11566
|
+
}
|
|
11567
|
+
else {
|
|
11568
|
+
this.map.events.remove('sourcedata', this._setAccessibleIndicator);
|
|
11569
|
+
}
|
|
11570
|
+
}
|
|
11571
|
+
_super.prototype.onRemove.call(this);
|
|
11572
|
+
};
|
|
11573
|
+
BubbleLayer.prototype._getSourceDataEventCacheKey = function () {
|
|
11574
|
+
if (!this.map) {
|
|
11575
|
+
return undefined;
|
|
11406
11576
|
}
|
|
11577
|
+
var mapConfiguration = this.map.getServiceOptions().mapConfiguration;
|
|
11578
|
+
return __spreadArray(__spreadArray([], __read$3(this.map.getCamera().bounds)), [
|
|
11579
|
+
this.map.getCamera().zoom,
|
|
11580
|
+
this.map.getCamera().pitch,
|
|
11581
|
+
this.map.getStyle().style,
|
|
11582
|
+
mapConfiguration instanceof Object ? mapConfiguration.id : mapConfiguration
|
|
11583
|
+
]).join(',');
|
|
11584
|
+
};
|
|
11585
|
+
BubbleLayer.prototype._getDataSource = function () {
|
|
11586
|
+
var source = typeof this.options.source === 'string' ? this.map.sources.getById(this.options.source) : this.options.source;
|
|
11587
|
+
if (source instanceof DataSource) {
|
|
11588
|
+
return source;
|
|
11589
|
+
}
|
|
11590
|
+
return undefined;
|
|
11407
11591
|
};
|
|
11408
11592
|
/**
|
|
11409
11593
|
* @internal
|
|
@@ -11456,6 +11640,17 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
11456
11640
|
ids.add(this.options.source);
|
|
11457
11641
|
return ids;
|
|
11458
11642
|
};
|
|
11643
|
+
/**
|
|
11644
|
+
* The coordinates can be nested, so we need to get the first coordinate.
|
|
11645
|
+
* @param coordinates The property from the Geometry. Can be Position, Position[], Position[][], etc.
|
|
11646
|
+
* @returns
|
|
11647
|
+
*/
|
|
11648
|
+
BubbleLayer.prototype.getFirstCoordinate = function (coordinates) {
|
|
11649
|
+
if (!Array.isArray(coordinates[0])) {
|
|
11650
|
+
return coordinates;
|
|
11651
|
+
}
|
|
11652
|
+
return this.getFirstCoordinate(coordinates[0]);
|
|
11653
|
+
};
|
|
11459
11654
|
return BubbleLayer;
|
|
11460
11655
|
}(Layer));
|
|
11461
11656
|
|
|
@@ -12539,7 +12734,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
12539
12734
|
}
|
|
12540
12735
|
return ar;
|
|
12541
12736
|
};
|
|
12542
|
-
var __spreadArray = (window && window.__spreadArray) || function (to, from) {
|
|
12737
|
+
var __spreadArray$1 = (window && window.__spreadArray) || function (to, from) {
|
|
12543
12738
|
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
12544
12739
|
to[j] = from[i];
|
|
12545
12740
|
return to;
|
|
@@ -12614,7 +12809,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
12614
12809
|
finally { if (e_1) throw e_1.error; }
|
|
12615
12810
|
}
|
|
12616
12811
|
// Then execute the standard merge behavior.
|
|
12617
|
-
var merged = _super.prototype.merge.apply(this, __spreadArray([], __read$4(valueList)));
|
|
12812
|
+
var merged = _super.prototype.merge.apply(this, __spreadArray$1([], __read$4(valueList)));
|
|
12618
12813
|
if (isNewColorSet) {
|
|
12619
12814
|
merged.fillPattern = undefined;
|
|
12620
12815
|
}
|
|
@@ -15308,7 +15503,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
15308
15503
|
}
|
|
15309
15504
|
return ar;
|
|
15310
15505
|
};
|
|
15311
|
-
var __spreadArray$
|
|
15506
|
+
var __spreadArray$2 = (window && window.__spreadArray) || function (to, from) {
|
|
15312
15507
|
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
15313
15508
|
to[j] = from[i];
|
|
15314
15509
|
return to;
|
|
@@ -15445,7 +15640,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
15445
15640
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
15446
15641
|
valueList[_i] = arguments[_i];
|
|
15447
15642
|
}
|
|
15448
|
-
var merged = _super.prototype.merge.apply(this, __spreadArray$
|
|
15643
|
+
var merged = _super.prototype.merge.apply(this, __spreadArray$2([], __read$6(valueList)));
|
|
15449
15644
|
if (merged.authType === exports.AuthenticationType.subscriptionKey) {
|
|
15450
15645
|
merged.authContext = merged.aadAppId = merged.getToken = undefined;
|
|
15451
15646
|
}
|
|
@@ -16116,10 +16311,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
16116
16311
|
if (add) {
|
|
16117
16312
|
this.logoAnchor = document.createElement("a");
|
|
16118
16313
|
this.logoAnchor.className = "azure-map-logo";
|
|
16119
|
-
this.logoAnchor.href = "https://
|
|
16314
|
+
this.logoAnchor.href = "https://aka.ms/azuremaps";
|
|
16120
16315
|
this.logoAnchor.setAttribute("aria-label", "Microsoft");
|
|
16316
|
+
this.logoAnchor.setAttribute("target", "_blank");
|
|
16121
16317
|
this.container.appendChild(this.logoAnchor);
|
|
16122
|
-
this.logoTooltip = buildAccessibleTooltip("Visit microsoft.com");
|
|
16318
|
+
this.logoTooltip = buildAccessibleTooltip("Visit azure.microsoft.com");
|
|
16123
16319
|
this.container.appendChild(this.logoTooltip);
|
|
16124
16320
|
positionTooltip(this.logoTooltip, this.logoAnchor);
|
|
16125
16321
|
}
|
|
@@ -16196,7 +16392,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
16196
16392
|
}
|
|
16197
16393
|
return ar;
|
|
16198
16394
|
};
|
|
16199
|
-
var __spreadArray$
|
|
16395
|
+
var __spreadArray$3 = (window && window.__spreadArray) || function (to, from) {
|
|
16200
16396
|
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
16201
16397
|
to[j] = from[i];
|
|
16202
16398
|
return to;
|
|
@@ -17308,7 +17504,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
17308
17504
|
this._removeListener(eventType, target, callback);
|
|
17309
17505
|
}
|
|
17310
17506
|
else {
|
|
17311
|
-
target._removeEventListener(eventType, callback);
|
|
17507
|
+
target === null || target === void 0 ? void 0 : target._removeEventListener(eventType, callback);
|
|
17312
17508
|
}
|
|
17313
17509
|
}
|
|
17314
17510
|
}
|
|
@@ -17798,10 +17994,15 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
17798
17994
|
return ids;
|
|
17799
17995
|
};
|
|
17800
17996
|
FundamentalMapLayer.prototype._updateLayoutProperty = function (name, newValue, oldValue, subValue) {
|
|
17801
|
-
|
|
17997
|
+
if (isEqual_1(newValue, oldValue))
|
|
17998
|
+
return;
|
|
17999
|
+
var map = this.map._getMap();
|
|
17802
18000
|
this.layers.forEach(function (layer) {
|
|
17803
|
-
if (
|
|
17804
|
-
|
|
18001
|
+
if (map.getLayer(layer.id)) {
|
|
18002
|
+
map.setLayoutProperty(layer.id, name, subValue || newValue);
|
|
18003
|
+
}
|
|
18004
|
+
else {
|
|
18005
|
+
console.warn("Could not update layout property " + name + " for layer " + layer.id + " to " + (subValue || newValue));
|
|
17805
18006
|
}
|
|
17806
18007
|
});
|
|
17807
18008
|
};
|
|
@@ -17835,7 +18036,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
17835
18036
|
}
|
|
17836
18037
|
return ar;
|
|
17837
18038
|
};
|
|
17838
|
-
var __spreadArray$
|
|
18039
|
+
var __spreadArray$4 = (window && window.__spreadArray) || function (to, from) {
|
|
17839
18040
|
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
17840
18041
|
to[j] = from[i];
|
|
17841
18042
|
return to;
|
|
@@ -17896,10 +18097,12 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
17896
18097
|
// Place the new layer behind the specified before layer.
|
|
17897
18098
|
var layerIndex = this.layerIndex.findIndex(function (l) { return l.getId() === layer.getId(); });
|
|
17898
18099
|
var userLayerIndex = this.userLayers.findIndex(function (ul) { return ul.layer.getId() === layer.getId(); });
|
|
17899
|
-
var tempLayer = this.layerIndex[layerIndex];
|
|
17900
18100
|
this._removeMapboxLayers(layer);
|
|
17901
18101
|
this._addMapboxLayers(layer, before);
|
|
17902
|
-
this.
|
|
18102
|
+
var tempLayer = this.layerIndex[layerIndex];
|
|
18103
|
+
if (tempLayer) {
|
|
18104
|
+
this.map.events._disableLayerEvents(tempLayer);
|
|
18105
|
+
}
|
|
17903
18106
|
this.map.events._enableLayerEvents(layer);
|
|
17904
18107
|
this.layerIndex.splice(layerIndex, 1);
|
|
17905
18108
|
var beforeIndex = this.layerIndex.findIndex(function (l) { return l.getId() === before; });
|
|
@@ -17907,7 +18110,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
17907
18110
|
if (!(layer instanceof FundamentalMapLayer)) {
|
|
17908
18111
|
this.userLayers[userLayerIndex] = { layer: layer, before: before };
|
|
17909
18112
|
}
|
|
17910
|
-
tempLayer
|
|
18113
|
+
if (tempLayer) {
|
|
18114
|
+
tempLayer.onRemove();
|
|
18115
|
+
}
|
|
17911
18116
|
layer.onAdd(this.map);
|
|
17912
18117
|
}
|
|
17913
18118
|
else {
|
|
@@ -18118,9 +18323,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
18118
18323
|
LayerManager.prototype.clear = function () {
|
|
18119
18324
|
for (var layerIndexIndex = this.layerIndex.length - 1; layerIndexIndex >= 0; layerIndexIndex--) {
|
|
18120
18325
|
var tempLayer = this.layerIndex[layerIndexIndex];
|
|
18121
|
-
|
|
18122
|
-
|
|
18123
|
-
|
|
18326
|
+
if (tempLayer) {
|
|
18327
|
+
this._removeMapboxLayers(tempLayer, true);
|
|
18328
|
+
this.layerIndex.splice(layerIndexIndex, 1);
|
|
18329
|
+
tempLayer.onRemove();
|
|
18330
|
+
}
|
|
18124
18331
|
}
|
|
18125
18332
|
this.userLayers = [];
|
|
18126
18333
|
};
|
|
@@ -18271,7 +18478,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
18271
18478
|
// If a specified layer hasn't been added to the map throw an error.
|
|
18272
18479
|
var index = this_1.layerIndex.findIndex(function (l) { return l.getId() === layerId; });
|
|
18273
18480
|
if (index > -1) {
|
|
18274
|
-
layerIds.push.apply(layerIds, __spreadArray$
|
|
18481
|
+
layerIds.push.apply(layerIds, __spreadArray$4([], __read$9(this_1.layerIndex[index]._getLayerIds()
|
|
18275
18482
|
.filter(function (id) { return !!_this.map._getMap().getLayer(id); }))));
|
|
18276
18483
|
}
|
|
18277
18484
|
else {
|
|
@@ -18560,6 +18767,37 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
18560
18767
|
FundamentalMapSource.prototype._buildSource = function () {
|
|
18561
18768
|
return this.source;
|
|
18562
18769
|
};
|
|
18770
|
+
/**
|
|
18771
|
+
* @internal
|
|
18772
|
+
*/
|
|
18773
|
+
FundamentalMapSource.prototype._isDeepEqual = function (other) {
|
|
18774
|
+
if (this.constructor !== other.constructor) {
|
|
18775
|
+
return false;
|
|
18776
|
+
}
|
|
18777
|
+
var source = this.source;
|
|
18778
|
+
var otherSource = other.source;
|
|
18779
|
+
var baseEqual = source.type === otherSource.type &&
|
|
18780
|
+
source.url === otherSource.url
|
|
18781
|
+
&& ((source.tiles === undefined && otherSource.tiles === undefined) ||
|
|
18782
|
+
(source.tiles && otherSource.tiles && source.tiles.length === otherSource.tiles.length && source.tiles.every(function (value, idx) { return value === otherSource.tiles[idx]; })))
|
|
18783
|
+
&& source.minzoom === otherSource.minzoom
|
|
18784
|
+
&& source.maxzoom === otherSource.maxzoom
|
|
18785
|
+
&& source.bounds === otherSource.bounds
|
|
18786
|
+
&& source.attribution === otherSource.attribution;
|
|
18787
|
+
var rasterEqual = source.type !== "raster" || (source.type === "raster"
|
|
18788
|
+
&& source.type === otherSource.type
|
|
18789
|
+
&& source.tileSize === otherSource.tileSize
|
|
18790
|
+
&& source.scheme === otherSource.scheme);
|
|
18791
|
+
var rasterDemEqual = source.type !== "raster-dem" || (source.type === "raster-dem"
|
|
18792
|
+
&& source.type === otherSource.type
|
|
18793
|
+
&& source.tileSize === otherSource.tileSize
|
|
18794
|
+
&& source.encoding === otherSource.encoding);
|
|
18795
|
+
var vectorEqual = source.type !== "vector" || (source.type === "vector"
|
|
18796
|
+
&& source.type === otherSource.type
|
|
18797
|
+
&& source.promoteId === otherSource.promoteId
|
|
18798
|
+
&& source.scheme === otherSource.scheme);
|
|
18799
|
+
return baseEqual && rasterEqual && rasterDemEqual && vectorEqual;
|
|
18800
|
+
};
|
|
18563
18801
|
/**
|
|
18564
18802
|
* Updates the source info to convert the tiles to url strings.
|
|
18565
18803
|
* @param sourceDef The original source info.
|
|
@@ -18856,39 +19094,52 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
18856
19094
|
var _this = this;
|
|
18857
19095
|
if (sources) {
|
|
18858
19096
|
Object.keys(sources).forEach(function (sourceId) {
|
|
19097
|
+
var sourceToAdd = sources[sourceId];
|
|
19098
|
+
var newSource;
|
|
19099
|
+
if (sourceToAdd.type === "vector") {
|
|
19100
|
+
newSource = new FundamentalMapSource(sourceId, {
|
|
19101
|
+
name: sourceId,
|
|
19102
|
+
tiles: sourceToAdd.tiles,
|
|
19103
|
+
type: "vector",
|
|
19104
|
+
url: sourceToAdd.url
|
|
19105
|
+
});
|
|
19106
|
+
}
|
|
19107
|
+
else if (sourceToAdd.type === "raster") {
|
|
19108
|
+
newSource = new FundamentalMapSource(sourceId, {
|
|
19109
|
+
name: sourceId,
|
|
19110
|
+
tiles: sourceToAdd.tiles,
|
|
19111
|
+
type: "raster",
|
|
19112
|
+
url: sourceToAdd.url
|
|
19113
|
+
});
|
|
19114
|
+
}
|
|
19115
|
+
else {
|
|
19116
|
+
// Do not throw for the source of unknown type.
|
|
19117
|
+
// throw new Error(`Unable to construct source with ID ${sourceId}.`);
|
|
19118
|
+
// no other handling for the source we don't sync into the state here
|
|
19119
|
+
return;
|
|
19120
|
+
}
|
|
18859
19121
|
if (!_this.sources.has(sourceId)) {
|
|
18860
|
-
|
|
18861
|
-
|
|
18862
|
-
var newSource = new FundamentalMapSource(sourceId, {
|
|
18863
|
-
name: sourceId,
|
|
18864
|
-
tiles: sourceToAdd.tiles,
|
|
18865
|
-
type: "vector",
|
|
18866
|
-
url: sourceToAdd.url
|
|
18867
|
-
});
|
|
18868
|
-
_this.sources.set(sourceId, newSource);
|
|
18869
|
-
newSource._setMap(_this.map);
|
|
18870
|
-
}
|
|
18871
|
-
else if (sourceToAdd.type === "raster") {
|
|
18872
|
-
var newSource = new FundamentalMapSource(sourceId, {
|
|
18873
|
-
name: sourceId,
|
|
18874
|
-
tiles: sourceToAdd.tiles,
|
|
18875
|
-
type: "raster",
|
|
18876
|
-
url: sourceToAdd.url
|
|
18877
|
-
});
|
|
18878
|
-
_this.sources.set(sourceId, newSource);
|
|
18879
|
-
newSource._setMap(_this.map);
|
|
18880
|
-
}
|
|
18881
|
-
else {
|
|
18882
|
-
throw new Error("Unable to construct source with ID " + sourceId + ".");
|
|
18883
|
-
}
|
|
19122
|
+
_this.sources.set(sourceId, newSource);
|
|
19123
|
+
newSource._setMap(_this.map);
|
|
18884
19124
|
}
|
|
18885
|
-
|
|
18886
|
-
|
|
18887
|
-
|
|
18888
|
-
|
|
18889
|
-
_this.sources.delete(sourceId);
|
|
19125
|
+
else if (_this.sources.has(sourceId) && !_this.sources.get(sourceId)._isDeepEqual(newSource)) {
|
|
19126
|
+
// source with same id but different properties: update
|
|
19127
|
+
_this.sources.set(sourceId, newSource);
|
|
19128
|
+
newSource._setMap(_this.map, false);
|
|
18890
19129
|
}
|
|
18891
19130
|
});
|
|
19131
|
+
// counter-intuitive: below is a bug and will do nothing since Object.keys(this.sources) will always return [], it should rather be:
|
|
19132
|
+
// Array.from(this.sources.keys()).forEach(sourceId => {
|
|
19133
|
+
// however, we have seen the first party users are compensating for this with their code containing explicit azm.sources.remove but not containing the check for existing
|
|
19134
|
+
// such removal will cause the exception, since the source would already be removed
|
|
19135
|
+
//
|
|
19136
|
+
// given this bug was here historically, we keep the removal unfixed here (already fixed in v3) to make sure we don't cause any unintented side effects for existing users
|
|
19137
|
+
// Object.keys(this.sources).forEach(sourceId => {
|
|
19138
|
+
// if (!sources.hasOwnProperty(sourceId)) {
|
|
19139
|
+
// this.sources.get(sourceId)._setMap(null);
|
|
19140
|
+
// this.sources.delete(sourceId);
|
|
19141
|
+
// }
|
|
19142
|
+
// });
|
|
18892
19143
|
}
|
|
18893
19144
|
};
|
|
18894
19145
|
return SourceManager;
|
|
@@ -19030,7 +19281,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
19030
19281
|
}
|
|
19031
19282
|
return ar;
|
|
19032
19283
|
};
|
|
19033
|
-
var __spreadArray$
|
|
19284
|
+
var __spreadArray$5 = (window && window.__spreadArray) || function (to, from) {
|
|
19034
19285
|
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
19035
19286
|
to[j] = from[i];
|
|
19036
19287
|
return to;
|
|
@@ -19105,7 +19356,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
19105
19356
|
}
|
|
19106
19357
|
finally { if (e_1) throw e_1.error; }
|
|
19107
19358
|
}
|
|
19108
|
-
return _super.prototype.merge.apply(this, __spreadArray$
|
|
19359
|
+
return _super.prototype.merge.apply(this, __spreadArray$5([], __read$a(valuesList)));
|
|
19109
19360
|
};
|
|
19110
19361
|
return CameraBoundsOptions;
|
|
19111
19362
|
}(Options));
|
|
@@ -19594,7 +19845,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
19594
19845
|
}
|
|
19595
19846
|
return ar;
|
|
19596
19847
|
};
|
|
19597
|
-
var __spreadArray$
|
|
19848
|
+
var __spreadArray$6 = (window && window.__spreadArray) || function (to, from) {
|
|
19598
19849
|
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
19599
19850
|
to[j] = from[i];
|
|
19600
19851
|
return to;
|
|
@@ -19714,6 +19965,13 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
19714
19965
|
* @deprecated use `view` instead.
|
|
19715
19966
|
*/
|
|
19716
19967
|
_this.userRegion = _this.view;
|
|
19968
|
+
/**
|
|
19969
|
+
* allows substituting a default MapControl's style transformer with custom one
|
|
19970
|
+
* Default style transformer is meant to update the incoming fetched style to desired state, as well as to synchronize the SDK state with style state
|
|
19971
|
+
* and move additional layers over
|
|
19972
|
+
* @internal
|
|
19973
|
+
*/
|
|
19974
|
+
_this.customStyleTransform = undefined;
|
|
19717
19975
|
return _this;
|
|
19718
19976
|
}
|
|
19719
19977
|
/**
|
|
@@ -19753,7 +20011,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
19753
20011
|
finally { if (e_1) throw e_1.error; }
|
|
19754
20012
|
}
|
|
19755
20013
|
// Then execute the standard merge behavior.
|
|
19756
|
-
return _super.prototype.merge.apply(this, __spreadArray$
|
|
20014
|
+
return _super.prototype.merge.apply(this, __spreadArray$6([], __read$b(valueList)));
|
|
19757
20015
|
};
|
|
19758
20016
|
return StyleOptions;
|
|
19759
20017
|
}(Options));
|
|
@@ -19811,7 +20069,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
19811
20069
|
}
|
|
19812
20070
|
return ar;
|
|
19813
20071
|
};
|
|
19814
|
-
var __spreadArray$
|
|
20072
|
+
var __spreadArray$7 = (window && window.__spreadArray) || function (to, from) {
|
|
19815
20073
|
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
19816
20074
|
to[j] = from[i];
|
|
19817
20075
|
return to;
|
|
@@ -20046,10 +20304,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
20046
20304
|
// won't change default behavior in Options as usually that's what desired
|
|
20047
20305
|
// instead capture it here and reassign.
|
|
20048
20306
|
var currentTransforms = this._transformers;
|
|
20049
|
-
var transformersToMerge = valueList ? valueList.filter(function (value) { return value !== undefined; }).reduce(function (flattened, value) { return __spreadArray$
|
|
20307
|
+
var transformersToMerge = valueList ? valueList.filter(function (value) { return value !== undefined; }).reduce(function (flattened, value) { return __spreadArray$7(__spreadArray$7([], __read$c(flattened)), __read$c(value._transformers || [])); }, []) : [];
|
|
20050
20308
|
// Then execute the standard merge behavior.
|
|
20051
20309
|
// If subscription key auth method isn't being used then the subscription key property should be undefined.
|
|
20052
|
-
var merged = _super.prototype.merge.apply(this, __spreadArray$
|
|
20310
|
+
var merged = _super.prototype.merge.apply(this, __spreadArray$7([], __read$c(valueList)));
|
|
20053
20311
|
if (merged.authOptions.authType !== exports.AuthenticationType.subscriptionKey) {
|
|
20054
20312
|
merged["subscription-key"] = merged.subscriptionKey = undefined;
|
|
20055
20313
|
}
|
|
@@ -20061,7 +20319,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
20061
20319
|
if (merged.mapConfiguration && typeof merged.mapConfiguration !== 'string') {
|
|
20062
20320
|
merged.mapConfiguration = __assign$7(__assign$7({}, merged.mapConfiguration), { defaultConfiguration: merged.mapConfiguration.defaultConfiguration || merged.mapConfiguration['defaultStyle'], configurations: merged.mapConfiguration.configurations || merged.mapConfiguration['styles'] });
|
|
20063
20321
|
}
|
|
20064
|
-
this._transformers = __spreadArray$
|
|
20322
|
+
this._transformers = __spreadArray$7(__spreadArray$7([], __read$c(currentTransforms || [])), __read$c(transformersToMerge.filter(function (toMerge) { return !currentTransforms.includes(toMerge); })));
|
|
20065
20323
|
if (this.transformRequest && !this._transformers.includes(this.transformRequest)) {
|
|
20066
20324
|
this._transformers.push(this.transformRequest);
|
|
20067
20325
|
}
|
|
@@ -20309,7 +20567,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
20309
20567
|
}
|
|
20310
20568
|
return ar;
|
|
20311
20569
|
};
|
|
20312
|
-
var __spreadArray$
|
|
20570
|
+
var __spreadArray$8 = (window && window.__spreadArray) || function (to, from) {
|
|
20313
20571
|
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
20314
20572
|
to[j] = from[i];
|
|
20315
20573
|
return to;
|
|
@@ -20362,7 +20620,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
20362
20620
|
var deferredLayers = Object.entries(layerGroupLayers).reduce(function (deferred, _a) {
|
|
20363
20621
|
var _b = __read$d(_a, 2), groupName = _b[0], layers = _b[1];
|
|
20364
20622
|
var isInInitialLayerGroup = validInitLayerGroups.includes(groupName);
|
|
20365
|
-
return __spreadArray$
|
|
20623
|
+
return __spreadArray$8(__spreadArray$8([], __read$d(deferred)), __read$d(layers.filter(function (layer) {
|
|
20366
20624
|
var _a;
|
|
20367
20625
|
// Exclude custom layers
|
|
20368
20626
|
if (layer.type === 'custom')
|
|
@@ -20414,13 +20672,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
20414
20672
|
};
|
|
20415
20673
|
_this.map.events.addOnce('load', _this._progressiveLoadingState.pendingVisibilityChange);
|
|
20416
20674
|
};
|
|
20417
|
-
this._onStyleData = function () {
|
|
20418
|
-
_this.
|
|
20419
|
-
|
|
20420
|
-
|
|
20421
|
-
|
|
20422
|
-
type: "stylechanged"
|
|
20423
|
-
});
|
|
20675
|
+
this._onStyleData = function (definition) {
|
|
20676
|
+
_this.map.events.invoke("stylechanged", {
|
|
20677
|
+
style: definition.name,
|
|
20678
|
+
map: _this.map,
|
|
20679
|
+
type: "stylechanged"
|
|
20424
20680
|
});
|
|
20425
20681
|
};
|
|
20426
20682
|
/**
|
|
@@ -20527,7 +20783,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
20527
20783
|
return baseName in styleNamesMap ? styleNamesMap[baseName] : baseName;
|
|
20528
20784
|
};
|
|
20529
20785
|
if (!this.serviceOptions.mapConfiguration) {
|
|
20530
|
-
|
|
20786
|
+
var ensureAuthentication = this.map.authentication ? this.map.authentication.initialize() : Promise.resolve();
|
|
20787
|
+
newPromise = new HijackablePromise(ensureAuthentication.then(function () { return _this._request(_this.serviceOptions.staticAssetsDomain, constants.stylePath + "/" + constants.styleResourcePath, "StyleDefinitions", { version: _this.serviceOptions.styleDefinitionsVersion }).then(function (definitions) { return ({
|
|
20531
20788
|
version: isNaN(definitions.version) ? 0 : parseFloat(definitions.version),
|
|
20532
20789
|
defaultConfiguration: definitions.defaultStyle,
|
|
20533
20790
|
configurations: definitions.styles
|
|
@@ -20566,12 +20823,13 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
20566
20823
|
protocol: "https"
|
|
20567
20824
|
}).toString(),
|
|
20568
20825
|
}); })
|
|
20569
|
-
}); }));
|
|
20826
|
+
}); }); }));
|
|
20570
20827
|
}
|
|
20571
20828
|
else if (typeof this.serviceOptions.mapConfiguration === 'string') {
|
|
20572
|
-
|
|
20829
|
+
var ensureAuthentication = this.map.authentication ? this.map.authentication.initialize() : Promise.resolve();
|
|
20830
|
+
newPromise = new HijackablePromise(ensureAuthentication.then(function () { return _this._request(_this.serviceOptions.domain, constants.styleResourcePath + "/mapconfigurations/metadata/" + _this.serviceOptions.mapConfiguration, "StyleDefinitions"
|
|
20573
20831
|
// reassign properties from legacy mapConfiguration to new structure if needed
|
|
20574
|
-
).then(function (definitions) { return (__assign$8(__assign$8({}, definitions), { defaultConfiguration: definitions.defaultConfiguration || definitions['defaultStyle'], configurations: definitions.configurations || definitions['styles'] })); }));
|
|
20832
|
+
).then(function (definitions) { return (__assign$8(__assign$8({}, definitions), { defaultConfiguration: definitions.defaultConfiguration || definitions['defaultStyle'], configurations: definitions.configurations || definitions['styles'] })); }); }));
|
|
20575
20833
|
}
|
|
20576
20834
|
else {
|
|
20577
20835
|
newPromise = HijackablePromise.resolve(this.serviceOptions.mapConfiguration);
|
|
@@ -20602,23 +20860,183 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
20602
20860
|
if (styleDefinition.style) {
|
|
20603
20861
|
return styleDefinition.style;
|
|
20604
20862
|
}
|
|
20605
|
-
throw Error("Style definition
|
|
20863
|
+
throw Error("Style definition neither contains URL nor style object.");
|
|
20864
|
+
};
|
|
20865
|
+
StyleManager.prototype.deriveNewStyleAndLayerGroups = function (previousStyle, nextStyle) {
|
|
20866
|
+
var _a, _b, _c, _d, _e, _f;
|
|
20867
|
+
// Layers in the next style with default properties that do not align with current StyleOptions
|
|
20868
|
+
// should be modified before they are applied to the map.
|
|
20869
|
+
var styleOptions = this.map.getStyle();
|
|
20870
|
+
var trafficOptions = this.map.getTraffic();
|
|
20871
|
+
var layersGroups = {};
|
|
20872
|
+
for (var i = 0; i < nextStyle.layers.length; i++) {
|
|
20873
|
+
var nextLayer = nextStyle.layers[i];
|
|
20874
|
+
var layerGroup = LayerGroupComparator.getLayerGroup(nextLayer);
|
|
20875
|
+
if (!layerGroup) {
|
|
20876
|
+
layersGroups[nextLayer.id] = [nextLayer];
|
|
20877
|
+
continue;
|
|
20878
|
+
}
|
|
20879
|
+
if (!layersGroups[layerGroup]) {
|
|
20880
|
+
layersGroups[layerGroup] = [];
|
|
20881
|
+
}
|
|
20882
|
+
var layerGroupLayers = layersGroups[layerGroup];
|
|
20883
|
+
layerGroupLayers.push(nextLayer);
|
|
20884
|
+
// 1. Set visiblity of fill-extrusion layers according to StyleOptions.showBuildingModels
|
|
20885
|
+
if (!styleOptions.showBuildingModels && nextLayer.type === "fill-extrusion") {
|
|
20886
|
+
nextLayer.layout = (_a = nextLayer.layout) !== null && _a !== void 0 ? _a : {};
|
|
20887
|
+
nextLayer.layout.visibility = "none";
|
|
20888
|
+
}
|
|
20889
|
+
else if (nextLayer.type === "fill-extrusion") {
|
|
20890
|
+
nextLayer.layout = (_b = nextLayer.layout) !== null && _b !== void 0 ? _b : {};
|
|
20891
|
+
nextLayer.layout.visibility = "visible";
|
|
20892
|
+
}
|
|
20893
|
+
// 2. Set visibility of traffic layers depending on traffic settings.
|
|
20894
|
+
if (trafficOptions.flow !== "none" && layerGroup) {
|
|
20895
|
+
if (layerGroup === "traffic_" + trafficOptions.flow && nextLayer.type == "line") {
|
|
20896
|
+
nextLayer.layout = (_c = nextLayer.layout) !== null && _c !== void 0 ? _c : {};
|
|
20897
|
+
nextLayer.layout.visibility = "visible";
|
|
20898
|
+
}
|
|
20899
|
+
}
|
|
20900
|
+
// 3. Set visibility of labels
|
|
20901
|
+
var isLabelLayerGroup = layerGroup === 'labels' || layerGroup === 'labels_places' || layerGroup === 'labels_indoor';
|
|
20902
|
+
if (isLabelLayerGroup && nextLayer.type === 'symbol') {
|
|
20903
|
+
if (styleOptions.showLabels && ((_d = nextLayer.layout) === null || _d === void 0 ? void 0 : _d.visibility) !== "none") {
|
|
20904
|
+
nextLayer.layout = (_e = nextLayer.layout) !== null && _e !== void 0 ? _e : {};
|
|
20905
|
+
nextLayer.layout.visibility = "visible";
|
|
20906
|
+
}
|
|
20907
|
+
else {
|
|
20908
|
+
nextLayer.layout = (_f = nextLayer.layout) !== null && _f !== void 0 ? _f : {};
|
|
20909
|
+
nextLayer.layout.visibility = "none";
|
|
20910
|
+
}
|
|
20911
|
+
}
|
|
20912
|
+
}
|
|
20913
|
+
return [nextStyle, layersGroups];
|
|
20914
|
+
};
|
|
20915
|
+
StyleManager.prototype.injectUserLayersIntoStyle = function (previousStyle, nextStyle, layerGroupLayers) {
|
|
20916
|
+
// Custom layers added to mapbox through this SDK should be carried over to the next style.
|
|
20917
|
+
return !previousStyle
|
|
20918
|
+
? nextStyle
|
|
20919
|
+
: this.map.layers._getUserLayers().reduce(function (style, userLayer) {
|
|
20920
|
+
if (userLayer.layer instanceof WebGLLayer) {
|
|
20921
|
+
// mapbox custom layers cannot be serialized and preserved,
|
|
20922
|
+
// return to continue to the next user layer.
|
|
20923
|
+
return style;
|
|
20924
|
+
}
|
|
20925
|
+
var before = layerGroupLayers[userLayer.before] && layerGroupLayers[userLayer.before].length > 0
|
|
20926
|
+
? layerGroupLayers[userLayer.before][0]
|
|
20927
|
+
: undefined;
|
|
20928
|
+
var layer = previousStyle.layers.find(function (layer) { return layer.id === userLayer.layer.getId(); });
|
|
20929
|
+
// when setStyle diff attempt is unsuccesful, _load will be called on the style that may have already injected user layers -> clean it up
|
|
20930
|
+
var existingLayerIdx = nextStyle.layers.findIndex(function (layer) { return layer.id === userLayer.layer.getId(); });
|
|
20931
|
+
if (existingLayerIdx > -1) {
|
|
20932
|
+
nextStyle.layers.splice(existingLayerIdx, 1);
|
|
20933
|
+
}
|
|
20934
|
+
if (layer) {
|
|
20935
|
+
var sourcesToCopy = new Set(Array.from(userLayer.layer._getSourceIds())
|
|
20936
|
+
.map(function (sourceId) { return previousStyle.sources[sourceId] ? { source: previousStyle.sources[sourceId], id: sourceId } : undefined; })
|
|
20937
|
+
.filter(function (source) { return source !== undefined; }));
|
|
20938
|
+
var insertIdx = before ? style.layers.findIndex(function (layer) { return layer.id === before.id; }) : -1;
|
|
20939
|
+
if (insertIdx > -1) {
|
|
20940
|
+
style.layers.splice(insertIdx, 0, layer);
|
|
20941
|
+
}
|
|
20942
|
+
else {
|
|
20943
|
+
style.layers.push(layer);
|
|
20944
|
+
}
|
|
20945
|
+
sourcesToCopy.forEach(function (_a) {
|
|
20946
|
+
var source = _a.source, id = _a.id;
|
|
20947
|
+
style.sources[id] = source;
|
|
20948
|
+
});
|
|
20949
|
+
}
|
|
20950
|
+
return style;
|
|
20951
|
+
}, __assign$8({}, nextStyle));
|
|
20606
20952
|
};
|
|
20607
20953
|
/**
|
|
20608
20954
|
* @internal
|
|
20609
20955
|
*/
|
|
20610
20956
|
StyleManager.prototype.setStyle = function (styleOptions, diff) {
|
|
20957
|
+
var _this = this;
|
|
20611
20958
|
if (diff === void 0) { diff = true; }
|
|
20612
|
-
|
|
20613
|
-
|
|
20614
|
-
|
|
20615
|
-
|
|
20616
|
-
|
|
20617
|
-
|
|
20959
|
+
var transformStyleFunc;
|
|
20960
|
+
var targetDefinition = this._lookUp(styleOptions);
|
|
20961
|
+
if (!targetDefinition) {
|
|
20962
|
+
throw Error("Style definition " + styleOptions.style + " is not available.");
|
|
20963
|
+
}
|
|
20964
|
+
if (!targetDefinition.url && !targetDefinition.style) {
|
|
20965
|
+
throw Error("Style definition neither contains URL nor style object.");
|
|
20966
|
+
}
|
|
20967
|
+
var styleDataCallback = function () { return _this._onStyleData(targetDefinition); };
|
|
20968
|
+
var patchStyleEvent = function () {
|
|
20969
|
+
// FIXME: below diffing will be soon fixed on the maplibre side
|
|
20970
|
+
// If there was a previous styledata change event attached, remove it.
|
|
20971
|
+
// When the sprite url changes between style changes then maplibre can't perform the diff
|
|
20972
|
+
// In such cases it recalculate the style again. Removing previous attached
|
|
20973
|
+
// event listener makes sure that style changed event is not fired twice in these cases.
|
|
20974
|
+
_this.map.events.remove("styledata", styleDataCallback);
|
|
20975
|
+
_this.map.events.addOnce("styledata", styleDataCallback);
|
|
20976
|
+
};
|
|
20977
|
+
if (styleOptions && styleOptions.customStyleTransform) {
|
|
20978
|
+
transformStyleFunc = function (prev, next) {
|
|
20979
|
+
var target = styleOptions.customStyleTransform(prev, next);
|
|
20980
|
+
patchStyleEvent();
|
|
20981
|
+
return target;
|
|
20982
|
+
};
|
|
20618
20983
|
}
|
|
20619
|
-
|
|
20620
|
-
|
|
20984
|
+
else {
|
|
20985
|
+
transformStyleFunc = function (previousStyle, style) {
|
|
20986
|
+
// make sure we always have a shallow clone to prevent mutating explicit json(rather then url) styles being set
|
|
20987
|
+
var nextStyle = __assign$8(__assign$8({}, style), { layers: __spreadArray$8([], __read$d(style.layers)), sources: __assign$8({}, style.sources) });
|
|
20988
|
+
var shouldProgressiveLoading = (styleOptions.progressiveLoading &&
|
|
20989
|
+
// The feature only effective at the initial load.
|
|
20990
|
+
!_this.map._isLoaded());
|
|
20991
|
+
// Shallow-clone the style object and duplicate layer.layout properties to avoid side-effects.
|
|
20992
|
+
if (shouldProgressiveLoading && Array.isArray(style === null || style === void 0 ? void 0 : style.layers)) {
|
|
20993
|
+
nextStyle = __assign$8({}, style);
|
|
20994
|
+
nextStyle.layers = nextStyle.layers.map(function (layer) {
|
|
20995
|
+
var nextLayer = __assign$8({}, layer);
|
|
20996
|
+
if (layer.layout) {
|
|
20997
|
+
nextLayer.layout = __assign$8({}, layer.layout);
|
|
20998
|
+
}
|
|
20999
|
+
return nextLayer;
|
|
21000
|
+
});
|
|
21001
|
+
}
|
|
21002
|
+
// 1. derive the base new style (without user layers) and layer groups
|
|
21003
|
+
var _a = __read$d(_this.deriveNewStyleAndLayerGroups(previousStyle, nextStyle), 2), targetStyle = _a[0], layerGroupLayers = _a[1];
|
|
21004
|
+
// 2. side effect: progressively render map layers to the canvas to shorten the time to the first meaningful render.
|
|
21005
|
+
if (shouldProgressiveLoading) {
|
|
21006
|
+
var initLayerGroups = styleOptions.progressiveLoadingInitialLayerGroups;
|
|
21007
|
+
if (Array.isArray(initLayerGroups) && initLayerGroups.length > 0) {
|
|
21008
|
+
_this._deferLayerGroupVisibilities(layerGroupLayers, initLayerGroups);
|
|
21009
|
+
}
|
|
21010
|
+
}
|
|
21011
|
+
// 3. copy user layers and sources from previous style into new one
|
|
21012
|
+
var targetStyleWithUserLayers = _this.injectUserLayersIntoStyle(previousStyle, targetStyle, layerGroupLayers);
|
|
21013
|
+
// 4. side effects: sync our control's LayerManager and SourceManager
|
|
21014
|
+
var nextFundamentalLayers = Object.entries(layerGroupLayers).map(function (_a) {
|
|
21015
|
+
var _b = __read$d(_a, 2), layerGroupId = _b[0], layers = _b[1];
|
|
21016
|
+
return _this._buildFundamentalLayerFrom(layers, layerGroupId);
|
|
21017
|
+
});
|
|
21018
|
+
var layerIndex = _this.map.layers._getUserLayers().reduce(function (layerIndex, userLayer) {
|
|
21019
|
+
var layerInsertIndex = userLayer.before ? layerIndex.findIndex(function (layer) { return layer.getId() === userLayer.before; }) : -1;
|
|
21020
|
+
if (layerInsertIndex > -1) {
|
|
21021
|
+
layerIndex.splice(layerInsertIndex, 0, userLayer.layer);
|
|
21022
|
+
}
|
|
21023
|
+
else {
|
|
21024
|
+
layerIndex.push(userLayer.layer);
|
|
21025
|
+
}
|
|
21026
|
+
return layerIndex;
|
|
21027
|
+
}, nextFundamentalLayers);
|
|
21028
|
+
_this.map.layers['layerIndex'] = layerIndex;
|
|
21029
|
+
_this.map.sources._syncSources(targetStyleWithUserLayers.sources);
|
|
21030
|
+
// 5. temporarily patch style data event
|
|
21031
|
+
patchStyleEvent();
|
|
21032
|
+
return targetStyleWithUserLayers;
|
|
21033
|
+
};
|
|
20621
21034
|
}
|
|
21035
|
+
this.map._getMap().setStyle(targetDefinition.url || targetDefinition.style, {
|
|
21036
|
+
diff: diff,
|
|
21037
|
+
validate: this.serviceOptions.validateStyle,
|
|
21038
|
+
transformStyle: transformStyleFunc
|
|
21039
|
+
});
|
|
20622
21040
|
};
|
|
20623
21041
|
/**
|
|
20624
21042
|
* Gets the color theme (light/dark) for the style type specified by the style options.
|
|
@@ -20683,135 +21101,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
20683
21101
|
StyleManager.prototype.clearStyleSet = function () {
|
|
20684
21102
|
this.unsetIndoorState();
|
|
20685
21103
|
};
|
|
20686
|
-
/**
|
|
20687
|
-
* Function invoked by mapbox after a style is fetched but before it is committed to the map state.
|
|
20688
|
-
*
|
|
20689
|
-
* @param previousStyle The current style.
|
|
20690
|
-
* @param nextStyle The next style which is to be applied.
|
|
20691
|
-
* @param preserveLayer Preserve a layer from the previous style in the next style.
|
|
20692
|
-
* @param updatePaintProperty Modify paint properties of a layer in the next style before the style is applied.
|
|
20693
|
-
* @param updateLayoutProperty Modify layout properties of a layer in the next style before the style is applied.
|
|
20694
|
-
* @param updateFilter Modify filter property of a layer in the next style before the style is applied.
|
|
20695
|
-
*/
|
|
20696
|
-
StyleManager.prototype._stylePatch = function (previousStyle, nextStyle, preserveLayer, updatePaintProperty, updateLayoutProperty, updateFilter) {
|
|
20697
|
-
var _this = this;
|
|
20698
|
-
// Layers in the next style with default properties that do not align with current StyleOptions
|
|
20699
|
-
// should be modified before they are applied to the map.
|
|
20700
|
-
var styleOptions = this.map.getStyle();
|
|
20701
|
-
var trafficOptions = this.map.getTraffic();
|
|
20702
|
-
var shouldProgressiveLoading = (styleOptions.progressiveLoading &&
|
|
20703
|
-
// The feature only effective at the initial load.
|
|
20704
|
-
!this.map._isLoaded());
|
|
20705
|
-
var setLayerVisibility = function (layer, visibility) {
|
|
20706
|
-
var _a;
|
|
20707
|
-
if (!shouldProgressiveLoading) {
|
|
20708
|
-
// No need to apply the visibility change to maplibre while progressive loading is enabled.
|
|
20709
|
-
// This can save a lot of CPU time.
|
|
20710
|
-
updateLayoutProperty(layer.id, 'visibility', visibility);
|
|
20711
|
-
}
|
|
20712
|
-
layer.layout = (_a = layer.layout) !== null && _a !== void 0 ? _a : {};
|
|
20713
|
-
layer.layout.visibility = visibility;
|
|
20714
|
-
};
|
|
20715
|
-
var layerGroupLayers = {};
|
|
20716
|
-
nextStyle.layers.forEach(function (nextLayer) {
|
|
20717
|
-
var _a;
|
|
20718
|
-
var layerGroup = LayerGroupComparator.getLayerGroup(nextLayer);
|
|
20719
|
-
if (layerGroup) {
|
|
20720
|
-
// Set visibility of fill-extrusion layers according to StyleOptions.showBuildingModels
|
|
20721
|
-
if (nextLayer.type === 'fill-extrusion') {
|
|
20722
|
-
setLayerVisibility(nextLayer, styleOptions.showBuildingModels ? 'visible' : 'none');
|
|
20723
|
-
}
|
|
20724
|
-
// Set visibility of traffic layers depending on traffic settings.
|
|
20725
|
-
if (trafficOptions.flow !== 'none' && nextLayer.type == 'line' &&
|
|
20726
|
-
(layerGroup === "traffic_" + trafficOptions.flow ||
|
|
20727
|
-
// Check if deprecated flow types are used and the layer is a bing-traffic layer.
|
|
20728
|
-
// Needed for backwards compatibility in Bing styles to support deprecated flow types.
|
|
20729
|
-
(['absolute', 'relative-delay'].includes(trafficOptions.flow) && nextLayer['source'] === "bing-traffic"))) {
|
|
20730
|
-
setLayerVisibility(nextLayer, 'visible');
|
|
20731
|
-
}
|
|
20732
|
-
// Set visibility of labels
|
|
20733
|
-
var isLabelLayerGroup = layerGroup === 'labels' || layerGroup === 'labels_places' || layerGroup === 'labels_indoor';
|
|
20734
|
-
if (isLabelLayerGroup && nextLayer.type === 'symbol') {
|
|
20735
|
-
var isLayerVisible = ((_a = nextLayer.layout) === null || _a === void 0 ? void 0 : _a.visibility) !== 'none';
|
|
20736
|
-
setLayerVisibility(nextLayer, isLayerVisible && styleOptions.showLabels ? 'visible' : 'none');
|
|
20737
|
-
}
|
|
20738
|
-
// Once this _stylePatch returns control to maplibre the next style will be applied immediately in the same context.
|
|
20739
|
-
// To avoid potential data races update LayerManager with new a new set of FundamentalMapLayers from here instead of
|
|
20740
|
-
// waiting for a styledata.load event to trigger a sync in a different context.
|
|
20741
|
-
if (layerGroupLayers[layerGroup]) {
|
|
20742
|
-
layerGroupLayers[layerGroup].push(nextLayer);
|
|
20743
|
-
}
|
|
20744
|
-
else {
|
|
20745
|
-
layerGroupLayers[layerGroup] = [nextLayer];
|
|
20746
|
-
}
|
|
20747
|
-
}
|
|
20748
|
-
});
|
|
20749
|
-
if (shouldProgressiveLoading) {
|
|
20750
|
-
var initLayerGroups = styleOptions.progressiveLoadingInitialLayerGroups;
|
|
20751
|
-
if (Array.isArray(initLayerGroups) && initLayerGroups.length > 0) {
|
|
20752
|
-
this._deferLayerGroupVisibilities(layerGroupLayers, initLayerGroups);
|
|
20753
|
-
}
|
|
20754
|
-
}
|
|
20755
|
-
// A FundamentalMapLayer (grouped layer) representation of the next style must be built.
|
|
20756
|
-
var previousLayers = this.map.layers.getLayers();
|
|
20757
|
-
var nextLayers = Object.entries(layerGroupLayers).map(function (_a) {
|
|
20758
|
-
var _b = __read$d(_a, 2), layerGroupName = _b[0], layerGroupMapboxLayers = _b[1];
|
|
20759
|
-
return _this._buildFundamentalLayerFrom(layerGroupMapboxLayers, layerGroupName);
|
|
20760
|
-
});
|
|
20761
|
-
// Update FundamentalMapLayers in LayerManager
|
|
20762
|
-
var userLayers = this.map.layers._getUserLayers();
|
|
20763
|
-
var layersToRemove = previousLayers.filter(function (c) {
|
|
20764
|
-
return (nextLayers.findIndex(function (n) { return c.getId() === n.getId(); }) < 0 &&
|
|
20765
|
-
userLayers.findIndex(function (n) { return c.getId() === n.layer.getId(); }) < 0);
|
|
20766
|
-
});
|
|
20767
|
-
var prevNextIntersection = nextLayers.filter(function (n) { return previousLayers.find(function (c) { return c.getId() === n.getId(); }); });
|
|
20768
|
-
var ePrevNextIntersection = prevNextIntersection.entries();
|
|
20769
|
-
var replace = ePrevNextIntersection.next();
|
|
20770
|
-
nextLayers.forEach(function (newFundamentalLayer) {
|
|
20771
|
-
if (replace.value && replace.value[1].getId() === newFundamentalLayer.getId()) {
|
|
20772
|
-
// Replace the existing layer with this ID with the new one.
|
|
20773
|
-
var insertBefore = previousLayers.findIndex(function (l) { return l.getId() === newFundamentalLayer.getId(); });
|
|
20774
|
-
_this.map.layers.remove(newFundamentalLayer.getId());
|
|
20775
|
-
_this.map.layers.add(newFundamentalLayer, previousLayers[insertBefore].getId());
|
|
20776
|
-
replace = ePrevNextIntersection.next();
|
|
20777
|
-
}
|
|
20778
|
-
else {
|
|
20779
|
-
if (replace.value) {
|
|
20780
|
-
// Insert new layer before the next common layer.
|
|
20781
|
-
_this.map.layers.add(newFundamentalLayer, replace.value[1]);
|
|
20782
|
-
}
|
|
20783
|
-
else {
|
|
20784
|
-
_this.map.layers.add(newFundamentalLayer);
|
|
20785
|
-
}
|
|
20786
|
-
}
|
|
20787
|
-
});
|
|
20788
|
-
layersToRemove.forEach(function (layer) {
|
|
20789
|
-
_this.map.layers.remove(layer);
|
|
20790
|
-
});
|
|
20791
|
-
// Layers added to mapbox through this SDK since loading the last style should be
|
|
20792
|
-
// carried over to the next style.
|
|
20793
|
-
userLayers.forEach(function (userLayer) {
|
|
20794
|
-
if (userLayer.layer instanceof WebGLLayer) {
|
|
20795
|
-
// mapbox custom layers cannot be serialized and preserved,
|
|
20796
|
-
// return to continue to the next user layer.
|
|
20797
|
-
return;
|
|
20798
|
-
}
|
|
20799
|
-
var before = undefined;
|
|
20800
|
-
if (_this.map.layers.getLayerById(userLayer.before)) {
|
|
20801
|
-
var beforeCandidates = _this.map.layers.getLayerById(userLayer.before)._buildLayers();
|
|
20802
|
-
before = (beforeCandidates.length > 0) ? beforeCandidates[0] : undefined;
|
|
20803
|
-
}
|
|
20804
|
-
preserveLayer(userLayer.layer.getId(), before === null || before === void 0 ? void 0 : before.id);
|
|
20805
|
-
_this.map.layers.move(userLayer.layer, userLayer.before);
|
|
20806
|
-
});
|
|
20807
|
-
this.map.sources._syncSources(nextStyle.sources);
|
|
20808
|
-
// If there was a previous styledata change event attached, remove it.
|
|
20809
|
-
// When the sprite url changes between style changes then mapbox can't perform the diff
|
|
20810
|
-
// In such cases it recalculate the style again. Removing previous attached
|
|
20811
|
-
// event listener makes sure that style changed event is not fired twice in these cases.
|
|
20812
|
-
this.map.events.remove("styledata", this._onStyleData);
|
|
20813
|
-
this.map.events.addOnce("styledata", this._onStyleData);
|
|
20814
|
-
};
|
|
20815
21104
|
StyleManager.prototype._buildFundamentalLayerFrom = function (layers, id) {
|
|
20816
21105
|
if (layers && layers.length > 0) {
|
|
20817
21106
|
var newLayer = new FundamentalMapLayer(layers, id);
|
|
@@ -21115,7 +21404,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
21115
21404
|
}
|
|
21116
21405
|
return ar;
|
|
21117
21406
|
};
|
|
21118
|
-
var __spreadArray$
|
|
21407
|
+
var __spreadArray$9 = (window && window.__spreadArray) || function (to, from) {
|
|
21119
21408
|
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
21120
21409
|
to[j] = from[i];
|
|
21121
21410
|
return to;
|
|
@@ -21238,6 +21527,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
21238
21527
|
showLogo: _this.styleOptions.showLogo,
|
|
21239
21528
|
customAttribution: _this.styleOptions.customAttribution
|
|
21240
21529
|
});
|
|
21530
|
+
_this.controls.add(_this.copyrightControl, {
|
|
21531
|
+
position: exports.ControlPosition.NonFixed
|
|
21532
|
+
});
|
|
21241
21533
|
// Initialize state of map
|
|
21242
21534
|
// --> Initialize the authentication manager
|
|
21243
21535
|
var authManInit = _this.authentication ?
|
|
@@ -21265,17 +21557,14 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
21265
21557
|
_this.map.showTileBoundaries = _this.styleOptions.showTileBoundaries;
|
|
21266
21558
|
_this.localizedStringsPromise = Localizer.getStrings(_this.styleOptions.language);
|
|
21267
21559
|
authManInit
|
|
21268
|
-
|
|
21560
|
+
// reuses this.styles.initPromise if initStyleset is already called
|
|
21561
|
+
.then(function () { return _this.styles.definitions(); })
|
|
21269
21562
|
.then(function (definitions) {
|
|
21270
21563
|
// Check that the map hasn't been removed for any reason.
|
|
21271
21564
|
// If so no need to finish styling the map.
|
|
21272
21565
|
if (_this.removed) {
|
|
21273
21566
|
return;
|
|
21274
21567
|
}
|
|
21275
|
-
// Add controls after initStyleset to prevent redundant initStyleset calls
|
|
21276
|
-
_this.controls.add(_this.copyrightControl, {
|
|
21277
|
-
position: exports.ControlPosition.NonFixed
|
|
21278
|
-
});
|
|
21279
21568
|
if (_this.authentication && !_this.authentication.getToken()) {
|
|
21280
21569
|
throw new Error("AuthenticationManager finished initializing, but no token is available");
|
|
21281
21570
|
}
|
|
@@ -21333,6 +21622,16 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
21333
21622
|
}
|
|
21334
21623
|
return _this;
|
|
21335
21624
|
}
|
|
21625
|
+
Object.defineProperty(Map.prototype, "isDisposed", {
|
|
21626
|
+
/**
|
|
21627
|
+
* Returns true if the map has been disposed.
|
|
21628
|
+
*/
|
|
21629
|
+
get: function () {
|
|
21630
|
+
return this.removed;
|
|
21631
|
+
},
|
|
21632
|
+
enumerable: false,
|
|
21633
|
+
configurable: true
|
|
21634
|
+
});
|
|
21336
21635
|
/**
|
|
21337
21636
|
* Returns the HTMLCanvasElement that the map is drawn to.
|
|
21338
21637
|
*/
|
|
@@ -21369,9 +21668,17 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
21369
21668
|
else {
|
|
21370
21669
|
this.accessibleMapDelegate.removeFromMap();
|
|
21371
21670
|
}
|
|
21372
|
-
|
|
21671
|
+
var shouldReloadStyle = this.styles.serviceOptions.mapConfiguration !== this.serviceOptions.mapConfiguration
|
|
21672
|
+
|| this.styles.serviceOptions.staticAssetsDomain !== this.serviceOptions.staticAssetsDomain
|
|
21673
|
+
|| this.styles.serviceOptions.styleDefinitionsVersion !== this.serviceOptions.styleDefinitionsVersion
|
|
21674
|
+
|| this.styles.serviceOptions.domain !== this.serviceOptions.domain
|
|
21675
|
+
|| this.styles.serviceOptions.styleAPIVersion !== this.serviceOptions.styleAPIVersion;
|
|
21676
|
+
// NOTE: only perform a reload when the style dependent properties are changed
|
|
21677
|
+
//|| this.styles.serviceOptions.validateStyle !== this.serviceOptions.validateStyle
|
|
21678
|
+
//|| this.styles.serviceOptions.transformRequest !== this.serviceOptions.transformRequest
|
|
21679
|
+
this.styles.serviceOptions = this.serviceOptions;
|
|
21680
|
+
if (shouldReloadStyle) {
|
|
21373
21681
|
this.styles.initPromise = null;
|
|
21374
|
-
this.styles.serviceOptions.mapConfiguration = this.serviceOptions.mapConfiguration;
|
|
21375
21682
|
this.setStyle({});
|
|
21376
21683
|
}
|
|
21377
21684
|
};
|
|
@@ -21923,7 +22230,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
21923
22230
|
urls = layer.getOptions().subdomains || [];
|
|
21924
22231
|
}
|
|
21925
22232
|
// Add the tile urls to the layer, but don't update the map yet.
|
|
21926
|
-
urls.push.apply(urls, __spreadArray$
|
|
22233
|
+
urls.push.apply(urls, __spreadArray$9([], __read$e(tileSources)));
|
|
21927
22234
|
layer._setOptionsNoUpdate({
|
|
21928
22235
|
subdomains: urls
|
|
21929
22236
|
});
|
|
@@ -22444,7 +22751,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
22444
22751
|
}
|
|
22445
22752
|
return ar;
|
|
22446
22753
|
};
|
|
22447
|
-
var __spreadArray$
|
|
22754
|
+
var __spreadArray$a = (window && window.__spreadArray) || function (to, from) {
|
|
22448
22755
|
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
22449
22756
|
to[j] = from[i];
|
|
22450
22757
|
return to;
|
|
@@ -22590,7 +22897,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
22590
22897
|
lineLength = 50;
|
|
22591
22898
|
}
|
|
22592
22899
|
var lines = c.split(/<(tr|div|br|li|h[0-9]|p>)/);
|
|
22593
|
-
longestStringLength = Math.max.apply(Math, __spreadArray$
|
|
22900
|
+
longestStringLength = Math.max.apply(Math, __spreadArray$a([], __read$f((lines.map(function (el) { return el.replace(/<[a-zA-Z0-9\s=\/]+>/g, "").length; }))))) - 1;
|
|
22594
22901
|
var w = Math.ceil(longestStringLength * 3.5);
|
|
22595
22902
|
if (w < width) {
|
|
22596
22903
|
width = w;
|