azure-maps-control 2.2.7 → 2.3.1
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 +448 -225
- package/dist/atlas-core-bare.js +458 -235
- package/dist/atlas-core-bare.min.js +1 -1
- package/dist/atlas-core-snr.js +484 -403
- package/dist/atlas-core.js +494 -413
- package/dist/atlas-core.min.js +1 -1
- package/dist/atlas.css +6 -3
- package/dist/atlas.js +494 -413
- package/dist/atlas.min.css +1 -1
- package/dist/atlas.min.js +1 -1
- package/package.json +6 -2
- package/thirdpartynotices.txt +0 -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.1/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.1";
|
|
113
113
|
|
|
114
114
|
var unitbezier = UnitBezier;
|
|
115
115
|
function UnitBezier(p1x, p1y, p2x, p2y) {
|
|
@@ -441,7 +441,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
441
441
|
}
|
|
442
442
|
function uuid() {
|
|
443
443
|
function b(a) {
|
|
444
|
-
|
|
444
|
+
var rand = window$1.crypto.getRandomValues(new Uint32Array(1))[0] / Math.pow(2, 32);
|
|
445
|
+
return a ? (a ^ rand * 16 >> a / 4).toString(16) : ([10000000] + -[1000] + -4000 + -8000 + -100000000000).replace(/[018]/g, b);
|
|
445
446
|
}
|
|
446
447
|
return b();
|
|
447
448
|
}
|
|
@@ -33124,7 +33125,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
33124
33125
|
Style.__proto__ = Evented;
|
|
33125
33126
|
Style.prototype = Object.create(Evented && Evented.prototype);
|
|
33126
33127
|
Style.prototype.constructor = Style;
|
|
33127
|
-
Style.prototype.loadURL = function loadURL(url, options) {
|
|
33128
|
+
Style.prototype.loadURL = function loadURL(url, options, previousStyle) {
|
|
33128
33129
|
var this$1 = this;
|
|
33129
33130
|
if (options === void 0)
|
|
33130
33131
|
options = {};
|
|
@@ -33137,11 +33138,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
33137
33138
|
if (error) {
|
|
33138
33139
|
this$1.fire(new performance.ErrorEvent(error));
|
|
33139
33140
|
} else if (json) {
|
|
33140
|
-
this$1._load(json, options);
|
|
33141
|
+
this$1._load(json, options, previousStyle);
|
|
33141
33142
|
}
|
|
33142
33143
|
});
|
|
33143
33144
|
};
|
|
33144
|
-
Style.prototype.loadJSON = function loadJSON(json, options) {
|
|
33145
|
+
Style.prototype.loadJSON = function loadJSON(json, options, previousStyle) {
|
|
33145
33146
|
var this$1 = this;
|
|
33146
33147
|
if (options === void 0)
|
|
33147
33148
|
options = {};
|
|
@@ -33149,34 +33150,29 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
33149
33150
|
this._request = performance.browser.frame(function () {
|
|
33150
33151
|
this$1._request = null;
|
|
33151
33152
|
options.validate = options.validate !== false;
|
|
33152
|
-
this$1._load(json, options);
|
|
33153
|
+
this$1._load(json, options, previousStyle);
|
|
33153
33154
|
});
|
|
33154
33155
|
};
|
|
33155
33156
|
Style.prototype.loadEmpty = function loadEmpty() {
|
|
33156
33157
|
this.fire(new performance.Event('dataloading', { dataType: 'style' }));
|
|
33157
33158
|
this._load(empty, { validate: false });
|
|
33158
33159
|
};
|
|
33159
|
-
Style.prototype._load = function _load(json, options) {
|
|
33160
|
-
var
|
|
33161
|
-
if (options.validate && emitValidationErrors(this, performance.validateStyle(
|
|
33160
|
+
Style.prototype._load = function _load(json, options, previousStyle) {
|
|
33161
|
+
var nextState = options.transformStyle ? options.transformStyle(previousStyle, json) : json;
|
|
33162
|
+
if (options.validate && emitValidationErrors(this, performance.validateStyle(nextState))) {
|
|
33162
33163
|
return;
|
|
33163
33164
|
}
|
|
33164
|
-
var patchOperations = [];
|
|
33165
|
-
if (options.stylePatch) {
|
|
33166
|
-
patchOperations = this._buildStylePatch(json, options);
|
|
33167
|
-
this.sourceCaches = {};
|
|
33168
|
-
}
|
|
33169
33165
|
this._loaded = true;
|
|
33170
|
-
this.stylesheet =
|
|
33171
|
-
for (var id in
|
|
33172
|
-
this.addSource(id,
|
|
33166
|
+
this.stylesheet = nextState;
|
|
33167
|
+
for (var id in nextState.sources) {
|
|
33168
|
+
this.addSource(id, nextState.sources[id], { validate: false });
|
|
33173
33169
|
}
|
|
33174
|
-
if (
|
|
33175
|
-
this._loadSprite(
|
|
33170
|
+
if (nextState.sprite) {
|
|
33171
|
+
this._loadSprite(nextState.sprite);
|
|
33176
33172
|
} else {
|
|
33177
33173
|
this.imageManager.setLoaded(true);
|
|
33178
33174
|
}
|
|
33179
|
-
this.glyphManager.setURL(
|
|
33175
|
+
this.glyphManager.setURL(nextState.glyphs);
|
|
33180
33176
|
var layers = derefLayers(this.stylesheet.layers);
|
|
33181
33177
|
this._order = layers.map(function (layer) {
|
|
33182
33178
|
return layer.id;
|
|
@@ -33192,11 +33188,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
33192
33188
|
}
|
|
33193
33189
|
this.dispatcher.broadcast('setLayers', this._serializeLayers(this._order));
|
|
33194
33190
|
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
33191
|
this.fire(new performance.Event('data', { dataType: 'style' }));
|
|
33201
33192
|
this.fire(new performance.Event('style.load'));
|
|
33202
33193
|
};
|
|
@@ -33371,33 +33362,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
33371
33362
|
if (emitValidationErrors(this, performance.validateStyle(nextState))) {
|
|
33372
33363
|
return false;
|
|
33373
33364
|
}
|
|
33374
|
-
nextState =
|
|
33365
|
+
nextState = options.transformStyle ? options.transformStyle(this.serialize(), nextState) : nextState;
|
|
33375
33366
|
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
33367
|
var changes = diffStyles(this.serialize(), nextState).filter(function (op) {
|
|
33398
33368
|
return !(op.command in ignoredDiffOperations);
|
|
33399
33369
|
});
|
|
33400
|
-
changes = changes.concat(patchOperations);
|
|
33401
33370
|
if (changes.length === 0) {
|
|
33402
33371
|
return false;
|
|
33403
33372
|
}
|
|
@@ -33413,12 +33382,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
33413
33382
|
if (op.command === 'setTransition') {
|
|
33414
33383
|
return;
|
|
33415
33384
|
}
|
|
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
33385
|
this$1[op.command].apply(this$1, op.args);
|
|
33423
33386
|
});
|
|
33424
33387
|
this.stylesheet = nextState;
|
|
@@ -33809,109 +33772,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
33809
33772
|
return empty;
|
|
33810
33773
|
}
|
|
33811
33774
|
};
|
|
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
33775
|
Style.prototype._updateLayer = function _updateLayer(layer) {
|
|
33916
33776
|
this._updatedLayers[layer.id] = true;
|
|
33917
33777
|
if (layer.source && !this._updatedSources[layer.source] && this.sourceCaches[layer.source].getSource().type !== 'raster') {
|
|
@@ -41194,33 +41054,31 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
41194
41054
|
return str;
|
|
41195
41055
|
};
|
|
41196
41056
|
Map.prototype._updateStyle = function _updateStyle(style, options) {
|
|
41057
|
+
var this$1 = this;
|
|
41197
41058
|
if (options === void 0)
|
|
41198
41059
|
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
|
-
}
|
|
41060
|
+
if (options.transformStyle && this.style && !this.style._loaded) {
|
|
41061
|
+
this.style.once('style.load', function () {
|
|
41062
|
+
return this$1._updateStyle(style, options);
|
|
41063
|
+
});
|
|
41064
|
+
return;
|
|
41215
41065
|
}
|
|
41216
|
-
|
|
41066
|
+
var previousStyle = this.style && options.transformStyle ? this.style.serialize() : undefined;
|
|
41067
|
+
if (this.style) {
|
|
41068
|
+
this.style.setEventedParent(null);
|
|
41069
|
+
this.style._remove();
|
|
41070
|
+
}
|
|
41071
|
+
if (!style) {
|
|
41072
|
+
delete this.style;
|
|
41073
|
+
return this;
|
|
41074
|
+
} else {
|
|
41217
41075
|
this.style = new Style(this, options);
|
|
41218
|
-
this.style.setEventedParent(this, { style: this.style });
|
|
41219
41076
|
}
|
|
41077
|
+
this.style.setEventedParent(this, { style: this.style });
|
|
41220
41078
|
if (typeof style === 'string') {
|
|
41221
|
-
this.style.loadURL(style, options);
|
|
41079
|
+
this.style.loadURL(style, options, previousStyle);
|
|
41222
41080
|
} else {
|
|
41223
|
-
this.style.loadJSON(style, options);
|
|
41081
|
+
this.style.loadJSON(style, options, previousStyle);
|
|
41224
41082
|
}
|
|
41225
41083
|
return this;
|
|
41226
41084
|
};
|
|
@@ -43619,7 +43477,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
43619
43477
|
return Url;
|
|
43620
43478
|
}());
|
|
43621
43479
|
|
|
43622
|
-
var version = "2.
|
|
43480
|
+
var version = "2.3.1";
|
|
43623
43481
|
|
|
43624
43482
|
/**
|
|
43625
43483
|
* A helper class that provides methods for getting various forms of the map controls current version.
|
|
@@ -53648,19 +53506,24 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
53648
53506
|
* Get reference to Mapbox Map
|
|
53649
53507
|
* @internal
|
|
53650
53508
|
*/
|
|
53651
|
-
Source.prototype._setMap = function (map) {
|
|
53509
|
+
Source.prototype._setMap = function (map, shouldInvokeEvent) {
|
|
53510
|
+
if (shouldInvokeEvent === void 0) { shouldInvokeEvent = true; }
|
|
53652
53511
|
if (map == null || map === undefined) {
|
|
53653
53512
|
var temp = this.map;
|
|
53654
53513
|
delete this.map;
|
|
53655
|
-
|
|
53656
|
-
|
|
53657
|
-
temp
|
|
53514
|
+
if (shouldInvokeEvent) {
|
|
53515
|
+
this._invokeEvent("sourceremoved", this);
|
|
53516
|
+
if (temp) {
|
|
53517
|
+
temp.events.invoke("sourceremoved", this);
|
|
53518
|
+
}
|
|
53658
53519
|
}
|
|
53659
53520
|
}
|
|
53660
53521
|
else {
|
|
53661
53522
|
this.map = map;
|
|
53662
|
-
|
|
53663
|
-
|
|
53523
|
+
if (shouldInvokeEvent) {
|
|
53524
|
+
this._invokeEvent("sourceadded", this);
|
|
53525
|
+
this.map.events.invoke("sourceadded", this);
|
|
53526
|
+
}
|
|
53664
53527
|
}
|
|
53665
53528
|
};
|
|
53666
53529
|
return Source;
|
|
@@ -53981,6 +53844,27 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
53981
53844
|
}
|
|
53982
53845
|
return geoJsonSource;
|
|
53983
53846
|
};
|
|
53847
|
+
DataSource.prototype._isDeepEqual = function (other) {
|
|
53848
|
+
if (this.constructor !== other.constructor) {
|
|
53849
|
+
return false;
|
|
53850
|
+
}
|
|
53851
|
+
var source = this._buildSource();
|
|
53852
|
+
var otherSource = other._buildSource();
|
|
53853
|
+
return source.type === otherSource.type &&
|
|
53854
|
+
// 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.
|
|
53855
|
+
//source.data === otherSource.data &&
|
|
53856
|
+
source.maxzoom === otherSource.maxzoom &&
|
|
53857
|
+
source.cluster === otherSource.cluster &&
|
|
53858
|
+
source.clusterRadius === otherSource.clusterRadius &&
|
|
53859
|
+
source.tolerance === otherSource.tolerance &&
|
|
53860
|
+
source.lineMetrics === otherSource.lineMetrics &&
|
|
53861
|
+
JSON.stringify(source.clusterProperties) === JSON.stringify(otherSource.clusterProperties) &&
|
|
53862
|
+
source.buffer === otherSource.buffer &&
|
|
53863
|
+
source.clusterMinPoints === otherSource.clusterMinPoints &&
|
|
53864
|
+
source.generateId === otherSource.generateId &&
|
|
53865
|
+
source.promoteId === otherSource.promoteId &&
|
|
53866
|
+
source.filter === otherSource.filter;
|
|
53867
|
+
};
|
|
53984
53868
|
/**
|
|
53985
53869
|
* @internal
|
|
53986
53870
|
*/
|
|
@@ -54262,6 +54146,26 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
54262
54146
|
}
|
|
54263
54147
|
return vectorSource;
|
|
54264
54148
|
};
|
|
54149
|
+
/**
|
|
54150
|
+
* @internal
|
|
54151
|
+
*/
|
|
54152
|
+
VectorTileSource.prototype._isDeepEqual = function (other) {
|
|
54153
|
+
if (this.constructor !== other.constructor) {
|
|
54154
|
+
return false;
|
|
54155
|
+
}
|
|
54156
|
+
var source = this._buildSource();
|
|
54157
|
+
var otherSource = other._buildSource();
|
|
54158
|
+
return source.type === otherSource.type &&
|
|
54159
|
+
source.url === otherSource.url &&
|
|
54160
|
+
((source.tiles === undefined && otherSource.tiles === undefined) ||
|
|
54161
|
+
(source.tiles && otherSource.tiles && source.tiles.length === otherSource.tiles.length && source.tiles.every(function (value, idx) { return value === otherSource.tiles[idx]; }))) &&
|
|
54162
|
+
source.minzoom === otherSource.minzoom &&
|
|
54163
|
+
source.maxzoom === otherSource.maxzoom &&
|
|
54164
|
+
source.bounds === otherSource.bounds &&
|
|
54165
|
+
source.attribution === otherSource.attribution &&
|
|
54166
|
+
source.promoteId === otherSource.promoteId &&
|
|
54167
|
+
source.scheme === otherSource.scheme;
|
|
54168
|
+
};
|
|
54265
54169
|
return VectorTileSource;
|
|
54266
54170
|
}(Source));
|
|
54267
54171
|
|
|
@@ -54553,11 +54457,41 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
54553
54457
|
/**
|
|
54554
54458
|
* @internal
|
|
54555
54459
|
* Specifies whether to create focusable indicators for the bubbles.
|
|
54460
|
+
* The default highlighting style is provided if the source is DataSource with Shape:
|
|
54461
|
+
* ```ts
|
|
54462
|
+
* const datasource = new DataSource('bubble-source');
|
|
54463
|
+
* datasource.setShapes([new Shape(new Point([-122.335, 47.62]))]);
|
|
54464
|
+
* this.map.sources.add(datasource);
|
|
54465
|
+
* const layer = new BubbleLayer(datasource, 'bubble', {
|
|
54466
|
+
* radius: 10,
|
|
54467
|
+
* color: 'cyan',
|
|
54468
|
+
* createIndicators: true,
|
|
54469
|
+
* });
|
|
54470
|
+
* ```
|
|
54471
|
+
*
|
|
54472
|
+
* For other sources, you can provide the accessibilityIdKey option to specify the property name of the feature to use as the accessibility id.
|
|
54473
|
+
* ```ts
|
|
54474
|
+
* const vtSource = new VectorTileSource("indoorTiles", { tiles, // provide your tile urls });
|
|
54475
|
+
* this.map.sources.add(vtSource);
|
|
54476
|
+
* const layer = new BubbleLayer(vtSource, 'bubble', {
|
|
54477
|
+
* createIndicators: true,
|
|
54478
|
+
* accessibilityIdKey: '{add your ID here}'
|
|
54479
|
+
* });
|
|
54480
|
+
* ```
|
|
54481
|
+
*
|
|
54482
|
+
* If you want to customize the highlighting style, you can use the focusin/focusout events to change the style of the bubble.
|
|
54483
|
+
* ```ts
|
|
54484
|
+
* this.map.events.add('focusin', 'bubble', (e) => { handle the style highlight });
|
|
54485
|
+
* ```
|
|
54556
54486
|
*
|
|
54557
54487
|
* Note: We treat this as an internal option for now because we hadn't fully decided the default styling for the indicators.
|
|
54558
54488
|
* Once we decide, we will make this a public option or remove it.
|
|
54559
54489
|
*/
|
|
54560
54490
|
_this.createIndicators = false;
|
|
54491
|
+
/**
|
|
54492
|
+
* @internal
|
|
54493
|
+
*/
|
|
54494
|
+
_this.accessibilityIdKey = undefined;
|
|
54561
54495
|
return _this;
|
|
54562
54496
|
}
|
|
54563
54497
|
return BubbleLayerOptions;
|
|
@@ -54630,6 +54564,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
54630
54564
|
}
|
|
54631
54565
|
return ar;
|
|
54632
54566
|
};
|
|
54567
|
+
var __spreadArray = (window && window.__spreadArray) || function (to, from) {
|
|
54568
|
+
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
54569
|
+
to[j] = from[i];
|
|
54570
|
+
return to;
|
|
54571
|
+
};
|
|
54633
54572
|
/**
|
|
54634
54573
|
* Renders Point objects as scalable circles (bubbles).
|
|
54635
54574
|
*/
|
|
@@ -54644,13 +54583,15 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
54644
54583
|
function BubbleLayer(source, id, options) {
|
|
54645
54584
|
var _this = _super.call(this, id) || this;
|
|
54646
54585
|
_this.accessibleIndicator = [];
|
|
54647
|
-
|
|
54648
|
-
|
|
54586
|
+
/** @internal */
|
|
54587
|
+
_this._setAccessibleIndicator = function () { return __awaiter$1(_this, void 0, void 0, function () {
|
|
54588
|
+
var renderedShapes, accessibilityIdKey, createIndicator, insertHiddenBefore, insertHiddenInFront, attach;
|
|
54649
54589
|
var _this = this;
|
|
54650
54590
|
return __generator$1(this, function (_a) {
|
|
54651
54591
|
this.accessibleIndicator.forEach(function (indicator) { return indicator.remove(); });
|
|
54652
54592
|
this.accessibleIndicator = [];
|
|
54653
54593
|
renderedShapes = this.map.layers.getRenderedShapes(this.map.getCamera().bounds, this);
|
|
54594
|
+
accessibilityIdKey = this.options.accessibilityIdKey || (this._getDataSource() ? Shape._shapeIdPropName : undefined);
|
|
54654
54595
|
createIndicator = function (renderedShapes, idx) {
|
|
54655
54596
|
var curRenderedShape = renderedShapes[idx];
|
|
54656
54597
|
var bubbleFeature = curRenderedShape instanceof Shape ? curRenderedShape.toJson() : curRenderedShape;
|
|
@@ -54674,9 +54615,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
54674
54615
|
if (idx == 0 && renderedShapes.length >= 2) {
|
|
54675
54616
|
attach(createIndicator(renderedShapes, renderedShapes.length - 1));
|
|
54676
54617
|
}
|
|
54677
|
-
|
|
54678
|
-
|
|
54679
|
-
_this.map._getMap().setPaintProperty(_this.id, 'circle-stroke-color', ['case', ['==', ['get', '_azureMapsShapeId'], bubbleFeature.id], '#000000', _this.options.strokeColor]);
|
|
54618
|
+
if (accessibilityIdKey !== undefined) {
|
|
54619
|
+
_this.map._getMap().setPaintProperty(_this.id, 'circle-stroke-color', ['case', ['==', ['get', accessibilityIdKey], bubbleFeature.properties[accessibilityIdKey]], '#000000', _this.options.strokeColor]);
|
|
54680
54620
|
}
|
|
54681
54621
|
var focusEvent = {
|
|
54682
54622
|
target: element,
|
|
@@ -54689,8 +54629,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
54689
54629
|
_this._invokeEvent('focusin', focusEvent);
|
|
54690
54630
|
});
|
|
54691
54631
|
element.addEventListener('focusout', function (event) {
|
|
54692
|
-
if (
|
|
54693
|
-
_this.map._getMap().setPaintProperty(_this.id, 'circle-stroke-color', ['case', ['==', ['get',
|
|
54632
|
+
if (accessibilityIdKey !== undefined) {
|
|
54633
|
+
_this.map._getMap().setPaintProperty(_this.id, 'circle-stroke-color', ['case', ['==', ['get', accessibilityIdKey], bubbleFeature.properties[accessibilityIdKey]], _this.options.strokeColor, _this.options.strokeColor]);
|
|
54694
54634
|
}
|
|
54695
54635
|
var focusEvent = {
|
|
54696
54636
|
target: element,
|
|
@@ -54777,19 +54717,72 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
54777
54717
|
this.options = newOptions;
|
|
54778
54718
|
};
|
|
54779
54719
|
BubbleLayer.prototype.onAdd = function (map) {
|
|
54720
|
+
var _this = this;
|
|
54780
54721
|
_super.prototype.onAdd.call(this, map);
|
|
54781
54722
|
if (this.options.createIndicators) {
|
|
54782
|
-
map
|
|
54783
|
-
map.events.
|
|
54723
|
+
// Wait for map idle for the first time to ensure `layer.getRenderedShapes` return correct shapes.
|
|
54724
|
+
map.events.addOnce('idle', this._setAccessibleIndicator);
|
|
54725
|
+
// The rendered shapes may be changed when map is moved. Update the indicators when map is moved.
|
|
54726
|
+
map.events.add('moveend', this._setAccessibleIndicator);
|
|
54727
|
+
var dataSource = this._getDataSource();
|
|
54728
|
+
if (dataSource) {
|
|
54729
|
+
// The rendered shapes may be changed when data is added. Update the indicators when data is added.
|
|
54730
|
+
map.events.add('dataadded', dataSource, function () {
|
|
54731
|
+
// Wait for map idle to ensure `layer.getRenderedShapes` return correct shapes.
|
|
54732
|
+
map.events.addOnce('idle', _this._setAccessibleIndicator);
|
|
54733
|
+
});
|
|
54734
|
+
}
|
|
54735
|
+
else {
|
|
54736
|
+
var sourceId_1 = typeof this.options.source === 'string' ? this.options.source : this.options.source.getId();
|
|
54737
|
+
map.events.add('sourcedata', function (mapDataEvent) {
|
|
54738
|
+
var _a;
|
|
54739
|
+
// There's chances that mapDataEvent.isSourceLoaded doesn't update correctly when using flyTo, thus we check by using map.isSourceLoaded.
|
|
54740
|
+
if (((_a = mapDataEvent.source) === null || _a === void 0 ? void 0 : _a.getId()) === sourceId_1 && map._getMap().isSourceLoaded(sourceId_1)) {
|
|
54741
|
+
// Source event will be fired multiple times, and we are only interested when the source is loaded.
|
|
54742
|
+
// Thus design a cache key that only changed when camera & style properties are changed.
|
|
54743
|
+
var curCacheKey = _this._getSourceDataEventCacheKey();
|
|
54744
|
+
if (curCacheKey !== _this.sourceDataEventCacheKey) {
|
|
54745
|
+
_this._setAccessibleIndicator();
|
|
54746
|
+
_this.sourceDataEventCacheKey = curCacheKey;
|
|
54747
|
+
}
|
|
54748
|
+
}
|
|
54749
|
+
});
|
|
54750
|
+
}
|
|
54784
54751
|
}
|
|
54785
54752
|
};
|
|
54786
54753
|
BubbleLayer.prototype.onRemove = function () {
|
|
54787
54754
|
if (this.options.createIndicators) {
|
|
54788
|
-
this.map.events.remove('idle', this.
|
|
54789
|
-
this.map.events.remove('moveend', this.
|
|
54755
|
+
this.map.events.remove('idle', this._setAccessibleIndicator);
|
|
54756
|
+
this.map.events.remove('moveend', this._setAccessibleIndicator);
|
|
54757
|
+
var dataSource = this._getDataSource();
|
|
54758
|
+
if (dataSource) {
|
|
54759
|
+
this.map.events.remove('dataadded', dataSource, this._setAccessibleIndicator);
|
|
54760
|
+
}
|
|
54761
|
+
else {
|
|
54762
|
+
this.map.events.remove('sourcedata', this._setAccessibleIndicator);
|
|
54763
|
+
}
|
|
54790
54764
|
}
|
|
54791
54765
|
_super.prototype.onRemove.call(this);
|
|
54792
54766
|
};
|
|
54767
|
+
BubbleLayer.prototype._getSourceDataEventCacheKey = function () {
|
|
54768
|
+
if (!this.map) {
|
|
54769
|
+
return undefined;
|
|
54770
|
+
}
|
|
54771
|
+
var mapConfiguration = this.map.getServiceOptions().mapConfiguration;
|
|
54772
|
+
return __spreadArray(__spreadArray([], __read$3(this.map.getCamera().bounds)), [
|
|
54773
|
+
this.map.getCamera().zoom,
|
|
54774
|
+
this.map.getCamera().pitch,
|
|
54775
|
+
this.map.getStyle().style,
|
|
54776
|
+
mapConfiguration instanceof Object ? mapConfiguration.id : mapConfiguration
|
|
54777
|
+
]).join(',');
|
|
54778
|
+
};
|
|
54779
|
+
BubbleLayer.prototype._getDataSource = function () {
|
|
54780
|
+
var source = typeof this.options.source === 'string' ? this.map.sources.getById(this.options.source) : this.options.source;
|
|
54781
|
+
if (source instanceof DataSource) {
|
|
54782
|
+
return source;
|
|
54783
|
+
}
|
|
54784
|
+
return undefined;
|
|
54785
|
+
};
|
|
54793
54786
|
/**
|
|
54794
54787
|
* @internal
|
|
54795
54788
|
*/
|
|
@@ -55935,7 +55928,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
55935
55928
|
}
|
|
55936
55929
|
return ar;
|
|
55937
55930
|
};
|
|
55938
|
-
var __spreadArray = (window && window.__spreadArray) || function (to, from) {
|
|
55931
|
+
var __spreadArray$1 = (window && window.__spreadArray) || function (to, from) {
|
|
55939
55932
|
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
55940
55933
|
to[j] = from[i];
|
|
55941
55934
|
return to;
|
|
@@ -56010,7 +56003,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
56010
56003
|
finally { if (e_1) throw e_1.error; }
|
|
56011
56004
|
}
|
|
56012
56005
|
// Then execute the standard merge behavior.
|
|
56013
|
-
var merged = _super.prototype.merge.apply(this, __spreadArray([], __read$4(valueList)));
|
|
56006
|
+
var merged = _super.prototype.merge.apply(this, __spreadArray$1([], __read$4(valueList)));
|
|
56014
56007
|
if (isNewColorSet) {
|
|
56015
56008
|
merged.fillPattern = undefined;
|
|
56016
56009
|
}
|
|
@@ -58704,7 +58697,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
58704
58697
|
}
|
|
58705
58698
|
return ar;
|
|
58706
58699
|
};
|
|
58707
|
-
var __spreadArray$
|
|
58700
|
+
var __spreadArray$2 = (window && window.__spreadArray) || function (to, from) {
|
|
58708
58701
|
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
58709
58702
|
to[j] = from[i];
|
|
58710
58703
|
return to;
|
|
@@ -58841,7 +58834,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
58841
58834
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
58842
58835
|
valueList[_i] = arguments[_i];
|
|
58843
58836
|
}
|
|
58844
|
-
var merged = _super.prototype.merge.apply(this, __spreadArray$
|
|
58837
|
+
var merged = _super.prototype.merge.apply(this, __spreadArray$2([], __read$6(valueList)));
|
|
58845
58838
|
if (merged.authType === exports.AuthenticationType.subscriptionKey) {
|
|
58846
58839
|
merged.authContext = merged.aadAppId = merged.getToken = undefined;
|
|
58847
58840
|
}
|
|
@@ -59512,10 +59505,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
59512
59505
|
if (add) {
|
|
59513
59506
|
this.logoAnchor = document.createElement("a");
|
|
59514
59507
|
this.logoAnchor.className = "azure-map-logo";
|
|
59515
|
-
this.logoAnchor.href = "https://
|
|
59508
|
+
this.logoAnchor.href = "https://aka.ms/azuremaps";
|
|
59516
59509
|
this.logoAnchor.setAttribute("aria-label", "Microsoft");
|
|
59510
|
+
this.logoAnchor.setAttribute("target", "_blank");
|
|
59517
59511
|
this.container.appendChild(this.logoAnchor);
|
|
59518
|
-
this.logoTooltip = buildAccessibleTooltip("Visit microsoft.com");
|
|
59512
|
+
this.logoTooltip = buildAccessibleTooltip("Visit azure.microsoft.com");
|
|
59519
59513
|
this.container.appendChild(this.logoTooltip);
|
|
59520
59514
|
positionTooltip(this.logoTooltip, this.logoAnchor);
|
|
59521
59515
|
}
|
|
@@ -59797,7 +59791,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
59797
59791
|
}
|
|
59798
59792
|
return ar;
|
|
59799
59793
|
};
|
|
59800
|
-
var __spreadArray$
|
|
59794
|
+
var __spreadArray$3 = (window && window.__spreadArray) || function (to, from) {
|
|
59801
59795
|
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
59802
59796
|
to[j] = from[i];
|
|
59803
59797
|
return to;
|
|
@@ -60265,7 +60259,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
60265
60259
|
// Derive polygon layers from the label config.
|
|
60266
60260
|
_this._polygonStyleLayer = _this._labelConfig.reduce(function (acc, cur) {
|
|
60267
60261
|
if (cur.polygonSources) {
|
|
60268
|
-
acc.push.apply(acc, __spreadArray$
|
|
60262
|
+
acc.push.apply(acc, __spreadArray$3([], __read$7(cur.polygonSources)));
|
|
60269
60263
|
}
|
|
60270
60264
|
return acc;
|
|
60271
60265
|
}, []);
|
|
@@ -64750,7 +64744,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
64750
64744
|
}
|
|
64751
64745
|
return ar;
|
|
64752
64746
|
};
|
|
64753
|
-
var __spreadArray$
|
|
64747
|
+
var __spreadArray$4 = (window && window.__spreadArray) || function (to, from) {
|
|
64754
64748
|
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
64755
64749
|
to[j] = from[i];
|
|
64756
64750
|
return to;
|
|
@@ -64768,7 +64762,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
64768
64762
|
'data-azure-maps-attribution-order',
|
|
64769
64763
|
'data-azure-maps-attribution-dynamic'
|
|
64770
64764
|
];
|
|
64771
|
-
var allowedAttributionAttributes = __spreadArray$
|
|
64765
|
+
var allowedAttributionAttributes = __spreadArray$4([
|
|
64772
64766
|
'href'
|
|
64773
64767
|
], __read$8(attributionRuleAttributes));
|
|
64774
64768
|
var AttributionRuleProxy = /** @class */ (function () {
|
|
@@ -64993,7 +64987,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
64993
64987
|
};
|
|
64994
64988
|
AttributionRuleProxy.prototype.applyAttributionResponse = function (attributions) {
|
|
64995
64989
|
var _this = this;
|
|
64996
|
-
var copyrights = attributions.map(function (resp) { return resp.copyrights || []; }).reduce(function (flat, copyrights) { return __spreadArray$
|
|
64990
|
+
var copyrights = attributions.map(function (resp) { return resp.copyrights || []; }).reduce(function (flat, copyrights) { return __spreadArray$4(__spreadArray$4([], __read$8(flat)), __read$8(copyrights)); }, []);
|
|
64997
64991
|
if (copyrights.length == 0) {
|
|
64998
64992
|
// no attribution for a provided tileset/bbox/z
|
|
64999
64993
|
return;
|
|
@@ -65058,7 +65052,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
65058
65052
|
}
|
|
65059
65053
|
return ar;
|
|
65060
65054
|
};
|
|
65061
|
-
var __spreadArray$
|
|
65055
|
+
var __spreadArray$5 = (window && window.__spreadArray) || function (to, from) {
|
|
65062
65056
|
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
65063
65057
|
to[j] = from[i];
|
|
65064
65058
|
return to;
|
|
@@ -65177,10 +65171,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
65177
65171
|
}, function () { return document.createElement('span'); });
|
|
65178
65172
|
});
|
|
65179
65173
|
var registeredRuleSet = new Set(Object.values(registeredRules));
|
|
65180
|
-
var redundantRules = new Set(__spreadArray$
|
|
65181
|
-
var redundantElements = new Set(__spreadArray$
|
|
65174
|
+
var redundantRules = new Set(__spreadArray$5([], __read$9(allRules)).filter(function (rule) { return !registeredRuleSet.has(rule); }));
|
|
65175
|
+
var redundantElements = new Set(__spreadArray$5([], __read$9(redundantRules)).map(function (rule) { return rule.getElement(); }));
|
|
65182
65176
|
// eject redundant rules associated elements altogether
|
|
65183
|
-
__spreadArray$
|
|
65177
|
+
__spreadArray$5([], __read$9(redundantElements)).filter(function (elem) { return elem.parentElement !== null; })
|
|
65184
65178
|
.forEach(function (elem) { return elem.parentElement.removeChild(elem); });
|
|
65185
65179
|
_this.rules = Object.values(registeredRules);
|
|
65186
65180
|
var attributionsToApply = attributions
|
|
@@ -65216,7 +65210,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
65216
65210
|
var visibleTextNodes = function (elem) {
|
|
65217
65211
|
return Array.from(elem.style.display != 'none' ? elem.children : [])
|
|
65218
65212
|
.map(function (elem) { return visibleTextNodes(elem); })
|
|
65219
|
-
.reduce(function (flattened, nodes) { return __spreadArray$
|
|
65213
|
+
.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; }));
|
|
65220
65214
|
};
|
|
65221
65215
|
var newRenderContext = _this.virtualContext.cloneNode(true);
|
|
65222
65216
|
var visibleNodes = visibleTextNodes(newRenderContext);
|
|
@@ -65231,7 +65225,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
65231
65225
|
// }
|
|
65232
65226
|
// });
|
|
65233
65227
|
// strip all predefined keywords
|
|
65234
|
-
visibleNodes.forEach(function (node) { return node.textContent = __spreadArray$
|
|
65228
|
+
visibleNodes.forEach(function (node) { return node.textContent = __spreadArray$5([], __read$9(attributionFilters)).reduce(function (target, filter) { return target.replace(filter, '').trim(); }, node.textContent); });
|
|
65235
65229
|
// strip year from each node
|
|
65236
65230
|
// visibleNodes.forEach(node => node.textContent = node.textContent.replace(copyrightYearPattern, '').trim());
|
|
65237
65231
|
// deduplicate attribution text
|
|
@@ -68913,10 +68907,15 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
68913
68907
|
return ids;
|
|
68914
68908
|
};
|
|
68915
68909
|
FundamentalMapLayer.prototype._updateLayoutProperty = function (name, newValue, oldValue, subValue) {
|
|
68916
|
-
|
|
68910
|
+
if (isEqual_1(newValue, oldValue))
|
|
68911
|
+
return;
|
|
68912
|
+
var map = this.map._getMap();
|
|
68917
68913
|
this.layers.forEach(function (layer) {
|
|
68918
|
-
if (
|
|
68919
|
-
|
|
68914
|
+
if (map.getLayer(layer.id)) {
|
|
68915
|
+
map.setLayoutProperty(layer.id, name, subValue || newValue);
|
|
68916
|
+
}
|
|
68917
|
+
else {
|
|
68918
|
+
console.warn("Could not update layout property " + name + " for layer " + layer.id + " to " + (subValue || newValue));
|
|
68920
68919
|
}
|
|
68921
68920
|
});
|
|
68922
68921
|
};
|
|
@@ -68950,7 +68949,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
68950
68949
|
}
|
|
68951
68950
|
return ar;
|
|
68952
68951
|
};
|
|
68953
|
-
var __spreadArray$
|
|
68952
|
+
var __spreadArray$6 = (window && window.__spreadArray) || function (to, from) {
|
|
68954
68953
|
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
68955
68954
|
to[j] = from[i];
|
|
68956
68955
|
return to;
|
|
@@ -69011,10 +69010,12 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
69011
69010
|
// Place the new layer behind the specified before layer.
|
|
69012
69011
|
var layerIndex = this.layerIndex.findIndex(function (l) { return l.getId() === layer.getId(); });
|
|
69013
69012
|
var userLayerIndex = this.userLayers.findIndex(function (ul) { return ul.layer.getId() === layer.getId(); });
|
|
69014
|
-
var tempLayer = this.layerIndex[layerIndex];
|
|
69015
69013
|
this._removeMapboxLayers(layer);
|
|
69016
69014
|
this._addMapboxLayers(layer, before);
|
|
69017
|
-
this.
|
|
69015
|
+
var tempLayer = this.layerIndex[layerIndex];
|
|
69016
|
+
if (tempLayer) {
|
|
69017
|
+
this.map.events._disableLayerEvents(tempLayer);
|
|
69018
|
+
}
|
|
69018
69019
|
this.map.events._enableLayerEvents(layer);
|
|
69019
69020
|
this.layerIndex.splice(layerIndex, 1);
|
|
69020
69021
|
var beforeIndex = this.layerIndex.findIndex(function (l) { return l.getId() === before; });
|
|
@@ -69022,7 +69023,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
69022
69023
|
if (!(layer instanceof FundamentalMapLayer)) {
|
|
69023
69024
|
this.userLayers[userLayerIndex] = { layer: layer, before: before };
|
|
69024
69025
|
}
|
|
69025
|
-
tempLayer
|
|
69026
|
+
if (tempLayer) {
|
|
69027
|
+
tempLayer.onRemove();
|
|
69028
|
+
}
|
|
69026
69029
|
layer.onAdd(this.map);
|
|
69027
69030
|
}
|
|
69028
69031
|
else {
|
|
@@ -69388,7 +69391,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
69388
69391
|
// If a specified layer hasn't been added to the map throw an error.
|
|
69389
69392
|
var index = this_1.layerIndex.findIndex(function (l) { return l.getId() === layerId; });
|
|
69390
69393
|
if (index > -1) {
|
|
69391
|
-
layerIds.push.apply(layerIds, __spreadArray$
|
|
69394
|
+
layerIds.push.apply(layerIds, __spreadArray$6([], __read$b(this_1.layerIndex[index]._getLayerIds()
|
|
69392
69395
|
.filter(function (id) { return !!_this.map._getMap().getLayer(id); }))));
|
|
69393
69396
|
}
|
|
69394
69397
|
else {
|
|
@@ -69677,6 +69680,37 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
69677
69680
|
FundamentalMapSource.prototype._buildSource = function () {
|
|
69678
69681
|
return this.source;
|
|
69679
69682
|
};
|
|
69683
|
+
/**
|
|
69684
|
+
* @internal
|
|
69685
|
+
*/
|
|
69686
|
+
FundamentalMapSource.prototype._isDeepEqual = function (other) {
|
|
69687
|
+
if (this.constructor !== other.constructor) {
|
|
69688
|
+
return false;
|
|
69689
|
+
}
|
|
69690
|
+
var source = this.source;
|
|
69691
|
+
var otherSource = other.source;
|
|
69692
|
+
var baseEqual = source.type === otherSource.type &&
|
|
69693
|
+
source.url === otherSource.url
|
|
69694
|
+
&& ((source.tiles === undefined && otherSource.tiles === undefined) ||
|
|
69695
|
+
(source.tiles && otherSource.tiles && source.tiles.length === otherSource.tiles.length && source.tiles.every(function (value, idx) { return value === otherSource.tiles[idx]; })))
|
|
69696
|
+
&& source.minzoom === otherSource.minzoom
|
|
69697
|
+
&& source.maxzoom === otherSource.maxzoom
|
|
69698
|
+
&& source.bounds === otherSource.bounds
|
|
69699
|
+
&& source.attribution === otherSource.attribution;
|
|
69700
|
+
var rasterEqual = source.type !== "raster" || (source.type === "raster"
|
|
69701
|
+
&& source.type === otherSource.type
|
|
69702
|
+
&& source.tileSize === otherSource.tileSize
|
|
69703
|
+
&& source.scheme === otherSource.scheme);
|
|
69704
|
+
var rasterDemEqual = source.type !== "raster-dem" || (source.type === "raster-dem"
|
|
69705
|
+
&& source.type === otherSource.type
|
|
69706
|
+
&& source.tileSize === otherSource.tileSize
|
|
69707
|
+
&& source.encoding === otherSource.encoding);
|
|
69708
|
+
var vectorEqual = source.type !== "vector" || (source.type === "vector"
|
|
69709
|
+
&& source.type === otherSource.type
|
|
69710
|
+
&& source.promoteId === otherSource.promoteId
|
|
69711
|
+
&& source.scheme === otherSource.scheme);
|
|
69712
|
+
return baseEqual && rasterEqual && rasterDemEqual && vectorEqual;
|
|
69713
|
+
};
|
|
69680
69714
|
/**
|
|
69681
69715
|
* Updates the source info to convert the tiles to url strings.
|
|
69682
69716
|
* @param sourceDef The original source info.
|
|
@@ -69973,39 +70007,52 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
69973
70007
|
var _this = this;
|
|
69974
70008
|
if (sources) {
|
|
69975
70009
|
Object.keys(sources).forEach(function (sourceId) {
|
|
70010
|
+
var sourceToAdd = sources[sourceId];
|
|
70011
|
+
var newSource;
|
|
70012
|
+
if (sourceToAdd.type === "vector") {
|
|
70013
|
+
newSource = new FundamentalMapSource(sourceId, {
|
|
70014
|
+
name: sourceId,
|
|
70015
|
+
tiles: sourceToAdd.tiles,
|
|
70016
|
+
type: "vector",
|
|
70017
|
+
url: sourceToAdd.url
|
|
70018
|
+
});
|
|
70019
|
+
}
|
|
70020
|
+
else if (sourceToAdd.type === "raster") {
|
|
70021
|
+
newSource = new FundamentalMapSource(sourceId, {
|
|
70022
|
+
name: sourceId,
|
|
70023
|
+
tiles: sourceToAdd.tiles,
|
|
70024
|
+
type: "raster",
|
|
70025
|
+
url: sourceToAdd.url
|
|
70026
|
+
});
|
|
70027
|
+
}
|
|
70028
|
+
else {
|
|
70029
|
+
// Do not throw for the source of unknown type.
|
|
70030
|
+
// throw new Error(`Unable to construct source with ID ${sourceId}.`);
|
|
70031
|
+
// no other handling for the source we don't sync into the state here
|
|
70032
|
+
return;
|
|
70033
|
+
}
|
|
69976
70034
|
if (!_this.sources.has(sourceId)) {
|
|
69977
|
-
|
|
69978
|
-
|
|
69979
|
-
var newSource = new FundamentalMapSource(sourceId, {
|
|
69980
|
-
name: sourceId,
|
|
69981
|
-
tiles: sourceToAdd.tiles,
|
|
69982
|
-
type: "vector",
|
|
69983
|
-
url: sourceToAdd.url
|
|
69984
|
-
});
|
|
69985
|
-
_this.sources.set(sourceId, newSource);
|
|
69986
|
-
newSource._setMap(_this.map);
|
|
69987
|
-
}
|
|
69988
|
-
else if (sourceToAdd.type === "raster") {
|
|
69989
|
-
var newSource = new FundamentalMapSource(sourceId, {
|
|
69990
|
-
name: sourceId,
|
|
69991
|
-
tiles: sourceToAdd.tiles,
|
|
69992
|
-
type: "raster",
|
|
69993
|
-
url: sourceToAdd.url
|
|
69994
|
-
});
|
|
69995
|
-
_this.sources.set(sourceId, newSource);
|
|
69996
|
-
newSource._setMap(_this.map);
|
|
69997
|
-
}
|
|
69998
|
-
else {
|
|
69999
|
-
throw new Error("Unable to construct source with ID " + sourceId + ".");
|
|
70000
|
-
}
|
|
70035
|
+
_this.sources.set(sourceId, newSource);
|
|
70036
|
+
newSource._setMap(_this.map);
|
|
70001
70037
|
}
|
|
70002
|
-
|
|
70003
|
-
|
|
70004
|
-
|
|
70005
|
-
|
|
70006
|
-
_this.sources.delete(sourceId);
|
|
70038
|
+
else if (_this.sources.has(sourceId) && !_this.sources.get(sourceId)._isDeepEqual(newSource)) {
|
|
70039
|
+
// source with same id but different properties: update
|
|
70040
|
+
_this.sources.set(sourceId, newSource);
|
|
70041
|
+
newSource._setMap(_this.map, false);
|
|
70007
70042
|
}
|
|
70008
70043
|
});
|
|
70044
|
+
// counter-intuitive: below is a bug and will do nothing since Object.keys(this.sources) will always return [], it should rather be:
|
|
70045
|
+
// Array.from(this.sources.keys()).forEach(sourceId => {
|
|
70046
|
+
// 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
|
|
70047
|
+
// such removal will cause the exception, since the source would already be removed
|
|
70048
|
+
//
|
|
70049
|
+
// 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
|
|
70050
|
+
// Object.keys(this.sources).forEach(sourceId => {
|
|
70051
|
+
// if (!sources.hasOwnProperty(sourceId)) {
|
|
70052
|
+
// this.sources.get(sourceId)._setMap(null);
|
|
70053
|
+
// this.sources.delete(sourceId);
|
|
70054
|
+
// }
|
|
70055
|
+
// });
|
|
70009
70056
|
}
|
|
70010
70057
|
};
|
|
70011
70058
|
return SourceManager;
|
|
@@ -70147,7 +70194,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
70147
70194
|
}
|
|
70148
70195
|
return ar;
|
|
70149
70196
|
};
|
|
70150
|
-
var __spreadArray$
|
|
70197
|
+
var __spreadArray$7 = (window && window.__spreadArray) || function (to, from) {
|
|
70151
70198
|
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
70152
70199
|
to[j] = from[i];
|
|
70153
70200
|
return to;
|
|
@@ -70222,7 +70269,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
70222
70269
|
}
|
|
70223
70270
|
finally { if (e_1) throw e_1.error; }
|
|
70224
70271
|
}
|
|
70225
|
-
return _super.prototype.merge.apply(this, __spreadArray$
|
|
70272
|
+
return _super.prototype.merge.apply(this, __spreadArray$7([], __read$c(valuesList)));
|
|
70226
70273
|
};
|
|
70227
70274
|
return CameraBoundsOptions;
|
|
70228
70275
|
}(Options));
|
|
@@ -70711,7 +70758,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
70711
70758
|
}
|
|
70712
70759
|
return ar;
|
|
70713
70760
|
};
|
|
70714
|
-
var __spreadArray$
|
|
70761
|
+
var __spreadArray$8 = (window && window.__spreadArray) || function (to, from) {
|
|
70715
70762
|
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
70716
70763
|
to[j] = from[i];
|
|
70717
70764
|
return to;
|
|
@@ -70831,6 +70878,13 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
70831
70878
|
* @deprecated use `view` instead.
|
|
70832
70879
|
*/
|
|
70833
70880
|
_this.userRegion = _this.view;
|
|
70881
|
+
/**
|
|
70882
|
+
* allows substituting a default MapControl's style transformer with custom one
|
|
70883
|
+
* 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
|
|
70884
|
+
* and move additional layers over
|
|
70885
|
+
* @internal
|
|
70886
|
+
*/
|
|
70887
|
+
_this.customStyleTransform = undefined;
|
|
70834
70888
|
return _this;
|
|
70835
70889
|
}
|
|
70836
70890
|
/**
|
|
@@ -70870,7 +70924,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
70870
70924
|
finally { if (e_1) throw e_1.error; }
|
|
70871
70925
|
}
|
|
70872
70926
|
// Then execute the standard merge behavior.
|
|
70873
|
-
return _super.prototype.merge.apply(this, __spreadArray$
|
|
70927
|
+
return _super.prototype.merge.apply(this, __spreadArray$8([], __read$d(valueList)));
|
|
70874
70928
|
};
|
|
70875
70929
|
return StyleOptions;
|
|
70876
70930
|
}(Options));
|
|
@@ -70928,7 +70982,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
70928
70982
|
}
|
|
70929
70983
|
return ar;
|
|
70930
70984
|
};
|
|
70931
|
-
var __spreadArray$
|
|
70985
|
+
var __spreadArray$9 = (window && window.__spreadArray) || function (to, from) {
|
|
70932
70986
|
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
70933
70987
|
to[j] = from[i];
|
|
70934
70988
|
return to;
|
|
@@ -71163,10 +71217,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
71163
71217
|
// won't change default behavior in Options as usually that's what desired
|
|
71164
71218
|
// instead capture it here and reassign.
|
|
71165
71219
|
var currentTransforms = this._transformers;
|
|
71166
|
-
var transformersToMerge = valueList ? valueList.filter(function (value) { return value !== undefined; }).reduce(function (flattened, value) { return __spreadArray$
|
|
71220
|
+
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 || [])); }, []) : [];
|
|
71167
71221
|
// Then execute the standard merge behavior.
|
|
71168
71222
|
// If subscription key auth method isn't being used then the subscription key property should be undefined.
|
|
71169
|
-
var merged = _super.prototype.merge.apply(this, __spreadArray$
|
|
71223
|
+
var merged = _super.prototype.merge.apply(this, __spreadArray$9([], __read$e(valueList)));
|
|
71170
71224
|
if (merged.authOptions.authType !== exports.AuthenticationType.subscriptionKey) {
|
|
71171
71225
|
merged["subscription-key"] = merged.subscriptionKey = undefined;
|
|
71172
71226
|
}
|
|
@@ -71178,7 +71232,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
71178
71232
|
if (merged.mapConfiguration && typeof merged.mapConfiguration !== 'string') {
|
|
71179
71233
|
merged.mapConfiguration = __assign$7(__assign$7({}, merged.mapConfiguration), { defaultConfiguration: merged.mapConfiguration.defaultConfiguration || merged.mapConfiguration['defaultStyle'], configurations: merged.mapConfiguration.configurations || merged.mapConfiguration['styles'] });
|
|
71180
71234
|
}
|
|
71181
|
-
this._transformers = __spreadArray$
|
|
71235
|
+
this._transformers = __spreadArray$9(__spreadArray$9([], __read$e(currentTransforms || [])), __read$e(transformersToMerge.filter(function (toMerge) { return !currentTransforms.includes(toMerge); })));
|
|
71182
71236
|
if (this.transformRequest && !this._transformers.includes(this.transformRequest)) {
|
|
71183
71237
|
this._transformers.push(this.transformRequest);
|
|
71184
71238
|
}
|
|
@@ -71426,7 +71480,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
71426
71480
|
}
|
|
71427
71481
|
return ar;
|
|
71428
71482
|
};
|
|
71429
|
-
var __spreadArray$
|
|
71483
|
+
var __spreadArray$a = (window && window.__spreadArray) || function (to, from) {
|
|
71430
71484
|
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
71431
71485
|
to[j] = from[i];
|
|
71432
71486
|
return to;
|
|
@@ -71479,7 +71533,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
71479
71533
|
var deferredLayers = Object.entries(layerGroupLayers).reduce(function (deferred, _a) {
|
|
71480
71534
|
var _b = __read$f(_a, 2), groupName = _b[0], layers = _b[1];
|
|
71481
71535
|
var isInInitialLayerGroup = validInitLayerGroups.includes(groupName);
|
|
71482
|
-
return __spreadArray$
|
|
71536
|
+
return __spreadArray$a(__spreadArray$a([], __read$f(deferred)), __read$f(layers.filter(function (layer) {
|
|
71483
71537
|
var _a;
|
|
71484
71538
|
// Exclude custom layers
|
|
71485
71539
|
if (layer.type === 'custom')
|
|
@@ -71531,13 +71585,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
71531
71585
|
};
|
|
71532
71586
|
_this.map.events.addOnce('load', _this._progressiveLoadingState.pendingVisibilityChange);
|
|
71533
71587
|
};
|
|
71534
|
-
this._onStyleData = function () {
|
|
71535
|
-
_this.
|
|
71536
|
-
|
|
71537
|
-
|
|
71538
|
-
|
|
71539
|
-
type: "stylechanged"
|
|
71540
|
-
});
|
|
71588
|
+
this._onStyleData = function (definition) {
|
|
71589
|
+
_this.map.events.invoke("stylechanged", {
|
|
71590
|
+
style: definition.name,
|
|
71591
|
+
map: _this.map,
|
|
71592
|
+
type: "stylechanged"
|
|
71541
71593
|
});
|
|
71542
71594
|
};
|
|
71543
71595
|
/**
|
|
@@ -71721,23 +71773,183 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
71721
71773
|
if (styleDefinition.style) {
|
|
71722
71774
|
return styleDefinition.style;
|
|
71723
71775
|
}
|
|
71724
|
-
throw Error("Style definition
|
|
71776
|
+
throw Error("Style definition neither contains URL nor style object.");
|
|
71777
|
+
};
|
|
71778
|
+
StyleManager.prototype.deriveNewStyleAndLayerGroups = function (previousStyle, nextStyle) {
|
|
71779
|
+
var _a, _b, _c, _d, _e, _f;
|
|
71780
|
+
// Layers in the next style with default properties that do not align with current StyleOptions
|
|
71781
|
+
// should be modified before they are applied to the map.
|
|
71782
|
+
var styleOptions = this.map.getStyle();
|
|
71783
|
+
var trafficOptions = this.map.getTraffic();
|
|
71784
|
+
var layersGroups = {};
|
|
71785
|
+
for (var i = 0; i < nextStyle.layers.length; i++) {
|
|
71786
|
+
var nextLayer = nextStyle.layers[i];
|
|
71787
|
+
var layerGroup = LayerGroupComparator.getLayerGroup(nextLayer);
|
|
71788
|
+
if (!layerGroup) {
|
|
71789
|
+
layersGroups[nextLayer.id] = [nextLayer];
|
|
71790
|
+
continue;
|
|
71791
|
+
}
|
|
71792
|
+
if (!layersGroups[layerGroup]) {
|
|
71793
|
+
layersGroups[layerGroup] = [];
|
|
71794
|
+
}
|
|
71795
|
+
var layerGroupLayers = layersGroups[layerGroup];
|
|
71796
|
+
layerGroupLayers.push(nextLayer);
|
|
71797
|
+
// 1. Set visiblity of fill-extrusion layers according to StyleOptions.showBuildingModels
|
|
71798
|
+
if (!styleOptions.showBuildingModels && nextLayer.type === "fill-extrusion") {
|
|
71799
|
+
nextLayer.layout = (_a = nextLayer.layout) !== null && _a !== void 0 ? _a : {};
|
|
71800
|
+
nextLayer.layout.visibility = "none";
|
|
71801
|
+
}
|
|
71802
|
+
else if (nextLayer.type === "fill-extrusion") {
|
|
71803
|
+
nextLayer.layout = (_b = nextLayer.layout) !== null && _b !== void 0 ? _b : {};
|
|
71804
|
+
nextLayer.layout.visibility = "visible";
|
|
71805
|
+
}
|
|
71806
|
+
// 2. Set visibility of traffic layers depending on traffic settings.
|
|
71807
|
+
if (trafficOptions.flow !== "none" && layerGroup) {
|
|
71808
|
+
if (layerGroup === "traffic_" + trafficOptions.flow && nextLayer.type == "line") {
|
|
71809
|
+
nextLayer.layout = (_c = nextLayer.layout) !== null && _c !== void 0 ? _c : {};
|
|
71810
|
+
nextLayer.layout.visibility = "visible";
|
|
71811
|
+
}
|
|
71812
|
+
}
|
|
71813
|
+
// 3. Set visibility of labels
|
|
71814
|
+
var isLabelLayerGroup = layerGroup === 'labels' || layerGroup === 'labels_places' || layerGroup === 'labels_indoor';
|
|
71815
|
+
if (isLabelLayerGroup && nextLayer.type === 'symbol') {
|
|
71816
|
+
if (styleOptions.showLabels && ((_d = nextLayer.layout) === null || _d === void 0 ? void 0 : _d.visibility) !== "none") {
|
|
71817
|
+
nextLayer.layout = (_e = nextLayer.layout) !== null && _e !== void 0 ? _e : {};
|
|
71818
|
+
nextLayer.layout.visibility = "visible";
|
|
71819
|
+
}
|
|
71820
|
+
else {
|
|
71821
|
+
nextLayer.layout = (_f = nextLayer.layout) !== null && _f !== void 0 ? _f : {};
|
|
71822
|
+
nextLayer.layout.visibility = "none";
|
|
71823
|
+
}
|
|
71824
|
+
}
|
|
71825
|
+
}
|
|
71826
|
+
return [nextStyle, layersGroups];
|
|
71827
|
+
};
|
|
71828
|
+
StyleManager.prototype.injectUserLayersIntoStyle = function (previousStyle, nextStyle, layerGroupLayers) {
|
|
71829
|
+
// Custom layers added to mapbox through this SDK should be carried over to the next style.
|
|
71830
|
+
return !previousStyle
|
|
71831
|
+
? nextStyle
|
|
71832
|
+
: this.map.layers._getUserLayers().reduce(function (style, userLayer) {
|
|
71833
|
+
if (userLayer.layer instanceof WebGLLayer) {
|
|
71834
|
+
// mapbox custom layers cannot be serialized and preserved,
|
|
71835
|
+
// return to continue to the next user layer.
|
|
71836
|
+
return style;
|
|
71837
|
+
}
|
|
71838
|
+
var before = layerGroupLayers[userLayer.before] && layerGroupLayers[userLayer.before].length > 0
|
|
71839
|
+
? layerGroupLayers[userLayer.before][0]
|
|
71840
|
+
: undefined;
|
|
71841
|
+
var layer = previousStyle.layers.find(function (layer) { return layer.id === userLayer.layer.getId(); });
|
|
71842
|
+
// when setStyle diff attempt is unsuccesful, _load will be called on the style that may have already injected user layers -> clean it up
|
|
71843
|
+
var existingLayerIdx = nextStyle.layers.findIndex(function (layer) { return layer.id === userLayer.layer.getId(); });
|
|
71844
|
+
if (existingLayerIdx > -1) {
|
|
71845
|
+
nextStyle.layers.splice(existingLayerIdx, 1);
|
|
71846
|
+
}
|
|
71847
|
+
if (layer) {
|
|
71848
|
+
var sourcesToCopy = new Set(Array.from(userLayer.layer._getSourceIds())
|
|
71849
|
+
.map(function (sourceId) { return previousStyle.sources[sourceId] ? { source: previousStyle.sources[sourceId], id: sourceId } : undefined; })
|
|
71850
|
+
.filter(function (source) { return source !== undefined; }));
|
|
71851
|
+
var insertIdx = before ? style.layers.findIndex(function (layer) { return layer.id === before.id; }) : -1;
|
|
71852
|
+
if (insertIdx > -1) {
|
|
71853
|
+
style.layers.splice(insertIdx, 0, layer);
|
|
71854
|
+
}
|
|
71855
|
+
else {
|
|
71856
|
+
style.layers.push(layer);
|
|
71857
|
+
}
|
|
71858
|
+
sourcesToCopy.forEach(function (_a) {
|
|
71859
|
+
var source = _a.source, id = _a.id;
|
|
71860
|
+
style.sources[id] = source;
|
|
71861
|
+
});
|
|
71862
|
+
}
|
|
71863
|
+
return style;
|
|
71864
|
+
}, __assign$8({}, nextStyle));
|
|
71725
71865
|
};
|
|
71726
71866
|
/**
|
|
71727
71867
|
* @internal
|
|
71728
71868
|
*/
|
|
71729
71869
|
StyleManager.prototype.setStyle = function (styleOptions, diff) {
|
|
71870
|
+
var _this = this;
|
|
71730
71871
|
if (diff === void 0) { diff = true; }
|
|
71731
|
-
|
|
71732
|
-
|
|
71733
|
-
|
|
71734
|
-
|
|
71735
|
-
|
|
71736
|
-
|
|
71872
|
+
var transformStyleFunc;
|
|
71873
|
+
var targetDefinition = this._lookUp(styleOptions);
|
|
71874
|
+
if (!targetDefinition) {
|
|
71875
|
+
throw Error("Style definition " + styleOptions.style + " is not available.");
|
|
71876
|
+
}
|
|
71877
|
+
if (!targetDefinition.url && !targetDefinition.style) {
|
|
71878
|
+
throw Error("Style definition neither contains URL nor style object.");
|
|
71879
|
+
}
|
|
71880
|
+
var styleDataCallback = function () { return _this._onStyleData(targetDefinition); };
|
|
71881
|
+
var patchStyleEvent = function () {
|
|
71882
|
+
// FIXME: below diffing will be soon fixed on the maplibre side
|
|
71883
|
+
// If there was a previous styledata change event attached, remove it.
|
|
71884
|
+
// When the sprite url changes between style changes then maplibre can't perform the diff
|
|
71885
|
+
// In such cases it recalculate the style again. Removing previous attached
|
|
71886
|
+
// event listener makes sure that style changed event is not fired twice in these cases.
|
|
71887
|
+
_this.map.events.remove("styledata", styleDataCallback);
|
|
71888
|
+
_this.map.events.addOnce("styledata", styleDataCallback);
|
|
71889
|
+
};
|
|
71890
|
+
if (styleOptions && styleOptions.customStyleTransform) {
|
|
71891
|
+
transformStyleFunc = function (prev, next) {
|
|
71892
|
+
var target = styleOptions.customStyleTransform(prev, next);
|
|
71893
|
+
patchStyleEvent();
|
|
71894
|
+
return target;
|
|
71895
|
+
};
|
|
71737
71896
|
}
|
|
71738
|
-
|
|
71739
|
-
|
|
71897
|
+
else {
|
|
71898
|
+
transformStyleFunc = function (previousStyle, style) {
|
|
71899
|
+
// make sure we always have a shallow clone to prevent mutating explicit json(rather then url) styles being set
|
|
71900
|
+
var nextStyle = __assign$8(__assign$8({}, style), { layers: __spreadArray$a([], __read$f(style.layers)), sources: __assign$8({}, style.sources) });
|
|
71901
|
+
var shouldProgressiveLoading = (styleOptions.progressiveLoading &&
|
|
71902
|
+
// The feature only effective at the initial load.
|
|
71903
|
+
!_this.map._isLoaded());
|
|
71904
|
+
// Shallow-clone the style object and duplicate layer.layout properties to avoid side-effects.
|
|
71905
|
+
if (shouldProgressiveLoading && Array.isArray(style === null || style === void 0 ? void 0 : style.layers)) {
|
|
71906
|
+
nextStyle = __assign$8({}, style);
|
|
71907
|
+
nextStyle.layers = nextStyle.layers.map(function (layer) {
|
|
71908
|
+
var nextLayer = __assign$8({}, layer);
|
|
71909
|
+
if (layer.layout) {
|
|
71910
|
+
nextLayer.layout = __assign$8({}, layer.layout);
|
|
71911
|
+
}
|
|
71912
|
+
return nextLayer;
|
|
71913
|
+
});
|
|
71914
|
+
}
|
|
71915
|
+
// 1. derive the base new style (without user layers) and layer groups
|
|
71916
|
+
var _a = __read$f(_this.deriveNewStyleAndLayerGroups(previousStyle, nextStyle), 2), targetStyle = _a[0], layerGroupLayers = _a[1];
|
|
71917
|
+
// 2. side effect: progressively render map layers to the canvas to shorten the time to the first meaningful render.
|
|
71918
|
+
if (shouldProgressiveLoading) {
|
|
71919
|
+
var initLayerGroups = styleOptions.progressiveLoadingInitialLayerGroups;
|
|
71920
|
+
if (Array.isArray(initLayerGroups) && initLayerGroups.length > 0) {
|
|
71921
|
+
_this._deferLayerGroupVisibilities(layerGroupLayers, initLayerGroups);
|
|
71922
|
+
}
|
|
71923
|
+
}
|
|
71924
|
+
// 3. copy user layers and sources from previous style into new one
|
|
71925
|
+
var targetStyleWithUserLayers = _this.injectUserLayersIntoStyle(previousStyle, targetStyle, layerGroupLayers);
|
|
71926
|
+
// 4. side effects: sync our control's LayerManager and SourceManager
|
|
71927
|
+
var nextFundamentalLayers = Object.entries(layerGroupLayers).map(function (_a) {
|
|
71928
|
+
var _b = __read$f(_a, 2), layerGroupId = _b[0], layers = _b[1];
|
|
71929
|
+
return _this._buildFundamentalLayerFrom(layers, layerGroupId);
|
|
71930
|
+
});
|
|
71931
|
+
var layerIndex = _this.map.layers._getUserLayers().reduce(function (layerIndex, userLayer) {
|
|
71932
|
+
var layerInsertIndex = userLayer.before ? layerIndex.findIndex(function (layer) { return layer.getId() === userLayer.before; }) : -1;
|
|
71933
|
+
if (layerInsertIndex > -1) {
|
|
71934
|
+
layerIndex.splice(layerInsertIndex, 0, userLayer.layer);
|
|
71935
|
+
}
|
|
71936
|
+
else {
|
|
71937
|
+
layerIndex.push(userLayer.layer);
|
|
71938
|
+
}
|
|
71939
|
+
return layerIndex;
|
|
71940
|
+
}, nextFundamentalLayers);
|
|
71941
|
+
_this.map.layers['layerIndex'] = layerIndex;
|
|
71942
|
+
_this.map.sources._syncSources(targetStyleWithUserLayers.sources);
|
|
71943
|
+
// 5. temporarily patch style data event
|
|
71944
|
+
patchStyleEvent();
|
|
71945
|
+
return targetStyleWithUserLayers;
|
|
71946
|
+
};
|
|
71740
71947
|
}
|
|
71948
|
+
this.map._getMap().setStyle(targetDefinition.url || targetDefinition.style, {
|
|
71949
|
+
diff: diff,
|
|
71950
|
+
validate: this.serviceOptions.validateStyle,
|
|
71951
|
+
transformStyle: transformStyleFunc
|
|
71952
|
+
});
|
|
71741
71953
|
};
|
|
71742
71954
|
/**
|
|
71743
71955
|
* Gets the color theme (light/dark) for the style type specified by the style options.
|
|
@@ -71802,138 +72014,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
71802
72014
|
StyleManager.prototype.clearStyleSet = function () {
|
|
71803
72015
|
this.unsetIndoorState();
|
|
71804
72016
|
};
|
|
71805
|
-
/**
|
|
71806
|
-
* Function invoked by mapbox after a style is fetched but before it is committed to the map state.
|
|
71807
|
-
*
|
|
71808
|
-
* @param previousStyle The current style.
|
|
71809
|
-
* @param nextStyle The next style which is to be applied.
|
|
71810
|
-
* @param preserveLayer Preserve a layer from the previous style in the next style.
|
|
71811
|
-
* @param updatePaintProperty Modify paint properties of a layer in the next style before the style is applied.
|
|
71812
|
-
* @param updateLayoutProperty Modify layout properties of a layer in the next style before the style is applied.
|
|
71813
|
-
* @param updateFilter Modify filter property of a layer in the next style before the style is applied.
|
|
71814
|
-
*/
|
|
71815
|
-
StyleManager.prototype._stylePatch = function (previousStyle, nextStyle, preserveLayer, updatePaintProperty, updateLayoutProperty, updateFilter) {
|
|
71816
|
-
var _this = this;
|
|
71817
|
-
// Skip the style patch if the map has been disposed.
|
|
71818
|
-
if (this.map.isDisposed)
|
|
71819
|
-
return;
|
|
71820
|
-
// Layers in the next style with default properties that do not align with current StyleOptions
|
|
71821
|
-
// should be modified before they are applied to the map.
|
|
71822
|
-
var styleOptions = this.map.getStyle();
|
|
71823
|
-
var trafficOptions = this.map.getTraffic();
|
|
71824
|
-
var shouldProgressiveLoading = (styleOptions.progressiveLoading &&
|
|
71825
|
-
// The feature only effective at the initial load.
|
|
71826
|
-
!this.map._isLoaded());
|
|
71827
|
-
var setLayerVisibility = function (layer, visibility) {
|
|
71828
|
-
var _a;
|
|
71829
|
-
if (!shouldProgressiveLoading) {
|
|
71830
|
-
// No need to apply the visibility change to maplibre while progressive loading is enabled.
|
|
71831
|
-
// This can save a lot of CPU time.
|
|
71832
|
-
updateLayoutProperty(layer.id, 'visibility', visibility);
|
|
71833
|
-
}
|
|
71834
|
-
layer.layout = (_a = layer.layout) !== null && _a !== void 0 ? _a : {};
|
|
71835
|
-
layer.layout.visibility = visibility;
|
|
71836
|
-
};
|
|
71837
|
-
var layerGroupLayers = {};
|
|
71838
|
-
nextStyle.layers.forEach(function (nextLayer) {
|
|
71839
|
-
var _a;
|
|
71840
|
-
var layerGroup = LayerGroupComparator.getLayerGroup(nextLayer);
|
|
71841
|
-
if (layerGroup) {
|
|
71842
|
-
// Set visibility of fill-extrusion layers according to StyleOptions.showBuildingModels
|
|
71843
|
-
if (nextLayer.type === 'fill-extrusion') {
|
|
71844
|
-
setLayerVisibility(nextLayer, styleOptions.showBuildingModels ? 'visible' : 'none');
|
|
71845
|
-
}
|
|
71846
|
-
// Set visibility of traffic layers depending on traffic settings.
|
|
71847
|
-
if (trafficOptions.flow !== 'none' && nextLayer.type == 'line' &&
|
|
71848
|
-
(layerGroup === "traffic_" + trafficOptions.flow ||
|
|
71849
|
-
// Check if deprecated flow types are used and the layer is a bing-traffic layer.
|
|
71850
|
-
// Needed for backwards compatibility in Bing styles to support deprecated flow types.
|
|
71851
|
-
(['absolute', 'relative-delay'].includes(trafficOptions.flow) && nextLayer['source'] === "bing-traffic"))) {
|
|
71852
|
-
setLayerVisibility(nextLayer, 'visible');
|
|
71853
|
-
}
|
|
71854
|
-
// Set visibility of labels
|
|
71855
|
-
var isLabelLayerGroup = layerGroup === 'labels' || layerGroup === 'labels_places' || layerGroup === 'labels_indoor';
|
|
71856
|
-
if (isLabelLayerGroup && nextLayer.type === 'symbol') {
|
|
71857
|
-
var isLayerVisible = ((_a = nextLayer.layout) === null || _a === void 0 ? void 0 : _a.visibility) !== 'none';
|
|
71858
|
-
setLayerVisibility(nextLayer, isLayerVisible && styleOptions.showLabels ? 'visible' : 'none');
|
|
71859
|
-
}
|
|
71860
|
-
// Once this _stylePatch returns control to maplibre the next style will be applied immediately in the same context.
|
|
71861
|
-
// To avoid potential data races update LayerManager with new a new set of FundamentalMapLayers from here instead of
|
|
71862
|
-
// waiting for a styledata.load event to trigger a sync in a different context.
|
|
71863
|
-
if (layerGroupLayers[layerGroup]) {
|
|
71864
|
-
layerGroupLayers[layerGroup].push(nextLayer);
|
|
71865
|
-
}
|
|
71866
|
-
else {
|
|
71867
|
-
layerGroupLayers[layerGroup] = [nextLayer];
|
|
71868
|
-
}
|
|
71869
|
-
}
|
|
71870
|
-
});
|
|
71871
|
-
if (shouldProgressiveLoading) {
|
|
71872
|
-
var initLayerGroups = styleOptions.progressiveLoadingInitialLayerGroups;
|
|
71873
|
-
if (Array.isArray(initLayerGroups) && initLayerGroups.length > 0) {
|
|
71874
|
-
this._deferLayerGroupVisibilities(layerGroupLayers, initLayerGroups);
|
|
71875
|
-
}
|
|
71876
|
-
}
|
|
71877
|
-
// A FundamentalMapLayer (grouped layer) representation of the next style must be built.
|
|
71878
|
-
var previousLayers = this.map.layers.getLayers();
|
|
71879
|
-
var nextLayers = Object.entries(layerGroupLayers).map(function (_a) {
|
|
71880
|
-
var _b = __read$f(_a, 2), layerGroupName = _b[0], layerGroupMapboxLayers = _b[1];
|
|
71881
|
-
return _this._buildFundamentalLayerFrom(layerGroupMapboxLayers, layerGroupName);
|
|
71882
|
-
});
|
|
71883
|
-
// Update FundamentalMapLayers in LayerManager
|
|
71884
|
-
var userLayers = this.map.layers._getUserLayers();
|
|
71885
|
-
var layersToRemove = previousLayers.filter(function (c) {
|
|
71886
|
-
return (nextLayers.findIndex(function (n) { return c.getId() === n.getId(); }) < 0 &&
|
|
71887
|
-
userLayers.findIndex(function (n) { return c.getId() === n.layer.getId(); }) < 0);
|
|
71888
|
-
});
|
|
71889
|
-
var prevNextIntersection = nextLayers.filter(function (n) { return previousLayers.find(function (c) { return c.getId() === n.getId(); }); });
|
|
71890
|
-
var ePrevNextIntersection = prevNextIntersection.entries();
|
|
71891
|
-
var replace = ePrevNextIntersection.next();
|
|
71892
|
-
nextLayers.forEach(function (newFundamentalLayer) {
|
|
71893
|
-
if (replace.value && replace.value[1].getId() === newFundamentalLayer.getId()) {
|
|
71894
|
-
// Replace the existing layer with this ID with the new one.
|
|
71895
|
-
var insertBefore = previousLayers.findIndex(function (l) { return l.getId() === newFundamentalLayer.getId(); });
|
|
71896
|
-
_this.map.layers.remove(newFundamentalLayer.getId());
|
|
71897
|
-
_this.map.layers.add(newFundamentalLayer, previousLayers[insertBefore].getId());
|
|
71898
|
-
replace = ePrevNextIntersection.next();
|
|
71899
|
-
}
|
|
71900
|
-
else {
|
|
71901
|
-
if (replace.value) {
|
|
71902
|
-
// Insert new layer before the next common layer.
|
|
71903
|
-
_this.map.layers.add(newFundamentalLayer, replace.value[1]);
|
|
71904
|
-
}
|
|
71905
|
-
else {
|
|
71906
|
-
_this.map.layers.add(newFundamentalLayer);
|
|
71907
|
-
}
|
|
71908
|
-
}
|
|
71909
|
-
});
|
|
71910
|
-
layersToRemove.forEach(function (layer) {
|
|
71911
|
-
_this.map.layers.remove(layer);
|
|
71912
|
-
});
|
|
71913
|
-
// Layers added to mapbox through this SDK since loading the last style should be
|
|
71914
|
-
// carried over to the next style.
|
|
71915
|
-
userLayers.forEach(function (userLayer) {
|
|
71916
|
-
if (userLayer.layer instanceof WebGLLayer) {
|
|
71917
|
-
// mapbox custom layers cannot be serialized and preserved,
|
|
71918
|
-
// return to continue to the next user layer.
|
|
71919
|
-
return;
|
|
71920
|
-
}
|
|
71921
|
-
var before = undefined;
|
|
71922
|
-
if (_this.map.layers.getLayerById(userLayer.before)) {
|
|
71923
|
-
var beforeCandidates = _this.map.layers.getLayerById(userLayer.before)._buildLayers();
|
|
71924
|
-
before = (beforeCandidates.length > 0) ? beforeCandidates[0] : undefined;
|
|
71925
|
-
}
|
|
71926
|
-
preserveLayer(userLayer.layer.getId(), before === null || before === void 0 ? void 0 : before.id);
|
|
71927
|
-
_this.map.layers.move(userLayer.layer.getId(), userLayer.before);
|
|
71928
|
-
});
|
|
71929
|
-
this.map.sources._syncSources(nextStyle.sources);
|
|
71930
|
-
// If there was a previous styledata change event attached, remove it.
|
|
71931
|
-
// When the sprite url changes between style changes then mapbox can't perform the diff
|
|
71932
|
-
// In such cases it recalculate the style again. Removing previous attached
|
|
71933
|
-
// event listener makes sure that style changed event is not fired twice in these cases.
|
|
71934
|
-
this.map.events.remove("styledata", this._onStyleData);
|
|
71935
|
-
this.map.events.addOnce("styledata", this._onStyleData);
|
|
71936
|
-
};
|
|
71937
72017
|
StyleManager.prototype._buildFundamentalLayerFrom = function (layers, id) {
|
|
71938
72018
|
if (layers && layers.length > 0) {
|
|
71939
72019
|
var newLayer = new FundamentalMapLayer(layers, id);
|
|
@@ -72237,7 +72317,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
72237
72317
|
}
|
|
72238
72318
|
return ar;
|
|
72239
72319
|
};
|
|
72240
|
-
var __spreadArray$
|
|
72320
|
+
var __spreadArray$b = (window && window.__spreadArray) || function (to, from) {
|
|
72241
72321
|
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
72242
72322
|
to[j] = from[i];
|
|
72243
72323
|
return to;
|
|
@@ -73069,7 +73149,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
73069
73149
|
urls = layer.getOptions().subdomains || [];
|
|
73070
73150
|
}
|
|
73071
73151
|
// Add the tile urls to the layer, but don't update the map yet.
|
|
73072
|
-
urls.push.apply(urls, __spreadArray$
|
|
73152
|
+
urls.push.apply(urls, __spreadArray$b([], __read$g(tileSources)));
|
|
73073
73153
|
layer._setOptionsNoUpdate({
|
|
73074
73154
|
subdomains: urls
|
|
73075
73155
|
});
|
|
@@ -73358,9 +73438,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
73358
73438
|
Map.prototype._rebuildStyle = function (diff) {
|
|
73359
73439
|
if (diff === void 0) { diff = true; }
|
|
73360
73440
|
return __awaiter$5(this, void 0, void 0, function () {
|
|
73441
|
+
var _this = this;
|
|
73361
73442
|
return __generator$5(this, function (_a) {
|
|
73362
73443
|
this.styles.setStyle(this.styleOptions, diff);
|
|
73363
|
-
this.imageSprite._restoreImages();
|
|
73444
|
+
this.events.addOnce("stylechanged", function () { return _this.imageSprite._restoreImages(); });
|
|
73364
73445
|
return [2 /*return*/];
|
|
73365
73446
|
});
|
|
73366
73447
|
});
|
|
@@ -73590,7 +73671,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
73590
73671
|
}
|
|
73591
73672
|
return ar;
|
|
73592
73673
|
};
|
|
73593
|
-
var __spreadArray$
|
|
73674
|
+
var __spreadArray$c = (window && window.__spreadArray) || function (to, from) {
|
|
73594
73675
|
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
73595
73676
|
to[j] = from[i];
|
|
73596
73677
|
return to;
|
|
@@ -73736,7 +73817,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
73736
73817
|
lineLength = 50;
|
|
73737
73818
|
}
|
|
73738
73819
|
var lines = c.split(/<(tr|div|br|li|h[0-9]|p>)/);
|
|
73739
|
-
longestStringLength = Math.max.apply(Math, __spreadArray$
|
|
73820
|
+
longestStringLength = Math.max.apply(Math, __spreadArray$c([], __read$h((lines.map(function (el) { return el.replace(/<[a-zA-Z0-9\s=\/]+>/g, "").length; }))))) - 1;
|
|
73740
73821
|
var w = Math.ceil(longestStringLength * 3.5);
|
|
73741
73822
|
if (w < width) {
|
|
73742
73823
|
width = w;
|