azure-maps-control 2.1.17 → 3.0.0-preview.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/ReadMe.md +5 -1
- package/dist/atlas-core-bare-snr-min.js +55 -0
- package/dist/atlas-core-bare-snr.js +20852 -0
- package/dist/atlas-core-bare.js +583 -230
- package/dist/atlas-core-bare.min.js +1 -1
- package/dist/atlas-core-snr.js +66907 -0
- package/dist/atlas-core.js +36063 -32782
- package/dist/atlas-core.min.js +53 -1
- package/dist/atlas.css +104 -104
- package/dist/atlas.js +36058 -32777
- package/dist/atlas.min.css +1 -1
- package/dist/atlas.min.js +53 -1
- package/package.json +16 -26
- package/thirdpartynotices.txt +0 -0
- package/typings/index.d.ts +195 -13
package/dist/atlas-core-bare.js
CHANGED
|
@@ -56,15 +56,15 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
56
56
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('azuremaps-maplibre-gl')) :
|
|
57
57
|
typeof define === 'function' && define.amd ? define(['exports', 'azuremaps-maplibre-gl'], factory) :
|
|
58
58
|
(global = global || self, factory(global.atlas = global.atlas || {}, global.maplibregl));
|
|
59
|
-
}(this, (function (exports,
|
|
59
|
+
}(this, (function (exports, maplibregl) { 'use strict';
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
maplibregl = maplibregl && Object.prototype.hasOwnProperty.call(maplibregl, 'default') ? maplibregl['default'] : maplibregl;
|
|
62
62
|
|
|
63
63
|
var env = {
|
|
64
64
|
domain: "atlas.microsoft.com",
|
|
65
65
|
staticAssetsDomain: "atlas.microsoft.com",
|
|
66
66
|
stylePath: "styling",
|
|
67
|
-
styleDefinitionsVersion: "
|
|
67
|
+
styleDefinitionsVersion: "2022-08-05",
|
|
68
68
|
appInsightsKey: "e96cb745-c6f5-409c-a775-c4313e468c1d",
|
|
69
69
|
aadInstance: "https://login.microsoftonline.com/"
|
|
70
70
|
};
|
|
@@ -343,7 +343,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
343
343
|
return Url;
|
|
344
344
|
}());
|
|
345
345
|
|
|
346
|
-
var version = "
|
|
346
|
+
var version = "3.0.0-preview.1";
|
|
347
347
|
|
|
348
348
|
/**
|
|
349
349
|
* A helper class that provides methods for getting various forms of the map controls current version.
|
|
@@ -4372,7 +4372,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
4372
4372
|
_this.setSelectedStyle(newStyle);
|
|
4373
4373
|
}
|
|
4374
4374
|
};
|
|
4375
|
-
_this.
|
|
4375
|
+
_this.onMapConfigurationChange = function (definitions) {
|
|
4376
4376
|
if (!_this.styleOpsGrid) {
|
|
4377
4377
|
return;
|
|
4378
4378
|
}
|
|
@@ -4380,8 +4380,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
4380
4380
|
_this.styleButtons.clear();
|
|
4381
4381
|
_this.populateOpsGridFromDefinitions(definitions);
|
|
4382
4382
|
};
|
|
4383
|
-
_this.mapToFriendlyStyleName = function (name,
|
|
4384
|
-
var style =
|
|
4383
|
+
_this.mapToFriendlyStyleName = function (name, mapConfiguration) {
|
|
4384
|
+
var style = mapConfiguration.configurations.find(function (style) { return style.name === name; });
|
|
4385
4385
|
return (style === null || style === void 0 ? void 0 : style.displayName) || name;
|
|
4386
4386
|
};
|
|
4387
4387
|
_this.options = new StyleControlOptions().merge(cloneDeep_1(options));
|
|
@@ -4477,7 +4477,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
4477
4477
|
this.styleOpsGrid = null;
|
|
4478
4478
|
this.styleButtons.clear();
|
|
4479
4479
|
this.map.events.remove("stylechanged", this.onStyleChange);
|
|
4480
|
-
this.map.events.remove("
|
|
4480
|
+
this.map.events.remove("mapconfigurationchanged", this.onMapConfigurationChange);
|
|
4481
4481
|
};
|
|
4482
4482
|
/**
|
|
4483
4483
|
* Set the style that need to be displayed as currently selected.
|
|
@@ -4496,8 +4496,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
4496
4496
|
var _b = __read(_a, 2), buttonStyleName = _b[0], button = _b[1];
|
|
4497
4497
|
return button.setAttribute('aria-current', buttonStyleName === styleName ? 'true' : 'false');
|
|
4498
4498
|
});
|
|
4499
|
-
this.map.styles.definitions().then(function (
|
|
4500
|
-
var newAlt = _this.mapToFriendlyStyleName(styleName,
|
|
4499
|
+
this.map.styles.definitions().then(function (mapConfiguration) {
|
|
4500
|
+
var newAlt = _this.mapToFriendlyStyleName(styleName, mapConfiguration);
|
|
4501
4501
|
if (image_1.alt !== newAlt) {
|
|
4502
4502
|
image_1.alt = newAlt;
|
|
4503
4503
|
}
|
|
@@ -4527,10 +4527,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
4527
4527
|
styleButton.removeAttribute("disabled");
|
|
4528
4528
|
}
|
|
4529
4529
|
};
|
|
4530
|
-
StyleControl.prototype.buildSelectStyleBtn = function (name,
|
|
4530
|
+
StyleControl.prototype.buildSelectStyleBtn = function (name, mapConfiguration, fetchIconPromise) {
|
|
4531
4531
|
var _this = this;
|
|
4532
4532
|
var styleOptionButton = document.createElement("button");
|
|
4533
|
-
var friendlyName = this.mapToFriendlyStyleName(name,
|
|
4533
|
+
var friendlyName = this.mapToFriendlyStyleName(name, mapConfiguration);
|
|
4534
4534
|
styleOptionButton.setAttribute("aria-label", friendlyName);
|
|
4535
4535
|
styleOptionButton.setAttribute("type", "button");
|
|
4536
4536
|
var styleIconImage = new Image();
|
|
@@ -4615,12 +4615,12 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
4615
4615
|
// If a style is one of those to be shown by the style picker also create it's element.
|
|
4616
4616
|
this.map.styles.definitions().then(function (definitions) { return __awaiter(_this, void 0, void 0, function () {
|
|
4617
4617
|
return __generator(this, function (_a) {
|
|
4618
|
-
this.
|
|
4618
|
+
this.onMapConfigurationChange(definitions);
|
|
4619
4619
|
this.map.events.add("stylechanged", this.onStyleChange);
|
|
4620
4620
|
return [2 /*return*/];
|
|
4621
4621
|
});
|
|
4622
4622
|
}); });
|
|
4623
|
-
this.map.events.add("
|
|
4623
|
+
this.map.events.add("mapconfigurationchanged", this.onMapConfigurationChange);
|
|
4624
4624
|
return styleOpsGrid;
|
|
4625
4625
|
};
|
|
4626
4626
|
StyleControl.prototype.populateOpsGridFromDefinitions = function (definitions) {
|
|
@@ -4628,7 +4628,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
4628
4628
|
if (!this.styleOpsGrid) {
|
|
4629
4629
|
return;
|
|
4630
4630
|
}
|
|
4631
|
-
var styles = definitions.
|
|
4631
|
+
var styles = definitions.configurations;
|
|
4632
4632
|
if (Array.isArray(this.options.mapStyles)) {
|
|
4633
4633
|
styles = styles.filter(function (style) { return _this.options.mapStyles.includes(style.name.split("_indoor")[0]); });
|
|
4634
4634
|
}
|
|
@@ -9095,6 +9095,151 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
9095
9095
|
return MultiPolygon;
|
|
9096
9096
|
}());
|
|
9097
9097
|
|
|
9098
|
+
//Based on: https://github.com/mapbox/mapbox-gl-js/blob/main/src/geo/mercator_coordinate.js
|
|
9099
|
+
/**
|
|
9100
|
+
* A `MercatorPoint` object represents a projected three dimensional position.
|
|
9101
|
+
*
|
|
9102
|
+
* `MercatorPoint` uses the web mercator projection ([EPSG:3857](https://epsg.io/3857)) with slightly different units:
|
|
9103
|
+
* - the size of 1 unit is the width of the projected world instead of the "mercator meter"
|
|
9104
|
+
* - the origin of the coordinate space is at the north-west corner instead of the middle.
|
|
9105
|
+
*
|
|
9106
|
+
* For example, `MercatorPoint(0, 0, 0)` is the north-west corner of the mercator world and
|
|
9107
|
+
* `MercatorPoint(1, 1, 0)` is the south-east corner. If you are familiar with
|
|
9108
|
+
* [vector tiles](https://github.com/mapbox/vector-tile-spec) it may be helpful to think
|
|
9109
|
+
* of the coordinate space as the `0/0/0` tile with an extent of `1`.
|
|
9110
|
+
*
|
|
9111
|
+
* The `z` dimension of `MercatorPoint` is conformal. A cube in the mercator coordinate space would be rendered as a cube.
|
|
9112
|
+
*/
|
|
9113
|
+
var MercatorPoint = /** @class */ (function (_super) {
|
|
9114
|
+
__extends(MercatorPoint, _super);
|
|
9115
|
+
/**
|
|
9116
|
+
* Constructs a MercatorPoint.
|
|
9117
|
+
* @param x A points x position in mercator units.
|
|
9118
|
+
* @param y A points y position in mercator units.
|
|
9119
|
+
* @param z A points z position in mercator units.
|
|
9120
|
+
*/
|
|
9121
|
+
function MercatorPoint(x, y, z) {
|
|
9122
|
+
return _super.call(this, x, y, z ? z : 0) || this;
|
|
9123
|
+
}
|
|
9124
|
+
/***********************************
|
|
9125
|
+
* Public static functions
|
|
9126
|
+
***********************************/
|
|
9127
|
+
/**
|
|
9128
|
+
* Converts a position into a mercator point.
|
|
9129
|
+
* @param position Position to convert.
|
|
9130
|
+
* @returns A mercator point.
|
|
9131
|
+
*/
|
|
9132
|
+
MercatorPoint.fromPosition = function (position) {
|
|
9133
|
+
if (position.length >= 2) {
|
|
9134
|
+
return new MercatorPoint((180 + position[0]) / 360, MercatorPoint._latToMercatorY(position[1]), position.length >= 3 ? MercatorPoint._altitudeToMercatorZ(position[2], position[1]) : 0);
|
|
9135
|
+
}
|
|
9136
|
+
return [0, 0, 0];
|
|
9137
|
+
};
|
|
9138
|
+
/**
|
|
9139
|
+
* Converts an array of positions into an array of mercator points.
|
|
9140
|
+
* @param positions Array of positions to convert.
|
|
9141
|
+
* @returns An array of mercator points.
|
|
9142
|
+
*/
|
|
9143
|
+
MercatorPoint.fromPositions = function (positions) {
|
|
9144
|
+
var mercators = [];
|
|
9145
|
+
for (var i = 0, len = positions.length; i < len; i++) {
|
|
9146
|
+
mercators.push(this.fromPosition(positions[i]));
|
|
9147
|
+
}
|
|
9148
|
+
return mercators;
|
|
9149
|
+
};
|
|
9150
|
+
/**
|
|
9151
|
+
* Converts an array of positions into a Float32Array of mercator xyz values.
|
|
9152
|
+
* @param positions Array of positions to convert.
|
|
9153
|
+
* @returns A Float32Array of mercator xyz values.
|
|
9154
|
+
*/
|
|
9155
|
+
MercatorPoint.toFloat32Array = function (positions) {
|
|
9156
|
+
var arr = new Float32Array(positions.length * 3);
|
|
9157
|
+
for (var i = 0, len = positions.length; i < len; i++) {
|
|
9158
|
+
var idx = i * 3;
|
|
9159
|
+
var p = positions[i];
|
|
9160
|
+
//x
|
|
9161
|
+
arr[idx] = (180 + p[0]) / 360;
|
|
9162
|
+
//y
|
|
9163
|
+
arr[idx + 1] = MercatorPoint._latToMercatorY(p[1]);
|
|
9164
|
+
//z
|
|
9165
|
+
arr[idx + 2] = p.length >= 3 ? MercatorPoint._altitudeToMercatorZ(p[2], p[1]) : 0;
|
|
9166
|
+
}
|
|
9167
|
+
return arr;
|
|
9168
|
+
};
|
|
9169
|
+
/**
|
|
9170
|
+
* Converts a mercator point into a map position.
|
|
9171
|
+
* @param mercator Mercator point to convert.
|
|
9172
|
+
* @returns A map position.
|
|
9173
|
+
*/
|
|
9174
|
+
MercatorPoint.toPosition = function (mercator) {
|
|
9175
|
+
if (mercator.length >= 2) {
|
|
9176
|
+
var lat = (360 / Math.PI) * Math.atan(Math.exp(((180 - mercator[1] * 360) * Math.PI) / 180)) - 90;
|
|
9177
|
+
return new Position(mercator[0] * 360 - 180, lat, mercator.length >= 3 ? MercatorPoint._mercatorZToAltitude(mercator[2], mercator[1]) : 0);
|
|
9178
|
+
}
|
|
9179
|
+
return [0, 0, 0];
|
|
9180
|
+
};
|
|
9181
|
+
/**
|
|
9182
|
+
* Converts an array of mercator points into an array of map positions.
|
|
9183
|
+
* @param mercators Mercator points to convert.
|
|
9184
|
+
* @returns An array of map positions.
|
|
9185
|
+
*/
|
|
9186
|
+
MercatorPoint.toPositions = function (mercators) {
|
|
9187
|
+
var positions = [];
|
|
9188
|
+
for (var i = 0, len = mercators.length; i < len; i++) {
|
|
9189
|
+
positions.push(this.toPosition(mercators[i]));
|
|
9190
|
+
}
|
|
9191
|
+
return positions;
|
|
9192
|
+
};
|
|
9193
|
+
/**
|
|
9194
|
+
* Determine the Mercator scale factor for a given latitude, see
|
|
9195
|
+
* https://en.wikipedia.org/wiki/Mercator_projection#Scale_factor
|
|
9196
|
+
*
|
|
9197
|
+
* At the equator the scale factor will be 1, which increases at higher latitudes.
|
|
9198
|
+
*
|
|
9199
|
+
* @param latitude Latitude
|
|
9200
|
+
* @returns The mercator scale factor.
|
|
9201
|
+
*/
|
|
9202
|
+
MercatorPoint.mercatorScale = function (latitude) {
|
|
9203
|
+
return 1 / Math.cos((latitude * Math.PI) / 180);
|
|
9204
|
+
};
|
|
9205
|
+
/**
|
|
9206
|
+
* Returns the distance of 1 meter in `MercatorPoint` units at this latitude.
|
|
9207
|
+
*
|
|
9208
|
+
* For coordinates in real world units using meters, this naturally provides the scale
|
|
9209
|
+
* to transform into `MercatorPoint`s.
|
|
9210
|
+
*
|
|
9211
|
+
* @returns {number} Distance of 1 meter in `MercatorPoint` units.
|
|
9212
|
+
*/
|
|
9213
|
+
MercatorPoint.meterInMercatorUnits = function (latitude) {
|
|
9214
|
+
// 1 meter / circumference at equator in meters * Mercator projection scale factor at this latitude
|
|
9215
|
+
return ((1 / MercatorPoint.earthCircumference) *
|
|
9216
|
+
MercatorPoint.mercatorScale(MercatorPoint._latToMercatorY(latitude)));
|
|
9217
|
+
};
|
|
9218
|
+
/***********************************
|
|
9219
|
+
* Private static functions
|
|
9220
|
+
***********************************/
|
|
9221
|
+
/*
|
|
9222
|
+
* The circumference at a line of latitude in meters.
|
|
9223
|
+
*/
|
|
9224
|
+
MercatorPoint._circumferenceAtLatitude = function (latitude) {
|
|
9225
|
+
return MercatorPoint.earthCircumference * Math.cos((latitude * Math.PI) / 180);
|
|
9226
|
+
};
|
|
9227
|
+
MercatorPoint._altitudeToMercatorZ = function (altitude, latitude) {
|
|
9228
|
+
return altitude / MercatorPoint._circumferenceAtLatitude(latitude);
|
|
9229
|
+
};
|
|
9230
|
+
MercatorPoint._mercatorZToAltitude = function (zoom, y) {
|
|
9231
|
+
return zoom * MercatorPoint._circumferenceAtLatitude(MercatorPoint._latToMercatorY(y));
|
|
9232
|
+
};
|
|
9233
|
+
MercatorPoint._latToMercatorY = function (y) {
|
|
9234
|
+
return (180 - (180 / Math.PI) * Math.log(Math.tan(Math.PI / 4 + (y * Math.PI) / 360))) / 360;
|
|
9235
|
+
};
|
|
9236
|
+
/*
|
|
9237
|
+
* The average circumference of the world in meters.
|
|
9238
|
+
*/
|
|
9239
|
+
MercatorPoint.earthCircumference = 2 * Math.PI * getEarthRadius(); // meters
|
|
9240
|
+
return MercatorPoint;
|
|
9241
|
+
}(Array));
|
|
9242
|
+
|
|
9098
9243
|
|
|
9099
9244
|
|
|
9100
9245
|
var index$1 = /*#__PURE__*/Object.freeze({
|
|
@@ -9106,6 +9251,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
9106
9251
|
Polygon: Polygon,
|
|
9107
9252
|
Position: Position,
|
|
9108
9253
|
BoundingBox: BoundingBox,
|
|
9254
|
+
MercatorPoint: MercatorPoint,
|
|
9109
9255
|
MultiLineString: MultiLineString,
|
|
9110
9256
|
MultiPoint: MultiPoint,
|
|
9111
9257
|
MultiPolygon: MultiPolygon,
|
|
@@ -9522,6 +9668,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
9522
9668
|
return this.container;
|
|
9523
9669
|
};
|
|
9524
9670
|
ZoomControl.prototype.onRemove = function () {
|
|
9671
|
+
_super.prototype.onRemove.call(this);
|
|
9525
9672
|
if (this.map) {
|
|
9526
9673
|
this.map.events.remove('zoom', this.zoomChanged);
|
|
9527
9674
|
this.map.events.remove('minzoomchanged', this.minZoomChanged);
|
|
@@ -12389,6 +12536,155 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
12389
12536
|
return TileLayer;
|
|
12390
12537
|
}(SourceBuildingLayer));
|
|
12391
12538
|
|
|
12539
|
+
/**
|
|
12540
|
+
* Options used to render graphics in a WebGLLayer.
|
|
12541
|
+
*/
|
|
12542
|
+
var WebGLLayerOptions = /** @class */ (function (_super) {
|
|
12543
|
+
__extends(WebGLLayerOptions, _super);
|
|
12544
|
+
function WebGLLayerOptions() {
|
|
12545
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
12546
|
+
/**
|
|
12547
|
+
* An object that contains the rendering logic.
|
|
12548
|
+
*/
|
|
12549
|
+
_this.renderer = undefined;
|
|
12550
|
+
return _this;
|
|
12551
|
+
}
|
|
12552
|
+
return WebGLLayerOptions;
|
|
12553
|
+
}(LayerOptions));
|
|
12554
|
+
|
|
12555
|
+
/**
|
|
12556
|
+
* Enables custom rendering logic with access to the WebGL context of the map.
|
|
12557
|
+
*/
|
|
12558
|
+
var WebGLLayer = /** @class */ (function (_super) {
|
|
12559
|
+
__extends(WebGLLayer, _super);
|
|
12560
|
+
/**
|
|
12561
|
+
* Constructs a new WebGLLayer.
|
|
12562
|
+
* @param id The id of the layer. If not specified a random one will be generated.
|
|
12563
|
+
* @param options The options of the WebGL layer.
|
|
12564
|
+
*/
|
|
12565
|
+
function WebGLLayer(id, options) {
|
|
12566
|
+
var _this = _super.call(this, id) || this;
|
|
12567
|
+
/**
|
|
12568
|
+
* Make sure the layer is available after a style change.
|
|
12569
|
+
* @internal
|
|
12570
|
+
*/
|
|
12571
|
+
_this._onStyleChange = function () {
|
|
12572
|
+
var _a;
|
|
12573
|
+
// Custom layers cannot be serialized and preserved by mapbox.
|
|
12574
|
+
// Add this layer again if the layer was removed by mapbox after a style change.
|
|
12575
|
+
if (!_this.map._getMap().getLayer(_this.id)) {
|
|
12576
|
+
var map = _this.map;
|
|
12577
|
+
var before = (_a = _this.map.layers._getUserLayers().find(function (l) { return l.layer.getId() == _this.id; })) === null || _a === void 0 ? void 0 : _a.before;
|
|
12578
|
+
map.layers.remove(_this);
|
|
12579
|
+
map.layers.add(_this, before);
|
|
12580
|
+
}
|
|
12581
|
+
};
|
|
12582
|
+
_this.options = new WebGLLayerOptions().merge(cloneDeepWith_1(options, WebGLLayerOptions._cloneCustomizer));
|
|
12583
|
+
_this.source = new DataSource();
|
|
12584
|
+
return _this;
|
|
12585
|
+
}
|
|
12586
|
+
/**
|
|
12587
|
+
* Gets the options of the WebGL layer.
|
|
12588
|
+
*/
|
|
12589
|
+
WebGLLayer.prototype.getOptions = function () {
|
|
12590
|
+
// Copy the options so the user can't directly change options.
|
|
12591
|
+
// They must use setOptions(...).
|
|
12592
|
+
return cloneDeepWith_1(this.options, WebGLLayerOptions._cloneCustomizer);
|
|
12593
|
+
};
|
|
12594
|
+
/**
|
|
12595
|
+
* Sets the options of the WebGL layer.
|
|
12596
|
+
* @param options The new options of the WebGL layer.
|
|
12597
|
+
*/
|
|
12598
|
+
WebGLLayer.prototype.setOptions = function (options) {
|
|
12599
|
+
var newOptions = new WebGLLayerOptions().merge(this.options, cloneDeepWith_1(options, WebGLLayerOptions._cloneCustomizer));
|
|
12600
|
+
// Trigger a repaint of the map if the layer options have changed.
|
|
12601
|
+
if (this.map) {
|
|
12602
|
+
this.map.triggerRepaint();
|
|
12603
|
+
}
|
|
12604
|
+
this.options = newOptions;
|
|
12605
|
+
};
|
|
12606
|
+
WebGLLayer.prototype.onAdd = function (map) {
|
|
12607
|
+
var _a, _b;
|
|
12608
|
+
_super.prototype.onAdd.call(this, map);
|
|
12609
|
+
// Make sure the layer is available after a style change.
|
|
12610
|
+
this.map.events.add("stylechanged", this._onStyleChange);
|
|
12611
|
+
// Notify the renderer this layer has been added to the map.
|
|
12612
|
+
if (this.options.renderer && this.glContext) {
|
|
12613
|
+
(_b = (_a = this.options.renderer).onAdd) === null || _b === void 0 ? void 0 : _b.call(_a, map, this.glContext);
|
|
12614
|
+
}
|
|
12615
|
+
};
|
|
12616
|
+
WebGLLayer.prototype.onRemove = function () {
|
|
12617
|
+
var _a, _b;
|
|
12618
|
+
// Notify the renderer this layer has been removed from the map.
|
|
12619
|
+
if (this.options.renderer && this.glContext) {
|
|
12620
|
+
(_b = (_a = this.options.renderer).onRemove) === null || _b === void 0 ? void 0 : _b.call(_a, this.map, this.glContext);
|
|
12621
|
+
}
|
|
12622
|
+
// Cleanup
|
|
12623
|
+
this.map.events.remove("stylechanged", this._onStyleChange);
|
|
12624
|
+
this.glContext = null;
|
|
12625
|
+
_super.prototype.onRemove.call(this);
|
|
12626
|
+
};
|
|
12627
|
+
/**
|
|
12628
|
+
* @internal
|
|
12629
|
+
*/
|
|
12630
|
+
WebGLLayer.prototype._buildLayers = function () {
|
|
12631
|
+
var _this = this;
|
|
12632
|
+
if (!this.options.renderer) {
|
|
12633
|
+
throw new Error("Cannot build the WebGL layer because renderer was not set.");
|
|
12634
|
+
}
|
|
12635
|
+
return [
|
|
12636
|
+
{
|
|
12637
|
+
id: this.id,
|
|
12638
|
+
type: "custom",
|
|
12639
|
+
renderingMode: this.options.renderer.renderingMode,
|
|
12640
|
+
onAdd: function (m, gl) {
|
|
12641
|
+
// Capture the GL context to reuse it later.
|
|
12642
|
+
// renderer.onAdd will be called in the onAdd callback of this layer.
|
|
12643
|
+
_this.glContext = gl;
|
|
12644
|
+
},
|
|
12645
|
+
onRemove: function (m, gl) {
|
|
12646
|
+
// renderer.onRemove will be called in the onRemove callback of this layer.
|
|
12647
|
+
},
|
|
12648
|
+
prerender: function (gl, matrix) {
|
|
12649
|
+
var _a, _b;
|
|
12650
|
+
if (_this._shouldRender()) {
|
|
12651
|
+
(_b = (_a = _this.options.renderer).prerender) === null || _b === void 0 ? void 0 : _b.call(_a, gl, matrix);
|
|
12652
|
+
}
|
|
12653
|
+
},
|
|
12654
|
+
render: function (gl, matrix) {
|
|
12655
|
+
if (_this._shouldRender()) {
|
|
12656
|
+
_this.options.renderer.render(gl, matrix);
|
|
12657
|
+
}
|
|
12658
|
+
}
|
|
12659
|
+
}
|
|
12660
|
+
];
|
|
12661
|
+
};
|
|
12662
|
+
/**
|
|
12663
|
+
* @internal
|
|
12664
|
+
*/
|
|
12665
|
+
WebGLLayer.prototype._getLayerIds = function () {
|
|
12666
|
+
return [this.id];
|
|
12667
|
+
};
|
|
12668
|
+
/**
|
|
12669
|
+
* @internal
|
|
12670
|
+
*/
|
|
12671
|
+
WebGLLayer.prototype._getSourceIds = function () {
|
|
12672
|
+
return new Set().add(this.source.getId());
|
|
12673
|
+
};
|
|
12674
|
+
/**
|
|
12675
|
+
* Returns true if the next frame should be rendered
|
|
12676
|
+
* @internal
|
|
12677
|
+
*/
|
|
12678
|
+
WebGLLayer.prototype._shouldRender = function () {
|
|
12679
|
+
if (this.map) {
|
|
12680
|
+
var zoom = this.map.getCamera().zoom;
|
|
12681
|
+
return this.options.visible && this.options.minZoom <= zoom && this.options.maxZoom > zoom;
|
|
12682
|
+
}
|
|
12683
|
+
return false;
|
|
12684
|
+
};
|
|
12685
|
+
return WebGLLayer;
|
|
12686
|
+
}(Layer));
|
|
12687
|
+
|
|
12392
12688
|
|
|
12393
12689
|
|
|
12394
12690
|
var index$5 = /*#__PURE__*/Object.freeze({
|
|
@@ -12401,7 +12697,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
12401
12697
|
SymbolLayer: SymbolLayer,
|
|
12402
12698
|
TileLayer: TileLayer,
|
|
12403
12699
|
HeatMapLayer: HeatMapLayer,
|
|
12404
|
-
ImageLayer: ImageLayer
|
|
12700
|
+
ImageLayer: ImageLayer,
|
|
12701
|
+
WebGLLayer: WebGLLayer
|
|
12405
12702
|
});
|
|
12406
12703
|
|
|
12407
12704
|
var Html = /** @class */ (function () {
|
|
@@ -12946,7 +13243,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
12946
13243
|
if (options.anchor === "none") {
|
|
12947
13244
|
this.autoAnchor = autoAnchor || "bottom";
|
|
12948
13245
|
this.containerDiv.classList.add(this.autoAnchor);
|
|
12949
|
-
marker = new
|
|
13246
|
+
marker = new maplibregl.Marker({
|
|
12950
13247
|
anchor: this.autoAnchor,
|
|
12951
13248
|
element: this.containerDiv,
|
|
12952
13249
|
offset: options.pixelOffset,
|
|
@@ -12954,7 +13251,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
12954
13251
|
}
|
|
12955
13252
|
else {
|
|
12956
13253
|
this.containerDiv.classList.add(options.anchor);
|
|
12957
|
-
marker = new
|
|
13254
|
+
marker = new maplibregl.Marker({
|
|
12958
13255
|
anchor: options.anchor,
|
|
12959
13256
|
element: this.containerDiv,
|
|
12960
13257
|
offset: options.pixelOffset,
|
|
@@ -13320,7 +13617,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
13320
13617
|
if (!options.visible) {
|
|
13321
13618
|
this.element.classList.add(HtmlMarker.hiddenClass);
|
|
13322
13619
|
}
|
|
13323
|
-
this.marker = new
|
|
13620
|
+
this.marker = new maplibregl.Marker({
|
|
13324
13621
|
element: this.element,
|
|
13325
13622
|
offset: options.pixelOffset,
|
|
13326
13623
|
draggable: options.draggable,
|
|
@@ -14029,13 +14326,13 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
14029
14326
|
* Gets the worker count that will get created.
|
|
14030
14327
|
*/
|
|
14031
14328
|
function getWorkerCount() {
|
|
14032
|
-
return
|
|
14329
|
+
return maplibregl.workerCount;
|
|
14033
14330
|
}
|
|
14034
14331
|
/**
|
|
14035
14332
|
* Gets the Maximum number of images (raster tiles, sprites, icons) to load in parallel
|
|
14036
14333
|
*/
|
|
14037
14334
|
function getMaxParallelImageRequests() {
|
|
14038
|
-
return
|
|
14335
|
+
return maplibregl.maxParallelImageRequests;
|
|
14039
14336
|
}
|
|
14040
14337
|
/**
|
|
14041
14338
|
* Gets the default language that was provided.
|
|
@@ -14088,7 +14385,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
14088
14385
|
if (UserAgent.isIE()) {
|
|
14089
14386
|
return false;
|
|
14090
14387
|
}
|
|
14091
|
-
return
|
|
14388
|
+
return maplibregl.supported({
|
|
14092
14389
|
failIfMajorPerformanceCaveat: failIfMajorPerformanceCaveat
|
|
14093
14390
|
});
|
|
14094
14391
|
}
|
|
@@ -14147,7 +14444,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
14147
14444
|
*/
|
|
14148
14445
|
function setWorkerCount(workerCount) {
|
|
14149
14446
|
if (workerCount > 0) {
|
|
14150
|
-
|
|
14447
|
+
maplibregl.workerCount = workerCount;
|
|
14151
14448
|
hasWorkerCount = true;
|
|
14152
14449
|
}
|
|
14153
14450
|
}
|
|
@@ -14158,7 +14455,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
14158
14455
|
*/
|
|
14159
14456
|
function setMaxParallelImageRequests(maxParallelImageRequests) {
|
|
14160
14457
|
if (maxParallelImageRequests > 0) {
|
|
14161
|
-
|
|
14458
|
+
maplibregl.maxParallelImageRequests = maxParallelImageRequests;
|
|
14162
14459
|
hasMaxParallelImageRequests = true;
|
|
14163
14460
|
}
|
|
14164
14461
|
}
|
|
@@ -14273,7 +14570,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
14273
14570
|
* created and destroyed.
|
|
14274
14571
|
*/
|
|
14275
14572
|
function prewarm() {
|
|
14276
|
-
|
|
14573
|
+
maplibregl.prewarm();
|
|
14277
14574
|
}
|
|
14278
14575
|
/**
|
|
14279
14576
|
* Clears up resources that have previously been created by `atlas.prewarm()`.
|
|
@@ -14282,7 +14579,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
14282
14579
|
* in your application.
|
|
14283
14580
|
*/
|
|
14284
14581
|
function clearPrewarmedResources() {
|
|
14285
|
-
|
|
14582
|
+
maplibregl.clearPrewarmedResources();
|
|
14286
14583
|
}
|
|
14287
14584
|
/**
|
|
14288
14585
|
* Returns if authentication options are set.
|
|
@@ -15960,6 +16257,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
15960
16257
|
40
|
|
15961
16258
|
];
|
|
15962
16259
|
// accessibility recommendation: After using any of the map shortcut keys, NVDA should not read all the shortcut keys again.
|
|
16260
|
+
// // TODO: this should be this.map._getMap().getCanvas
|
|
15963
16261
|
var mapCanvas = _this.map._getMap()._canvas;
|
|
15964
16262
|
mapCanvas === null || mapCanvas === void 0 ? void 0 : mapCanvas.addEventListener('keyup', function (event) {
|
|
15965
16263
|
if (baseShortcutKeyCodes.find(function (code) { return event.keyCode === code; })) {
|
|
@@ -22926,6 +23224,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
22926
23224
|
|
|
22927
23225
|
// Disable unified signatures linter rule so we can generate separate docs for function overloads.
|
|
22928
23226
|
// tslint:disable:unified-signatures
|
|
23227
|
+
var MAP_CLIENT_EVENTS = ['maxzoomchanged', 'minzoomchanged', 'mapconfigurationchanged'];
|
|
22929
23228
|
/**
|
|
22930
23229
|
* A manager for the map control's events.
|
|
22931
23230
|
* Exposed through the events property of the atlas.Map class.
|
|
@@ -23037,6 +23336,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
23037
23336
|
* @private
|
|
23038
23337
|
*/
|
|
23039
23338
|
EventManager.prototype._addGlobalListener = function (eventType, callback, legacy, once) {
|
|
23339
|
+
// add our custom events emitted by Map client to the map (note: they don't utilize modifiedCallback)
|
|
23340
|
+
if (MAP_CLIENT_EVENTS.includes(eventType)) {
|
|
23341
|
+
this.map._addEventListener(eventType, callback, once);
|
|
23342
|
+
return;
|
|
23343
|
+
}
|
|
23040
23344
|
var oldModifiedCallback = this.mapCallbackHandler.getModifiedCallback(eventType, "", callback);
|
|
23041
23345
|
// Get a new modified callback.
|
|
23042
23346
|
this.mapCallbackHandler.addCallback(eventType, "", callback, legacy, once);
|
|
@@ -23061,9 +23365,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
23061
23365
|
setTimeout(function () { return modifiedCallback(readyData_1); });
|
|
23062
23366
|
}
|
|
23063
23367
|
}
|
|
23064
|
-
else if (["minzoomchanged", "maxzoomchanged", "stylesetchanged"].includes(eventType)) {
|
|
23065
|
-
this.map._addEventListener(eventType, callback, once);
|
|
23066
|
-
}
|
|
23067
23368
|
else {
|
|
23068
23369
|
// If a callback already exists disable it so the new one can replace it.
|
|
23069
23370
|
if (oldModifiedCallback) {
|
|
@@ -23160,6 +23461,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
23160
23461
|
*/
|
|
23161
23462
|
EventManager.prototype._removeListener = function (eventType, target, callback) {
|
|
23162
23463
|
var e_5, _a;
|
|
23464
|
+
// remove our custom events emitted by Map client to the map (note: they don't utilize modifiedCallback)
|
|
23465
|
+
if (MAP_CLIENT_EVENTS.includes(eventType)) {
|
|
23466
|
+
this.map._removeEventListener(eventType, callback);
|
|
23467
|
+
return;
|
|
23468
|
+
}
|
|
23163
23469
|
var layerId = target instanceof Layer ? target.getId() : target;
|
|
23164
23470
|
var modifiedCallback = this.mapCallbackHandler.getModifiedCallback(eventType, layerId, callback);
|
|
23165
23471
|
// If a callback already exists disable it so the new one can replace it.
|
|
@@ -23645,6 +23951,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
23645
23951
|
// Replace the existing layer with the new one.
|
|
23646
23952
|
// Place the new layer behind the specified before layer.
|
|
23647
23953
|
var layerIndex = this.layerIndex.findIndex(function (l) { return l.getId() === layer.getId(); });
|
|
23954
|
+
var userLayerIndex = this.userLayers.findIndex(function (ul) { return ul.layer.getId() === layer.getId(); });
|
|
23648
23955
|
var tempLayer = this.layerIndex[layerIndex];
|
|
23649
23956
|
this._removeMapboxLayers(layer);
|
|
23650
23957
|
this._addMapboxLayers(layer, before);
|
|
@@ -23653,8 +23960,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
23653
23960
|
this.layerIndex.splice(layerIndex, 1);
|
|
23654
23961
|
var beforeIndex = this.layerIndex.findIndex(function (l) { return l.getId() === before; });
|
|
23655
23962
|
this.layerIndex.splice(beforeIndex, 0, layer);
|
|
23656
|
-
if (!(layer instanceof FundamentalMapLayer))
|
|
23657
|
-
this.userLayers
|
|
23963
|
+
if (!(layer instanceof FundamentalMapLayer)) {
|
|
23964
|
+
this.userLayers[userLayerIndex] = { layer: layer, before: before };
|
|
23965
|
+
}
|
|
23658
23966
|
tempLayer.onRemove();
|
|
23659
23967
|
layer.onAdd(this.map);
|
|
23660
23968
|
}
|
|
@@ -23664,14 +23972,16 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
23664
23972
|
this.map.events._enableLayerEvents(layer);
|
|
23665
23973
|
var beforeIndex = this.layerIndex.findIndex(function (l) { return l.getId() === before; });
|
|
23666
23974
|
this.layerIndex.splice(beforeIndex, 0, layer);
|
|
23667
|
-
if (!(layer instanceof FundamentalMapLayer))
|
|
23975
|
+
if (!(layer instanceof FundamentalMapLayer)) {
|
|
23668
23976
|
this.userLayers.push({ layer: layer, before: before });
|
|
23977
|
+
}
|
|
23669
23978
|
layer.onAdd(this.map);
|
|
23670
23979
|
}
|
|
23671
23980
|
}
|
|
23672
23981
|
else {
|
|
23673
23982
|
var layerIndex = this.layerIndex.findIndex(function (l) { return l.getId() === layer.getId(); });
|
|
23674
|
-
|
|
23983
|
+
var userLayerIndex = this.userLayers.findIndex(function (ul) { return ul.layer.getId() === layer.getId(); });
|
|
23984
|
+
if (layerIndex >= 0 && userLayerIndex >= 0) {
|
|
23675
23985
|
// Replace the existing layer with the new one.
|
|
23676
23986
|
var tempLayer = this.layerIndex[layerIndex];
|
|
23677
23987
|
this._removeMapboxLayers(tempLayer);
|
|
@@ -23679,6 +23989,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
23679
23989
|
this.map.events._disableLayerEvents(tempLayer);
|
|
23680
23990
|
this.map.events._enableLayerEvents(layer);
|
|
23681
23991
|
this.layerIndex[layerIndex] = layer;
|
|
23992
|
+
if (!(layer instanceof FundamentalMapLayer)) {
|
|
23993
|
+
this.userLayers[userLayerIndex] = { layer: layer, before: undefined };
|
|
23994
|
+
}
|
|
23682
23995
|
tempLayer.onRemove();
|
|
23683
23996
|
layer.onAdd(this.map);
|
|
23684
23997
|
}
|
|
@@ -23687,8 +24000,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
23687
24000
|
this._addMapboxLayers(layer);
|
|
23688
24001
|
this.map.events._enableLayerEvents(layer);
|
|
23689
24002
|
this.layerIndex.push(layer);
|
|
23690
|
-
if (!(layer instanceof FundamentalMapLayer))
|
|
24003
|
+
if (!(layer instanceof FundamentalMapLayer)) {
|
|
23691
24004
|
this.userLayers.push({ layer: layer, before: before });
|
|
24005
|
+
}
|
|
23692
24006
|
layer.onAdd(this.map);
|
|
23693
24007
|
}
|
|
23694
24008
|
}
|
|
@@ -23934,6 +24248,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
23934
24248
|
else {
|
|
23935
24249
|
this.layerIndex.push(layer);
|
|
23936
24250
|
}
|
|
24251
|
+
// Update before property of the user layer
|
|
24252
|
+
var userLayer = this.userLayers.find(function (ul) { return ul.layer.getId() === layerId; });
|
|
24253
|
+
if (userLayer) {
|
|
24254
|
+
userLayer.before = beforeId;
|
|
24255
|
+
}
|
|
23937
24256
|
};
|
|
23938
24257
|
LayerManager.prototype._moveMapboxLayers = function (layer, before) {
|
|
23939
24258
|
var e_7, _a;
|
|
@@ -24067,15 +24386,15 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
24067
24386
|
*/
|
|
24068
24387
|
LayerManager.prototype._removeLayer = function (layer) {
|
|
24069
24388
|
var layerId = layer instanceof Layer ? layer.getId() : layer;
|
|
24070
|
-
|
|
24389
|
+
var layerIndex = this.layerIndex.findIndex(function (l) { return l.getId() === layerId; });
|
|
24390
|
+
if (layerIndex == -1) {
|
|
24071
24391
|
throw new Error("The layer '" + layerId + "' has not been added to the map and cannot be removed.");
|
|
24072
24392
|
}
|
|
24073
|
-
var layerIndex = this.layerIndex.findIndex(function (l) { return l.getId() === layerId; });
|
|
24074
24393
|
var tempLayer = this.layerIndex[layerIndex];
|
|
24075
24394
|
this._removeMapboxLayers(tempLayer);
|
|
24076
24395
|
this.layerIndex.splice(layerIndex, 1);
|
|
24077
|
-
var userLayerIndex = this.userLayers.findIndex(function (ul) { return ul.layer.getId() ===
|
|
24078
|
-
if (userLayerIndex
|
|
24396
|
+
var userLayerIndex = this.userLayers.findIndex(function (ul) { return ul.layer.getId() === layerId; });
|
|
24397
|
+
if (userLayerIndex != -1) {
|
|
24079
24398
|
this.userLayers.splice(userLayerIndex, 1);
|
|
24080
24399
|
}
|
|
24081
24400
|
tempLayer.onRemove();
|
|
@@ -25051,6 +25370,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
25051
25370
|
__extends(StyleOptions, _super);
|
|
25052
25371
|
function StyleOptions() {
|
|
25053
25372
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
25373
|
+
/**
|
|
25374
|
+
* If true, the gl context will be created with MSAA antialiasing, which can be useful for antialiasing WebGL layers.
|
|
25375
|
+
*/
|
|
25376
|
+
_this.antialias = undefined;
|
|
25054
25377
|
/**
|
|
25055
25378
|
* If true the map will automatically resize whenever the window's size changes.
|
|
25056
25379
|
* Otherwise map.resize() must be called.
|
|
@@ -25247,10 +25570,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
25247
25570
|
*/
|
|
25248
25571
|
_this.styleAPIVersion = getStyleAPIVersion();
|
|
25249
25572
|
/**
|
|
25250
|
-
* The
|
|
25251
|
-
|
|
25252
|
-
|
|
25253
|
-
|
|
25573
|
+
* The map configuration defines the set of styles available to the map.
|
|
25574
|
+
*/
|
|
25575
|
+
_this.mapConfiguration = undefined;
|
|
25576
|
+
/**
|
|
25577
|
+
* @deprecated use mapConfiguration instead
|
|
25254
25578
|
*/
|
|
25255
25579
|
_this.styleSet = undefined;
|
|
25256
25580
|
/**
|
|
@@ -25421,6 +25745,14 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
25421
25745
|
if (merged.authOptions.authType !== exports.AuthenticationType.subscriptionKey) {
|
|
25422
25746
|
merged["subscription-key"] = merged.subscriptionKey = undefined;
|
|
25423
25747
|
}
|
|
25748
|
+
// if mapConfiguration is not set and legacy styleSet option is used, assign it to mapConfiguration
|
|
25749
|
+
if (merged.styleSet !== undefined && merged.mapConfiguration === undefined) {
|
|
25750
|
+
merged.mapConfiguration = merged.styleSet;
|
|
25751
|
+
}
|
|
25752
|
+
// reassign properties from legacy mapConfiguration to new structure if needed
|
|
25753
|
+
if (merged.mapConfiguration && typeof merged.mapConfiguration !== 'string') {
|
|
25754
|
+
merged.mapConfiguration = __assign(__assign({}, merged.mapConfiguration), { defaultConfiguration: merged.mapConfiguration.defaultConfiguration || merged.mapConfiguration['defaultStyle'], configurations: merged.mapConfiguration.configurations || merged.mapConfiguration['styles'] });
|
|
25755
|
+
}
|
|
25424
25756
|
this._transformers = __spread(currentTransforms || [], transformersToMerge.filter(function (toMerge) { return !currentTransforms.includes(toMerge); }));
|
|
25425
25757
|
if (this.transformRequest && !this._transformers.includes(this.transformRequest)) {
|
|
25426
25758
|
this._transformers.push(this.transformRequest);
|
|
@@ -25475,10 +25807,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
25475
25807
|
*/
|
|
25476
25808
|
LayerGroupComparator.getLayerGroup = function (layer) {
|
|
25477
25809
|
var _a;
|
|
25478
|
-
|
|
25479
|
-
|
|
25810
|
+
var layerObject = layer;
|
|
25811
|
+
if ((layerObject === null || layerObject === void 0 ? void 0 : layerObject.metadata) && layerObject.metadata['microsoft.maps:layerGroup']) {
|
|
25812
|
+
return layerObject.metadata['microsoft.maps:layerGroup'];
|
|
25480
25813
|
}
|
|
25481
|
-
var layerId = (_a =
|
|
25814
|
+
var layerId = (_a = layerObject === null || layerObject === void 0 ? void 0 : layerObject.id) !== null && _a !== void 0 ? _a : layer;
|
|
25482
25815
|
if (!layerId.startsWith("microsoft.")) {
|
|
25483
25816
|
return undefined;
|
|
25484
25817
|
}
|
|
@@ -25625,9 +25958,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
25625
25958
|
*/
|
|
25626
25959
|
this.indoorState = undefined;
|
|
25627
25960
|
/**
|
|
25628
|
-
* Preserve the
|
|
25961
|
+
* Preserve the map configuration that was used before the indoor map configuration was set
|
|
25629
25962
|
*/
|
|
25630
|
-
this.
|
|
25963
|
+
this.preservedPreindoorMapConfiguration = undefined;
|
|
25631
25964
|
this._onStyleData = function () {
|
|
25632
25965
|
_this._lookUpAsync(_this.map.getStyle()).then(function (style) {
|
|
25633
25966
|
_this.map.events.invoke("stylechanged", {
|
|
@@ -25650,11 +25983,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
25650
25983
|
return null;
|
|
25651
25984
|
}
|
|
25652
25985
|
else {
|
|
25653
|
-
return definitions.
|
|
25986
|
+
return definitions.configurations.find(function (style) { return style.name === (options.style || definitions.defaultConfiguration); })
|
|
25654
25987
|
// retrieve default style definition unless option.style's one was found
|
|
25655
|
-
|| definitions.
|
|
25656
|
-
// no default style in the
|
|
25657
|
-
|| definitions.
|
|
25988
|
+
|| definitions.configurations.find(function (style) { return style.name === definitions.defaultConfiguration; })
|
|
25989
|
+
// no default style in the mapConfiguration -> pick the first style
|
|
25990
|
+
|| definitions.configurations[0];
|
|
25658
25991
|
}
|
|
25659
25992
|
};
|
|
25660
25993
|
this._lookUpAsync = function (options) { return __awaiter(_this, void 0, void 0, function () {
|
|
@@ -25664,11 +25997,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
25664
25997
|
case 0: return [4 /*yield*/, this.definitions()];
|
|
25665
25998
|
case 1:
|
|
25666
25999
|
definitions = _a.sent();
|
|
25667
|
-
result = definitions.
|
|
26000
|
+
result = definitions.configurations.find(function (style) { return style.name === (options.style || definitions.defaultConfiguration); })
|
|
25668
26001
|
// retrieve default style definition unless option.style's one was found
|
|
25669
|
-
|| definitions.
|
|
25670
|
-
// no default style in the
|
|
25671
|
-
|| definitions.
|
|
26002
|
+
|| definitions.configurations.find(function (style) { return style.name === definitions.defaultConfiguration; })
|
|
26003
|
+
// no default style in the mapConfiguration -> pick the first style
|
|
26004
|
+
|| definitions.configurations[0];
|
|
25672
26005
|
return [2 /*return*/, result];
|
|
25673
26006
|
}
|
|
25674
26007
|
});
|
|
@@ -25679,13 +26012,13 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
25679
26012
|
StyleManager.prototype.updateIndoorState = function (theme, tilesetId) {
|
|
25680
26013
|
var _this = this;
|
|
25681
26014
|
var _a;
|
|
25682
|
-
var
|
|
25683
|
-
if (
|
|
25684
|
-
this.
|
|
26015
|
+
var mapConfiguration = this.map.styles.getMapConfiguration();
|
|
26016
|
+
if (mapConfiguration) {
|
|
26017
|
+
this.preservedPreindoorMapConfiguration = mapConfiguration;
|
|
25685
26018
|
// tilesetId fallback
|
|
25686
26019
|
// MAGIC: if we are on a default style set - match existing style to the one in the default indoor style set
|
|
25687
26020
|
var desiredIndoorStyle = this.map.getStyle().style ? this.map.getStyle().style + "_indoor" + (theme === 'dark' ? '_dark' : '') + "_tileset_" + tilesetId : undefined;
|
|
25688
|
-
this.map.styles.setMapConfiguration("defaultIndoor_" + tilesetId,
|
|
26021
|
+
this.map.styles.setMapConfiguration("defaultIndoor_" + tilesetId, mapConfiguration === 'microsoft-maps:default' ? desiredIndoorStyle : undefined);
|
|
25689
26022
|
}
|
|
25690
26023
|
else {
|
|
25691
26024
|
var didTilesetIdChange_1 = ((_a = this.indoorState) === null || _a === void 0 ? void 0 : _a.tilesetId) !== tilesetId;
|
|
@@ -25695,12 +26028,12 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
25695
26028
|
};
|
|
25696
26029
|
this.initStyleset();
|
|
25697
26030
|
this.definitions().then(function (definitions) {
|
|
25698
|
-
var currentStyle = (_this.map.getStyle().style || definitions.
|
|
26031
|
+
var currentStyle = (_this.map.getStyle().style || definitions.defaultConfiguration)
|
|
25699
26032
|
.replace('_indoor_dark', '')
|
|
25700
26033
|
.replace('_indoor', '');
|
|
25701
26034
|
// we cannot compose the precise style name for auto theme, search for prefix style name match
|
|
25702
26035
|
var targetStylePrefix = currentStyle + "_indoor";
|
|
25703
|
-
var candidateStyle = definitions.
|
|
26036
|
+
var candidateStyle = definitions.configurations.find(function (style) { return style.name.startsWith(targetStylePrefix); });
|
|
25704
26037
|
if (candidateStyle) {
|
|
25705
26038
|
// force style reload if tileset id has changed to make sure the tiles will be re-requested with new tileset applied in indoor source placeholder
|
|
25706
26039
|
_this.map.setStyle({ style: candidateStyle.name }, !didTilesetIdChange_1);
|
|
@@ -25710,10 +26043,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
25710
26043
|
};
|
|
25711
26044
|
StyleManager.prototype.unsetIndoorState = function () {
|
|
25712
26045
|
var _this = this;
|
|
25713
|
-
var
|
|
25714
|
-
if (
|
|
26046
|
+
var mapConfiguration = this.preservedPreindoorMapConfiguration;
|
|
26047
|
+
if (mapConfiguration) {
|
|
25715
26048
|
// we need to revert to the styleset that was ap
|
|
25716
|
-
this.map.styles.setMapConfiguration(
|
|
26049
|
+
this.map.styles.setMapConfiguration(mapConfiguration);
|
|
25717
26050
|
}
|
|
25718
26051
|
else {
|
|
25719
26052
|
this.indoorState = undefined;
|
|
@@ -25740,11 +26073,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
25740
26073
|
var baseName = _this.indoorState && styleName.includes('_indoor') ? styleName.split('_indoor')[0] : styleName;
|
|
25741
26074
|
return baseName in styleNamesMap ? styleNamesMap[baseName] : baseName;
|
|
25742
26075
|
};
|
|
25743
|
-
if (!this.serviceOptions.
|
|
26076
|
+
if (!this.serviceOptions.mapConfiguration) {
|
|
25744
26077
|
newPromise = new HijackablePromise(this._request(this.serviceOptions.staticAssetsDomain, constants.stylePath + "/" + constants.styleResourcePath, "StyleDefinitions", { version: this.serviceOptions.styleDefinitionsVersion }).then(function (definitions) { return ({
|
|
25745
26078
|
version: isNaN(definitions.version) ? 0 : parseFloat(definitions.version),
|
|
25746
|
-
|
|
25747
|
-
|
|
26079
|
+
defaultConfiguration: definitions.defaultStyle,
|
|
26080
|
+
configurations: definitions.styles
|
|
25748
26081
|
.filter(function (style) {
|
|
25749
26082
|
if (!_this.indoorState) {
|
|
25750
26083
|
return !style.name.includes('indoor');
|
|
@@ -25775,11 +26108,13 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
25775
26108
|
}); })
|
|
25776
26109
|
}); }));
|
|
25777
26110
|
}
|
|
25778
|
-
else if (typeof this.serviceOptions.
|
|
25779
|
-
newPromise = new HijackablePromise(this._request(this.serviceOptions.domain, constants.styleResourcePath + "/mapconfigurations/metadata/" + this.serviceOptions.
|
|
26111
|
+
else if (typeof this.serviceOptions.mapConfiguration === 'string') {
|
|
26112
|
+
newPromise = new HijackablePromise(this._request(this.serviceOptions.domain, constants.styleResourcePath + "/mapconfigurations/metadata/" + this.serviceOptions.mapConfiguration, "StyleDefinitions"
|
|
26113
|
+
// reassign properties from legacy mapConfiguration to new structure if needed
|
|
26114
|
+
).then(function (definitions) { return (__assign(__assign({}, definitions), { defaultConfiguration: definitions.defaultConfiguration || definitions['defaultStyle'], configurations: definitions.configurations || definitions['styles'] })); }));
|
|
25780
26115
|
}
|
|
25781
26116
|
else {
|
|
25782
|
-
newPromise = HijackablePromise.resolve(this.serviceOptions.
|
|
26117
|
+
newPromise = HijackablePromise.resolve(this.serviceOptions.mapConfiguration);
|
|
25783
26118
|
}
|
|
25784
26119
|
if (this.initPromise) {
|
|
25785
26120
|
this.initPromise.switchWith(newPromise);
|
|
@@ -25789,7 +26124,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
25789
26124
|
this.initPromise = newPromise;
|
|
25790
26125
|
}
|
|
25791
26126
|
// propagate styleset change
|
|
25792
|
-
this.initPromise.then(function (styleset) { return _this.map._invokeEvent("
|
|
26127
|
+
this.initPromise.then(function (styleset) { return _this.map._invokeEvent("mapconfigurationchanged", styleset); });
|
|
25793
26128
|
return this.initPromise;
|
|
25794
26129
|
};
|
|
25795
26130
|
/**
|
|
@@ -25809,16 +26144,153 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
25809
26144
|
}
|
|
25810
26145
|
throw Error("Style definition does not contain neither URL nor style object.");
|
|
25811
26146
|
};
|
|
26147
|
+
StyleManager.prototype.deriveNewStyle = function (previousStyle, nextStyle) {
|
|
26148
|
+
// Layers in the next style with default properties that do not align with current StyleOptions
|
|
26149
|
+
// should be modified before they are applied to the map.
|
|
26150
|
+
var styleOptions = this.map.getStyle();
|
|
26151
|
+
var trafficOptions = this.map.getTraffic();
|
|
26152
|
+
return __assign(__assign({}, nextStyle), {
|
|
26153
|
+
// force a replacement of language placeholder in the tileset url to avoid resolution to a same cache with placeholders on language change
|
|
26154
|
+
sources: Object.entries(nextStyle.sources).reduce(function (newSources, _a) {
|
|
26155
|
+
var _b = __read(_a, 2), sourceKey = _b[0], source = _b[1];
|
|
26156
|
+
var newSource = __assign({}, source);
|
|
26157
|
+
if ('url' in newSource && typeof newSource.url === 'string') {
|
|
26158
|
+
if (newSource.url.includes(constants.languagePlaceHolder)) {
|
|
26159
|
+
newSource.url = newSource.url.replace(constants.languagePlaceHolder, styleOptions.language);
|
|
26160
|
+
}
|
|
26161
|
+
}
|
|
26162
|
+
newSources[sourceKey] = newSource;
|
|
26163
|
+
return newSources;
|
|
26164
|
+
}, {}), layers: nextStyle.layers.map(function (layer) {
|
|
26165
|
+
var _a, _b, _c, _d, _e;
|
|
26166
|
+
var nextLayer = __assign({}, layer);
|
|
26167
|
+
var layerGroup = LayerGroupComparator.getLayerGroup(nextLayer);
|
|
26168
|
+
if (!layerGroup) {
|
|
26169
|
+
return nextLayer;
|
|
26170
|
+
}
|
|
26171
|
+
// 1. Set visiblity of fill-extrusion layers according to StyleOptions.showBuildingModels
|
|
26172
|
+
if (!styleOptions.showBuildingModels && nextLayer.type === "fill-extrusion") {
|
|
26173
|
+
nextLayer.layout = (_a = nextLayer.layout) !== null && _a !== void 0 ? _a : {};
|
|
26174
|
+
nextLayer.layout.visibility = "none";
|
|
26175
|
+
}
|
|
26176
|
+
else if (nextLayer.type === "fill-extrusion") {
|
|
26177
|
+
nextLayer.layout = (_b = nextLayer.layout) !== null && _b !== void 0 ? _b : {};
|
|
26178
|
+
nextLayer.layout.visibility = "visible";
|
|
26179
|
+
}
|
|
26180
|
+
// 2. Set visibility of traffic layers depending on traffic settings.
|
|
26181
|
+
if (trafficOptions.flow !== "none" && layerGroup) {
|
|
26182
|
+
if (layerGroup === "traffic_" + trafficOptions.flow && nextLayer.type == "line") {
|
|
26183
|
+
nextLayer.layout = (_c = nextLayer.layout) !== null && _c !== void 0 ? _c : {};
|
|
26184
|
+
nextLayer.layout.visibility = "visible";
|
|
26185
|
+
}
|
|
26186
|
+
}
|
|
26187
|
+
// 3. Set visibility of labels
|
|
26188
|
+
var isLabelLayerGroup = layerGroup === 'labels' || layerGroup === 'labels_places' || layerGroup === 'labels_indoor';
|
|
26189
|
+
if (isLabelLayerGroup && nextLayer.type === 'symbol') {
|
|
26190
|
+
if (styleOptions.showLabels) {
|
|
26191
|
+
nextLayer.layout = (_d = nextLayer.layout) !== null && _d !== void 0 ? _d : {};
|
|
26192
|
+
nextLayer.layout.visibility = "visible";
|
|
26193
|
+
}
|
|
26194
|
+
else {
|
|
26195
|
+
nextLayer.layout = (_e = nextLayer.layout) !== null && _e !== void 0 ? _e : {};
|
|
26196
|
+
nextLayer.layout.visibility = "none";
|
|
26197
|
+
}
|
|
26198
|
+
}
|
|
26199
|
+
return nextLayer;
|
|
26200
|
+
}) });
|
|
26201
|
+
};
|
|
26202
|
+
StyleManager.prototype.injectUserLayersIntoStyle = function (previousStyle, nextStyle, layerGroupLayers) {
|
|
26203
|
+
// Custom layers added to mapbox through this SDK should be carried over to the next style.
|
|
26204
|
+
return !previousStyle
|
|
26205
|
+
? nextStyle
|
|
26206
|
+
: this.map.layers._getUserLayers().reduce(function (style, userLayer) {
|
|
26207
|
+
if (userLayer.layer instanceof WebGLLayer) {
|
|
26208
|
+
// mapbox custom layers cannot be serialized and preserved,
|
|
26209
|
+
// return to continue to the next user layer.
|
|
26210
|
+
return style;
|
|
26211
|
+
}
|
|
26212
|
+
var before = layerGroupLayers[userLayer.before] && layerGroupLayers[userLayer.before].length > 0
|
|
26213
|
+
? layerGroupLayers[userLayer.before][0]
|
|
26214
|
+
: undefined;
|
|
26215
|
+
var layer = previousStyle.layers.find(function (layer) { return layer.id === userLayer.layer.getId(); });
|
|
26216
|
+
// when setStyle diff attempt is unsuccesful, _load will be called on the style that may have already injected user layers -> clean it up
|
|
26217
|
+
var existingLayerIdx = nextStyle.layers.findIndex(function (layer) { return layer.id === userLayer.layer.getId(); });
|
|
26218
|
+
if (existingLayerIdx > -1) {
|
|
26219
|
+
nextStyle.layers.splice(existingLayerIdx, 1);
|
|
26220
|
+
}
|
|
26221
|
+
if (layer) {
|
|
26222
|
+
var sourcesToCopy = new Set(Array.from(userLayer.layer._getSourceIds())
|
|
26223
|
+
.map(function (sourceId) { return previousStyle.sources[sourceId] ? { source: previousStyle.sources[sourceId], id: sourceId } : undefined; })
|
|
26224
|
+
.filter(function (source) { return source !== undefined; }));
|
|
26225
|
+
var insertIdx = before ? style.layers.findIndex(function (layer) { return layer.id === before.id; }) : -1;
|
|
26226
|
+
if (insertIdx > -1) {
|
|
26227
|
+
style.layers.splice(insertIdx, 0, layer);
|
|
26228
|
+
}
|
|
26229
|
+
else {
|
|
26230
|
+
style.layers.push(layer);
|
|
26231
|
+
}
|
|
26232
|
+
sourcesToCopy.forEach(function (_a) {
|
|
26233
|
+
var source = _a.source, id = _a.id;
|
|
26234
|
+
style.sources[id] = source;
|
|
26235
|
+
});
|
|
26236
|
+
}
|
|
26237
|
+
return style;
|
|
26238
|
+
}, __assign({}, nextStyle));
|
|
26239
|
+
};
|
|
25812
26240
|
/**
|
|
25813
26241
|
* @internal
|
|
25814
26242
|
*/
|
|
25815
26243
|
StyleManager.prototype.setStyle = function (styleOptions, diff) {
|
|
26244
|
+
var _this = this;
|
|
25816
26245
|
if (diff === void 0) { diff = true; }
|
|
25817
26246
|
try {
|
|
25818
26247
|
this.map._getMap().setStyle(this.getStyle(styleOptions), {
|
|
25819
26248
|
diff: diff,
|
|
25820
|
-
|
|
25821
|
-
|
|
26249
|
+
validate: this.serviceOptions.validateStyle,
|
|
26250
|
+
transformStyle: function (previousStyle, nextStyle) {
|
|
26251
|
+
// 1. derive the base new style (without user layers)
|
|
26252
|
+
var targetStyle = _this.deriveNewStyle(previousStyle, nextStyle);
|
|
26253
|
+
// 2. derive layer groups for the new style
|
|
26254
|
+
var layerGroupLayers = targetStyle.layers
|
|
26255
|
+
.map(function (nextLayer) { return ({ nextLayer: nextLayer, layerGroup: LayerGroupComparator.getLayerGroup(nextLayer) }); })
|
|
26256
|
+
.filter(function (_a) {
|
|
26257
|
+
var nextLayer = _a.nextLayer, layerGroup = _a.layerGroup;
|
|
26258
|
+
return layerGroup !== undefined;
|
|
26259
|
+
})
|
|
26260
|
+
.reduce(function (layerGroupLayers, _a) {
|
|
26261
|
+
var _b;
|
|
26262
|
+
var nextLayer = _a.nextLayer, layerGroup = _a.layerGroup;
|
|
26263
|
+
return (__assign(__assign({}, layerGroupLayers), (_b = {}, _b[layerGroup] = layerGroup in layerGroupLayers ? __spread(layerGroupLayers[layerGroup], [nextLayer]) : [nextLayer], _b)));
|
|
26264
|
+
}, {});
|
|
26265
|
+
// 3. copy user layers and sources from previous style into new one
|
|
26266
|
+
var targetStyleWithUserLayers = _this.injectUserLayersIntoStyle(previousStyle, nextStyle, layerGroupLayers);
|
|
26267
|
+
// 4. side effects: sync our control's LayerManager and SourceManager
|
|
26268
|
+
var nextFundamentalLayers = Object.entries(layerGroupLayers).map(function (_a) {
|
|
26269
|
+
var _b = __read(_a, 2), layerGroupId = _b[0], layers = _b[1];
|
|
26270
|
+
return _this._buildFundamentalLayerFrom(layers, layerGroupId);
|
|
26271
|
+
});
|
|
26272
|
+
var layerIndex = _this.map.layers._getUserLayers().reduce(function (layerIndex, userLayer) {
|
|
26273
|
+
var layerInsertIndex = userLayer.before ? layerIndex.findIndex(function (layer) { return layer.getId() === userLayer.before; }) : -1;
|
|
26274
|
+
if (layerInsertIndex > -1) {
|
|
26275
|
+
layerIndex.splice(layerInsertIndex, 0, userLayer.layer);
|
|
26276
|
+
}
|
|
26277
|
+
else {
|
|
26278
|
+
layerIndex.push(userLayer.layer);
|
|
26279
|
+
}
|
|
26280
|
+
return layerIndex;
|
|
26281
|
+
}, nextFundamentalLayers);
|
|
26282
|
+
_this.map.layers['layerIndex'] = layerIndex;
|
|
26283
|
+
_this.map.sources._syncSources(targetStyleWithUserLayers.sources);
|
|
26284
|
+
// 5. temporarily patch style data event
|
|
26285
|
+
// FIXME: below diffing will be soon fixed on the maplibre side
|
|
26286
|
+
// If there was a previous styledata change event attached, remove it.
|
|
26287
|
+
// When the sprite url changes between style changes then maplibre can't perform the diff
|
|
26288
|
+
// In such cases it recalculate the style again. Removing previous attached
|
|
26289
|
+
// event listener makes sure that style changed event is not fired twice in these cases.
|
|
26290
|
+
_this.map.events.remove("styledata", _this._onStyleData);
|
|
26291
|
+
_this.map.events.addOnce("styledata", _this._onStyleData);
|
|
26292
|
+
return targetStyleWithUserLayers;
|
|
26293
|
+
}
|
|
25822
26294
|
});
|
|
25823
26295
|
}
|
|
25824
26296
|
catch (e) {
|
|
@@ -25848,30 +26320,30 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
25848
26320
|
/**
|
|
25849
26321
|
* Replaces the style set used. Very costly as it reloads all controls and resources.
|
|
25850
26322
|
*/
|
|
25851
|
-
StyleManager.prototype.setMapConfiguration = function (
|
|
26323
|
+
StyleManager.prototype.setMapConfiguration = function (mapConfiguration, styleName) {
|
|
25852
26324
|
var _this = this;
|
|
25853
|
-
this.serviceOptions.
|
|
25854
|
-
if (typeof
|
|
26325
|
+
this.serviceOptions.mapConfiguration = mapConfiguration;
|
|
26326
|
+
if (typeof mapConfiguration === 'string') {
|
|
25855
26327
|
this.initStyleset();
|
|
25856
26328
|
}
|
|
25857
26329
|
else {
|
|
25858
26330
|
if (this.initPromise) {
|
|
25859
|
-
this.initPromise.hijackAndResolve(
|
|
26331
|
+
this.initPromise.hijackAndResolve(mapConfiguration);
|
|
25860
26332
|
}
|
|
25861
26333
|
else {
|
|
25862
|
-
this.initPromise = HijackablePromise.resolve(
|
|
26334
|
+
this.initPromise = HijackablePromise.resolve(mapConfiguration);
|
|
25863
26335
|
}
|
|
25864
26336
|
}
|
|
25865
26337
|
this.definitions().then(function (definitions) {
|
|
25866
|
-
var targetStyleName = definitions.
|
|
25867
|
-
if (definitions.
|
|
26338
|
+
var targetStyleName = definitions.defaultConfiguration;
|
|
26339
|
+
if (definitions.configurations.find(function (s) { return s.name === styleName; })) {
|
|
25868
26340
|
targetStyleName = styleName;
|
|
25869
26341
|
}
|
|
25870
26342
|
_this.map.setStyle({ style: targetStyleName });
|
|
25871
26343
|
});
|
|
25872
26344
|
};
|
|
25873
26345
|
StyleManager.prototype.getMapConfiguration = function () {
|
|
25874
|
-
return this.serviceOptions.
|
|
26346
|
+
return this.serviceOptions.mapConfiguration;
|
|
25875
26347
|
};
|
|
25876
26348
|
// backward-compatibility: this method preserves the interface that azure-maps-indoor@2.0.6 assumes
|
|
25877
26349
|
StyleManager.prototype.setStyleSet = function (styleSet) {
|
|
@@ -25888,147 +26360,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
25888
26360
|
StyleManager.prototype.clearStyleSet = function () {
|
|
25889
26361
|
this.unsetIndoorState();
|
|
25890
26362
|
};
|
|
25891
|
-
/**
|
|
25892
|
-
* Function invoked by mapbox after a style is fetched but before it is committed to the map state.
|
|
25893
|
-
*
|
|
25894
|
-
* @param previousStyle The current style.
|
|
25895
|
-
* @param nextStyle The next style which is to be applied.
|
|
25896
|
-
* @param preserveLayer Preserve a layer from the previous style in the next style.
|
|
25897
|
-
* @param updatePaintProperty Modify paint properties of a layer in the next style before the style is applied.
|
|
25898
|
-
* @param updateLayoutProperty Modify layout properties of a layer in the next style before the style is applied.
|
|
25899
|
-
* @param updateFilter Modify filter property of a layer in the next style before the style is applied.
|
|
25900
|
-
*/
|
|
25901
|
-
StyleManager.prototype._stylePatch = function (previousStyle, nextStyle, preserveLayer, updatePaintProperty, updateLayoutProperty, updateFilter) {
|
|
25902
|
-
var _this = this;
|
|
25903
|
-
// Layers in the next style with default properties that do not align with current StyleOptions
|
|
25904
|
-
// should be modified before they are applied to the map.
|
|
25905
|
-
var styleOptions = this.map.getStyle();
|
|
25906
|
-
var trafficOptions = this.map.getTraffic();
|
|
25907
|
-
// force a replacement of language placeholder in the tileset url to avoid resolution to a same cache with placeholders on language change
|
|
25908
|
-
nextStyle.sources = Object.entries(nextStyle.sources).reduce(function (newSources, _a) {
|
|
25909
|
-
var _b = __read(_a, 2), sourceKey = _b[0], source = _b[1];
|
|
25910
|
-
var newSource = __assign({}, source);
|
|
25911
|
-
if ('url' in newSource && typeof newSource.url === 'string') {
|
|
25912
|
-
if (newSource.url.includes(constants.languagePlaceHolder)) {
|
|
25913
|
-
newSource.url = newSource.url.replace(constants.languagePlaceHolder, styleOptions.language);
|
|
25914
|
-
}
|
|
25915
|
-
}
|
|
25916
|
-
newSources[sourceKey] = newSource;
|
|
25917
|
-
return newSources;
|
|
25918
|
-
}, {});
|
|
25919
|
-
// A FundamentalMapLayer (grouped layer) representation of the next style must be built.
|
|
25920
|
-
var previousLayers = this.map.layers.getLayers();
|
|
25921
|
-
var nextLayers = [];
|
|
25922
|
-
var currentLayerGroupId = "";
|
|
25923
|
-
var currentLayerGroupLayers = [];
|
|
25924
|
-
var advanceLayerGroup = function (nextLayerGroup) {
|
|
25925
|
-
nextLayers.push(_this._buildFundamentalLayerFrom(currentLayerGroupLayers, currentLayerGroupId));
|
|
25926
|
-
currentLayerGroupId = nextLayerGroup;
|
|
25927
|
-
currentLayerGroupLayers = [];
|
|
25928
|
-
};
|
|
25929
|
-
nextStyle.layers.forEach(function (nextLayer) {
|
|
25930
|
-
var _a, _b, _c, _d, _e;
|
|
25931
|
-
var layerGroup = LayerGroupComparator.getLayerGroup(nextLayer);
|
|
25932
|
-
currentLayerGroupId = currentLayerGroupId ? currentLayerGroupId : layerGroup;
|
|
25933
|
-
// Set visiblity of fill-extrusion layers according to StyleOptions.showBuildingModels
|
|
25934
|
-
if (!styleOptions.showBuildingModels && nextLayer.type === "fill-extrusion") {
|
|
25935
|
-
updateLayoutProperty(nextLayer.id, "visibility", "none");
|
|
25936
|
-
nextLayer.layout = (_a = nextLayer.layout) !== null && _a !== void 0 ? _a : {};
|
|
25937
|
-
nextLayer.layout.visibility = "none";
|
|
25938
|
-
}
|
|
25939
|
-
else if (nextLayer.type === "fill-extrusion") {
|
|
25940
|
-
updateLayoutProperty(nextLayer.id, "visibility", "visible");
|
|
25941
|
-
nextLayer.layout = (_b = nextLayer.layout) !== null && _b !== void 0 ? _b : {};
|
|
25942
|
-
nextLayer.layout.visibility = "visible";
|
|
25943
|
-
}
|
|
25944
|
-
// Set visibility of traffic layers depending on traffic settings.
|
|
25945
|
-
if (trafficOptions.flow !== "none" && layerGroup) {
|
|
25946
|
-
if (layerGroup === "traffic_" + trafficOptions.flow && nextLayer.type == "line") {
|
|
25947
|
-
updateLayoutProperty(nextLayer.id, "visibility", "visible");
|
|
25948
|
-
nextLayer.layout = (_c = nextLayer.layout) !== null && _c !== void 0 ? _c : {};
|
|
25949
|
-
nextLayer.layout.visibility = "visible";
|
|
25950
|
-
}
|
|
25951
|
-
}
|
|
25952
|
-
// Set visibility of labels
|
|
25953
|
-
var isLabelLayerGroup = layerGroup === 'labels' || layerGroup === 'labels_places' || layerGroup === 'labels_indoor';
|
|
25954
|
-
if (isLabelLayerGroup && nextLayer.type === 'symbol') {
|
|
25955
|
-
if (styleOptions.showLabels) {
|
|
25956
|
-
updateLayoutProperty(nextLayer.id, "visibility", "visible");
|
|
25957
|
-
nextLayer.layout = (_d = nextLayer.layout) !== null && _d !== void 0 ? _d : {};
|
|
25958
|
-
nextLayer.layout.visibility = "visible";
|
|
25959
|
-
}
|
|
25960
|
-
else {
|
|
25961
|
-
updateLayoutProperty(nextLayer.id, "visibility", "none");
|
|
25962
|
-
nextLayer.layout = (_e = nextLayer.layout) !== null && _e !== void 0 ? _e : {};
|
|
25963
|
-
nextLayer.layout.visibility = "none";
|
|
25964
|
-
}
|
|
25965
|
-
}
|
|
25966
|
-
// Once this _stylePatch returns control to maplibre the next style will be applied immediately in the same context.
|
|
25967
|
-
// To avoid potential data races update LayerManager with new a new set of FundamentalMapLayers from here instead of
|
|
25968
|
-
// waiting for a styledata.load event to trigger a sync in a different context.
|
|
25969
|
-
if (layerGroup) {
|
|
25970
|
-
if (currentLayerGroupLayers.length > 0 && layerGroup != currentLayerGroupId) {
|
|
25971
|
-
advanceLayerGroup(layerGroup);
|
|
25972
|
-
}
|
|
25973
|
-
currentLayerGroupLayers.push(nextLayer);
|
|
25974
|
-
}
|
|
25975
|
-
else if (currentLayerGroupLayers.length > 0) {
|
|
25976
|
-
advanceLayerGroup(layerGroup);
|
|
25977
|
-
}
|
|
25978
|
-
});
|
|
25979
|
-
if (currentLayerGroupLayers.length > 0) {
|
|
25980
|
-
advanceLayerGroup("");
|
|
25981
|
-
}
|
|
25982
|
-
// Update FundamentalMapLayers in LayerManager
|
|
25983
|
-
var userLayers = this.map.layers._getUserLayers();
|
|
25984
|
-
var firstUserLayer = userLayers[0];
|
|
25985
|
-
var layersToRemove = previousLayers.filter(function (c) {
|
|
25986
|
-
return (nextLayers.findIndex(function (n) { return c.getId() === n.getId(); }) < 0 &&
|
|
25987
|
-
userLayers.findIndex(function (n) { return c.getId() === n.layer.getId(); }) < 0);
|
|
25988
|
-
});
|
|
25989
|
-
var prevNextIntersection = nextLayers.filter(function (n) { return previousLayers.find(function (c) { return c.getId() === n.getId(); }); });
|
|
25990
|
-
var ePrevNextIntersection = prevNextIntersection.entries();
|
|
25991
|
-
var replace = ePrevNextIntersection.next();
|
|
25992
|
-
nextLayers.forEach(function (newFundamentalLayer) {
|
|
25993
|
-
if (replace.value && replace.value[1].getId() === newFundamentalLayer.getId()) {
|
|
25994
|
-
// Replace the existing layer with this ID with the new one.
|
|
25995
|
-
var insertBefore = previousLayers.findIndex(function (l) { return l.getId() === newFundamentalLayer.getId(); });
|
|
25996
|
-
_this.map.layers.remove(newFundamentalLayer.getId());
|
|
25997
|
-
_this.map.layers.add(newFundamentalLayer, previousLayers[insertBefore].getId());
|
|
25998
|
-
replace = ePrevNextIntersection.next();
|
|
25999
|
-
}
|
|
26000
|
-
else {
|
|
26001
|
-
if (replace.value) {
|
|
26002
|
-
// Insert new layer before the next common layer.
|
|
26003
|
-
_this.map.layers.add(newFundamentalLayer, replace.value[1]);
|
|
26004
|
-
}
|
|
26005
|
-
else {
|
|
26006
|
-
// Insert new layer underneath the first user layer, or the .
|
|
26007
|
-
_this.map.layers.add(newFundamentalLayer, firstUserLayer === null || firstUserLayer === void 0 ? void 0 : firstUserLayer.layer);
|
|
26008
|
-
}
|
|
26009
|
-
}
|
|
26010
|
-
});
|
|
26011
|
-
layersToRemove.forEach(function (layer) {
|
|
26012
|
-
_this.map.layers.remove(layer);
|
|
26013
|
-
});
|
|
26014
|
-
// Layers added to mapbox through this SDK since loading the last style should be
|
|
26015
|
-
// carried over to the next style.
|
|
26016
|
-
userLayers.forEach(function (userLayer) {
|
|
26017
|
-
var before = undefined;
|
|
26018
|
-
if (_this.map.layers.getLayerById(userLayer.before)) {
|
|
26019
|
-
var beforeCandidates = _this.map.layers.getLayerById(userLayer.before)._buildLayers();
|
|
26020
|
-
before = (beforeCandidates.length > 0) ? beforeCandidates[0] : undefined;
|
|
26021
|
-
}
|
|
26022
|
-
preserveLayer(userLayer.layer.getId(), before === null || before === void 0 ? void 0 : before.id);
|
|
26023
|
-
});
|
|
26024
|
-
this.map.sources._syncSources(nextStyle.sources);
|
|
26025
|
-
// If there was a previous styledata change event attached, remove it.
|
|
26026
|
-
// When the sprite url changes between style changes then mapbox can't perform the diff
|
|
26027
|
-
// In such cases it recalculate the style again. Removing previous attached
|
|
26028
|
-
// event listener makes sure that style changed event is not fired twice in these cases.
|
|
26029
|
-
this.map.events.remove("styledata", this._onStyleData);
|
|
26030
|
-
this.map.events.addOnce("styledata", this._onStyleData);
|
|
26031
|
-
};
|
|
26032
26363
|
StyleManager.prototype._buildFundamentalLayerFrom = function (layers, id) {
|
|
26033
26364
|
if (layers && layers.length > 0) {
|
|
26034
26365
|
var newLayer = new FundamentalMapLayer(layers, id);
|
|
@@ -26172,6 +26503,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
26172
26503
|
}
|
|
26173
26504
|
else {
|
|
26174
26505
|
var mapboxMapOptions = {
|
|
26506
|
+
antialias: _this.styleOptions.antialias,
|
|
26175
26507
|
attributionControl: false,
|
|
26176
26508
|
container: container,
|
|
26177
26509
|
fadeDuration: _this.serviceOptions.fadeDuration,
|
|
@@ -26199,10 +26531,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
26199
26531
|
if (_this.serviceOptions.transformRequest) {
|
|
26200
26532
|
merge_1(requestParams, _this.serviceOptions.transformRequest(requestParams.url, resourceType));
|
|
26201
26533
|
}
|
|
26534
|
+
// TODO: fix type variation
|
|
26202
26535
|
return requestParams;
|
|
26203
26536
|
}
|
|
26204
26537
|
};
|
|
26205
|
-
mapboxMap = new
|
|
26538
|
+
mapboxMap = new maplibregl.Map(mapboxMapOptions);
|
|
26206
26539
|
}
|
|
26207
26540
|
try {
|
|
26208
26541
|
_this.map = mapboxMap;
|
|
@@ -26370,6 +26703,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
26370
26703
|
*/
|
|
26371
26704
|
Map.prototype.removeRequestTransformer = function (transformer) { this.serviceOptions.removeTransformer(transformer); };
|
|
26372
26705
|
Map.prototype.setCamera = function (options, fromControl) {
|
|
26706
|
+
var _a;
|
|
26373
26707
|
if (fromControl === void 0) { fromControl = false; }
|
|
26374
26708
|
var mapboxCameraOptions;
|
|
26375
26709
|
var maxBounds;
|
|
@@ -26378,13 +26712,22 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
26378
26712
|
var cameraBoundsOptions = new CameraBoundsOptions()
|
|
26379
26713
|
.merge({ maxZoom: this.getCamera().maxZoom }, options);
|
|
26380
26714
|
var bounds = this._generateSafeBounds(cameraBoundsOptions.bounds);
|
|
26381
|
-
|
|
26715
|
+
var cameraForBoundsOptions = {
|
|
26382
26716
|
padding: cameraBoundsOptions.padding,
|
|
26383
26717
|
offset: cameraBoundsOptions.offset,
|
|
26384
26718
|
maxZoom: cameraBoundsOptions.maxZoom
|
|
26385
|
-
}
|
|
26719
|
+
};
|
|
26720
|
+
mapboxCameraOptions = this.map.cameraForBounds(bounds, cameraForBoundsOptions);
|
|
26386
26721
|
if (!mapboxCameraOptions) {
|
|
26387
|
-
|
|
26722
|
+
var currentContainer = (_a = this.map) === null || _a === void 0 ? void 0 : _a.getContainer();
|
|
26723
|
+
var errorDetails = {
|
|
26724
|
+
message: "The map cannot be fit to the current canvas with the given CameraBoundsOptions.",
|
|
26725
|
+
containerWidth: currentContainer === null || currentContainer === void 0 ? void 0 : currentContainer.clientWidth,
|
|
26726
|
+
containerHeight: currentContainer === null || currentContainer === void 0 ? void 0 : currentContainer.clientHeight,
|
|
26727
|
+
safeBounds: bounds,
|
|
26728
|
+
cameraForBoundsOptions: cameraForBoundsOptions
|
|
26729
|
+
};
|
|
26730
|
+
throw new Error(JSON.stringify(errorDetails));
|
|
26388
26731
|
}
|
|
26389
26732
|
this.map.setMaxZoom(cameraBoundsOptions.maxZoom);
|
|
26390
26733
|
this._invokeEvent("maxzoomchanged", this.map.getMaxZoom());
|
|
@@ -27162,6 +27505,16 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
27162
27505
|
Map.prototype.stop = function () {
|
|
27163
27506
|
this.map.stop();
|
|
27164
27507
|
};
|
|
27508
|
+
/**
|
|
27509
|
+
* Trigger the rendering of a single frame.
|
|
27510
|
+
* Use this method with WebGL layers to repaint the map when the layer's
|
|
27511
|
+
* properties or properties associated with the layer's source change.
|
|
27512
|
+
* Calling this multiple times before the next frame is rendered will still
|
|
27513
|
+
* result in only a single frame being rendered.
|
|
27514
|
+
*/
|
|
27515
|
+
Map.prototype.triggerRepaint = function () {
|
|
27516
|
+
this.map.triggerRepaint();
|
|
27517
|
+
};
|
|
27165
27518
|
/**
|
|
27166
27519
|
* @internal
|
|
27167
27520
|
*/
|
|
@@ -27293,9 +27646,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
27293
27646
|
return;
|
|
27294
27647
|
}
|
|
27295
27648
|
// Check if the default style is set by the client and if it exists in the current style set
|
|
27296
|
-
this.styles.definitions().then(function (
|
|
27297
|
-
if (!_this.styleOptions.style || !
|
|
27298
|
-
_this.styleOptions.style =
|
|
27649
|
+
this.styles.definitions().then(function (mapConfiguration) {
|
|
27650
|
+
if (!_this.styleOptions.style || !mapConfiguration.configurations.map(function (mapConfigurationStyle) { return mapConfigurationStyle.name; }).includes(_this.styleOptions.style)) {
|
|
27651
|
+
_this.styleOptions.style = mapConfiguration.defaultConfiguration;
|
|
27299
27652
|
}
|
|
27300
27653
|
_this.styleOptions = styleOptions;
|
|
27301
27654
|
_this._rebuildStyle(diff);
|
|
@@ -27937,7 +28290,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
27937
28290
|
domain: env.staticAssetsDomain,
|
|
27938
28291
|
path: "sdk/javascript/mapcontrol/" + Version.getEndpointVersion() + "/mapbox-gl-rtl-text.min.js"
|
|
27939
28292
|
});
|
|
27940
|
-
|
|
28293
|
+
maplibregl.setRTLTextPlugin(rtlPluginUrl.toString(), function (error) {
|
|
27941
28294
|
if (error) {
|
|
27942
28295
|
console.warn(error);
|
|
27943
28296
|
}
|