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
package/dist/atlas-core.js
CHANGED
|
@@ -77,7 +77,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
var azuremapsMaplibreGlUnminified = createCommonjsModule(function (module, exports) {
|
|
80
|
-
/* The Azure Maps fork of MapLibre GL JS is licensed under the 3-Clause BSD License. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v1.
|
|
80
|
+
/* The Azure Maps fork of MapLibre GL JS is licensed under the 3-Clause BSD License. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v1.16.0/LICENSE.txt */
|
|
81
81
|
(function (global, factory) {
|
|
82
82
|
module.exports = factory() ;
|
|
83
83
|
}(commonjsGlobal, (function () {
|
|
@@ -109,7 +109,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
109
109
|
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
var version = "1.
|
|
112
|
+
var version = "1.16.0";
|
|
113
113
|
|
|
114
114
|
var unitbezier = UnitBezier;
|
|
115
115
|
function UnitBezier(p1x, p1y, p2x, p2y) {
|
|
@@ -33124,7 +33124,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
33124
33124
|
Style.__proto__ = Evented;
|
|
33125
33125
|
Style.prototype = Object.create(Evented && Evented.prototype);
|
|
33126
33126
|
Style.prototype.constructor = Style;
|
|
33127
|
-
Style.prototype.loadURL = function loadURL(url, options) {
|
|
33127
|
+
Style.prototype.loadURL = function loadURL(url, options, previousStyle) {
|
|
33128
33128
|
var this$1 = this;
|
|
33129
33129
|
if (options === void 0)
|
|
33130
33130
|
options = {};
|
|
@@ -33137,11 +33137,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
33137
33137
|
if (error) {
|
|
33138
33138
|
this$1.fire(new performance.ErrorEvent(error));
|
|
33139
33139
|
} else if (json) {
|
|
33140
|
-
this$1._load(json, options);
|
|
33140
|
+
this$1._load(json, options, previousStyle);
|
|
33141
33141
|
}
|
|
33142
33142
|
});
|
|
33143
33143
|
};
|
|
33144
|
-
Style.prototype.loadJSON = function loadJSON(json, options) {
|
|
33144
|
+
Style.prototype.loadJSON = function loadJSON(json, options, previousStyle) {
|
|
33145
33145
|
var this$1 = this;
|
|
33146
33146
|
if (options === void 0)
|
|
33147
33147
|
options = {};
|
|
@@ -33149,34 +33149,29 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
33149
33149
|
this._request = performance.browser.frame(function () {
|
|
33150
33150
|
this$1._request = null;
|
|
33151
33151
|
options.validate = options.validate !== false;
|
|
33152
|
-
this$1._load(json, options);
|
|
33152
|
+
this$1._load(json, options, previousStyle);
|
|
33153
33153
|
});
|
|
33154
33154
|
};
|
|
33155
33155
|
Style.prototype.loadEmpty = function loadEmpty() {
|
|
33156
33156
|
this.fire(new performance.Event('dataloading', { dataType: 'style' }));
|
|
33157
33157
|
this._load(empty, { validate: false });
|
|
33158
33158
|
};
|
|
33159
|
-
Style.prototype._load = function _load(json, options) {
|
|
33160
|
-
var
|
|
33161
|
-
if (options.validate && emitValidationErrors(this, performance.validateStyle(
|
|
33159
|
+
Style.prototype._load = function _load(json, options, previousStyle) {
|
|
33160
|
+
var nextState = options.transformStyle ? options.transformStyle(previousStyle, json) : json;
|
|
33161
|
+
if (options.validate && emitValidationErrors(this, performance.validateStyle(nextState))) {
|
|
33162
33162
|
return;
|
|
33163
33163
|
}
|
|
33164
|
-
var patchOperations = [];
|
|
33165
|
-
if (options.stylePatch) {
|
|
33166
|
-
patchOperations = this._buildStylePatch(json, options);
|
|
33167
|
-
this.sourceCaches = {};
|
|
33168
|
-
}
|
|
33169
33164
|
this._loaded = true;
|
|
33170
|
-
this.stylesheet =
|
|
33171
|
-
for (var id in
|
|
33172
|
-
this.addSource(id,
|
|
33165
|
+
this.stylesheet = nextState;
|
|
33166
|
+
for (var id in nextState.sources) {
|
|
33167
|
+
this.addSource(id, nextState.sources[id], { validate: false });
|
|
33173
33168
|
}
|
|
33174
|
-
if (
|
|
33175
|
-
this._loadSprite(
|
|
33169
|
+
if (nextState.sprite) {
|
|
33170
|
+
this._loadSprite(nextState.sprite);
|
|
33176
33171
|
} else {
|
|
33177
33172
|
this.imageManager.setLoaded(true);
|
|
33178
33173
|
}
|
|
33179
|
-
this.glyphManager.setURL(
|
|
33174
|
+
this.glyphManager.setURL(nextState.glyphs);
|
|
33180
33175
|
var layers = derefLayers(this.stylesheet.layers);
|
|
33181
33176
|
this._order = layers.map(function (layer) {
|
|
33182
33177
|
return layer.id;
|
|
@@ -33192,11 +33187,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
33192
33187
|
}
|
|
33193
33188
|
this.dispatcher.broadcast('setLayers', this._serializeLayers(this._order));
|
|
33194
33189
|
this.light = new Light(this.stylesheet.light);
|
|
33195
|
-
patchOperations.filter(function (op) {
|
|
33196
|
-
return op.command !== operations.moveLayer;
|
|
33197
|
-
}).forEach(function (op) {
|
|
33198
|
-
this$1[op.command].apply(this$1, op.args);
|
|
33199
|
-
});
|
|
33200
33190
|
this.fire(new performance.Event('data', { dataType: 'style' }));
|
|
33201
33191
|
this.fire(new performance.Event('style.load'));
|
|
33202
33192
|
};
|
|
@@ -33371,33 +33361,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
33371
33361
|
if (emitValidationErrors(this, performance.validateStyle(nextState))) {
|
|
33372
33362
|
return false;
|
|
33373
33363
|
}
|
|
33374
|
-
nextState =
|
|
33364
|
+
nextState = options.transformStyle ? options.transformStyle(this.serialize(), nextState) : nextState;
|
|
33375
33365
|
nextState.layers = derefLayers(nextState.layers);
|
|
33376
|
-
var patchOperations = [];
|
|
33377
|
-
var preservedLayers = {};
|
|
33378
|
-
var preservedSources = {};
|
|
33379
|
-
if (options.stylePatch) {
|
|
33380
|
-
patchOperations = this._buildStylePatch(nextState, options);
|
|
33381
|
-
}
|
|
33382
|
-
patchOperations = patchOperations.filter(function (op) {
|
|
33383
|
-
if (op.command === operations.addLayer && this$1._serializedLayers.hasOwnProperty(op.args[0].id)) {
|
|
33384
|
-
preservedLayers[op.args[0].id] = true;
|
|
33385
|
-
return false;
|
|
33386
|
-
}
|
|
33387
|
-
if (op.command === operations.moveLayer && this$1._serializedLayers.hasOwnProperty(op.args[0])) {
|
|
33388
|
-
preservedLayers[op.args[0]] = true;
|
|
33389
|
-
return true;
|
|
33390
|
-
}
|
|
33391
|
-
if (op.command === operations.addSource && this$1.sourceCaches.hasOwnProperty(op.args[0])) {
|
|
33392
|
-
preservedSources[op.args[0]] = true;
|
|
33393
|
-
return false;
|
|
33394
|
-
}
|
|
33395
|
-
return true;
|
|
33396
|
-
});
|
|
33397
33366
|
var changes = diffStyles(this.serialize(), nextState).filter(function (op) {
|
|
33398
33367
|
return !(op.command in ignoredDiffOperations);
|
|
33399
33368
|
});
|
|
33400
|
-
changes = changes.concat(patchOperations);
|
|
33401
33369
|
if (changes.length === 0) {
|
|
33402
33370
|
return false;
|
|
33403
33371
|
}
|
|
@@ -33413,12 +33381,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
33413
33381
|
if (op.command === 'setTransition') {
|
|
33414
33382
|
return;
|
|
33415
33383
|
}
|
|
33416
|
-
if (op.command === operations.removeLayer && preservedLayers.hasOwnProperty(op.args[0])) {
|
|
33417
|
-
return;
|
|
33418
|
-
}
|
|
33419
|
-
if ((op.command === operations.addSource || op.command === operations.removeSource) && preservedSources.hasOwnProperty(op.args[0])) {
|
|
33420
|
-
return;
|
|
33421
|
-
}
|
|
33422
33384
|
this$1[op.command].apply(this$1, op.args);
|
|
33423
33385
|
});
|
|
33424
33386
|
this.stylesheet = nextState;
|
|
@@ -33809,109 +33771,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
33809
33771
|
return empty;
|
|
33810
33772
|
}
|
|
33811
33773
|
};
|
|
33812
|
-
Style.prototype._buildStylePatch = function _buildStylePatch(next, options) {
|
|
33813
|
-
var this$1 = this;
|
|
33814
|
-
var patchOperations = [];
|
|
33815
|
-
var preservedSources = [];
|
|
33816
|
-
var preservedLayers = [];
|
|
33817
|
-
var nextLayerIndex = next.layers.reduce(function (p, c) {
|
|
33818
|
-
p[c.id] = c;
|
|
33819
|
-
return p;
|
|
33820
|
-
}, {});
|
|
33821
|
-
var preserveLayer = function (layerId, before) {
|
|
33822
|
-
if (this$1.hasLayer(layerId)) {
|
|
33823
|
-
var preservedLayer = this$1._serializedLayers[layerId];
|
|
33824
|
-
if (!next.sources.hasOwnProperty(preservedLayer.source) && !preservedSources.includes(preservedLayer.source)) {
|
|
33825
|
-
patchOperations.push({
|
|
33826
|
-
command: 'addSource',
|
|
33827
|
-
args: [
|
|
33828
|
-
preservedLayer.source,
|
|
33829
|
-
this$1.sourceCaches[preservedLayer.source].serialize(),
|
|
33830
|
-
{ validate: false }
|
|
33831
|
-
]
|
|
33832
|
-
});
|
|
33833
|
-
preservedSources.push(preservedLayer.source);
|
|
33834
|
-
}
|
|
33835
|
-
if (nextLayerIndex.hasOwnProperty(layerId)) {
|
|
33836
|
-
patchOperations.push({
|
|
33837
|
-
command: 'removeLayer',
|
|
33838
|
-
args: [layerId]
|
|
33839
|
-
});
|
|
33840
|
-
}
|
|
33841
|
-
before = nextLayerIndex.hasOwnProperty(before) || preservedLayers.find(function (l) {
|
|
33842
|
-
return l.id === before;
|
|
33843
|
-
}) ? before : undefined;
|
|
33844
|
-
patchOperations.push({
|
|
33845
|
-
command: 'moveLayer',
|
|
33846
|
-
args: [
|
|
33847
|
-
preservedLayer.id,
|
|
33848
|
-
before,
|
|
33849
|
-
{ validate: true }
|
|
33850
|
-
]
|
|
33851
|
-
});
|
|
33852
|
-
patchOperations.push({
|
|
33853
|
-
command: 'addLayer',
|
|
33854
|
-
args: [
|
|
33855
|
-
preservedLayer,
|
|
33856
|
-
before,
|
|
33857
|
-
{ validate: true }
|
|
33858
|
-
]
|
|
33859
|
-
});
|
|
33860
|
-
preservedLayers.push(layerId);
|
|
33861
|
-
} else {
|
|
33862
|
-
performance.warnOnce('Cannot preserve layer ' + layerId + ' that is not in the previous style.');
|
|
33863
|
-
}
|
|
33864
|
-
};
|
|
33865
|
-
var updatePaintProperty = function (layerId, name, value) {
|
|
33866
|
-
if (nextLayerIndex.hasOwnProperty(layerId) || preservedLayers.includes(layerId)) {
|
|
33867
|
-
patchOperations.push({
|
|
33868
|
-
command: 'setPaintProperty',
|
|
33869
|
-
args: [
|
|
33870
|
-
layerId,
|
|
33871
|
-
name,
|
|
33872
|
-
value,
|
|
33873
|
-
{ validate: true }
|
|
33874
|
-
]
|
|
33875
|
-
});
|
|
33876
|
-
} else {
|
|
33877
|
-
performance.warnOnce('Cannot update paint property on layer ' + layerId + ' that is not in the next style.');
|
|
33878
|
-
}
|
|
33879
|
-
};
|
|
33880
|
-
var updateLayoutProperty = function (layerId, name, value) {
|
|
33881
|
-
if (nextLayerIndex.hasOwnProperty(layerId) || preservedLayers.includes(layerId)) {
|
|
33882
|
-
patchOperations.push({
|
|
33883
|
-
command: 'setLayoutProperty',
|
|
33884
|
-
args: [
|
|
33885
|
-
layerId,
|
|
33886
|
-
name,
|
|
33887
|
-
value,
|
|
33888
|
-
{ validate: true }
|
|
33889
|
-
]
|
|
33890
|
-
});
|
|
33891
|
-
} else {
|
|
33892
|
-
performance.warnOnce('Cannot update layout property on layer ' + layerId + ' that is not in the next style.');
|
|
33893
|
-
}
|
|
33894
|
-
};
|
|
33895
|
-
var updateFilter = function (layerId, name, value) {
|
|
33896
|
-
if (nextLayerIndex.hasOwnProperty(layerId) || preservedLayers.includes(layerId)) {
|
|
33897
|
-
patchOperations.push({
|
|
33898
|
-
command: 'setFilter',
|
|
33899
|
-
args: [
|
|
33900
|
-
layerId,
|
|
33901
|
-
name,
|
|
33902
|
-
value,
|
|
33903
|
-
{ validate: true }
|
|
33904
|
-
]
|
|
33905
|
-
});
|
|
33906
|
-
} else {
|
|
33907
|
-
performance.warnOnce('Cannot update filter on layer ' + layerId + ' that is not in the next style.');
|
|
33908
|
-
}
|
|
33909
|
-
};
|
|
33910
|
-
if (options.stylePatch) {
|
|
33911
|
-
options.stylePatch(this.serialize(), next, preserveLayer.bind(this), updatePaintProperty.bind(this), updateLayoutProperty.bind(this), updateFilter.bind(this));
|
|
33912
|
-
}
|
|
33913
|
-
return patchOperations;
|
|
33914
|
-
};
|
|
33915
33774
|
Style.prototype._updateLayer = function _updateLayer(layer) {
|
|
33916
33775
|
this._updatedLayers[layer.id] = true;
|
|
33917
33776
|
if (layer.source && !this._updatedSources[layer.source] && this.sourceCaches[layer.source].getSource().type !== 'raster') {
|
|
@@ -41194,33 +41053,31 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
41194
41053
|
return str;
|
|
41195
41054
|
};
|
|
41196
41055
|
Map.prototype._updateStyle = function _updateStyle(style, options) {
|
|
41056
|
+
var this$1 = this;
|
|
41197
41057
|
if (options === void 0)
|
|
41198
41058
|
options = {};
|
|
41199
|
-
if (
|
|
41200
|
-
|
|
41201
|
-
this.style
|
|
41202
|
-
|
|
41203
|
-
|
|
41204
|
-
if (!style) {
|
|
41205
|
-
delete this.style;
|
|
41206
|
-
return this;
|
|
41207
|
-
} else {
|
|
41208
|
-
this.style = new Style(this, options);
|
|
41209
|
-
}
|
|
41210
|
-
this.style.setEventedParent(this, { style: this.style });
|
|
41211
|
-
} else {
|
|
41212
|
-
if (!style) {
|
|
41213
|
-
style = emptyStyle();
|
|
41214
|
-
}
|
|
41059
|
+
if (options.transformStyle && this.style && !this.style._loaded) {
|
|
41060
|
+
this.style.once('style.load', function () {
|
|
41061
|
+
return this$1._updateStyle(style, options);
|
|
41062
|
+
});
|
|
41063
|
+
return;
|
|
41215
41064
|
}
|
|
41216
|
-
|
|
41065
|
+
var previousStyle = this.style && options.transformStyle ? this.style.serialize() : undefined;
|
|
41066
|
+
if (this.style) {
|
|
41067
|
+
this.style.setEventedParent(null);
|
|
41068
|
+
this.style._remove();
|
|
41069
|
+
}
|
|
41070
|
+
if (!style) {
|
|
41071
|
+
delete this.style;
|
|
41072
|
+
return this;
|
|
41073
|
+
} else {
|
|
41217
41074
|
this.style = new Style(this, options);
|
|
41218
|
-
this.style.setEventedParent(this, { style: this.style });
|
|
41219
41075
|
}
|
|
41076
|
+
this.style.setEventedParent(this, { style: this.style });
|
|
41220
41077
|
if (typeof style === 'string') {
|
|
41221
|
-
this.style.loadURL(style, options);
|
|
41078
|
+
this.style.loadURL(style, options, previousStyle);
|
|
41222
41079
|
} else {
|
|
41223
|
-
this.style.loadJSON(style, options);
|
|
41080
|
+
this.style.loadJSON(style, options, previousStyle);
|
|
41224
41081
|
}
|
|
41225
41082
|
return this;
|
|
41226
41083
|
};
|
|
@@ -43619,7 +43476,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
43619
43476
|
return Url;
|
|
43620
43477
|
}());
|
|
43621
43478
|
|
|
43622
|
-
var version = "2.
|
|
43479
|
+
var version = "2.3.0";
|
|
43623
43480
|
|
|
43624
43481
|
/**
|
|
43625
43482
|
* A helper class that provides methods for getting various forms of the map controls current version.
|
|
@@ -43999,7 +43856,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
43999
43856
|
* Build the outermost container for the control, applies styling including any listeners for auto styling.
|
|
44000
43857
|
*/
|
|
44001
43858
|
ControlBase.prototype.buildContainer = function (map, style, ariaLabel, tagName) {
|
|
44002
|
-
var _this = this;
|
|
44003
43859
|
this._map = map;
|
|
44004
43860
|
this._container = document.createElement(tagName || "div");
|
|
44005
43861
|
this._container.classList.add("azure-maps-control-container");
|
|
@@ -44008,11 +43864,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
44008
43864
|
}
|
|
44009
43865
|
// Set the style or add the auto listener.
|
|
44010
43866
|
if (style.toLowerCase() === exports.ControlStyle.auto) {
|
|
44011
|
-
this._map
|
|
44012
|
-
|
|
44013
|
-
|
|
44014
|
-
}
|
|
44015
|
-
});
|
|
43867
|
+
if (this._map) {
|
|
43868
|
+
this._map.events.add("stylechanged", this._onStyleChange);
|
|
43869
|
+
}
|
|
44016
43870
|
}
|
|
44017
43871
|
else {
|
|
44018
43872
|
this._container.classList.add(style);
|
|
@@ -47772,6 +47626,12 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
47772
47626
|
_this.hasFocus = false;
|
|
47773
47627
|
_this.styleButtons = new Dictionary();
|
|
47774
47628
|
_this.styleIcons = new Dictionary();
|
|
47629
|
+
// we need to rely on this to avoid potentially redundant thumbnail requests and .blob calls
|
|
47630
|
+
_this.thumbnailCache = {
|
|
47631
|
+
assumedConfiguration: undefined,
|
|
47632
|
+
response: new Dictionary(),
|
|
47633
|
+
blob: new Dictionary()
|
|
47634
|
+
};
|
|
47775
47635
|
/**
|
|
47776
47636
|
* Callback handler for the style changing.
|
|
47777
47637
|
*/
|
|
@@ -47785,6 +47645,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
47785
47645
|
if (!_this.styleOpsGrid) {
|
|
47786
47646
|
return;
|
|
47787
47647
|
}
|
|
47648
|
+
// do not recreate the styleOpsGrid if it is initialized and configuration object reference has not changed
|
|
47649
|
+
if (_this.styleOpsGrid.children.length > 0 && _this.thumbnailCache.assumedConfiguration === definitions) {
|
|
47650
|
+
return;
|
|
47651
|
+
}
|
|
47652
|
+
_this.thumbnailCache.assumedConfiguration = definitions;
|
|
47788
47653
|
Array.from(_this.styleOpsGrid.children).forEach(function (element) { return element.remove(); });
|
|
47789
47654
|
_this.styleButtons.clear();
|
|
47790
47655
|
_this.populateOpsGridFromDefinitions(definitions);
|
|
@@ -47890,6 +47755,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
47890
47755
|
_super.prototype.onRemove.call(this);
|
|
47891
47756
|
this.styleOpsGrid = null;
|
|
47892
47757
|
this.styleButtons.clear();
|
|
47758
|
+
this.thumbnailCache.response.clear();
|
|
47759
|
+
this.thumbnailCache.blob.clear();
|
|
47760
|
+
this.thumbnailCache.assumedConfiguration = undefined;
|
|
47893
47761
|
this.map.events.remove("stylechanged", this.onStyleChange);
|
|
47894
47762
|
this.map.events.remove("mapconfigurationchanged", this.onMapConfigurationChange);
|
|
47895
47763
|
};
|
|
@@ -47949,7 +47817,18 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
47949
47817
|
styleOptionButton.setAttribute("type", "button");
|
|
47950
47818
|
var styleIconImage = new Image();
|
|
47951
47819
|
fetchIconPromise
|
|
47952
|
-
.then(function (response) {
|
|
47820
|
+
.then(function (response) {
|
|
47821
|
+
if (_this.thumbnailCache.blob.has(response.url)) {
|
|
47822
|
+
return _this.thumbnailCache.blob.get(response.url);
|
|
47823
|
+
}
|
|
47824
|
+
else {
|
|
47825
|
+
// we need the response.clone() to allow reading over body multiple times since response objects are cached
|
|
47826
|
+
// and can be reused across multiple invocations
|
|
47827
|
+
var blobPromise = response.clone().blob();
|
|
47828
|
+
_this.thumbnailCache.blob.set(response.url, blobPromise);
|
|
47829
|
+
return blobPromise;
|
|
47830
|
+
}
|
|
47831
|
+
})
|
|
47953
47832
|
.then(function (blob) {
|
|
47954
47833
|
var iconUrl = URL.createObjectURL(blob);
|
|
47955
47834
|
styleIconImage.src = iconUrl;
|
|
@@ -48057,7 +47936,14 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
48057
47936
|
if (mapServiceOptions.transformRequest) {
|
|
48058
47937
|
merge_1(requestParams, mapServiceOptions.transformRequest(requestParams.url, "Thumbnail"));
|
|
48059
47938
|
}
|
|
48060
|
-
var fetchThumbnailPromise
|
|
47939
|
+
var fetchThumbnailPromise;
|
|
47940
|
+
if (_this.thumbnailCache.response.has(requestParams.url)) {
|
|
47941
|
+
fetchThumbnailPromise = Promise.resolve(_this.thumbnailCache.response.get(requestParams.url));
|
|
47942
|
+
}
|
|
47943
|
+
else {
|
|
47944
|
+
fetchThumbnailPromise = fetch(requestParams.url, { headers: requestParams.headers });
|
|
47945
|
+
_this.thumbnailCache.response.set(requestParams.url, fetchThumbnailPromise);
|
|
47946
|
+
}
|
|
48061
47947
|
// Add button for each style
|
|
48062
47948
|
var styleOptionButton = _this.buildSelectStyleBtn(style.name, definitions, fetchThumbnailPromise);
|
|
48063
47949
|
_this.styleOpsGrid.appendChild(styleOptionButton);
|
|
@@ -53335,7 +53221,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
53335
53221
|
};
|
|
53336
53222
|
ZoomControl.prototype.updateZoomButtonsState = function () {
|
|
53337
53223
|
var zoomInDisabled = this.map.getCamera().zoom >= this.map._getMap().getMaxZoom();
|
|
53338
|
-
// small values need special handling, since depending on the height of the map view
|
|
53224
|
+
// small values need special handling, since depending on the height of the map view
|
|
53339
53225
|
// the actual zoom we can zoom out to can be above or below 0 when the entire map fits the height into the view
|
|
53340
53226
|
// use web mercator bounds to check if entire latitude range is visible
|
|
53341
53227
|
var reachedLatitudeBoundaries = BoundingBox.getSouth(this.map.getCamera().bounds) <= -WEBMERCATOR_MAXLAT
|
|
@@ -53347,7 +53233,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
53347
53233
|
}
|
|
53348
53234
|
if (this.zoomOutButton && this.zoomOutButton.disabled != zoomOutDisabled) {
|
|
53349
53235
|
this.zoomOutButton.disabled = zoomOutDisabled;
|
|
53350
|
-
this.
|
|
53236
|
+
this.zoomOutButton.setAttribute("aria-label", zoomInDisabled ? "Zoom Out disabled" : "Zoom Out");
|
|
53351
53237
|
}
|
|
53352
53238
|
};
|
|
53353
53239
|
ZoomControl.prototype.constructZoomInButton = function (map) {
|
|
@@ -53619,19 +53505,24 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
53619
53505
|
* Get reference to Mapbox Map
|
|
53620
53506
|
* @internal
|
|
53621
53507
|
*/
|
|
53622
|
-
Source.prototype._setMap = function (map) {
|
|
53508
|
+
Source.prototype._setMap = function (map, shouldInvokeEvent) {
|
|
53509
|
+
if (shouldInvokeEvent === void 0) { shouldInvokeEvent = true; }
|
|
53623
53510
|
if (map == null || map === undefined) {
|
|
53624
53511
|
var temp = this.map;
|
|
53625
53512
|
delete this.map;
|
|
53626
|
-
|
|
53627
|
-
|
|
53628
|
-
temp
|
|
53513
|
+
if (shouldInvokeEvent) {
|
|
53514
|
+
this._invokeEvent("sourceremoved", this);
|
|
53515
|
+
if (temp) {
|
|
53516
|
+
temp.events.invoke("sourceremoved", this);
|
|
53517
|
+
}
|
|
53629
53518
|
}
|
|
53630
53519
|
}
|
|
53631
53520
|
else {
|
|
53632
53521
|
this.map = map;
|
|
53633
|
-
|
|
53634
|
-
|
|
53522
|
+
if (shouldInvokeEvent) {
|
|
53523
|
+
this._invokeEvent("sourceadded", this);
|
|
53524
|
+
this.map.events.invoke("sourceadded", this);
|
|
53525
|
+
}
|
|
53635
53526
|
}
|
|
53636
53527
|
};
|
|
53637
53528
|
return Source;
|
|
@@ -53952,6 +53843,27 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
53952
53843
|
}
|
|
53953
53844
|
return geoJsonSource;
|
|
53954
53845
|
};
|
|
53846
|
+
DataSource.prototype._isDeepEqual = function (other) {
|
|
53847
|
+
if (this.constructor !== other.constructor) {
|
|
53848
|
+
return false;
|
|
53849
|
+
}
|
|
53850
|
+
var source = this._buildSource();
|
|
53851
|
+
var otherSource = other._buildSource();
|
|
53852
|
+
return source.type === otherSource.type &&
|
|
53853
|
+
// 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.
|
|
53854
|
+
//source.data === otherSource.data &&
|
|
53855
|
+
source.maxzoom === otherSource.maxzoom &&
|
|
53856
|
+
source.cluster === otherSource.cluster &&
|
|
53857
|
+
source.clusterRadius === otherSource.clusterRadius &&
|
|
53858
|
+
source.tolerance === otherSource.tolerance &&
|
|
53859
|
+
source.lineMetrics === otherSource.lineMetrics &&
|
|
53860
|
+
JSON.stringify(source.clusterProperties) === JSON.stringify(otherSource.clusterProperties) &&
|
|
53861
|
+
source.buffer === otherSource.buffer &&
|
|
53862
|
+
source.clusterMinPoints === otherSource.clusterMinPoints &&
|
|
53863
|
+
source.generateId === otherSource.generateId &&
|
|
53864
|
+
source.promoteId === otherSource.promoteId &&
|
|
53865
|
+
source.filter === otherSource.filter;
|
|
53866
|
+
};
|
|
53955
53867
|
/**
|
|
53956
53868
|
* @internal
|
|
53957
53869
|
*/
|
|
@@ -54233,6 +54145,26 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
54233
54145
|
}
|
|
54234
54146
|
return vectorSource;
|
|
54235
54147
|
};
|
|
54148
|
+
/**
|
|
54149
|
+
* @internal
|
|
54150
|
+
*/
|
|
54151
|
+
VectorTileSource.prototype._isDeepEqual = function (other) {
|
|
54152
|
+
if (this.constructor !== other.constructor) {
|
|
54153
|
+
return false;
|
|
54154
|
+
}
|
|
54155
|
+
var source = this._buildSource();
|
|
54156
|
+
var otherSource = other._buildSource();
|
|
54157
|
+
return source.type === otherSource.type &&
|
|
54158
|
+
source.url === otherSource.url &&
|
|
54159
|
+
((source.tiles === undefined && otherSource.tiles === undefined) ||
|
|
54160
|
+
(source.tiles && otherSource.tiles && source.tiles.length === otherSource.tiles.length && source.tiles.every(function (value, idx) { return value === otherSource.tiles[idx]; }))) &&
|
|
54161
|
+
source.minzoom === otherSource.minzoom &&
|
|
54162
|
+
source.maxzoom === otherSource.maxzoom &&
|
|
54163
|
+
source.bounds === otherSource.bounds &&
|
|
54164
|
+
source.attribution === otherSource.attribution &&
|
|
54165
|
+
source.promoteId === otherSource.promoteId &&
|
|
54166
|
+
source.scheme === otherSource.scheme;
|
|
54167
|
+
};
|
|
54236
54168
|
return VectorTileSource;
|
|
54237
54169
|
}(Source));
|
|
54238
54170
|
|
|
@@ -54524,11 +54456,41 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
54524
54456
|
/**
|
|
54525
54457
|
* @internal
|
|
54526
54458
|
* Specifies whether to create focusable indicators for the bubbles.
|
|
54459
|
+
* The default highlighting style is provided if the source is DataSource with Shape:
|
|
54460
|
+
* ```ts
|
|
54461
|
+
* const datasource = new DataSource('bubble-source');
|
|
54462
|
+
* datasource.setShapes([new Shape(new Point([-122.335, 47.62]))]);
|
|
54463
|
+
* this.map.sources.add(datasource);
|
|
54464
|
+
* const layer = new BubbleLayer(datasource, 'bubble', {
|
|
54465
|
+
* radius: 10,
|
|
54466
|
+
* color: 'cyan',
|
|
54467
|
+
* createIndicators: true,
|
|
54468
|
+
* });
|
|
54469
|
+
* ```
|
|
54470
|
+
*
|
|
54471
|
+
* For other sources, you can provide the accessibilityIdKey option to specify the property name of the feature to use as the accessibility id.
|
|
54472
|
+
* ```ts
|
|
54473
|
+
* const vtSource = new VectorTileSource("indoorTiles", { tiles, // provide your tile urls });
|
|
54474
|
+
* this.map.sources.add(vtSource);
|
|
54475
|
+
* const layer = new BubbleLayer(vtSource, 'bubble', {
|
|
54476
|
+
* createIndicators: true,
|
|
54477
|
+
* accessibilityIdKey: '{add your ID here}'
|
|
54478
|
+
* });
|
|
54479
|
+
* ```
|
|
54480
|
+
*
|
|
54481
|
+
* If you want to customize the highlighting style, you can use the focusin/focusout events to change the style of the bubble.
|
|
54482
|
+
* ```ts
|
|
54483
|
+
* this.map.events.add('focusin', 'bubble', (e) => { handle the style highlight });
|
|
54484
|
+
* ```
|
|
54527
54485
|
*
|
|
54528
54486
|
* Note: We treat this as an internal option for now because we hadn't fully decided the default styling for the indicators.
|
|
54529
54487
|
* Once we decide, we will make this a public option or remove it.
|
|
54530
54488
|
*/
|
|
54531
54489
|
_this.createIndicators = false;
|
|
54490
|
+
/**
|
|
54491
|
+
* @internal
|
|
54492
|
+
*/
|
|
54493
|
+
_this.accessibilityIdKey = undefined;
|
|
54532
54494
|
return _this;
|
|
54533
54495
|
}
|
|
54534
54496
|
return BubbleLayerOptions;
|
|
@@ -54601,6 +54563,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
54601
54563
|
}
|
|
54602
54564
|
return ar;
|
|
54603
54565
|
};
|
|
54566
|
+
var __spreadArray = (window && window.__spreadArray) || function (to, from) {
|
|
54567
|
+
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
54568
|
+
to[j] = from[i];
|
|
54569
|
+
return to;
|
|
54570
|
+
};
|
|
54604
54571
|
/**
|
|
54605
54572
|
* Renders Point objects as scalable circles (bubbles).
|
|
54606
54573
|
*/
|
|
@@ -54615,45 +54582,60 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
54615
54582
|
function BubbleLayer(source, id, options) {
|
|
54616
54583
|
var _this = _super.call(this, id) || this;
|
|
54617
54584
|
_this.accessibleIndicator = [];
|
|
54618
|
-
|
|
54619
|
-
|
|
54585
|
+
/** @internal */
|
|
54586
|
+
_this._setAccessibleIndicator = function () { return __awaiter$1(_this, void 0, void 0, function () {
|
|
54587
|
+
var renderedShapes, accessibilityIdKey, createIndicator, insertHiddenBefore, insertHiddenInFront, attach;
|
|
54620
54588
|
var _this = this;
|
|
54621
54589
|
return __generator$1(this, function (_a) {
|
|
54622
54590
|
this.accessibleIndicator.forEach(function (indicator) { return indicator.remove(); });
|
|
54623
54591
|
this.accessibleIndicator = [];
|
|
54624
|
-
|
|
54625
|
-
|
|
54626
|
-
|
|
54627
|
-
var
|
|
54592
|
+
renderedShapes = this.map.layers.getRenderedShapes(this.map.getCamera().bounds, this);
|
|
54593
|
+
accessibilityIdKey = this.options.accessibilityIdKey || (this._getDataSource() ? Shape._shapeIdPropName : undefined);
|
|
54594
|
+
createIndicator = function (renderedShapes, idx) {
|
|
54595
|
+
var curRenderedShape = renderedShapes[idx];
|
|
54596
|
+
var bubbleFeature = curRenderedShape instanceof Shape ? curRenderedShape.toJson() : curRenderedShape;
|
|
54597
|
+
var indicator = new AccessibleIndicator({ positionInSet: idx + 1, setSize: renderedShapes.length });
|
|
54628
54598
|
var element = indicator.getElement();
|
|
54629
|
-
var _a = __read$3(_this.map.positionsToPixels([bubbleFeature.
|
|
54599
|
+
var _a = __read$3(_this.map.positionsToPixels([_this.getFirstCoordinate(bubbleFeature.geometry.coordinates)]), 1), pixel = _a[0];
|
|
54630
54600
|
element.addEventListener('focusin', function (event) {
|
|
54631
|
-
_this.accessibleIndicator.filter(function (
|
|
54601
|
+
_this.accessibleIndicator.filter(function (i) { return i !== indicator; }).forEach(function (indicator) { return indicator.remove(); });
|
|
54632
54602
|
// insert previous and next popups
|
|
54633
54603
|
if (idx - 1 >= 0) {
|
|
54634
|
-
insertHiddenBefore(indicator, createIndicator(
|
|
54604
|
+
insertHiddenBefore(indicator, createIndicator(renderedShapes, idx - 1));
|
|
54635
54605
|
}
|
|
54636
|
-
if (idx + 1 <
|
|
54637
|
-
attach(createIndicator(
|
|
54606
|
+
if (idx + 1 < renderedShapes.length) {
|
|
54607
|
+
attach(createIndicator(renderedShapes, idx + 1));
|
|
54608
|
+
}
|
|
54609
|
+
// if we are on boundaries: add the first / last indicator
|
|
54610
|
+
// to maintain indicators on full page navigation cycle
|
|
54611
|
+
if (idx >= 2 && idx == renderedShapes.length - 1) {
|
|
54612
|
+
insertHiddenInFront(createIndicator(renderedShapes, 0));
|
|
54613
|
+
}
|
|
54614
|
+
if (idx == 0 && renderedShapes.length >= 2) {
|
|
54615
|
+
attach(createIndicator(renderedShapes, renderedShapes.length - 1));
|
|
54616
|
+
}
|
|
54617
|
+
if (accessibilityIdKey !== undefined) {
|
|
54618
|
+
_this.map._getMap().setPaintProperty(_this.id, 'circle-stroke-color', ['case', ['==', ['get', accessibilityIdKey], bubbleFeature.properties[accessibilityIdKey]], '#000000', _this.options.strokeColor]);
|
|
54638
54619
|
}
|
|
54639
|
-
_this.map._getMap().setPaintProperty(_this.id, 'circle-stroke-color', ['case', ['==', ['get', '_azureMapsShapeId'], bubbleFeature.data.id], '#000000', _this.options.strokeColor]);
|
|
54640
54620
|
var focusEvent = {
|
|
54641
54621
|
target: element,
|
|
54642
54622
|
type: 'focusin',
|
|
54643
54623
|
map: _this.map,
|
|
54644
|
-
shape:
|
|
54624
|
+
shape: curRenderedShape,
|
|
54645
54625
|
originalEvent: event,
|
|
54646
54626
|
pixel: pixel
|
|
54647
54627
|
};
|
|
54648
54628
|
_this._invokeEvent('focusin', focusEvent);
|
|
54649
54629
|
});
|
|
54650
54630
|
element.addEventListener('focusout', function (event) {
|
|
54651
|
-
|
|
54631
|
+
if (accessibilityIdKey !== undefined) {
|
|
54632
|
+
_this.map._getMap().setPaintProperty(_this.id, 'circle-stroke-color', ['case', ['==', ['get', accessibilityIdKey], bubbleFeature.properties[accessibilityIdKey]], _this.options.strokeColor, _this.options.strokeColor]);
|
|
54633
|
+
}
|
|
54652
54634
|
var focusEvent = {
|
|
54653
54635
|
target: element,
|
|
54654
54636
|
type: 'focusout',
|
|
54655
54637
|
map: _this.map,
|
|
54656
|
-
shape:
|
|
54638
|
+
shape: curRenderedShape,
|
|
54657
54639
|
originalEvent: event,
|
|
54658
54640
|
pixel: pixel
|
|
54659
54641
|
};
|
|
@@ -54668,14 +54650,20 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
54668
54650
|
var baseElement = base.getElement();
|
|
54669
54651
|
baseElement.parentElement.insertBefore(elementToSwapIn, baseElement);
|
|
54670
54652
|
};
|
|
54653
|
+
insertHiddenInFront = function (toInsert) {
|
|
54654
|
+
toInsert.attach(_this.map);
|
|
54655
|
+
var elementToSwapIn = toInsert.getElement();
|
|
54656
|
+
var parent = elementToSwapIn.parentElement;
|
|
54657
|
+
parent.insertBefore(elementToSwapIn, parent.firstElementChild);
|
|
54658
|
+
};
|
|
54671
54659
|
attach = function (popup) {
|
|
54672
54660
|
popup.attach(_this.map);
|
|
54673
54661
|
};
|
|
54674
|
-
if (
|
|
54675
|
-
attach(createIndicator(
|
|
54662
|
+
if (renderedShapes.length > 0) {
|
|
54663
|
+
attach(createIndicator(renderedShapes, 0));
|
|
54676
54664
|
}
|
|
54677
|
-
if (
|
|
54678
|
-
attach(createIndicator(
|
|
54665
|
+
if (renderedShapes.length > 1) {
|
|
54666
|
+
attach(createIndicator(renderedShapes, renderedShapes.length - 1));
|
|
54679
54667
|
}
|
|
54680
54668
|
return [2 /*return*/];
|
|
54681
54669
|
});
|
|
@@ -54728,18 +54716,71 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
54728
54716
|
this.options = newOptions;
|
|
54729
54717
|
};
|
|
54730
54718
|
BubbleLayer.prototype.onAdd = function (map) {
|
|
54719
|
+
var _this = this;
|
|
54731
54720
|
_super.prototype.onAdd.call(this, map);
|
|
54732
54721
|
if (this.options.createIndicators) {
|
|
54733
|
-
map
|
|
54734
|
-
map.events.
|
|
54722
|
+
// Wait for map idle for the first time to ensure `layer.getRenderedShapes` return correct shapes.
|
|
54723
|
+
map.events.addOnce('idle', this._setAccessibleIndicator);
|
|
54724
|
+
// The rendered shapes may be changed when map is moved. Update the indicators when map is moved.
|
|
54725
|
+
map.events.add('moveend', this._setAccessibleIndicator);
|
|
54726
|
+
var dataSource = this._getDataSource();
|
|
54727
|
+
if (dataSource) {
|
|
54728
|
+
// The rendered shapes may be changed when data is added. Update the indicators when data is added.
|
|
54729
|
+
map.events.add('dataadded', dataSource, function () {
|
|
54730
|
+
// Wait for map idle to ensure `layer.getRenderedShapes` return correct shapes.
|
|
54731
|
+
map.events.addOnce('idle', _this._setAccessibleIndicator);
|
|
54732
|
+
});
|
|
54733
|
+
}
|
|
54734
|
+
else {
|
|
54735
|
+
var sourceId_1 = typeof this.options.source === 'string' ? this.options.source : this.options.source.getId();
|
|
54736
|
+
map.events.add('sourcedata', function (mapDataEvent) {
|
|
54737
|
+
var _a;
|
|
54738
|
+
// There's chances that mapDataEvent.isSourceLoaded doesn't update correctly when using flyTo, thus we check by using map.isSourceLoaded.
|
|
54739
|
+
if (((_a = mapDataEvent.source) === null || _a === void 0 ? void 0 : _a.getId()) === sourceId_1 && map._getMap().isSourceLoaded(sourceId_1)) {
|
|
54740
|
+
// Source event will be fired multiple times, and we are only interested when the source is loaded.
|
|
54741
|
+
// Thus design a cache key that only changed when camera & style properties are changed.
|
|
54742
|
+
var curCacheKey = _this._getSourceDataEventCacheKey();
|
|
54743
|
+
if (curCacheKey !== _this.sourceDataEventCacheKey) {
|
|
54744
|
+
_this._setAccessibleIndicator();
|
|
54745
|
+
_this.sourceDataEventCacheKey = curCacheKey;
|
|
54746
|
+
}
|
|
54747
|
+
}
|
|
54748
|
+
});
|
|
54749
|
+
}
|
|
54735
54750
|
}
|
|
54736
54751
|
};
|
|
54737
54752
|
BubbleLayer.prototype.onRemove = function () {
|
|
54738
|
-
_super.prototype.onRemove.call(this);
|
|
54739
54753
|
if (this.options.createIndicators) {
|
|
54740
|
-
this.map.events.remove('idle', this.
|
|
54741
|
-
this.map.events.remove('moveend', this.
|
|
54754
|
+
this.map.events.remove('idle', this._setAccessibleIndicator);
|
|
54755
|
+
this.map.events.remove('moveend', this._setAccessibleIndicator);
|
|
54756
|
+
var dataSource = this._getDataSource();
|
|
54757
|
+
if (dataSource) {
|
|
54758
|
+
this.map.events.remove('dataadded', dataSource, this._setAccessibleIndicator);
|
|
54759
|
+
}
|
|
54760
|
+
else {
|
|
54761
|
+
this.map.events.remove('sourcedata', this._setAccessibleIndicator);
|
|
54762
|
+
}
|
|
54763
|
+
}
|
|
54764
|
+
_super.prototype.onRemove.call(this);
|
|
54765
|
+
};
|
|
54766
|
+
BubbleLayer.prototype._getSourceDataEventCacheKey = function () {
|
|
54767
|
+
if (!this.map) {
|
|
54768
|
+
return undefined;
|
|
54742
54769
|
}
|
|
54770
|
+
var mapConfiguration = this.map.getServiceOptions().mapConfiguration;
|
|
54771
|
+
return __spreadArray(__spreadArray([], __read$3(this.map.getCamera().bounds)), [
|
|
54772
|
+
this.map.getCamera().zoom,
|
|
54773
|
+
this.map.getCamera().pitch,
|
|
54774
|
+
this.map.getStyle().style,
|
|
54775
|
+
mapConfiguration instanceof Object ? mapConfiguration.id : mapConfiguration
|
|
54776
|
+
]).join(',');
|
|
54777
|
+
};
|
|
54778
|
+
BubbleLayer.prototype._getDataSource = function () {
|
|
54779
|
+
var source = typeof this.options.source === 'string' ? this.map.sources.getById(this.options.source) : this.options.source;
|
|
54780
|
+
if (source instanceof DataSource) {
|
|
54781
|
+
return source;
|
|
54782
|
+
}
|
|
54783
|
+
return undefined;
|
|
54743
54784
|
};
|
|
54744
54785
|
/**
|
|
54745
54786
|
* @internal
|
|
@@ -54792,6 +54833,17 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
54792
54833
|
ids.add(this.options.source);
|
|
54793
54834
|
return ids;
|
|
54794
54835
|
};
|
|
54836
|
+
/**
|
|
54837
|
+
* The coordinates can be nested, so we need to get the first coordinate.
|
|
54838
|
+
* @param coordinates The property from the Geometry. Can be Position, Position[], Position[][], etc.
|
|
54839
|
+
* @returns
|
|
54840
|
+
*/
|
|
54841
|
+
BubbleLayer.prototype.getFirstCoordinate = function (coordinates) {
|
|
54842
|
+
if (!Array.isArray(coordinates[0])) {
|
|
54843
|
+
return coordinates;
|
|
54844
|
+
}
|
|
54845
|
+
return this.getFirstCoordinate(coordinates[0]);
|
|
54846
|
+
};
|
|
54795
54847
|
return BubbleLayer;
|
|
54796
54848
|
}(Layer));
|
|
54797
54849
|
|
|
@@ -55875,7 +55927,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
55875
55927
|
}
|
|
55876
55928
|
return ar;
|
|
55877
55929
|
};
|
|
55878
|
-
var __spreadArray = (window && window.__spreadArray) || function (to, from) {
|
|
55930
|
+
var __spreadArray$1 = (window && window.__spreadArray) || function (to, from) {
|
|
55879
55931
|
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
55880
55932
|
to[j] = from[i];
|
|
55881
55933
|
return to;
|
|
@@ -55950,7 +56002,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
55950
56002
|
finally { if (e_1) throw e_1.error; }
|
|
55951
56003
|
}
|
|
55952
56004
|
// Then execute the standard merge behavior.
|
|
55953
|
-
var merged = _super.prototype.merge.apply(this, __spreadArray([], __read$4(valueList)));
|
|
56005
|
+
var merged = _super.prototype.merge.apply(this, __spreadArray$1([], __read$4(valueList)));
|
|
55954
56006
|
if (isNewColorSet) {
|
|
55955
56007
|
merged.fillPattern = undefined;
|
|
55956
56008
|
}
|
|
@@ -58644,7 +58696,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
58644
58696
|
}
|
|
58645
58697
|
return ar;
|
|
58646
58698
|
};
|
|
58647
|
-
var __spreadArray$
|
|
58699
|
+
var __spreadArray$2 = (window && window.__spreadArray) || function (to, from) {
|
|
58648
58700
|
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
58649
58701
|
to[j] = from[i];
|
|
58650
58702
|
return to;
|
|
@@ -58781,7 +58833,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
58781
58833
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
58782
58834
|
valueList[_i] = arguments[_i];
|
|
58783
58835
|
}
|
|
58784
|
-
var merged = _super.prototype.merge.apply(this, __spreadArray$
|
|
58836
|
+
var merged = _super.prototype.merge.apply(this, __spreadArray$2([], __read$6(valueList)));
|
|
58785
58837
|
if (merged.authType === exports.AuthenticationType.subscriptionKey) {
|
|
58786
58838
|
merged.authContext = merged.aadAppId = merged.getToken = undefined;
|
|
58787
58839
|
}
|
|
@@ -59452,10 +59504,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
59452
59504
|
if (add) {
|
|
59453
59505
|
this.logoAnchor = document.createElement("a");
|
|
59454
59506
|
this.logoAnchor.className = "azure-map-logo";
|
|
59455
|
-
this.logoAnchor.href = "https://
|
|
59507
|
+
this.logoAnchor.href = "https://aka.ms/azuremaps";
|
|
59456
59508
|
this.logoAnchor.setAttribute("aria-label", "Microsoft");
|
|
59509
|
+
this.logoAnchor.setAttribute("target", "_blank");
|
|
59457
59510
|
this.container.appendChild(this.logoAnchor);
|
|
59458
|
-
this.logoTooltip = buildAccessibleTooltip("Visit microsoft.com");
|
|
59511
|
+
this.logoTooltip = buildAccessibleTooltip("Visit azure.microsoft.com");
|
|
59459
59512
|
this.container.appendChild(this.logoTooltip);
|
|
59460
59513
|
positionTooltip(this.logoTooltip, this.logoAnchor);
|
|
59461
59514
|
}
|
|
@@ -59737,7 +59790,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
59737
59790
|
}
|
|
59738
59791
|
return ar;
|
|
59739
59792
|
};
|
|
59740
|
-
var __spreadArray$
|
|
59793
|
+
var __spreadArray$3 = (window && window.__spreadArray) || function (to, from) {
|
|
59741
59794
|
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
59742
59795
|
to[j] = from[i];
|
|
59743
59796
|
return to;
|
|
@@ -60205,7 +60258,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
60205
60258
|
// Derive polygon layers from the label config.
|
|
60206
60259
|
_this._polygonStyleLayer = _this._labelConfig.reduce(function (acc, cur) {
|
|
60207
60260
|
if (cur.polygonSources) {
|
|
60208
|
-
acc.push.apply(acc, __spreadArray$
|
|
60261
|
+
acc.push.apply(acc, __spreadArray$3([], __read$7(cur.polygonSources)));
|
|
60209
60262
|
}
|
|
60210
60263
|
return acc;
|
|
60211
60264
|
}, []);
|
|
@@ -64690,7 +64743,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
64690
64743
|
}
|
|
64691
64744
|
return ar;
|
|
64692
64745
|
};
|
|
64693
|
-
var __spreadArray$
|
|
64746
|
+
var __spreadArray$4 = (window && window.__spreadArray) || function (to, from) {
|
|
64694
64747
|
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
64695
64748
|
to[j] = from[i];
|
|
64696
64749
|
return to;
|
|
@@ -64708,7 +64761,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
64708
64761
|
'data-azure-maps-attribution-order',
|
|
64709
64762
|
'data-azure-maps-attribution-dynamic'
|
|
64710
64763
|
];
|
|
64711
|
-
var allowedAttributionAttributes = __spreadArray$
|
|
64764
|
+
var allowedAttributionAttributes = __spreadArray$4([
|
|
64712
64765
|
'href'
|
|
64713
64766
|
], __read$8(attributionRuleAttributes));
|
|
64714
64767
|
var AttributionRuleProxy = /** @class */ (function () {
|
|
@@ -64933,7 +64986,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
64933
64986
|
};
|
|
64934
64987
|
AttributionRuleProxy.prototype.applyAttributionResponse = function (attributions) {
|
|
64935
64988
|
var _this = this;
|
|
64936
|
-
var copyrights = attributions.map(function (resp) { return resp.copyrights || []; }).reduce(function (flat, copyrights) { return __spreadArray$
|
|
64989
|
+
var copyrights = attributions.map(function (resp) { return resp.copyrights || []; }).reduce(function (flat, copyrights) { return __spreadArray$4(__spreadArray$4([], __read$8(flat)), __read$8(copyrights)); }, []);
|
|
64937
64990
|
if (copyrights.length == 0) {
|
|
64938
64991
|
// no attribution for a provided tileset/bbox/z
|
|
64939
64992
|
return;
|
|
@@ -64998,7 +65051,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
64998
65051
|
}
|
|
64999
65052
|
return ar;
|
|
65000
65053
|
};
|
|
65001
|
-
var __spreadArray$
|
|
65054
|
+
var __spreadArray$5 = (window && window.__spreadArray) || function (to, from) {
|
|
65002
65055
|
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
65003
65056
|
to[j] = from[i];
|
|
65004
65057
|
return to;
|
|
@@ -65117,10 +65170,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
65117
65170
|
}, function () { return document.createElement('span'); });
|
|
65118
65171
|
});
|
|
65119
65172
|
var registeredRuleSet = new Set(Object.values(registeredRules));
|
|
65120
|
-
var redundantRules = new Set(__spreadArray$
|
|
65121
|
-
var redundantElements = new Set(__spreadArray$
|
|
65173
|
+
var redundantRules = new Set(__spreadArray$5([], __read$9(allRules)).filter(function (rule) { return !registeredRuleSet.has(rule); }));
|
|
65174
|
+
var redundantElements = new Set(__spreadArray$5([], __read$9(redundantRules)).map(function (rule) { return rule.getElement(); }));
|
|
65122
65175
|
// eject redundant rules associated elements altogether
|
|
65123
|
-
__spreadArray$
|
|
65176
|
+
__spreadArray$5([], __read$9(redundantElements)).filter(function (elem) { return elem.parentElement !== null; })
|
|
65124
65177
|
.forEach(function (elem) { return elem.parentElement.removeChild(elem); });
|
|
65125
65178
|
_this.rules = Object.values(registeredRules);
|
|
65126
65179
|
var attributionsToApply = attributions
|
|
@@ -65156,7 +65209,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
65156
65209
|
var visibleTextNodes = function (elem) {
|
|
65157
65210
|
return Array.from(elem.style.display != 'none' ? elem.children : [])
|
|
65158
65211
|
.map(function (elem) { return visibleTextNodes(elem); })
|
|
65159
|
-
.reduce(function (flattened, nodes) { return __spreadArray$
|
|
65212
|
+
.reduce(function (flattened, nodes) { return __spreadArray$5(__spreadArray$5([], __read$9(flattened)), __read$9(nodes)); }, Array.from(elem.style.display != 'none' ? elem.childNodes : []).filter(function (node) { return node.nodeType == node.TEXT_NODE; }));
|
|
65160
65213
|
};
|
|
65161
65214
|
var newRenderContext = _this.virtualContext.cloneNode(true);
|
|
65162
65215
|
var visibleNodes = visibleTextNodes(newRenderContext);
|
|
@@ -65171,7 +65224,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
65171
65224
|
// }
|
|
65172
65225
|
// });
|
|
65173
65226
|
// strip all predefined keywords
|
|
65174
|
-
visibleNodes.forEach(function (node) { return node.textContent = __spreadArray$
|
|
65227
|
+
visibleNodes.forEach(function (node) { return node.textContent = __spreadArray$5([], __read$9(attributionFilters)).reduce(function (target, filter) { return target.replace(filter, '').trim(); }, node.textContent); });
|
|
65175
65228
|
// strip year from each node
|
|
65176
65229
|
// visibleNodes.forEach(node => node.textContent = node.textContent.replace(copyrightYearPattern, '').trim());
|
|
65177
65230
|
// deduplicate attribution text
|
|
@@ -68363,7 +68416,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
68363
68416
|
this._removeListener(eventType, target, callback);
|
|
68364
68417
|
}
|
|
68365
68418
|
else {
|
|
68366
|
-
target._removeEventListener(eventType, callback);
|
|
68419
|
+
target === null || target === void 0 ? void 0 : target._removeEventListener(eventType, callback);
|
|
68367
68420
|
}
|
|
68368
68421
|
}
|
|
68369
68422
|
}
|
|
@@ -68853,10 +68906,15 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
68853
68906
|
return ids;
|
|
68854
68907
|
};
|
|
68855
68908
|
FundamentalMapLayer.prototype._updateLayoutProperty = function (name, newValue, oldValue, subValue) {
|
|
68856
|
-
|
|
68909
|
+
if (isEqual_1(newValue, oldValue))
|
|
68910
|
+
return;
|
|
68911
|
+
var map = this.map._getMap();
|
|
68857
68912
|
this.layers.forEach(function (layer) {
|
|
68858
|
-
if (
|
|
68859
|
-
|
|
68913
|
+
if (map.getLayer(layer.id)) {
|
|
68914
|
+
map.setLayoutProperty(layer.id, name, subValue || newValue);
|
|
68915
|
+
}
|
|
68916
|
+
else {
|
|
68917
|
+
console.warn("Could not update layout property " + name + " for layer " + layer.id + " to " + (subValue || newValue));
|
|
68860
68918
|
}
|
|
68861
68919
|
});
|
|
68862
68920
|
};
|
|
@@ -68890,7 +68948,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
68890
68948
|
}
|
|
68891
68949
|
return ar;
|
|
68892
68950
|
};
|
|
68893
|
-
var __spreadArray$
|
|
68951
|
+
var __spreadArray$6 = (window && window.__spreadArray) || function (to, from) {
|
|
68894
68952
|
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
68895
68953
|
to[j] = from[i];
|
|
68896
68954
|
return to;
|
|
@@ -68951,10 +69009,12 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
68951
69009
|
// Place the new layer behind the specified before layer.
|
|
68952
69010
|
var layerIndex = this.layerIndex.findIndex(function (l) { return l.getId() === layer.getId(); });
|
|
68953
69011
|
var userLayerIndex = this.userLayers.findIndex(function (ul) { return ul.layer.getId() === layer.getId(); });
|
|
68954
|
-
var tempLayer = this.layerIndex[layerIndex];
|
|
68955
69012
|
this._removeMapboxLayers(layer);
|
|
68956
69013
|
this._addMapboxLayers(layer, before);
|
|
68957
|
-
this.
|
|
69014
|
+
var tempLayer = this.layerIndex[layerIndex];
|
|
69015
|
+
if (tempLayer) {
|
|
69016
|
+
this.map.events._disableLayerEvents(tempLayer);
|
|
69017
|
+
}
|
|
68958
69018
|
this.map.events._enableLayerEvents(layer);
|
|
68959
69019
|
this.layerIndex.splice(layerIndex, 1);
|
|
68960
69020
|
var beforeIndex = this.layerIndex.findIndex(function (l) { return l.getId() === before; });
|
|
@@ -68962,7 +69022,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
68962
69022
|
if (!(layer instanceof FundamentalMapLayer)) {
|
|
68963
69023
|
this.userLayers[userLayerIndex] = { layer: layer, before: before };
|
|
68964
69024
|
}
|
|
68965
|
-
tempLayer
|
|
69025
|
+
if (tempLayer) {
|
|
69026
|
+
tempLayer.onRemove();
|
|
69027
|
+
}
|
|
68966
69028
|
layer.onAdd(this.map);
|
|
68967
69029
|
}
|
|
68968
69030
|
else {
|
|
@@ -69173,9 +69235,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
69173
69235
|
LayerManager.prototype.clear = function () {
|
|
69174
69236
|
for (var layerIndexIndex = this.layerIndex.length - 1; layerIndexIndex >= 0; layerIndexIndex--) {
|
|
69175
69237
|
var tempLayer = this.layerIndex[layerIndexIndex];
|
|
69176
|
-
|
|
69177
|
-
|
|
69178
|
-
|
|
69238
|
+
if (tempLayer) {
|
|
69239
|
+
this._removeMapboxLayers(tempLayer, true);
|
|
69240
|
+
this.layerIndex.splice(layerIndexIndex, 1);
|
|
69241
|
+
tempLayer.onRemove();
|
|
69242
|
+
}
|
|
69179
69243
|
}
|
|
69180
69244
|
this.userLayers = [];
|
|
69181
69245
|
};
|
|
@@ -69326,7 +69390,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
69326
69390
|
// If a specified layer hasn't been added to the map throw an error.
|
|
69327
69391
|
var index = this_1.layerIndex.findIndex(function (l) { return l.getId() === layerId; });
|
|
69328
69392
|
if (index > -1) {
|
|
69329
|
-
layerIds.push.apply(layerIds, __spreadArray$
|
|
69393
|
+
layerIds.push.apply(layerIds, __spreadArray$6([], __read$b(this_1.layerIndex[index]._getLayerIds()
|
|
69330
69394
|
.filter(function (id) { return !!_this.map._getMap().getLayer(id); }))));
|
|
69331
69395
|
}
|
|
69332
69396
|
else {
|
|
@@ -69615,6 +69679,37 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
69615
69679
|
FundamentalMapSource.prototype._buildSource = function () {
|
|
69616
69680
|
return this.source;
|
|
69617
69681
|
};
|
|
69682
|
+
/**
|
|
69683
|
+
* @internal
|
|
69684
|
+
*/
|
|
69685
|
+
FundamentalMapSource.prototype._isDeepEqual = function (other) {
|
|
69686
|
+
if (this.constructor !== other.constructor) {
|
|
69687
|
+
return false;
|
|
69688
|
+
}
|
|
69689
|
+
var source = this.source;
|
|
69690
|
+
var otherSource = other.source;
|
|
69691
|
+
var baseEqual = source.type === otherSource.type &&
|
|
69692
|
+
source.url === otherSource.url
|
|
69693
|
+
&& ((source.tiles === undefined && otherSource.tiles === undefined) ||
|
|
69694
|
+
(source.tiles && otherSource.tiles && source.tiles.length === otherSource.tiles.length && source.tiles.every(function (value, idx) { return value === otherSource.tiles[idx]; })))
|
|
69695
|
+
&& source.minzoom === otherSource.minzoom
|
|
69696
|
+
&& source.maxzoom === otherSource.maxzoom
|
|
69697
|
+
&& source.bounds === otherSource.bounds
|
|
69698
|
+
&& source.attribution === otherSource.attribution;
|
|
69699
|
+
var rasterEqual = source.type !== "raster" || (source.type === "raster"
|
|
69700
|
+
&& source.type === otherSource.type
|
|
69701
|
+
&& source.tileSize === otherSource.tileSize
|
|
69702
|
+
&& source.scheme === otherSource.scheme);
|
|
69703
|
+
var rasterDemEqual = source.type !== "raster-dem" || (source.type === "raster-dem"
|
|
69704
|
+
&& source.type === otherSource.type
|
|
69705
|
+
&& source.tileSize === otherSource.tileSize
|
|
69706
|
+
&& source.encoding === otherSource.encoding);
|
|
69707
|
+
var vectorEqual = source.type !== "vector" || (source.type === "vector"
|
|
69708
|
+
&& source.type === otherSource.type
|
|
69709
|
+
&& source.promoteId === otherSource.promoteId
|
|
69710
|
+
&& source.scheme === otherSource.scheme);
|
|
69711
|
+
return baseEqual && rasterEqual && rasterDemEqual && vectorEqual;
|
|
69712
|
+
};
|
|
69618
69713
|
/**
|
|
69619
69714
|
* Updates the source info to convert the tiles to url strings.
|
|
69620
69715
|
* @param sourceDef The original source info.
|
|
@@ -69911,39 +70006,52 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
69911
70006
|
var _this = this;
|
|
69912
70007
|
if (sources) {
|
|
69913
70008
|
Object.keys(sources).forEach(function (sourceId) {
|
|
70009
|
+
var sourceToAdd = sources[sourceId];
|
|
70010
|
+
var newSource;
|
|
70011
|
+
if (sourceToAdd.type === "vector") {
|
|
70012
|
+
newSource = new FundamentalMapSource(sourceId, {
|
|
70013
|
+
name: sourceId,
|
|
70014
|
+
tiles: sourceToAdd.tiles,
|
|
70015
|
+
type: "vector",
|
|
70016
|
+
url: sourceToAdd.url
|
|
70017
|
+
});
|
|
70018
|
+
}
|
|
70019
|
+
else if (sourceToAdd.type === "raster") {
|
|
70020
|
+
newSource = new FundamentalMapSource(sourceId, {
|
|
70021
|
+
name: sourceId,
|
|
70022
|
+
tiles: sourceToAdd.tiles,
|
|
70023
|
+
type: "raster",
|
|
70024
|
+
url: sourceToAdd.url
|
|
70025
|
+
});
|
|
70026
|
+
}
|
|
70027
|
+
else {
|
|
70028
|
+
// Do not throw for the source of unknown type.
|
|
70029
|
+
// throw new Error(`Unable to construct source with ID ${sourceId}.`);
|
|
70030
|
+
// no other handling for the source we don't sync into the state here
|
|
70031
|
+
return;
|
|
70032
|
+
}
|
|
69914
70033
|
if (!_this.sources.has(sourceId)) {
|
|
69915
|
-
|
|
69916
|
-
|
|
69917
|
-
var newSource = new FundamentalMapSource(sourceId, {
|
|
69918
|
-
name: sourceId,
|
|
69919
|
-
tiles: sourceToAdd.tiles,
|
|
69920
|
-
type: "vector",
|
|
69921
|
-
url: sourceToAdd.url
|
|
69922
|
-
});
|
|
69923
|
-
_this.sources.set(sourceId, newSource);
|
|
69924
|
-
newSource._setMap(_this.map);
|
|
69925
|
-
}
|
|
69926
|
-
else if (sourceToAdd.type === "raster") {
|
|
69927
|
-
var newSource = new FundamentalMapSource(sourceId, {
|
|
69928
|
-
name: sourceId,
|
|
69929
|
-
tiles: sourceToAdd.tiles,
|
|
69930
|
-
type: "raster",
|
|
69931
|
-
url: sourceToAdd.url
|
|
69932
|
-
});
|
|
69933
|
-
_this.sources.set(sourceId, newSource);
|
|
69934
|
-
newSource._setMap(_this.map);
|
|
69935
|
-
}
|
|
69936
|
-
else {
|
|
69937
|
-
throw new Error("Unable to construct source with ID " + sourceId + ".");
|
|
69938
|
-
}
|
|
70034
|
+
_this.sources.set(sourceId, newSource);
|
|
70035
|
+
newSource._setMap(_this.map);
|
|
69939
70036
|
}
|
|
69940
|
-
|
|
69941
|
-
|
|
69942
|
-
|
|
69943
|
-
|
|
69944
|
-
_this.sources.delete(sourceId);
|
|
70037
|
+
else if (_this.sources.has(sourceId) && !_this.sources.get(sourceId)._isDeepEqual(newSource)) {
|
|
70038
|
+
// source with same id but different properties: update
|
|
70039
|
+
_this.sources.set(sourceId, newSource);
|
|
70040
|
+
newSource._setMap(_this.map, false);
|
|
69945
70041
|
}
|
|
69946
70042
|
});
|
|
70043
|
+
// counter-intuitive: below is a bug and will do nothing since Object.keys(this.sources) will always return [], it should rather be:
|
|
70044
|
+
// Array.from(this.sources.keys()).forEach(sourceId => {
|
|
70045
|
+
// 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
|
|
70046
|
+
// such removal will cause the exception, since the source would already be removed
|
|
70047
|
+
//
|
|
70048
|
+
// 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
|
|
70049
|
+
// Object.keys(this.sources).forEach(sourceId => {
|
|
70050
|
+
// if (!sources.hasOwnProperty(sourceId)) {
|
|
70051
|
+
// this.sources.get(sourceId)._setMap(null);
|
|
70052
|
+
// this.sources.delete(sourceId);
|
|
70053
|
+
// }
|
|
70054
|
+
// });
|
|
69947
70055
|
}
|
|
69948
70056
|
};
|
|
69949
70057
|
return SourceManager;
|
|
@@ -70085,7 +70193,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
70085
70193
|
}
|
|
70086
70194
|
return ar;
|
|
70087
70195
|
};
|
|
70088
|
-
var __spreadArray$
|
|
70196
|
+
var __spreadArray$7 = (window && window.__spreadArray) || function (to, from) {
|
|
70089
70197
|
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
70090
70198
|
to[j] = from[i];
|
|
70091
70199
|
return to;
|
|
@@ -70160,7 +70268,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
70160
70268
|
}
|
|
70161
70269
|
finally { if (e_1) throw e_1.error; }
|
|
70162
70270
|
}
|
|
70163
|
-
return _super.prototype.merge.apply(this, __spreadArray$
|
|
70271
|
+
return _super.prototype.merge.apply(this, __spreadArray$7([], __read$c(valuesList)));
|
|
70164
70272
|
};
|
|
70165
70273
|
return CameraBoundsOptions;
|
|
70166
70274
|
}(Options));
|
|
@@ -70649,7 +70757,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
70649
70757
|
}
|
|
70650
70758
|
return ar;
|
|
70651
70759
|
};
|
|
70652
|
-
var __spreadArray$
|
|
70760
|
+
var __spreadArray$8 = (window && window.__spreadArray) || function (to, from) {
|
|
70653
70761
|
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
70654
70762
|
to[j] = from[i];
|
|
70655
70763
|
return to;
|
|
@@ -70769,6 +70877,13 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
70769
70877
|
* @deprecated use `view` instead.
|
|
70770
70878
|
*/
|
|
70771
70879
|
_this.userRegion = _this.view;
|
|
70880
|
+
/**
|
|
70881
|
+
* allows substituting a default MapControl's style transformer with custom one
|
|
70882
|
+
* 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
|
|
70883
|
+
* and move additional layers over
|
|
70884
|
+
* @internal
|
|
70885
|
+
*/
|
|
70886
|
+
_this.customStyleTransform = undefined;
|
|
70772
70887
|
return _this;
|
|
70773
70888
|
}
|
|
70774
70889
|
/**
|
|
@@ -70808,7 +70923,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
70808
70923
|
finally { if (e_1) throw e_1.error; }
|
|
70809
70924
|
}
|
|
70810
70925
|
// Then execute the standard merge behavior.
|
|
70811
|
-
return _super.prototype.merge.apply(this, __spreadArray$
|
|
70926
|
+
return _super.prototype.merge.apply(this, __spreadArray$8([], __read$d(valueList)));
|
|
70812
70927
|
};
|
|
70813
70928
|
return StyleOptions;
|
|
70814
70929
|
}(Options));
|
|
@@ -70866,7 +70981,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
70866
70981
|
}
|
|
70867
70982
|
return ar;
|
|
70868
70983
|
};
|
|
70869
|
-
var __spreadArray$
|
|
70984
|
+
var __spreadArray$9 = (window && window.__spreadArray) || function (to, from) {
|
|
70870
70985
|
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
70871
70986
|
to[j] = from[i];
|
|
70872
70987
|
return to;
|
|
@@ -71101,10 +71216,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
71101
71216
|
// won't change default behavior in Options as usually that's what desired
|
|
71102
71217
|
// instead capture it here and reassign.
|
|
71103
71218
|
var currentTransforms = this._transformers;
|
|
71104
|
-
var transformersToMerge = valueList ? valueList.filter(function (value) { return value !== undefined; }).reduce(function (flattened, value) { return __spreadArray$
|
|
71219
|
+
var transformersToMerge = valueList ? valueList.filter(function (value) { return value !== undefined; }).reduce(function (flattened, value) { return __spreadArray$9(__spreadArray$9([], __read$e(flattened)), __read$e(value._transformers || [])); }, []) : [];
|
|
71105
71220
|
// Then execute the standard merge behavior.
|
|
71106
71221
|
// If subscription key auth method isn't being used then the subscription key property should be undefined.
|
|
71107
|
-
var merged = _super.prototype.merge.apply(this, __spreadArray$
|
|
71222
|
+
var merged = _super.prototype.merge.apply(this, __spreadArray$9([], __read$e(valueList)));
|
|
71108
71223
|
if (merged.authOptions.authType !== exports.AuthenticationType.subscriptionKey) {
|
|
71109
71224
|
merged["subscription-key"] = merged.subscriptionKey = undefined;
|
|
71110
71225
|
}
|
|
@@ -71116,7 +71231,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
71116
71231
|
if (merged.mapConfiguration && typeof merged.mapConfiguration !== 'string') {
|
|
71117
71232
|
merged.mapConfiguration = __assign$7(__assign$7({}, merged.mapConfiguration), { defaultConfiguration: merged.mapConfiguration.defaultConfiguration || merged.mapConfiguration['defaultStyle'], configurations: merged.mapConfiguration.configurations || merged.mapConfiguration['styles'] });
|
|
71118
71233
|
}
|
|
71119
|
-
this._transformers = __spreadArray$
|
|
71234
|
+
this._transformers = __spreadArray$9(__spreadArray$9([], __read$e(currentTransforms || [])), __read$e(transformersToMerge.filter(function (toMerge) { return !currentTransforms.includes(toMerge); })));
|
|
71120
71235
|
if (this.transformRequest && !this._transformers.includes(this.transformRequest)) {
|
|
71121
71236
|
this._transformers.push(this.transformRequest);
|
|
71122
71237
|
}
|
|
@@ -71364,7 +71479,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
71364
71479
|
}
|
|
71365
71480
|
return ar;
|
|
71366
71481
|
};
|
|
71367
|
-
var __spreadArray$
|
|
71482
|
+
var __spreadArray$a = (window && window.__spreadArray) || function (to, from) {
|
|
71368
71483
|
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
71369
71484
|
to[j] = from[i];
|
|
71370
71485
|
return to;
|
|
@@ -71417,7 +71532,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
71417
71532
|
var deferredLayers = Object.entries(layerGroupLayers).reduce(function (deferred, _a) {
|
|
71418
71533
|
var _b = __read$f(_a, 2), groupName = _b[0], layers = _b[1];
|
|
71419
71534
|
var isInInitialLayerGroup = validInitLayerGroups.includes(groupName);
|
|
71420
|
-
return __spreadArray$
|
|
71535
|
+
return __spreadArray$a(__spreadArray$a([], __read$f(deferred)), __read$f(layers.filter(function (layer) {
|
|
71421
71536
|
var _a;
|
|
71422
71537
|
// Exclude custom layers
|
|
71423
71538
|
if (layer.type === 'custom')
|
|
@@ -71469,13 +71584,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
71469
71584
|
};
|
|
71470
71585
|
_this.map.events.addOnce('load', _this._progressiveLoadingState.pendingVisibilityChange);
|
|
71471
71586
|
};
|
|
71472
|
-
this._onStyleData = function () {
|
|
71473
|
-
_this.
|
|
71474
|
-
|
|
71475
|
-
|
|
71476
|
-
|
|
71477
|
-
type: "stylechanged"
|
|
71478
|
-
});
|
|
71587
|
+
this._onStyleData = function (definition) {
|
|
71588
|
+
_this.map.events.invoke("stylechanged", {
|
|
71589
|
+
style: definition.name,
|
|
71590
|
+
map: _this.map,
|
|
71591
|
+
type: "stylechanged"
|
|
71479
71592
|
});
|
|
71480
71593
|
};
|
|
71481
71594
|
/**
|
|
@@ -71582,7 +71695,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
71582
71695
|
return baseName in styleNamesMap ? styleNamesMap[baseName] : baseName;
|
|
71583
71696
|
};
|
|
71584
71697
|
if (!this.serviceOptions.mapConfiguration) {
|
|
71585
|
-
|
|
71698
|
+
var ensureAuthentication = this.map.authentication ? this.map.authentication.initialize() : Promise.resolve();
|
|
71699
|
+
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 ({
|
|
71586
71700
|
version: isNaN(definitions.version) ? 0 : parseFloat(definitions.version),
|
|
71587
71701
|
defaultConfiguration: definitions.defaultStyle,
|
|
71588
71702
|
configurations: definitions.styles
|
|
@@ -71621,12 +71735,13 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
71621
71735
|
protocol: "https"
|
|
71622
71736
|
}).toString(),
|
|
71623
71737
|
}); })
|
|
71624
|
-
}); }));
|
|
71738
|
+
}); }); }));
|
|
71625
71739
|
}
|
|
71626
71740
|
else if (typeof this.serviceOptions.mapConfiguration === 'string') {
|
|
71627
|
-
|
|
71741
|
+
var ensureAuthentication = this.map.authentication ? this.map.authentication.initialize() : Promise.resolve();
|
|
71742
|
+
newPromise = new HijackablePromise(ensureAuthentication.then(function () { return _this._request(_this.serviceOptions.domain, constants.styleResourcePath + "/mapconfigurations/metadata/" + _this.serviceOptions.mapConfiguration, "StyleDefinitions"
|
|
71628
71743
|
// reassign properties from legacy mapConfiguration to new structure if needed
|
|
71629
|
-
).then(function (definitions) { return (__assign$8(__assign$8({}, definitions), { defaultConfiguration: definitions.defaultConfiguration || definitions['defaultStyle'], configurations: definitions.configurations || definitions['styles'] })); }));
|
|
71744
|
+
).then(function (definitions) { return (__assign$8(__assign$8({}, definitions), { defaultConfiguration: definitions.defaultConfiguration || definitions['defaultStyle'], configurations: definitions.configurations || definitions['styles'] })); }); }));
|
|
71630
71745
|
}
|
|
71631
71746
|
else {
|
|
71632
71747
|
newPromise = HijackablePromise.resolve(this.serviceOptions.mapConfiguration);
|
|
@@ -71657,23 +71772,183 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
71657
71772
|
if (styleDefinition.style) {
|
|
71658
71773
|
return styleDefinition.style;
|
|
71659
71774
|
}
|
|
71660
|
-
throw Error("Style definition
|
|
71775
|
+
throw Error("Style definition neither contains URL nor style object.");
|
|
71776
|
+
};
|
|
71777
|
+
StyleManager.prototype.deriveNewStyleAndLayerGroups = function (previousStyle, nextStyle) {
|
|
71778
|
+
var _a, _b, _c, _d, _e, _f;
|
|
71779
|
+
// Layers in the next style with default properties that do not align with current StyleOptions
|
|
71780
|
+
// should be modified before they are applied to the map.
|
|
71781
|
+
var styleOptions = this.map.getStyle();
|
|
71782
|
+
var trafficOptions = this.map.getTraffic();
|
|
71783
|
+
var layersGroups = {};
|
|
71784
|
+
for (var i = 0; i < nextStyle.layers.length; i++) {
|
|
71785
|
+
var nextLayer = nextStyle.layers[i];
|
|
71786
|
+
var layerGroup = LayerGroupComparator.getLayerGroup(nextLayer);
|
|
71787
|
+
if (!layerGroup) {
|
|
71788
|
+
layersGroups[nextLayer.id] = [nextLayer];
|
|
71789
|
+
continue;
|
|
71790
|
+
}
|
|
71791
|
+
if (!layersGroups[layerGroup]) {
|
|
71792
|
+
layersGroups[layerGroup] = [];
|
|
71793
|
+
}
|
|
71794
|
+
var layerGroupLayers = layersGroups[layerGroup];
|
|
71795
|
+
layerGroupLayers.push(nextLayer);
|
|
71796
|
+
// 1. Set visiblity of fill-extrusion layers according to StyleOptions.showBuildingModels
|
|
71797
|
+
if (!styleOptions.showBuildingModels && nextLayer.type === "fill-extrusion") {
|
|
71798
|
+
nextLayer.layout = (_a = nextLayer.layout) !== null && _a !== void 0 ? _a : {};
|
|
71799
|
+
nextLayer.layout.visibility = "none";
|
|
71800
|
+
}
|
|
71801
|
+
else if (nextLayer.type === "fill-extrusion") {
|
|
71802
|
+
nextLayer.layout = (_b = nextLayer.layout) !== null && _b !== void 0 ? _b : {};
|
|
71803
|
+
nextLayer.layout.visibility = "visible";
|
|
71804
|
+
}
|
|
71805
|
+
// 2. Set visibility of traffic layers depending on traffic settings.
|
|
71806
|
+
if (trafficOptions.flow !== "none" && layerGroup) {
|
|
71807
|
+
if (layerGroup === "traffic_" + trafficOptions.flow && nextLayer.type == "line") {
|
|
71808
|
+
nextLayer.layout = (_c = nextLayer.layout) !== null && _c !== void 0 ? _c : {};
|
|
71809
|
+
nextLayer.layout.visibility = "visible";
|
|
71810
|
+
}
|
|
71811
|
+
}
|
|
71812
|
+
// 3. Set visibility of labels
|
|
71813
|
+
var isLabelLayerGroup = layerGroup === 'labels' || layerGroup === 'labels_places' || layerGroup === 'labels_indoor';
|
|
71814
|
+
if (isLabelLayerGroup && nextLayer.type === 'symbol') {
|
|
71815
|
+
if (styleOptions.showLabels && ((_d = nextLayer.layout) === null || _d === void 0 ? void 0 : _d.visibility) !== "none") {
|
|
71816
|
+
nextLayer.layout = (_e = nextLayer.layout) !== null && _e !== void 0 ? _e : {};
|
|
71817
|
+
nextLayer.layout.visibility = "visible";
|
|
71818
|
+
}
|
|
71819
|
+
else {
|
|
71820
|
+
nextLayer.layout = (_f = nextLayer.layout) !== null && _f !== void 0 ? _f : {};
|
|
71821
|
+
nextLayer.layout.visibility = "none";
|
|
71822
|
+
}
|
|
71823
|
+
}
|
|
71824
|
+
}
|
|
71825
|
+
return [nextStyle, layersGroups];
|
|
71826
|
+
};
|
|
71827
|
+
StyleManager.prototype.injectUserLayersIntoStyle = function (previousStyle, nextStyle, layerGroupLayers) {
|
|
71828
|
+
// Custom layers added to mapbox through this SDK should be carried over to the next style.
|
|
71829
|
+
return !previousStyle
|
|
71830
|
+
? nextStyle
|
|
71831
|
+
: this.map.layers._getUserLayers().reduce(function (style, userLayer) {
|
|
71832
|
+
if (userLayer.layer instanceof WebGLLayer) {
|
|
71833
|
+
// mapbox custom layers cannot be serialized and preserved,
|
|
71834
|
+
// return to continue to the next user layer.
|
|
71835
|
+
return style;
|
|
71836
|
+
}
|
|
71837
|
+
var before = layerGroupLayers[userLayer.before] && layerGroupLayers[userLayer.before].length > 0
|
|
71838
|
+
? layerGroupLayers[userLayer.before][0]
|
|
71839
|
+
: undefined;
|
|
71840
|
+
var layer = previousStyle.layers.find(function (layer) { return layer.id === userLayer.layer.getId(); });
|
|
71841
|
+
// when setStyle diff attempt is unsuccesful, _load will be called on the style that may have already injected user layers -> clean it up
|
|
71842
|
+
var existingLayerIdx = nextStyle.layers.findIndex(function (layer) { return layer.id === userLayer.layer.getId(); });
|
|
71843
|
+
if (existingLayerIdx > -1) {
|
|
71844
|
+
nextStyle.layers.splice(existingLayerIdx, 1);
|
|
71845
|
+
}
|
|
71846
|
+
if (layer) {
|
|
71847
|
+
var sourcesToCopy = new Set(Array.from(userLayer.layer._getSourceIds())
|
|
71848
|
+
.map(function (sourceId) { return previousStyle.sources[sourceId] ? { source: previousStyle.sources[sourceId], id: sourceId } : undefined; })
|
|
71849
|
+
.filter(function (source) { return source !== undefined; }));
|
|
71850
|
+
var insertIdx = before ? style.layers.findIndex(function (layer) { return layer.id === before.id; }) : -1;
|
|
71851
|
+
if (insertIdx > -1) {
|
|
71852
|
+
style.layers.splice(insertIdx, 0, layer);
|
|
71853
|
+
}
|
|
71854
|
+
else {
|
|
71855
|
+
style.layers.push(layer);
|
|
71856
|
+
}
|
|
71857
|
+
sourcesToCopy.forEach(function (_a) {
|
|
71858
|
+
var source = _a.source, id = _a.id;
|
|
71859
|
+
style.sources[id] = source;
|
|
71860
|
+
});
|
|
71861
|
+
}
|
|
71862
|
+
return style;
|
|
71863
|
+
}, __assign$8({}, nextStyle));
|
|
71661
71864
|
};
|
|
71662
71865
|
/**
|
|
71663
71866
|
* @internal
|
|
71664
71867
|
*/
|
|
71665
71868
|
StyleManager.prototype.setStyle = function (styleOptions, diff) {
|
|
71869
|
+
var _this = this;
|
|
71666
71870
|
if (diff === void 0) { diff = true; }
|
|
71667
|
-
|
|
71668
|
-
|
|
71669
|
-
|
|
71670
|
-
|
|
71671
|
-
|
|
71672
|
-
|
|
71871
|
+
var transformStyleFunc;
|
|
71872
|
+
var targetDefinition = this._lookUp(styleOptions);
|
|
71873
|
+
if (!targetDefinition) {
|
|
71874
|
+
throw Error("Style definition " + styleOptions.style + " is not available.");
|
|
71875
|
+
}
|
|
71876
|
+
if (!targetDefinition.url && !targetDefinition.style) {
|
|
71877
|
+
throw Error("Style definition neither contains URL nor style object.");
|
|
71878
|
+
}
|
|
71879
|
+
var styleDataCallback = function () { return _this._onStyleData(targetDefinition); };
|
|
71880
|
+
var patchStyleEvent = function () {
|
|
71881
|
+
// FIXME: below diffing will be soon fixed on the maplibre side
|
|
71882
|
+
// If there was a previous styledata change event attached, remove it.
|
|
71883
|
+
// When the sprite url changes between style changes then maplibre can't perform the diff
|
|
71884
|
+
// In such cases it recalculate the style again. Removing previous attached
|
|
71885
|
+
// event listener makes sure that style changed event is not fired twice in these cases.
|
|
71886
|
+
_this.map.events.remove("styledata", styleDataCallback);
|
|
71887
|
+
_this.map.events.addOnce("styledata", styleDataCallback);
|
|
71888
|
+
};
|
|
71889
|
+
if (styleOptions && styleOptions.customStyleTransform) {
|
|
71890
|
+
transformStyleFunc = function (prev, next) {
|
|
71891
|
+
var target = styleOptions.customStyleTransform(prev, next);
|
|
71892
|
+
patchStyleEvent();
|
|
71893
|
+
return target;
|
|
71894
|
+
};
|
|
71673
71895
|
}
|
|
71674
|
-
|
|
71675
|
-
|
|
71896
|
+
else {
|
|
71897
|
+
transformStyleFunc = function (previousStyle, style) {
|
|
71898
|
+
// make sure we always have a shallow clone to prevent mutating explicit json(rather then url) styles being set
|
|
71899
|
+
var nextStyle = __assign$8(__assign$8({}, style), { layers: __spreadArray$a([], __read$f(style.layers)), sources: __assign$8({}, style.sources) });
|
|
71900
|
+
var shouldProgressiveLoading = (styleOptions.progressiveLoading &&
|
|
71901
|
+
// The feature only effective at the initial load.
|
|
71902
|
+
!_this.map._isLoaded());
|
|
71903
|
+
// Shallow-clone the style object and duplicate layer.layout properties to avoid side-effects.
|
|
71904
|
+
if (shouldProgressiveLoading && Array.isArray(style === null || style === void 0 ? void 0 : style.layers)) {
|
|
71905
|
+
nextStyle = __assign$8({}, style);
|
|
71906
|
+
nextStyle.layers = nextStyle.layers.map(function (layer) {
|
|
71907
|
+
var nextLayer = __assign$8({}, layer);
|
|
71908
|
+
if (layer.layout) {
|
|
71909
|
+
nextLayer.layout = __assign$8({}, layer.layout);
|
|
71910
|
+
}
|
|
71911
|
+
return nextLayer;
|
|
71912
|
+
});
|
|
71913
|
+
}
|
|
71914
|
+
// 1. derive the base new style (without user layers) and layer groups
|
|
71915
|
+
var _a = __read$f(_this.deriveNewStyleAndLayerGroups(previousStyle, nextStyle), 2), targetStyle = _a[0], layerGroupLayers = _a[1];
|
|
71916
|
+
// 2. side effect: progressively render map layers to the canvas to shorten the time to the first meaningful render.
|
|
71917
|
+
if (shouldProgressiveLoading) {
|
|
71918
|
+
var initLayerGroups = styleOptions.progressiveLoadingInitialLayerGroups;
|
|
71919
|
+
if (Array.isArray(initLayerGroups) && initLayerGroups.length > 0) {
|
|
71920
|
+
_this._deferLayerGroupVisibilities(layerGroupLayers, initLayerGroups);
|
|
71921
|
+
}
|
|
71922
|
+
}
|
|
71923
|
+
// 3. copy user layers and sources from previous style into new one
|
|
71924
|
+
var targetStyleWithUserLayers = _this.injectUserLayersIntoStyle(previousStyle, targetStyle, layerGroupLayers);
|
|
71925
|
+
// 4. side effects: sync our control's LayerManager and SourceManager
|
|
71926
|
+
var nextFundamentalLayers = Object.entries(layerGroupLayers).map(function (_a) {
|
|
71927
|
+
var _b = __read$f(_a, 2), layerGroupId = _b[0], layers = _b[1];
|
|
71928
|
+
return _this._buildFundamentalLayerFrom(layers, layerGroupId);
|
|
71929
|
+
});
|
|
71930
|
+
var layerIndex = _this.map.layers._getUserLayers().reduce(function (layerIndex, userLayer) {
|
|
71931
|
+
var layerInsertIndex = userLayer.before ? layerIndex.findIndex(function (layer) { return layer.getId() === userLayer.before; }) : -1;
|
|
71932
|
+
if (layerInsertIndex > -1) {
|
|
71933
|
+
layerIndex.splice(layerInsertIndex, 0, userLayer.layer);
|
|
71934
|
+
}
|
|
71935
|
+
else {
|
|
71936
|
+
layerIndex.push(userLayer.layer);
|
|
71937
|
+
}
|
|
71938
|
+
return layerIndex;
|
|
71939
|
+
}, nextFundamentalLayers);
|
|
71940
|
+
_this.map.layers['layerIndex'] = layerIndex;
|
|
71941
|
+
_this.map.sources._syncSources(targetStyleWithUserLayers.sources);
|
|
71942
|
+
// 5. temporarily patch style data event
|
|
71943
|
+
patchStyleEvent();
|
|
71944
|
+
return targetStyleWithUserLayers;
|
|
71945
|
+
};
|
|
71676
71946
|
}
|
|
71947
|
+
this.map._getMap().setStyle(targetDefinition.url || targetDefinition.style, {
|
|
71948
|
+
diff: diff,
|
|
71949
|
+
validate: this.serviceOptions.validateStyle,
|
|
71950
|
+
transformStyle: transformStyleFunc
|
|
71951
|
+
});
|
|
71677
71952
|
};
|
|
71678
71953
|
/**
|
|
71679
71954
|
* Gets the color theme (light/dark) for the style type specified by the style options.
|
|
@@ -71738,135 +72013,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
71738
72013
|
StyleManager.prototype.clearStyleSet = function () {
|
|
71739
72014
|
this.unsetIndoorState();
|
|
71740
72015
|
};
|
|
71741
|
-
/**
|
|
71742
|
-
* Function invoked by mapbox after a style is fetched but before it is committed to the map state.
|
|
71743
|
-
*
|
|
71744
|
-
* @param previousStyle The current style.
|
|
71745
|
-
* @param nextStyle The next style which is to be applied.
|
|
71746
|
-
* @param preserveLayer Preserve a layer from the previous style in the next style.
|
|
71747
|
-
* @param updatePaintProperty Modify paint properties of a layer in the next style before the style is applied.
|
|
71748
|
-
* @param updateLayoutProperty Modify layout properties of a layer in the next style before the style is applied.
|
|
71749
|
-
* @param updateFilter Modify filter property of a layer in the next style before the style is applied.
|
|
71750
|
-
*/
|
|
71751
|
-
StyleManager.prototype._stylePatch = function (previousStyle, nextStyle, preserveLayer, updatePaintProperty, updateLayoutProperty, updateFilter) {
|
|
71752
|
-
var _this = this;
|
|
71753
|
-
// Layers in the next style with default properties that do not align with current StyleOptions
|
|
71754
|
-
// should be modified before they are applied to the map.
|
|
71755
|
-
var styleOptions = this.map.getStyle();
|
|
71756
|
-
var trafficOptions = this.map.getTraffic();
|
|
71757
|
-
var shouldProgressiveLoading = (styleOptions.progressiveLoading &&
|
|
71758
|
-
// The feature only effective at the initial load.
|
|
71759
|
-
!this.map._isLoaded());
|
|
71760
|
-
var setLayerVisibility = function (layer, visibility) {
|
|
71761
|
-
var _a;
|
|
71762
|
-
if (!shouldProgressiveLoading) {
|
|
71763
|
-
// No need to apply the visibility change to maplibre while progressive loading is enabled.
|
|
71764
|
-
// This can save a lot of CPU time.
|
|
71765
|
-
updateLayoutProperty(layer.id, 'visibility', visibility);
|
|
71766
|
-
}
|
|
71767
|
-
layer.layout = (_a = layer.layout) !== null && _a !== void 0 ? _a : {};
|
|
71768
|
-
layer.layout.visibility = visibility;
|
|
71769
|
-
};
|
|
71770
|
-
var layerGroupLayers = {};
|
|
71771
|
-
nextStyle.layers.forEach(function (nextLayer) {
|
|
71772
|
-
var _a;
|
|
71773
|
-
var layerGroup = LayerGroupComparator.getLayerGroup(nextLayer);
|
|
71774
|
-
if (layerGroup) {
|
|
71775
|
-
// Set visibility of fill-extrusion layers according to StyleOptions.showBuildingModels
|
|
71776
|
-
if (nextLayer.type === 'fill-extrusion') {
|
|
71777
|
-
setLayerVisibility(nextLayer, styleOptions.showBuildingModels ? 'visible' : 'none');
|
|
71778
|
-
}
|
|
71779
|
-
// Set visibility of traffic layers depending on traffic settings.
|
|
71780
|
-
if (trafficOptions.flow !== 'none' && nextLayer.type == 'line' &&
|
|
71781
|
-
(layerGroup === "traffic_" + trafficOptions.flow ||
|
|
71782
|
-
// Check if deprecated flow types are used and the layer is a bing-traffic layer.
|
|
71783
|
-
// Needed for backwards compatibility in Bing styles to support deprecated flow types.
|
|
71784
|
-
(['absolute', 'relative-delay'].includes(trafficOptions.flow) && nextLayer['source'] === "bing-traffic"))) {
|
|
71785
|
-
setLayerVisibility(nextLayer, 'visible');
|
|
71786
|
-
}
|
|
71787
|
-
// Set visibility of labels
|
|
71788
|
-
var isLabelLayerGroup = layerGroup === 'labels' || layerGroup === 'labels_places' || layerGroup === 'labels_indoor';
|
|
71789
|
-
if (isLabelLayerGroup && nextLayer.type === 'symbol') {
|
|
71790
|
-
var isLayerVisible = ((_a = nextLayer.layout) === null || _a === void 0 ? void 0 : _a.visibility) !== 'none';
|
|
71791
|
-
setLayerVisibility(nextLayer, isLayerVisible && styleOptions.showLabels ? 'visible' : 'none');
|
|
71792
|
-
}
|
|
71793
|
-
// Once this _stylePatch returns control to maplibre the next style will be applied immediately in the same context.
|
|
71794
|
-
// To avoid potential data races update LayerManager with new a new set of FundamentalMapLayers from here instead of
|
|
71795
|
-
// waiting for a styledata.load event to trigger a sync in a different context.
|
|
71796
|
-
if (layerGroupLayers[layerGroup]) {
|
|
71797
|
-
layerGroupLayers[layerGroup].push(nextLayer);
|
|
71798
|
-
}
|
|
71799
|
-
else {
|
|
71800
|
-
layerGroupLayers[layerGroup] = [nextLayer];
|
|
71801
|
-
}
|
|
71802
|
-
}
|
|
71803
|
-
});
|
|
71804
|
-
if (shouldProgressiveLoading) {
|
|
71805
|
-
var initLayerGroups = styleOptions.progressiveLoadingInitialLayerGroups;
|
|
71806
|
-
if (Array.isArray(initLayerGroups) && initLayerGroups.length > 0) {
|
|
71807
|
-
this._deferLayerGroupVisibilities(layerGroupLayers, initLayerGroups);
|
|
71808
|
-
}
|
|
71809
|
-
}
|
|
71810
|
-
// A FundamentalMapLayer (grouped layer) representation of the next style must be built.
|
|
71811
|
-
var previousLayers = this.map.layers.getLayers();
|
|
71812
|
-
var nextLayers = Object.entries(layerGroupLayers).map(function (_a) {
|
|
71813
|
-
var _b = __read$f(_a, 2), layerGroupName = _b[0], layerGroupMapboxLayers = _b[1];
|
|
71814
|
-
return _this._buildFundamentalLayerFrom(layerGroupMapboxLayers, layerGroupName);
|
|
71815
|
-
});
|
|
71816
|
-
// Update FundamentalMapLayers in LayerManager
|
|
71817
|
-
var userLayers = this.map.layers._getUserLayers();
|
|
71818
|
-
var layersToRemove = previousLayers.filter(function (c) {
|
|
71819
|
-
return (nextLayers.findIndex(function (n) { return c.getId() === n.getId(); }) < 0 &&
|
|
71820
|
-
userLayers.findIndex(function (n) { return c.getId() === n.layer.getId(); }) < 0);
|
|
71821
|
-
});
|
|
71822
|
-
var prevNextIntersection = nextLayers.filter(function (n) { return previousLayers.find(function (c) { return c.getId() === n.getId(); }); });
|
|
71823
|
-
var ePrevNextIntersection = prevNextIntersection.entries();
|
|
71824
|
-
var replace = ePrevNextIntersection.next();
|
|
71825
|
-
nextLayers.forEach(function (newFundamentalLayer) {
|
|
71826
|
-
if (replace.value && replace.value[1].getId() === newFundamentalLayer.getId()) {
|
|
71827
|
-
// Replace the existing layer with this ID with the new one.
|
|
71828
|
-
var insertBefore = previousLayers.findIndex(function (l) { return l.getId() === newFundamentalLayer.getId(); });
|
|
71829
|
-
_this.map.layers.remove(newFundamentalLayer.getId());
|
|
71830
|
-
_this.map.layers.add(newFundamentalLayer, previousLayers[insertBefore].getId());
|
|
71831
|
-
replace = ePrevNextIntersection.next();
|
|
71832
|
-
}
|
|
71833
|
-
else {
|
|
71834
|
-
if (replace.value) {
|
|
71835
|
-
// Insert new layer before the next common layer.
|
|
71836
|
-
_this.map.layers.add(newFundamentalLayer, replace.value[1]);
|
|
71837
|
-
}
|
|
71838
|
-
else {
|
|
71839
|
-
_this.map.layers.add(newFundamentalLayer);
|
|
71840
|
-
}
|
|
71841
|
-
}
|
|
71842
|
-
});
|
|
71843
|
-
layersToRemove.forEach(function (layer) {
|
|
71844
|
-
_this.map.layers.remove(layer);
|
|
71845
|
-
});
|
|
71846
|
-
// Layers added to mapbox through this SDK since loading the last style should be
|
|
71847
|
-
// carried over to the next style.
|
|
71848
|
-
userLayers.forEach(function (userLayer) {
|
|
71849
|
-
if (userLayer.layer instanceof WebGLLayer) {
|
|
71850
|
-
// mapbox custom layers cannot be serialized and preserved,
|
|
71851
|
-
// return to continue to the next user layer.
|
|
71852
|
-
return;
|
|
71853
|
-
}
|
|
71854
|
-
var before = undefined;
|
|
71855
|
-
if (_this.map.layers.getLayerById(userLayer.before)) {
|
|
71856
|
-
var beforeCandidates = _this.map.layers.getLayerById(userLayer.before)._buildLayers();
|
|
71857
|
-
before = (beforeCandidates.length > 0) ? beforeCandidates[0] : undefined;
|
|
71858
|
-
}
|
|
71859
|
-
preserveLayer(userLayer.layer.getId(), before === null || before === void 0 ? void 0 : before.id);
|
|
71860
|
-
_this.map.layers.move(userLayer.layer, userLayer.before);
|
|
71861
|
-
});
|
|
71862
|
-
this.map.sources._syncSources(nextStyle.sources);
|
|
71863
|
-
// If there was a previous styledata change event attached, remove it.
|
|
71864
|
-
// When the sprite url changes between style changes then mapbox can't perform the diff
|
|
71865
|
-
// In such cases it recalculate the style again. Removing previous attached
|
|
71866
|
-
// event listener makes sure that style changed event is not fired twice in these cases.
|
|
71867
|
-
this.map.events.remove("styledata", this._onStyleData);
|
|
71868
|
-
this.map.events.addOnce("styledata", this._onStyleData);
|
|
71869
|
-
};
|
|
71870
72016
|
StyleManager.prototype._buildFundamentalLayerFrom = function (layers, id) {
|
|
71871
72017
|
if (layers && layers.length > 0) {
|
|
71872
72018
|
var newLayer = new FundamentalMapLayer(layers, id);
|
|
@@ -72170,7 +72316,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
72170
72316
|
}
|
|
72171
72317
|
return ar;
|
|
72172
72318
|
};
|
|
72173
|
-
var __spreadArray$
|
|
72319
|
+
var __spreadArray$b = (window && window.__spreadArray) || function (to, from) {
|
|
72174
72320
|
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
72175
72321
|
to[j] = from[i];
|
|
72176
72322
|
return to;
|
|
@@ -72297,6 +72443,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
72297
72443
|
showLogo: _this.styleOptions.showLogo,
|
|
72298
72444
|
customAttribution: _this.styleOptions.customAttribution
|
|
72299
72445
|
});
|
|
72446
|
+
_this.controls.add(_this.copyrightControl, {
|
|
72447
|
+
position: exports.ControlPosition.NonFixed
|
|
72448
|
+
});
|
|
72300
72449
|
// Initialize state of map
|
|
72301
72450
|
// --> Initialize the authentication manager
|
|
72302
72451
|
var authManInit = _this.authentication ?
|
|
@@ -72324,17 +72473,14 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
72324
72473
|
_this.map.showTileBoundaries = _this.styleOptions.showTileBoundaries;
|
|
72325
72474
|
_this.localizedStringsPromise = Localizer.getStrings(_this.styleOptions.language);
|
|
72326
72475
|
authManInit
|
|
72327
|
-
|
|
72476
|
+
// reuses this.styles.initPromise if initStyleset is already called
|
|
72477
|
+
.then(function () { return _this.styles.definitions(); })
|
|
72328
72478
|
.then(function (definitions) {
|
|
72329
72479
|
// Check that the map hasn't been removed for any reason.
|
|
72330
72480
|
// If so no need to finish styling the map.
|
|
72331
72481
|
if (_this.removed) {
|
|
72332
72482
|
return;
|
|
72333
72483
|
}
|
|
72334
|
-
// Add controls after initStyleset to prevent redundant initStyleset calls
|
|
72335
|
-
_this.controls.add(_this.copyrightControl, {
|
|
72336
|
-
position: exports.ControlPosition.NonFixed
|
|
72337
|
-
});
|
|
72338
72484
|
if (_this.authentication && !_this.authentication.getToken()) {
|
|
72339
72485
|
throw new Error("AuthenticationManager finished initializing, but no token is available");
|
|
72340
72486
|
}
|
|
@@ -72394,6 +72540,16 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
72394
72540
|
}
|
|
72395
72541
|
return _this;
|
|
72396
72542
|
}
|
|
72543
|
+
Object.defineProperty(Map.prototype, "isDisposed", {
|
|
72544
|
+
/**
|
|
72545
|
+
* Returns true if the map has been disposed.
|
|
72546
|
+
*/
|
|
72547
|
+
get: function () {
|
|
72548
|
+
return this.removed;
|
|
72549
|
+
},
|
|
72550
|
+
enumerable: false,
|
|
72551
|
+
configurable: true
|
|
72552
|
+
});
|
|
72397
72553
|
/**
|
|
72398
72554
|
* Returns the HTMLCanvasElement that the map is drawn to.
|
|
72399
72555
|
*/
|
|
@@ -72430,9 +72586,17 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
72430
72586
|
else {
|
|
72431
72587
|
this.accessibleMapDelegate.removeFromMap();
|
|
72432
72588
|
}
|
|
72433
|
-
|
|
72589
|
+
var shouldReloadStyle = this.styles.serviceOptions.mapConfiguration !== this.serviceOptions.mapConfiguration
|
|
72590
|
+
|| this.styles.serviceOptions.staticAssetsDomain !== this.serviceOptions.staticAssetsDomain
|
|
72591
|
+
|| this.styles.serviceOptions.styleDefinitionsVersion !== this.serviceOptions.styleDefinitionsVersion
|
|
72592
|
+
|| this.styles.serviceOptions.domain !== this.serviceOptions.domain
|
|
72593
|
+
|| this.styles.serviceOptions.styleAPIVersion !== this.serviceOptions.styleAPIVersion;
|
|
72594
|
+
// NOTE: only perform a reload when the style dependent properties are changed
|
|
72595
|
+
//|| this.styles.serviceOptions.validateStyle !== this.serviceOptions.validateStyle
|
|
72596
|
+
//|| this.styles.serviceOptions.transformRequest !== this.serviceOptions.transformRequest
|
|
72597
|
+
this.styles.serviceOptions = this.serviceOptions;
|
|
72598
|
+
if (shouldReloadStyle) {
|
|
72434
72599
|
this.styles.initPromise = null;
|
|
72435
|
-
this.styles.serviceOptions.mapConfiguration = this.serviceOptions.mapConfiguration;
|
|
72436
72600
|
this.setStyle({});
|
|
72437
72601
|
}
|
|
72438
72602
|
};
|
|
@@ -72984,7 +73148,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
72984
73148
|
urls = layer.getOptions().subdomains || [];
|
|
72985
73149
|
}
|
|
72986
73150
|
// Add the tile urls to the layer, but don't update the map yet.
|
|
72987
|
-
urls.push.apply(urls, __spreadArray$
|
|
73151
|
+
urls.push.apply(urls, __spreadArray$b([], __read$g(tileSources)));
|
|
72988
73152
|
layer._setOptionsNoUpdate({
|
|
72989
73153
|
subdomains: urls
|
|
72990
73154
|
});
|
|
@@ -73505,7 +73669,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
73505
73669
|
}
|
|
73506
73670
|
return ar;
|
|
73507
73671
|
};
|
|
73508
|
-
var __spreadArray$
|
|
73672
|
+
var __spreadArray$c = (window && window.__spreadArray) || function (to, from) {
|
|
73509
73673
|
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
73510
73674
|
to[j] = from[i];
|
|
73511
73675
|
return to;
|
|
@@ -73651,7 +73815,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
73651
73815
|
lineLength = 50;
|
|
73652
73816
|
}
|
|
73653
73817
|
var lines = c.split(/<(tr|div|br|li|h[0-9]|p>)/);
|
|
73654
|
-
longestStringLength = Math.max.apply(Math, __spreadArray$
|
|
73818
|
+
longestStringLength = Math.max.apply(Math, __spreadArray$c([], __read$h((lines.map(function (el) { return el.replace(/<[a-zA-Z0-9\s=\/]+>/g, "").length; }))))) - 1;
|
|
73655
73819
|
var w = Math.ceil(longestStringLength * 3.5);
|
|
73656
73820
|
if (w < width) {
|
|
73657
73821
|
width = w;
|