azure-maps-control 2.2.7 → 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 +446 -224
- package/dist/atlas-core-bare.js +456 -234
- package/dist/atlas-core-bare.min.js +1 -1
- package/dist/atlas-core-snr.js +480 -401
- package/dist/atlas-core.js +490 -411
- package/dist/atlas-core.min.js +1 -1
- package/dist/atlas.css +6 -3
- package/dist/atlas.js +490 -411
- 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/dist/atlas-core-snr.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.
|
|
@@ -53648,19 +53505,24 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
53648
53505
|
* Get reference to Mapbox Map
|
|
53649
53506
|
* @internal
|
|
53650
53507
|
*/
|
|
53651
|
-
Source.prototype._setMap = function (map) {
|
|
53508
|
+
Source.prototype._setMap = function (map, shouldInvokeEvent) {
|
|
53509
|
+
if (shouldInvokeEvent === void 0) { shouldInvokeEvent = true; }
|
|
53652
53510
|
if (map == null || map === undefined) {
|
|
53653
53511
|
var temp = this.map;
|
|
53654
53512
|
delete this.map;
|
|
53655
|
-
|
|
53656
|
-
|
|
53657
|
-
temp
|
|
53513
|
+
if (shouldInvokeEvent) {
|
|
53514
|
+
this._invokeEvent("sourceremoved", this);
|
|
53515
|
+
if (temp) {
|
|
53516
|
+
temp.events.invoke("sourceremoved", this);
|
|
53517
|
+
}
|
|
53658
53518
|
}
|
|
53659
53519
|
}
|
|
53660
53520
|
else {
|
|
53661
53521
|
this.map = map;
|
|
53662
|
-
|
|
53663
|
-
|
|
53522
|
+
if (shouldInvokeEvent) {
|
|
53523
|
+
this._invokeEvent("sourceadded", this);
|
|
53524
|
+
this.map.events.invoke("sourceadded", this);
|
|
53525
|
+
}
|
|
53664
53526
|
}
|
|
53665
53527
|
};
|
|
53666
53528
|
return Source;
|
|
@@ -53981,6 +53843,27 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
53981
53843
|
}
|
|
53982
53844
|
return geoJsonSource;
|
|
53983
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
|
+
};
|
|
53984
53867
|
/**
|
|
53985
53868
|
* @internal
|
|
53986
53869
|
*/
|
|
@@ -54262,6 +54145,26 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
54262
54145
|
}
|
|
54263
54146
|
return vectorSource;
|
|
54264
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
|
+
};
|
|
54265
54168
|
return VectorTileSource;
|
|
54266
54169
|
}(Source));
|
|
54267
54170
|
|
|
@@ -54553,11 +54456,41 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
54553
54456
|
/**
|
|
54554
54457
|
* @internal
|
|
54555
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
|
+
* ```
|
|
54556
54485
|
*
|
|
54557
54486
|
* Note: We treat this as an internal option for now because we hadn't fully decided the default styling for the indicators.
|
|
54558
54487
|
* Once we decide, we will make this a public option or remove it.
|
|
54559
54488
|
*/
|
|
54560
54489
|
_this.createIndicators = false;
|
|
54490
|
+
/**
|
|
54491
|
+
* @internal
|
|
54492
|
+
*/
|
|
54493
|
+
_this.accessibilityIdKey = undefined;
|
|
54561
54494
|
return _this;
|
|
54562
54495
|
}
|
|
54563
54496
|
return BubbleLayerOptions;
|
|
@@ -54630,6 +54563,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
54630
54563
|
}
|
|
54631
54564
|
return ar;
|
|
54632
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
|
+
};
|
|
54633
54571
|
/**
|
|
54634
54572
|
* Renders Point objects as scalable circles (bubbles).
|
|
54635
54573
|
*/
|
|
@@ -54644,13 +54582,15 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
54644
54582
|
function BubbleLayer(source, id, options) {
|
|
54645
54583
|
var _this = _super.call(this, id) || this;
|
|
54646
54584
|
_this.accessibleIndicator = [];
|
|
54647
|
-
|
|
54648
|
-
|
|
54585
|
+
/** @internal */
|
|
54586
|
+
_this._setAccessibleIndicator = function () { return __awaiter$1(_this, void 0, void 0, function () {
|
|
54587
|
+
var renderedShapes, accessibilityIdKey, createIndicator, insertHiddenBefore, insertHiddenInFront, attach;
|
|
54649
54588
|
var _this = this;
|
|
54650
54589
|
return __generator$1(this, function (_a) {
|
|
54651
54590
|
this.accessibleIndicator.forEach(function (indicator) { return indicator.remove(); });
|
|
54652
54591
|
this.accessibleIndicator = [];
|
|
54653
54592
|
renderedShapes = this.map.layers.getRenderedShapes(this.map.getCamera().bounds, this);
|
|
54593
|
+
accessibilityIdKey = this.options.accessibilityIdKey || (this._getDataSource() ? Shape._shapeIdPropName : undefined);
|
|
54654
54594
|
createIndicator = function (renderedShapes, idx) {
|
|
54655
54595
|
var curRenderedShape = renderedShapes[idx];
|
|
54656
54596
|
var bubbleFeature = curRenderedShape instanceof Shape ? curRenderedShape.toJson() : curRenderedShape;
|
|
@@ -54674,9 +54614,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
54674
54614
|
if (idx == 0 && renderedShapes.length >= 2) {
|
|
54675
54615
|
attach(createIndicator(renderedShapes, renderedShapes.length - 1));
|
|
54676
54616
|
}
|
|
54677
|
-
|
|
54678
|
-
|
|
54679
|
-
_this.map._getMap().setPaintProperty(_this.id, 'circle-stroke-color', ['case', ['==', ['get', '_azureMapsShapeId'], bubbleFeature.id], '#000000', _this.options.strokeColor]);
|
|
54617
|
+
if (accessibilityIdKey !== undefined) {
|
|
54618
|
+
_this.map._getMap().setPaintProperty(_this.id, 'circle-stroke-color', ['case', ['==', ['get', accessibilityIdKey], bubbleFeature.properties[accessibilityIdKey]], '#000000', _this.options.strokeColor]);
|
|
54680
54619
|
}
|
|
54681
54620
|
var focusEvent = {
|
|
54682
54621
|
target: element,
|
|
@@ -54689,8 +54628,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
54689
54628
|
_this._invokeEvent('focusin', focusEvent);
|
|
54690
54629
|
});
|
|
54691
54630
|
element.addEventListener('focusout', function (event) {
|
|
54692
|
-
if (
|
|
54693
|
-
_this.map._getMap().setPaintProperty(_this.id, 'circle-stroke-color', ['case', ['==', ['get',
|
|
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]);
|
|
54694
54633
|
}
|
|
54695
54634
|
var focusEvent = {
|
|
54696
54635
|
target: element,
|
|
@@ -54777,19 +54716,72 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
54777
54716
|
this.options = newOptions;
|
|
54778
54717
|
};
|
|
54779
54718
|
BubbleLayer.prototype.onAdd = function (map) {
|
|
54719
|
+
var _this = this;
|
|
54780
54720
|
_super.prototype.onAdd.call(this, map);
|
|
54781
54721
|
if (this.options.createIndicators) {
|
|
54782
|
-
map
|
|
54783
|
-
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
|
+
}
|
|
54784
54750
|
}
|
|
54785
54751
|
};
|
|
54786
54752
|
BubbleLayer.prototype.onRemove = function () {
|
|
54787
54753
|
if (this.options.createIndicators) {
|
|
54788
|
-
this.map.events.remove('idle', this.
|
|
54789
|
-
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
|
+
}
|
|
54790
54763
|
}
|
|
54791
54764
|
_super.prototype.onRemove.call(this);
|
|
54792
54765
|
};
|
|
54766
|
+
BubbleLayer.prototype._getSourceDataEventCacheKey = function () {
|
|
54767
|
+
if (!this.map) {
|
|
54768
|
+
return undefined;
|
|
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;
|
|
54784
|
+
};
|
|
54793
54785
|
/**
|
|
54794
54786
|
* @internal
|
|
54795
54787
|
*/
|
|
@@ -55935,7 +55927,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
55935
55927
|
}
|
|
55936
55928
|
return ar;
|
|
55937
55929
|
};
|
|
55938
|
-
var __spreadArray = (window && window.__spreadArray) || function (to, from) {
|
|
55930
|
+
var __spreadArray$1 = (window && window.__spreadArray) || function (to, from) {
|
|
55939
55931
|
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
55940
55932
|
to[j] = from[i];
|
|
55941
55933
|
return to;
|
|
@@ -56010,7 +56002,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
56010
56002
|
finally { if (e_1) throw e_1.error; }
|
|
56011
56003
|
}
|
|
56012
56004
|
// Then execute the standard merge behavior.
|
|
56013
|
-
var merged = _super.prototype.merge.apply(this, __spreadArray([], __read$4(valueList)));
|
|
56005
|
+
var merged = _super.prototype.merge.apply(this, __spreadArray$1([], __read$4(valueList)));
|
|
56014
56006
|
if (isNewColorSet) {
|
|
56015
56007
|
merged.fillPattern = undefined;
|
|
56016
56008
|
}
|
|
@@ -58704,7 +58696,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
58704
58696
|
}
|
|
58705
58697
|
return ar;
|
|
58706
58698
|
};
|
|
58707
|
-
var __spreadArray$
|
|
58699
|
+
var __spreadArray$2 = (window && window.__spreadArray) || function (to, from) {
|
|
58708
58700
|
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
58709
58701
|
to[j] = from[i];
|
|
58710
58702
|
return to;
|
|
@@ -58841,7 +58833,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
58841
58833
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
58842
58834
|
valueList[_i] = arguments[_i];
|
|
58843
58835
|
}
|
|
58844
|
-
var merged = _super.prototype.merge.apply(this, __spreadArray$
|
|
58836
|
+
var merged = _super.prototype.merge.apply(this, __spreadArray$2([], __read$6(valueList)));
|
|
58845
58837
|
if (merged.authType === exports.AuthenticationType.subscriptionKey) {
|
|
58846
58838
|
merged.authContext = merged.aadAppId = merged.getToken = undefined;
|
|
58847
58839
|
}
|
|
@@ -59512,10 +59504,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
59512
59504
|
if (add) {
|
|
59513
59505
|
this.logoAnchor = document.createElement("a");
|
|
59514
59506
|
this.logoAnchor.className = "azure-map-logo";
|
|
59515
|
-
this.logoAnchor.href = "https://
|
|
59507
|
+
this.logoAnchor.href = "https://aka.ms/azuremaps";
|
|
59516
59508
|
this.logoAnchor.setAttribute("aria-label", "Microsoft");
|
|
59509
|
+
this.logoAnchor.setAttribute("target", "_blank");
|
|
59517
59510
|
this.container.appendChild(this.logoAnchor);
|
|
59518
|
-
this.logoTooltip = buildAccessibleTooltip("Visit microsoft.com");
|
|
59511
|
+
this.logoTooltip = buildAccessibleTooltip("Visit azure.microsoft.com");
|
|
59519
59512
|
this.container.appendChild(this.logoTooltip);
|
|
59520
59513
|
positionTooltip(this.logoTooltip, this.logoAnchor);
|
|
59521
59514
|
}
|
|
@@ -59592,7 +59585,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
59592
59585
|
}
|
|
59593
59586
|
return ar;
|
|
59594
59587
|
};
|
|
59595
|
-
var __spreadArray$
|
|
59588
|
+
var __spreadArray$3 = (window && window.__spreadArray) || function (to, from) {
|
|
59596
59589
|
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
59597
59590
|
to[j] = from[i];
|
|
59598
59591
|
return to;
|
|
@@ -61194,10 +61187,15 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
61194
61187
|
return ids;
|
|
61195
61188
|
};
|
|
61196
61189
|
FundamentalMapLayer.prototype._updateLayoutProperty = function (name, newValue, oldValue, subValue) {
|
|
61197
|
-
|
|
61190
|
+
if (isEqual_1(newValue, oldValue))
|
|
61191
|
+
return;
|
|
61192
|
+
var map = this.map._getMap();
|
|
61198
61193
|
this.layers.forEach(function (layer) {
|
|
61199
|
-
if (
|
|
61200
|
-
|
|
61194
|
+
if (map.getLayer(layer.id)) {
|
|
61195
|
+
map.setLayoutProperty(layer.id, name, subValue || newValue);
|
|
61196
|
+
}
|
|
61197
|
+
else {
|
|
61198
|
+
console.warn("Could not update layout property " + name + " for layer " + layer.id + " to " + (subValue || newValue));
|
|
61201
61199
|
}
|
|
61202
61200
|
});
|
|
61203
61201
|
};
|
|
@@ -61231,7 +61229,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
61231
61229
|
}
|
|
61232
61230
|
return ar;
|
|
61233
61231
|
};
|
|
61234
|
-
var __spreadArray$
|
|
61232
|
+
var __spreadArray$4 = (window && window.__spreadArray) || function (to, from) {
|
|
61235
61233
|
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
61236
61234
|
to[j] = from[i];
|
|
61237
61235
|
return to;
|
|
@@ -61292,10 +61290,12 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
61292
61290
|
// Place the new layer behind the specified before layer.
|
|
61293
61291
|
var layerIndex = this.layerIndex.findIndex(function (l) { return l.getId() === layer.getId(); });
|
|
61294
61292
|
var userLayerIndex = this.userLayers.findIndex(function (ul) { return ul.layer.getId() === layer.getId(); });
|
|
61295
|
-
var tempLayer = this.layerIndex[layerIndex];
|
|
61296
61293
|
this._removeMapboxLayers(layer);
|
|
61297
61294
|
this._addMapboxLayers(layer, before);
|
|
61298
|
-
this.
|
|
61295
|
+
var tempLayer = this.layerIndex[layerIndex];
|
|
61296
|
+
if (tempLayer) {
|
|
61297
|
+
this.map.events._disableLayerEvents(tempLayer);
|
|
61298
|
+
}
|
|
61299
61299
|
this.map.events._enableLayerEvents(layer);
|
|
61300
61300
|
this.layerIndex.splice(layerIndex, 1);
|
|
61301
61301
|
var beforeIndex = this.layerIndex.findIndex(function (l) { return l.getId() === before; });
|
|
@@ -61303,7 +61303,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
61303
61303
|
if (!(layer instanceof FundamentalMapLayer)) {
|
|
61304
61304
|
this.userLayers[userLayerIndex] = { layer: layer, before: before };
|
|
61305
61305
|
}
|
|
61306
|
-
tempLayer
|
|
61306
|
+
if (tempLayer) {
|
|
61307
|
+
tempLayer.onRemove();
|
|
61308
|
+
}
|
|
61307
61309
|
layer.onAdd(this.map);
|
|
61308
61310
|
}
|
|
61309
61311
|
else {
|
|
@@ -61669,7 +61671,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
61669
61671
|
// If a specified layer hasn't been added to the map throw an error.
|
|
61670
61672
|
var index = this_1.layerIndex.findIndex(function (l) { return l.getId() === layerId; });
|
|
61671
61673
|
if (index > -1) {
|
|
61672
|
-
layerIds.push.apply(layerIds, __spreadArray$
|
|
61674
|
+
layerIds.push.apply(layerIds, __spreadArray$4([], __read$9(this_1.layerIndex[index]._getLayerIds()
|
|
61673
61675
|
.filter(function (id) { return !!_this.map._getMap().getLayer(id); }))));
|
|
61674
61676
|
}
|
|
61675
61677
|
else {
|
|
@@ -61958,6 +61960,37 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
61958
61960
|
FundamentalMapSource.prototype._buildSource = function () {
|
|
61959
61961
|
return this.source;
|
|
61960
61962
|
};
|
|
61963
|
+
/**
|
|
61964
|
+
* @internal
|
|
61965
|
+
*/
|
|
61966
|
+
FundamentalMapSource.prototype._isDeepEqual = function (other) {
|
|
61967
|
+
if (this.constructor !== other.constructor) {
|
|
61968
|
+
return false;
|
|
61969
|
+
}
|
|
61970
|
+
var source = this.source;
|
|
61971
|
+
var otherSource = other.source;
|
|
61972
|
+
var baseEqual = source.type === otherSource.type &&
|
|
61973
|
+
source.url === otherSource.url
|
|
61974
|
+
&& ((source.tiles === undefined && otherSource.tiles === undefined) ||
|
|
61975
|
+
(source.tiles && otherSource.tiles && source.tiles.length === otherSource.tiles.length && source.tiles.every(function (value, idx) { return value === otherSource.tiles[idx]; })))
|
|
61976
|
+
&& source.minzoom === otherSource.minzoom
|
|
61977
|
+
&& source.maxzoom === otherSource.maxzoom
|
|
61978
|
+
&& source.bounds === otherSource.bounds
|
|
61979
|
+
&& source.attribution === otherSource.attribution;
|
|
61980
|
+
var rasterEqual = source.type !== "raster" || (source.type === "raster"
|
|
61981
|
+
&& source.type === otherSource.type
|
|
61982
|
+
&& source.tileSize === otherSource.tileSize
|
|
61983
|
+
&& source.scheme === otherSource.scheme);
|
|
61984
|
+
var rasterDemEqual = source.type !== "raster-dem" || (source.type === "raster-dem"
|
|
61985
|
+
&& source.type === otherSource.type
|
|
61986
|
+
&& source.tileSize === otherSource.tileSize
|
|
61987
|
+
&& source.encoding === otherSource.encoding);
|
|
61988
|
+
var vectorEqual = source.type !== "vector" || (source.type === "vector"
|
|
61989
|
+
&& source.type === otherSource.type
|
|
61990
|
+
&& source.promoteId === otherSource.promoteId
|
|
61991
|
+
&& source.scheme === otherSource.scheme);
|
|
61992
|
+
return baseEqual && rasterEqual && rasterDemEqual && vectorEqual;
|
|
61993
|
+
};
|
|
61961
61994
|
/**
|
|
61962
61995
|
* Updates the source info to convert the tiles to url strings.
|
|
61963
61996
|
* @param sourceDef The original source info.
|
|
@@ -62254,39 +62287,52 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
62254
62287
|
var _this = this;
|
|
62255
62288
|
if (sources) {
|
|
62256
62289
|
Object.keys(sources).forEach(function (sourceId) {
|
|
62290
|
+
var sourceToAdd = sources[sourceId];
|
|
62291
|
+
var newSource;
|
|
62292
|
+
if (sourceToAdd.type === "vector") {
|
|
62293
|
+
newSource = new FundamentalMapSource(sourceId, {
|
|
62294
|
+
name: sourceId,
|
|
62295
|
+
tiles: sourceToAdd.tiles,
|
|
62296
|
+
type: "vector",
|
|
62297
|
+
url: sourceToAdd.url
|
|
62298
|
+
});
|
|
62299
|
+
}
|
|
62300
|
+
else if (sourceToAdd.type === "raster") {
|
|
62301
|
+
newSource = new FundamentalMapSource(sourceId, {
|
|
62302
|
+
name: sourceId,
|
|
62303
|
+
tiles: sourceToAdd.tiles,
|
|
62304
|
+
type: "raster",
|
|
62305
|
+
url: sourceToAdd.url
|
|
62306
|
+
});
|
|
62307
|
+
}
|
|
62308
|
+
else {
|
|
62309
|
+
// Do not throw for the source of unknown type.
|
|
62310
|
+
// throw new Error(`Unable to construct source with ID ${sourceId}.`);
|
|
62311
|
+
// no other handling for the source we don't sync into the state here
|
|
62312
|
+
return;
|
|
62313
|
+
}
|
|
62257
62314
|
if (!_this.sources.has(sourceId)) {
|
|
62258
|
-
|
|
62259
|
-
|
|
62260
|
-
var newSource = new FundamentalMapSource(sourceId, {
|
|
62261
|
-
name: sourceId,
|
|
62262
|
-
tiles: sourceToAdd.tiles,
|
|
62263
|
-
type: "vector",
|
|
62264
|
-
url: sourceToAdd.url
|
|
62265
|
-
});
|
|
62266
|
-
_this.sources.set(sourceId, newSource);
|
|
62267
|
-
newSource._setMap(_this.map);
|
|
62268
|
-
}
|
|
62269
|
-
else if (sourceToAdd.type === "raster") {
|
|
62270
|
-
var newSource = new FundamentalMapSource(sourceId, {
|
|
62271
|
-
name: sourceId,
|
|
62272
|
-
tiles: sourceToAdd.tiles,
|
|
62273
|
-
type: "raster",
|
|
62274
|
-
url: sourceToAdd.url
|
|
62275
|
-
});
|
|
62276
|
-
_this.sources.set(sourceId, newSource);
|
|
62277
|
-
newSource._setMap(_this.map);
|
|
62278
|
-
}
|
|
62279
|
-
else {
|
|
62280
|
-
throw new Error("Unable to construct source with ID " + sourceId + ".");
|
|
62281
|
-
}
|
|
62315
|
+
_this.sources.set(sourceId, newSource);
|
|
62316
|
+
newSource._setMap(_this.map);
|
|
62282
62317
|
}
|
|
62283
|
-
|
|
62284
|
-
|
|
62285
|
-
|
|
62286
|
-
|
|
62287
|
-
_this.sources.delete(sourceId);
|
|
62318
|
+
else if (_this.sources.has(sourceId) && !_this.sources.get(sourceId)._isDeepEqual(newSource)) {
|
|
62319
|
+
// source with same id but different properties: update
|
|
62320
|
+
_this.sources.set(sourceId, newSource);
|
|
62321
|
+
newSource._setMap(_this.map, false);
|
|
62288
62322
|
}
|
|
62289
62323
|
});
|
|
62324
|
+
// counter-intuitive: below is a bug and will do nothing since Object.keys(this.sources) will always return [], it should rather be:
|
|
62325
|
+
// Array.from(this.sources.keys()).forEach(sourceId => {
|
|
62326
|
+
// 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
|
|
62327
|
+
// such removal will cause the exception, since the source would already be removed
|
|
62328
|
+
//
|
|
62329
|
+
// 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
|
|
62330
|
+
// Object.keys(this.sources).forEach(sourceId => {
|
|
62331
|
+
// if (!sources.hasOwnProperty(sourceId)) {
|
|
62332
|
+
// this.sources.get(sourceId)._setMap(null);
|
|
62333
|
+
// this.sources.delete(sourceId);
|
|
62334
|
+
// }
|
|
62335
|
+
// });
|
|
62290
62336
|
}
|
|
62291
62337
|
};
|
|
62292
62338
|
return SourceManager;
|
|
@@ -62428,7 +62474,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
62428
62474
|
}
|
|
62429
62475
|
return ar;
|
|
62430
62476
|
};
|
|
62431
|
-
var __spreadArray$
|
|
62477
|
+
var __spreadArray$5 = (window && window.__spreadArray) || function (to, from) {
|
|
62432
62478
|
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
62433
62479
|
to[j] = from[i];
|
|
62434
62480
|
return to;
|
|
@@ -62503,7 +62549,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
62503
62549
|
}
|
|
62504
62550
|
finally { if (e_1) throw e_1.error; }
|
|
62505
62551
|
}
|
|
62506
|
-
return _super.prototype.merge.apply(this, __spreadArray$
|
|
62552
|
+
return _super.prototype.merge.apply(this, __spreadArray$5([], __read$a(valuesList)));
|
|
62507
62553
|
};
|
|
62508
62554
|
return CameraBoundsOptions;
|
|
62509
62555
|
}(Options));
|
|
@@ -62992,7 +63038,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
62992
63038
|
}
|
|
62993
63039
|
return ar;
|
|
62994
63040
|
};
|
|
62995
|
-
var __spreadArray$
|
|
63041
|
+
var __spreadArray$6 = (window && window.__spreadArray) || function (to, from) {
|
|
62996
63042
|
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
62997
63043
|
to[j] = from[i];
|
|
62998
63044
|
return to;
|
|
@@ -63112,6 +63158,13 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
63112
63158
|
* @deprecated use `view` instead.
|
|
63113
63159
|
*/
|
|
63114
63160
|
_this.userRegion = _this.view;
|
|
63161
|
+
/**
|
|
63162
|
+
* allows substituting a default MapControl's style transformer with custom one
|
|
63163
|
+
* 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
|
|
63164
|
+
* and move additional layers over
|
|
63165
|
+
* @internal
|
|
63166
|
+
*/
|
|
63167
|
+
_this.customStyleTransform = undefined;
|
|
63115
63168
|
return _this;
|
|
63116
63169
|
}
|
|
63117
63170
|
/**
|
|
@@ -63151,7 +63204,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
63151
63204
|
finally { if (e_1) throw e_1.error; }
|
|
63152
63205
|
}
|
|
63153
63206
|
// Then execute the standard merge behavior.
|
|
63154
|
-
return _super.prototype.merge.apply(this, __spreadArray$
|
|
63207
|
+
return _super.prototype.merge.apply(this, __spreadArray$6([], __read$b(valueList)));
|
|
63155
63208
|
};
|
|
63156
63209
|
return StyleOptions;
|
|
63157
63210
|
}(Options));
|
|
@@ -63209,7 +63262,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
63209
63262
|
}
|
|
63210
63263
|
return ar;
|
|
63211
63264
|
};
|
|
63212
|
-
var __spreadArray$
|
|
63265
|
+
var __spreadArray$7 = (window && window.__spreadArray) || function (to, from) {
|
|
63213
63266
|
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
63214
63267
|
to[j] = from[i];
|
|
63215
63268
|
return to;
|
|
@@ -63444,10 +63497,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
63444
63497
|
// won't change default behavior in Options as usually that's what desired
|
|
63445
63498
|
// instead capture it here and reassign.
|
|
63446
63499
|
var currentTransforms = this._transformers;
|
|
63447
|
-
var transformersToMerge = valueList ? valueList.filter(function (value) { return value !== undefined; }).reduce(function (flattened, value) { return __spreadArray$
|
|
63500
|
+
var transformersToMerge = valueList ? valueList.filter(function (value) { return value !== undefined; }).reduce(function (flattened, value) { return __spreadArray$7(__spreadArray$7([], __read$c(flattened)), __read$c(value._transformers || [])); }, []) : [];
|
|
63448
63501
|
// Then execute the standard merge behavior.
|
|
63449
63502
|
// If subscription key auth method isn't being used then the subscription key property should be undefined.
|
|
63450
|
-
var merged = _super.prototype.merge.apply(this, __spreadArray$
|
|
63503
|
+
var merged = _super.prototype.merge.apply(this, __spreadArray$7([], __read$c(valueList)));
|
|
63451
63504
|
if (merged.authOptions.authType !== exports.AuthenticationType.subscriptionKey) {
|
|
63452
63505
|
merged["subscription-key"] = merged.subscriptionKey = undefined;
|
|
63453
63506
|
}
|
|
@@ -63459,7 +63512,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
63459
63512
|
if (merged.mapConfiguration && typeof merged.mapConfiguration !== 'string') {
|
|
63460
63513
|
merged.mapConfiguration = __assign$7(__assign$7({}, merged.mapConfiguration), { defaultConfiguration: merged.mapConfiguration.defaultConfiguration || merged.mapConfiguration['defaultStyle'], configurations: merged.mapConfiguration.configurations || merged.mapConfiguration['styles'] });
|
|
63461
63514
|
}
|
|
63462
|
-
this._transformers = __spreadArray$
|
|
63515
|
+
this._transformers = __spreadArray$7(__spreadArray$7([], __read$c(currentTransforms || [])), __read$c(transformersToMerge.filter(function (toMerge) { return !currentTransforms.includes(toMerge); })));
|
|
63463
63516
|
if (this.transformRequest && !this._transformers.includes(this.transformRequest)) {
|
|
63464
63517
|
this._transformers.push(this.transformRequest);
|
|
63465
63518
|
}
|
|
@@ -63707,7 +63760,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
63707
63760
|
}
|
|
63708
63761
|
return ar;
|
|
63709
63762
|
};
|
|
63710
|
-
var __spreadArray$
|
|
63763
|
+
var __spreadArray$8 = (window && window.__spreadArray) || function (to, from) {
|
|
63711
63764
|
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
63712
63765
|
to[j] = from[i];
|
|
63713
63766
|
return to;
|
|
@@ -63760,7 +63813,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
63760
63813
|
var deferredLayers = Object.entries(layerGroupLayers).reduce(function (deferred, _a) {
|
|
63761
63814
|
var _b = __read$d(_a, 2), groupName = _b[0], layers = _b[1];
|
|
63762
63815
|
var isInInitialLayerGroup = validInitLayerGroups.includes(groupName);
|
|
63763
|
-
return __spreadArray$
|
|
63816
|
+
return __spreadArray$8(__spreadArray$8([], __read$d(deferred)), __read$d(layers.filter(function (layer) {
|
|
63764
63817
|
var _a;
|
|
63765
63818
|
// Exclude custom layers
|
|
63766
63819
|
if (layer.type === 'custom')
|
|
@@ -63812,13 +63865,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
63812
63865
|
};
|
|
63813
63866
|
_this.map.events.addOnce('load', _this._progressiveLoadingState.pendingVisibilityChange);
|
|
63814
63867
|
};
|
|
63815
|
-
this._onStyleData = function () {
|
|
63816
|
-
_this.
|
|
63817
|
-
|
|
63818
|
-
|
|
63819
|
-
|
|
63820
|
-
type: "stylechanged"
|
|
63821
|
-
});
|
|
63868
|
+
this._onStyleData = function (definition) {
|
|
63869
|
+
_this.map.events.invoke("stylechanged", {
|
|
63870
|
+
style: definition.name,
|
|
63871
|
+
map: _this.map,
|
|
63872
|
+
type: "stylechanged"
|
|
63822
63873
|
});
|
|
63823
63874
|
};
|
|
63824
63875
|
/**
|
|
@@ -64002,23 +64053,183 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
64002
64053
|
if (styleDefinition.style) {
|
|
64003
64054
|
return styleDefinition.style;
|
|
64004
64055
|
}
|
|
64005
|
-
throw Error("Style definition
|
|
64056
|
+
throw Error("Style definition neither contains URL nor style object.");
|
|
64057
|
+
};
|
|
64058
|
+
StyleManager.prototype.deriveNewStyleAndLayerGroups = function (previousStyle, nextStyle) {
|
|
64059
|
+
var _a, _b, _c, _d, _e, _f;
|
|
64060
|
+
// Layers in the next style with default properties that do not align with current StyleOptions
|
|
64061
|
+
// should be modified before they are applied to the map.
|
|
64062
|
+
var styleOptions = this.map.getStyle();
|
|
64063
|
+
var trafficOptions = this.map.getTraffic();
|
|
64064
|
+
var layersGroups = {};
|
|
64065
|
+
for (var i = 0; i < nextStyle.layers.length; i++) {
|
|
64066
|
+
var nextLayer = nextStyle.layers[i];
|
|
64067
|
+
var layerGroup = LayerGroupComparator.getLayerGroup(nextLayer);
|
|
64068
|
+
if (!layerGroup) {
|
|
64069
|
+
layersGroups[nextLayer.id] = [nextLayer];
|
|
64070
|
+
continue;
|
|
64071
|
+
}
|
|
64072
|
+
if (!layersGroups[layerGroup]) {
|
|
64073
|
+
layersGroups[layerGroup] = [];
|
|
64074
|
+
}
|
|
64075
|
+
var layerGroupLayers = layersGroups[layerGroup];
|
|
64076
|
+
layerGroupLayers.push(nextLayer);
|
|
64077
|
+
// 1. Set visiblity of fill-extrusion layers according to StyleOptions.showBuildingModels
|
|
64078
|
+
if (!styleOptions.showBuildingModels && nextLayer.type === "fill-extrusion") {
|
|
64079
|
+
nextLayer.layout = (_a = nextLayer.layout) !== null && _a !== void 0 ? _a : {};
|
|
64080
|
+
nextLayer.layout.visibility = "none";
|
|
64081
|
+
}
|
|
64082
|
+
else if (nextLayer.type === "fill-extrusion") {
|
|
64083
|
+
nextLayer.layout = (_b = nextLayer.layout) !== null && _b !== void 0 ? _b : {};
|
|
64084
|
+
nextLayer.layout.visibility = "visible";
|
|
64085
|
+
}
|
|
64086
|
+
// 2. Set visibility of traffic layers depending on traffic settings.
|
|
64087
|
+
if (trafficOptions.flow !== "none" && layerGroup) {
|
|
64088
|
+
if (layerGroup === "traffic_" + trafficOptions.flow && nextLayer.type == "line") {
|
|
64089
|
+
nextLayer.layout = (_c = nextLayer.layout) !== null && _c !== void 0 ? _c : {};
|
|
64090
|
+
nextLayer.layout.visibility = "visible";
|
|
64091
|
+
}
|
|
64092
|
+
}
|
|
64093
|
+
// 3. Set visibility of labels
|
|
64094
|
+
var isLabelLayerGroup = layerGroup === 'labels' || layerGroup === 'labels_places' || layerGroup === 'labels_indoor';
|
|
64095
|
+
if (isLabelLayerGroup && nextLayer.type === 'symbol') {
|
|
64096
|
+
if (styleOptions.showLabels && ((_d = nextLayer.layout) === null || _d === void 0 ? void 0 : _d.visibility) !== "none") {
|
|
64097
|
+
nextLayer.layout = (_e = nextLayer.layout) !== null && _e !== void 0 ? _e : {};
|
|
64098
|
+
nextLayer.layout.visibility = "visible";
|
|
64099
|
+
}
|
|
64100
|
+
else {
|
|
64101
|
+
nextLayer.layout = (_f = nextLayer.layout) !== null && _f !== void 0 ? _f : {};
|
|
64102
|
+
nextLayer.layout.visibility = "none";
|
|
64103
|
+
}
|
|
64104
|
+
}
|
|
64105
|
+
}
|
|
64106
|
+
return [nextStyle, layersGroups];
|
|
64107
|
+
};
|
|
64108
|
+
StyleManager.prototype.injectUserLayersIntoStyle = function (previousStyle, nextStyle, layerGroupLayers) {
|
|
64109
|
+
// Custom layers added to mapbox through this SDK should be carried over to the next style.
|
|
64110
|
+
return !previousStyle
|
|
64111
|
+
? nextStyle
|
|
64112
|
+
: this.map.layers._getUserLayers().reduce(function (style, userLayer) {
|
|
64113
|
+
if (userLayer.layer instanceof WebGLLayer) {
|
|
64114
|
+
// mapbox custom layers cannot be serialized and preserved,
|
|
64115
|
+
// return to continue to the next user layer.
|
|
64116
|
+
return style;
|
|
64117
|
+
}
|
|
64118
|
+
var before = layerGroupLayers[userLayer.before] && layerGroupLayers[userLayer.before].length > 0
|
|
64119
|
+
? layerGroupLayers[userLayer.before][0]
|
|
64120
|
+
: undefined;
|
|
64121
|
+
var layer = previousStyle.layers.find(function (layer) { return layer.id === userLayer.layer.getId(); });
|
|
64122
|
+
// when setStyle diff attempt is unsuccesful, _load will be called on the style that may have already injected user layers -> clean it up
|
|
64123
|
+
var existingLayerIdx = nextStyle.layers.findIndex(function (layer) { return layer.id === userLayer.layer.getId(); });
|
|
64124
|
+
if (existingLayerIdx > -1) {
|
|
64125
|
+
nextStyle.layers.splice(existingLayerIdx, 1);
|
|
64126
|
+
}
|
|
64127
|
+
if (layer) {
|
|
64128
|
+
var sourcesToCopy = new Set(Array.from(userLayer.layer._getSourceIds())
|
|
64129
|
+
.map(function (sourceId) { return previousStyle.sources[sourceId] ? { source: previousStyle.sources[sourceId], id: sourceId } : undefined; })
|
|
64130
|
+
.filter(function (source) { return source !== undefined; }));
|
|
64131
|
+
var insertIdx = before ? style.layers.findIndex(function (layer) { return layer.id === before.id; }) : -1;
|
|
64132
|
+
if (insertIdx > -1) {
|
|
64133
|
+
style.layers.splice(insertIdx, 0, layer);
|
|
64134
|
+
}
|
|
64135
|
+
else {
|
|
64136
|
+
style.layers.push(layer);
|
|
64137
|
+
}
|
|
64138
|
+
sourcesToCopy.forEach(function (_a) {
|
|
64139
|
+
var source = _a.source, id = _a.id;
|
|
64140
|
+
style.sources[id] = source;
|
|
64141
|
+
});
|
|
64142
|
+
}
|
|
64143
|
+
return style;
|
|
64144
|
+
}, __assign$8({}, nextStyle));
|
|
64006
64145
|
};
|
|
64007
64146
|
/**
|
|
64008
64147
|
* @internal
|
|
64009
64148
|
*/
|
|
64010
64149
|
StyleManager.prototype.setStyle = function (styleOptions, diff) {
|
|
64150
|
+
var _this = this;
|
|
64011
64151
|
if (diff === void 0) { diff = true; }
|
|
64012
|
-
|
|
64013
|
-
|
|
64014
|
-
|
|
64015
|
-
|
|
64016
|
-
|
|
64017
|
-
|
|
64152
|
+
var transformStyleFunc;
|
|
64153
|
+
var targetDefinition = this._lookUp(styleOptions);
|
|
64154
|
+
if (!targetDefinition) {
|
|
64155
|
+
throw Error("Style definition " + styleOptions.style + " is not available.");
|
|
64156
|
+
}
|
|
64157
|
+
if (!targetDefinition.url && !targetDefinition.style) {
|
|
64158
|
+
throw Error("Style definition neither contains URL nor style object.");
|
|
64159
|
+
}
|
|
64160
|
+
var styleDataCallback = function () { return _this._onStyleData(targetDefinition); };
|
|
64161
|
+
var patchStyleEvent = function () {
|
|
64162
|
+
// FIXME: below diffing will be soon fixed on the maplibre side
|
|
64163
|
+
// If there was a previous styledata change event attached, remove it.
|
|
64164
|
+
// When the sprite url changes between style changes then maplibre can't perform the diff
|
|
64165
|
+
// In such cases it recalculate the style again. Removing previous attached
|
|
64166
|
+
// event listener makes sure that style changed event is not fired twice in these cases.
|
|
64167
|
+
_this.map.events.remove("styledata", styleDataCallback);
|
|
64168
|
+
_this.map.events.addOnce("styledata", styleDataCallback);
|
|
64169
|
+
};
|
|
64170
|
+
if (styleOptions && styleOptions.customStyleTransform) {
|
|
64171
|
+
transformStyleFunc = function (prev, next) {
|
|
64172
|
+
var target = styleOptions.customStyleTransform(prev, next);
|
|
64173
|
+
patchStyleEvent();
|
|
64174
|
+
return target;
|
|
64175
|
+
};
|
|
64018
64176
|
}
|
|
64019
|
-
|
|
64020
|
-
|
|
64177
|
+
else {
|
|
64178
|
+
transformStyleFunc = function (previousStyle, style) {
|
|
64179
|
+
// make sure we always have a shallow clone to prevent mutating explicit json(rather then url) styles being set
|
|
64180
|
+
var nextStyle = __assign$8(__assign$8({}, style), { layers: __spreadArray$8([], __read$d(style.layers)), sources: __assign$8({}, style.sources) });
|
|
64181
|
+
var shouldProgressiveLoading = (styleOptions.progressiveLoading &&
|
|
64182
|
+
// The feature only effective at the initial load.
|
|
64183
|
+
!_this.map._isLoaded());
|
|
64184
|
+
// Shallow-clone the style object and duplicate layer.layout properties to avoid side-effects.
|
|
64185
|
+
if (shouldProgressiveLoading && Array.isArray(style === null || style === void 0 ? void 0 : style.layers)) {
|
|
64186
|
+
nextStyle = __assign$8({}, style);
|
|
64187
|
+
nextStyle.layers = nextStyle.layers.map(function (layer) {
|
|
64188
|
+
var nextLayer = __assign$8({}, layer);
|
|
64189
|
+
if (layer.layout) {
|
|
64190
|
+
nextLayer.layout = __assign$8({}, layer.layout);
|
|
64191
|
+
}
|
|
64192
|
+
return nextLayer;
|
|
64193
|
+
});
|
|
64194
|
+
}
|
|
64195
|
+
// 1. derive the base new style (without user layers) and layer groups
|
|
64196
|
+
var _a = __read$d(_this.deriveNewStyleAndLayerGroups(previousStyle, nextStyle), 2), targetStyle = _a[0], layerGroupLayers = _a[1];
|
|
64197
|
+
// 2. side effect: progressively render map layers to the canvas to shorten the time to the first meaningful render.
|
|
64198
|
+
if (shouldProgressiveLoading) {
|
|
64199
|
+
var initLayerGroups = styleOptions.progressiveLoadingInitialLayerGroups;
|
|
64200
|
+
if (Array.isArray(initLayerGroups) && initLayerGroups.length > 0) {
|
|
64201
|
+
_this._deferLayerGroupVisibilities(layerGroupLayers, initLayerGroups);
|
|
64202
|
+
}
|
|
64203
|
+
}
|
|
64204
|
+
// 3. copy user layers and sources from previous style into new one
|
|
64205
|
+
var targetStyleWithUserLayers = _this.injectUserLayersIntoStyle(previousStyle, targetStyle, layerGroupLayers);
|
|
64206
|
+
// 4. side effects: sync our control's LayerManager and SourceManager
|
|
64207
|
+
var nextFundamentalLayers = Object.entries(layerGroupLayers).map(function (_a) {
|
|
64208
|
+
var _b = __read$d(_a, 2), layerGroupId = _b[0], layers = _b[1];
|
|
64209
|
+
return _this._buildFundamentalLayerFrom(layers, layerGroupId);
|
|
64210
|
+
});
|
|
64211
|
+
var layerIndex = _this.map.layers._getUserLayers().reduce(function (layerIndex, userLayer) {
|
|
64212
|
+
var layerInsertIndex = userLayer.before ? layerIndex.findIndex(function (layer) { return layer.getId() === userLayer.before; }) : -1;
|
|
64213
|
+
if (layerInsertIndex > -1) {
|
|
64214
|
+
layerIndex.splice(layerInsertIndex, 0, userLayer.layer);
|
|
64215
|
+
}
|
|
64216
|
+
else {
|
|
64217
|
+
layerIndex.push(userLayer.layer);
|
|
64218
|
+
}
|
|
64219
|
+
return layerIndex;
|
|
64220
|
+
}, nextFundamentalLayers);
|
|
64221
|
+
_this.map.layers['layerIndex'] = layerIndex;
|
|
64222
|
+
_this.map.sources._syncSources(targetStyleWithUserLayers.sources);
|
|
64223
|
+
// 5. temporarily patch style data event
|
|
64224
|
+
patchStyleEvent();
|
|
64225
|
+
return targetStyleWithUserLayers;
|
|
64226
|
+
};
|
|
64021
64227
|
}
|
|
64228
|
+
this.map._getMap().setStyle(targetDefinition.url || targetDefinition.style, {
|
|
64229
|
+
diff: diff,
|
|
64230
|
+
validate: this.serviceOptions.validateStyle,
|
|
64231
|
+
transformStyle: transformStyleFunc
|
|
64232
|
+
});
|
|
64022
64233
|
};
|
|
64023
64234
|
/**
|
|
64024
64235
|
* Gets the color theme (light/dark) for the style type specified by the style options.
|
|
@@ -64083,138 +64294,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
64083
64294
|
StyleManager.prototype.clearStyleSet = function () {
|
|
64084
64295
|
this.unsetIndoorState();
|
|
64085
64296
|
};
|
|
64086
|
-
/**
|
|
64087
|
-
* Function invoked by mapbox after a style is fetched but before it is committed to the map state.
|
|
64088
|
-
*
|
|
64089
|
-
* @param previousStyle The current style.
|
|
64090
|
-
* @param nextStyle The next style which is to be applied.
|
|
64091
|
-
* @param preserveLayer Preserve a layer from the previous style in the next style.
|
|
64092
|
-
* @param updatePaintProperty Modify paint properties of a layer in the next style before the style is applied.
|
|
64093
|
-
* @param updateLayoutProperty Modify layout properties of a layer in the next style before the style is applied.
|
|
64094
|
-
* @param updateFilter Modify filter property of a layer in the next style before the style is applied.
|
|
64095
|
-
*/
|
|
64096
|
-
StyleManager.prototype._stylePatch = function (previousStyle, nextStyle, preserveLayer, updatePaintProperty, updateLayoutProperty, updateFilter) {
|
|
64097
|
-
var _this = this;
|
|
64098
|
-
// Skip the style patch if the map has been disposed.
|
|
64099
|
-
if (this.map.isDisposed)
|
|
64100
|
-
return;
|
|
64101
|
-
// Layers in the next style with default properties that do not align with current StyleOptions
|
|
64102
|
-
// should be modified before they are applied to the map.
|
|
64103
|
-
var styleOptions = this.map.getStyle();
|
|
64104
|
-
var trafficOptions = this.map.getTraffic();
|
|
64105
|
-
var shouldProgressiveLoading = (styleOptions.progressiveLoading &&
|
|
64106
|
-
// The feature only effective at the initial load.
|
|
64107
|
-
!this.map._isLoaded());
|
|
64108
|
-
var setLayerVisibility = function (layer, visibility) {
|
|
64109
|
-
var _a;
|
|
64110
|
-
if (!shouldProgressiveLoading) {
|
|
64111
|
-
// No need to apply the visibility change to maplibre while progressive loading is enabled.
|
|
64112
|
-
// This can save a lot of CPU time.
|
|
64113
|
-
updateLayoutProperty(layer.id, 'visibility', visibility);
|
|
64114
|
-
}
|
|
64115
|
-
layer.layout = (_a = layer.layout) !== null && _a !== void 0 ? _a : {};
|
|
64116
|
-
layer.layout.visibility = visibility;
|
|
64117
|
-
};
|
|
64118
|
-
var layerGroupLayers = {};
|
|
64119
|
-
nextStyle.layers.forEach(function (nextLayer) {
|
|
64120
|
-
var _a;
|
|
64121
|
-
var layerGroup = LayerGroupComparator.getLayerGroup(nextLayer);
|
|
64122
|
-
if (layerGroup) {
|
|
64123
|
-
// Set visibility of fill-extrusion layers according to StyleOptions.showBuildingModels
|
|
64124
|
-
if (nextLayer.type === 'fill-extrusion') {
|
|
64125
|
-
setLayerVisibility(nextLayer, styleOptions.showBuildingModels ? 'visible' : 'none');
|
|
64126
|
-
}
|
|
64127
|
-
// Set visibility of traffic layers depending on traffic settings.
|
|
64128
|
-
if (trafficOptions.flow !== 'none' && nextLayer.type == 'line' &&
|
|
64129
|
-
(layerGroup === "traffic_" + trafficOptions.flow ||
|
|
64130
|
-
// Check if deprecated flow types are used and the layer is a bing-traffic layer.
|
|
64131
|
-
// Needed for backwards compatibility in Bing styles to support deprecated flow types.
|
|
64132
|
-
(['absolute', 'relative-delay'].includes(trafficOptions.flow) && nextLayer['source'] === "bing-traffic"))) {
|
|
64133
|
-
setLayerVisibility(nextLayer, 'visible');
|
|
64134
|
-
}
|
|
64135
|
-
// Set visibility of labels
|
|
64136
|
-
var isLabelLayerGroup = layerGroup === 'labels' || layerGroup === 'labels_places' || layerGroup === 'labels_indoor';
|
|
64137
|
-
if (isLabelLayerGroup && nextLayer.type === 'symbol') {
|
|
64138
|
-
var isLayerVisible = ((_a = nextLayer.layout) === null || _a === void 0 ? void 0 : _a.visibility) !== 'none';
|
|
64139
|
-
setLayerVisibility(nextLayer, isLayerVisible && styleOptions.showLabels ? 'visible' : 'none');
|
|
64140
|
-
}
|
|
64141
|
-
// Once this _stylePatch returns control to maplibre the next style will be applied immediately in the same context.
|
|
64142
|
-
// To avoid potential data races update LayerManager with new a new set of FundamentalMapLayers from here instead of
|
|
64143
|
-
// waiting for a styledata.load event to trigger a sync in a different context.
|
|
64144
|
-
if (layerGroupLayers[layerGroup]) {
|
|
64145
|
-
layerGroupLayers[layerGroup].push(nextLayer);
|
|
64146
|
-
}
|
|
64147
|
-
else {
|
|
64148
|
-
layerGroupLayers[layerGroup] = [nextLayer];
|
|
64149
|
-
}
|
|
64150
|
-
}
|
|
64151
|
-
});
|
|
64152
|
-
if (shouldProgressiveLoading) {
|
|
64153
|
-
var initLayerGroups = styleOptions.progressiveLoadingInitialLayerGroups;
|
|
64154
|
-
if (Array.isArray(initLayerGroups) && initLayerGroups.length > 0) {
|
|
64155
|
-
this._deferLayerGroupVisibilities(layerGroupLayers, initLayerGroups);
|
|
64156
|
-
}
|
|
64157
|
-
}
|
|
64158
|
-
// A FundamentalMapLayer (grouped layer) representation of the next style must be built.
|
|
64159
|
-
var previousLayers = this.map.layers.getLayers();
|
|
64160
|
-
var nextLayers = Object.entries(layerGroupLayers).map(function (_a) {
|
|
64161
|
-
var _b = __read$d(_a, 2), layerGroupName = _b[0], layerGroupMapboxLayers = _b[1];
|
|
64162
|
-
return _this._buildFundamentalLayerFrom(layerGroupMapboxLayers, layerGroupName);
|
|
64163
|
-
});
|
|
64164
|
-
// Update FundamentalMapLayers in LayerManager
|
|
64165
|
-
var userLayers = this.map.layers._getUserLayers();
|
|
64166
|
-
var layersToRemove = previousLayers.filter(function (c) {
|
|
64167
|
-
return (nextLayers.findIndex(function (n) { return c.getId() === n.getId(); }) < 0 &&
|
|
64168
|
-
userLayers.findIndex(function (n) { return c.getId() === n.layer.getId(); }) < 0);
|
|
64169
|
-
});
|
|
64170
|
-
var prevNextIntersection = nextLayers.filter(function (n) { return previousLayers.find(function (c) { return c.getId() === n.getId(); }); });
|
|
64171
|
-
var ePrevNextIntersection = prevNextIntersection.entries();
|
|
64172
|
-
var replace = ePrevNextIntersection.next();
|
|
64173
|
-
nextLayers.forEach(function (newFundamentalLayer) {
|
|
64174
|
-
if (replace.value && replace.value[1].getId() === newFundamentalLayer.getId()) {
|
|
64175
|
-
// Replace the existing layer with this ID with the new one.
|
|
64176
|
-
var insertBefore = previousLayers.findIndex(function (l) { return l.getId() === newFundamentalLayer.getId(); });
|
|
64177
|
-
_this.map.layers.remove(newFundamentalLayer.getId());
|
|
64178
|
-
_this.map.layers.add(newFundamentalLayer, previousLayers[insertBefore].getId());
|
|
64179
|
-
replace = ePrevNextIntersection.next();
|
|
64180
|
-
}
|
|
64181
|
-
else {
|
|
64182
|
-
if (replace.value) {
|
|
64183
|
-
// Insert new layer before the next common layer.
|
|
64184
|
-
_this.map.layers.add(newFundamentalLayer, replace.value[1]);
|
|
64185
|
-
}
|
|
64186
|
-
else {
|
|
64187
|
-
_this.map.layers.add(newFundamentalLayer);
|
|
64188
|
-
}
|
|
64189
|
-
}
|
|
64190
|
-
});
|
|
64191
|
-
layersToRemove.forEach(function (layer) {
|
|
64192
|
-
_this.map.layers.remove(layer);
|
|
64193
|
-
});
|
|
64194
|
-
// Layers added to mapbox through this SDK since loading the last style should be
|
|
64195
|
-
// carried over to the next style.
|
|
64196
|
-
userLayers.forEach(function (userLayer) {
|
|
64197
|
-
if (userLayer.layer instanceof WebGLLayer) {
|
|
64198
|
-
// mapbox custom layers cannot be serialized and preserved,
|
|
64199
|
-
// return to continue to the next user layer.
|
|
64200
|
-
return;
|
|
64201
|
-
}
|
|
64202
|
-
var before = undefined;
|
|
64203
|
-
if (_this.map.layers.getLayerById(userLayer.before)) {
|
|
64204
|
-
var beforeCandidates = _this.map.layers.getLayerById(userLayer.before)._buildLayers();
|
|
64205
|
-
before = (beforeCandidates.length > 0) ? beforeCandidates[0] : undefined;
|
|
64206
|
-
}
|
|
64207
|
-
preserveLayer(userLayer.layer.getId(), before === null || before === void 0 ? void 0 : before.id);
|
|
64208
|
-
_this.map.layers.move(userLayer.layer.getId(), userLayer.before);
|
|
64209
|
-
});
|
|
64210
|
-
this.map.sources._syncSources(nextStyle.sources);
|
|
64211
|
-
// If there was a previous styledata change event attached, remove it.
|
|
64212
|
-
// When the sprite url changes between style changes then mapbox can't perform the diff
|
|
64213
|
-
// In such cases it recalculate the style again. Removing previous attached
|
|
64214
|
-
// event listener makes sure that style changed event is not fired twice in these cases.
|
|
64215
|
-
this.map.events.remove("styledata", this._onStyleData);
|
|
64216
|
-
this.map.events.addOnce("styledata", this._onStyleData);
|
|
64217
|
-
};
|
|
64218
64297
|
StyleManager.prototype._buildFundamentalLayerFrom = function (layers, id) {
|
|
64219
64298
|
if (layers && layers.length > 0) {
|
|
64220
64299
|
var newLayer = new FundamentalMapLayer(layers, id);
|
|
@@ -64518,7 +64597,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
64518
64597
|
}
|
|
64519
64598
|
return ar;
|
|
64520
64599
|
};
|
|
64521
|
-
var __spreadArray$
|
|
64600
|
+
var __spreadArray$9 = (window && window.__spreadArray) || function (to, from) {
|
|
64522
64601
|
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
64523
64602
|
to[j] = from[i];
|
|
64524
64603
|
return to;
|
|
@@ -65344,7 +65423,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
65344
65423
|
urls = layer.getOptions().subdomains || [];
|
|
65345
65424
|
}
|
|
65346
65425
|
// Add the tile urls to the layer, but don't update the map yet.
|
|
65347
|
-
urls.push.apply(urls, __spreadArray$
|
|
65426
|
+
urls.push.apply(urls, __spreadArray$9([], __read$e(tileSources)));
|
|
65348
65427
|
layer._setOptionsNoUpdate({
|
|
65349
65428
|
subdomains: urls
|
|
65350
65429
|
});
|
|
@@ -65865,7 +65944,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
65865
65944
|
}
|
|
65866
65945
|
return ar;
|
|
65867
65946
|
};
|
|
65868
|
-
var __spreadArray$
|
|
65947
|
+
var __spreadArray$a = (window && window.__spreadArray) || function (to, from) {
|
|
65869
65948
|
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
65870
65949
|
to[j] = from[i];
|
|
65871
65950
|
return to;
|
|
@@ -66011,7 +66090,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
66011
66090
|
lineLength = 50;
|
|
66012
66091
|
}
|
|
66013
66092
|
var lines = c.split(/<(tr|div|br|li|h[0-9]|p>)/);
|
|
66014
|
-
longestStringLength = Math.max.apply(Math, __spreadArray$
|
|
66093
|
+
longestStringLength = Math.max.apply(Math, __spreadArray$a([], __read$f((lines.map(function (el) { return el.replace(/<[a-zA-Z0-9\s=\/]+>/g, "").length; }))))) - 1;
|
|
66015
66094
|
var w = Math.ceil(longestStringLength * 3.5);
|
|
66016
66095
|
if (w < width) {
|
|
66017
66096
|
width = w;
|