azure-maps-control 2.1.17 → 2.2.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/ReadMe.md +5 -1
- package/dist/atlas-core-bare.js +440 -111
- package/dist/atlas-core-bare.min.js +1 -1
- package/dist/atlas-core.js +440 -111
- package/dist/atlas-core.min.js +1 -1
- package/dist/atlas.js +440 -111
- package/dist/atlas.min.js +1 -1
- package/package.json +1 -1
- package/typings/index.d.ts +195 -13
package/dist/atlas.js
CHANGED
|
@@ -43209,7 +43209,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
43209
43209
|
domain: "atlas.microsoft.com",
|
|
43210
43210
|
staticAssetsDomain: "atlas.microsoft.com",
|
|
43211
43211
|
stylePath: "styling",
|
|
43212
|
-
styleDefinitionsVersion: "
|
|
43212
|
+
styleDefinitionsVersion: "2022-08-05",
|
|
43213
43213
|
appInsightsKey: "e96cb745-c6f5-409c-a775-c4313e468c1d",
|
|
43214
43214
|
aadInstance: "https://login.microsoftonline.com/"
|
|
43215
43215
|
};
|
|
@@ -43488,7 +43488,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
43488
43488
|
return Url;
|
|
43489
43489
|
}());
|
|
43490
43490
|
|
|
43491
|
-
var version = "2.
|
|
43491
|
+
var version = "2.2.0";
|
|
43492
43492
|
|
|
43493
43493
|
/**
|
|
43494
43494
|
* A helper class that provides methods for getting various forms of the map controls current version.
|
|
@@ -47499,7 +47499,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
47499
47499
|
_this.setSelectedStyle(newStyle);
|
|
47500
47500
|
}
|
|
47501
47501
|
};
|
|
47502
|
-
_this.
|
|
47502
|
+
_this.onMapConfigurationChange = function (definitions) {
|
|
47503
47503
|
if (!_this.styleOpsGrid) {
|
|
47504
47504
|
return;
|
|
47505
47505
|
}
|
|
@@ -47507,8 +47507,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
47507
47507
|
_this.styleButtons.clear();
|
|
47508
47508
|
_this.populateOpsGridFromDefinitions(definitions);
|
|
47509
47509
|
};
|
|
47510
|
-
_this.mapToFriendlyStyleName = function (name,
|
|
47511
|
-
var style =
|
|
47510
|
+
_this.mapToFriendlyStyleName = function (name, mapConfiguration) {
|
|
47511
|
+
var style = mapConfiguration.configurations.find(function (style) { return style.name === name; });
|
|
47512
47512
|
return (style === null || style === void 0 ? void 0 : style.displayName) || name;
|
|
47513
47513
|
};
|
|
47514
47514
|
_this.options = new StyleControlOptions().merge(cloneDeep_1(options));
|
|
@@ -47604,7 +47604,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
47604
47604
|
this.styleOpsGrid = null;
|
|
47605
47605
|
this.styleButtons.clear();
|
|
47606
47606
|
this.map.events.remove("stylechanged", this.onStyleChange);
|
|
47607
|
-
this.map.events.remove("
|
|
47607
|
+
this.map.events.remove("mapconfigurationchanged", this.onMapConfigurationChange);
|
|
47608
47608
|
};
|
|
47609
47609
|
/**
|
|
47610
47610
|
* Set the style that need to be displayed as currently selected.
|
|
@@ -47623,8 +47623,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
47623
47623
|
var _b = __read(_a, 2), buttonStyleName = _b[0], button = _b[1];
|
|
47624
47624
|
return button.setAttribute('aria-current', buttonStyleName === styleName ? 'true' : 'false');
|
|
47625
47625
|
});
|
|
47626
|
-
this.map.styles.definitions().then(function (
|
|
47627
|
-
var newAlt = _this.mapToFriendlyStyleName(styleName,
|
|
47626
|
+
this.map.styles.definitions().then(function (mapConfiguration) {
|
|
47627
|
+
var newAlt = _this.mapToFriendlyStyleName(styleName, mapConfiguration);
|
|
47628
47628
|
if (image_1.alt !== newAlt) {
|
|
47629
47629
|
image_1.alt = newAlt;
|
|
47630
47630
|
}
|
|
@@ -47654,10 +47654,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
47654
47654
|
styleButton.removeAttribute("disabled");
|
|
47655
47655
|
}
|
|
47656
47656
|
};
|
|
47657
|
-
StyleControl.prototype.buildSelectStyleBtn = function (name,
|
|
47657
|
+
StyleControl.prototype.buildSelectStyleBtn = function (name, mapConfiguration, fetchIconPromise) {
|
|
47658
47658
|
var _this = this;
|
|
47659
47659
|
var styleOptionButton = document.createElement("button");
|
|
47660
|
-
var friendlyName = this.mapToFriendlyStyleName(name,
|
|
47660
|
+
var friendlyName = this.mapToFriendlyStyleName(name, mapConfiguration);
|
|
47661
47661
|
styleOptionButton.setAttribute("aria-label", friendlyName);
|
|
47662
47662
|
styleOptionButton.setAttribute("type", "button");
|
|
47663
47663
|
var styleIconImage = new Image();
|
|
@@ -47742,12 +47742,12 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
47742
47742
|
// If a style is one of those to be shown by the style picker also create it's element.
|
|
47743
47743
|
this.map.styles.definitions().then(function (definitions) { return __awaiter(_this, void 0, void 0, function () {
|
|
47744
47744
|
return __generator(this, function (_a) {
|
|
47745
|
-
this.
|
|
47745
|
+
this.onMapConfigurationChange(definitions);
|
|
47746
47746
|
this.map.events.add("stylechanged", this.onStyleChange);
|
|
47747
47747
|
return [2 /*return*/];
|
|
47748
47748
|
});
|
|
47749
47749
|
}); });
|
|
47750
|
-
this.map.events.add("
|
|
47750
|
+
this.map.events.add("mapconfigurationchanged", this.onMapConfigurationChange);
|
|
47751
47751
|
return styleOpsGrid;
|
|
47752
47752
|
};
|
|
47753
47753
|
StyleControl.prototype.populateOpsGridFromDefinitions = function (definitions) {
|
|
@@ -47755,7 +47755,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
47755
47755
|
if (!this.styleOpsGrid) {
|
|
47756
47756
|
return;
|
|
47757
47757
|
}
|
|
47758
|
-
var styles = definitions.
|
|
47758
|
+
var styles = definitions.configurations;
|
|
47759
47759
|
if (Array.isArray(this.options.mapStyles)) {
|
|
47760
47760
|
styles = styles.filter(function (style) { return _this.options.mapStyles.includes(style.name.split("_indoor")[0]); });
|
|
47761
47761
|
}
|
|
@@ -52222,6 +52222,151 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
52222
52222
|
return MultiPolygon;
|
|
52223
52223
|
}());
|
|
52224
52224
|
|
|
52225
|
+
//Based on: https://github.com/mapbox/mapbox-gl-js/blob/main/src/geo/mercator_coordinate.js
|
|
52226
|
+
/**
|
|
52227
|
+
* A `MercatorPoint` object represents a projected three dimensional position.
|
|
52228
|
+
*
|
|
52229
|
+
* `MercatorPoint` uses the web mercator projection ([EPSG:3857](https://epsg.io/3857)) with slightly different units:
|
|
52230
|
+
* - the size of 1 unit is the width of the projected world instead of the "mercator meter"
|
|
52231
|
+
* - the origin of the coordinate space is at the north-west corner instead of the middle.
|
|
52232
|
+
*
|
|
52233
|
+
* For example, `MercatorPoint(0, 0, 0)` is the north-west corner of the mercator world and
|
|
52234
|
+
* `MercatorPoint(1, 1, 0)` is the south-east corner. If you are familiar with
|
|
52235
|
+
* [vector tiles](https://github.com/mapbox/vector-tile-spec) it may be helpful to think
|
|
52236
|
+
* of the coordinate space as the `0/0/0` tile with an extent of `1`.
|
|
52237
|
+
*
|
|
52238
|
+
* The `z` dimension of `MercatorPoint` is conformal. A cube in the mercator coordinate space would be rendered as a cube.
|
|
52239
|
+
*/
|
|
52240
|
+
var MercatorPoint = /** @class */ (function (_super) {
|
|
52241
|
+
__extends(MercatorPoint, _super);
|
|
52242
|
+
/**
|
|
52243
|
+
* Constructs a MercatorPoint.
|
|
52244
|
+
* @param x A points x position in mercator units.
|
|
52245
|
+
* @param y A points y position in mercator units.
|
|
52246
|
+
* @param z A points z position in mercator units.
|
|
52247
|
+
*/
|
|
52248
|
+
function MercatorPoint(x, y, z) {
|
|
52249
|
+
return _super.call(this, x, y, z ? z : 0) || this;
|
|
52250
|
+
}
|
|
52251
|
+
/***********************************
|
|
52252
|
+
* Public static functions
|
|
52253
|
+
***********************************/
|
|
52254
|
+
/**
|
|
52255
|
+
* Converts a position into a mercator point.
|
|
52256
|
+
* @param position Position to convert.
|
|
52257
|
+
* @returns A mercator point.
|
|
52258
|
+
*/
|
|
52259
|
+
MercatorPoint.fromPosition = function (position) {
|
|
52260
|
+
if (position.length >= 2) {
|
|
52261
|
+
return new MercatorPoint((180 + position[0]) / 360, MercatorPoint._latToMercatorY(position[1]), position.length >= 3 ? MercatorPoint._altitudeToMercatorZ(position[2], position[1]) : 0);
|
|
52262
|
+
}
|
|
52263
|
+
return [0, 0, 0];
|
|
52264
|
+
};
|
|
52265
|
+
/**
|
|
52266
|
+
* Converts an array of positions into an array of mercator points.
|
|
52267
|
+
* @param positions Array of positions to convert.
|
|
52268
|
+
* @returns An array of mercator points.
|
|
52269
|
+
*/
|
|
52270
|
+
MercatorPoint.fromPositions = function (positions) {
|
|
52271
|
+
var mercators = [];
|
|
52272
|
+
for (var i = 0, len = positions.length; i < len; i++) {
|
|
52273
|
+
mercators.push(this.fromPosition(positions[i]));
|
|
52274
|
+
}
|
|
52275
|
+
return mercators;
|
|
52276
|
+
};
|
|
52277
|
+
/**
|
|
52278
|
+
* Converts an array of positions into a Float32Array of mercator xyz values.
|
|
52279
|
+
* @param positions Array of positions to convert.
|
|
52280
|
+
* @returns A Float32Array of mercator xyz values.
|
|
52281
|
+
*/
|
|
52282
|
+
MercatorPoint.toFloat32Array = function (positions) {
|
|
52283
|
+
var arr = new Float32Array(positions.length * 3);
|
|
52284
|
+
for (var i = 0, len = positions.length; i < len; i++) {
|
|
52285
|
+
var idx = i * 3;
|
|
52286
|
+
var p = positions[i];
|
|
52287
|
+
//x
|
|
52288
|
+
arr[idx] = (180 + p[0]) / 360;
|
|
52289
|
+
//y
|
|
52290
|
+
arr[idx + 1] = MercatorPoint._latToMercatorY(p[1]);
|
|
52291
|
+
//z
|
|
52292
|
+
arr[idx + 2] = p.length >= 3 ? MercatorPoint._altitudeToMercatorZ(p[2], p[1]) : 0;
|
|
52293
|
+
}
|
|
52294
|
+
return arr;
|
|
52295
|
+
};
|
|
52296
|
+
/**
|
|
52297
|
+
* Converts a mercator point into a map position.
|
|
52298
|
+
* @param mercator Mercator point to convert.
|
|
52299
|
+
* @returns A map position.
|
|
52300
|
+
*/
|
|
52301
|
+
MercatorPoint.toPosition = function (mercator) {
|
|
52302
|
+
if (mercator.length >= 2) {
|
|
52303
|
+
var lat = (360 / Math.PI) * Math.atan(Math.exp(((180 - mercator[1] * 360) * Math.PI) / 180)) - 90;
|
|
52304
|
+
return new Position(mercator[0] * 360 - 180, lat, mercator.length >= 3 ? MercatorPoint._mercatorZToAltitude(mercator[2], mercator[1]) : 0);
|
|
52305
|
+
}
|
|
52306
|
+
return [0, 0, 0];
|
|
52307
|
+
};
|
|
52308
|
+
/**
|
|
52309
|
+
* Converts an array of mercator points into an array of map positions.
|
|
52310
|
+
* @param mercators Mercator points to convert.
|
|
52311
|
+
* @returns An array of map positions.
|
|
52312
|
+
*/
|
|
52313
|
+
MercatorPoint.toPositions = function (mercators) {
|
|
52314
|
+
var positions = [];
|
|
52315
|
+
for (var i = 0, len = mercators.length; i < len; i++) {
|
|
52316
|
+
positions.push(this.toPosition(mercators[i]));
|
|
52317
|
+
}
|
|
52318
|
+
return positions;
|
|
52319
|
+
};
|
|
52320
|
+
/**
|
|
52321
|
+
* Determine the Mercator scale factor for a given latitude, see
|
|
52322
|
+
* https://en.wikipedia.org/wiki/Mercator_projection#Scale_factor
|
|
52323
|
+
*
|
|
52324
|
+
* At the equator the scale factor will be 1, which increases at higher latitudes.
|
|
52325
|
+
*
|
|
52326
|
+
* @param latitude Latitude
|
|
52327
|
+
* @returns The mercator scale factor.
|
|
52328
|
+
*/
|
|
52329
|
+
MercatorPoint.mercatorScale = function (latitude) {
|
|
52330
|
+
return 1 / Math.cos((latitude * Math.PI) / 180);
|
|
52331
|
+
};
|
|
52332
|
+
/**
|
|
52333
|
+
* Returns the distance of 1 meter in `MercatorPoint` units at this latitude.
|
|
52334
|
+
*
|
|
52335
|
+
* For coordinates in real world units using meters, this naturally provides the scale
|
|
52336
|
+
* to transform into `MercatorPoint`s.
|
|
52337
|
+
*
|
|
52338
|
+
* @returns {number} Distance of 1 meter in `MercatorPoint` units.
|
|
52339
|
+
*/
|
|
52340
|
+
MercatorPoint.meterInMercatorUnits = function (latitude) {
|
|
52341
|
+
// 1 meter / circumference at equator in meters * Mercator projection scale factor at this latitude
|
|
52342
|
+
return ((1 / MercatorPoint.earthCircumference) *
|
|
52343
|
+
MercatorPoint.mercatorScale(MercatorPoint._latToMercatorY(latitude)));
|
|
52344
|
+
};
|
|
52345
|
+
/***********************************
|
|
52346
|
+
* Private static functions
|
|
52347
|
+
***********************************/
|
|
52348
|
+
/*
|
|
52349
|
+
* The circumference at a line of latitude in meters.
|
|
52350
|
+
*/
|
|
52351
|
+
MercatorPoint._circumferenceAtLatitude = function (latitude) {
|
|
52352
|
+
return MercatorPoint.earthCircumference * Math.cos((latitude * Math.PI) / 180);
|
|
52353
|
+
};
|
|
52354
|
+
MercatorPoint._altitudeToMercatorZ = function (altitude, latitude) {
|
|
52355
|
+
return altitude / MercatorPoint._circumferenceAtLatitude(latitude);
|
|
52356
|
+
};
|
|
52357
|
+
MercatorPoint._mercatorZToAltitude = function (zoom, y) {
|
|
52358
|
+
return zoom * MercatorPoint._circumferenceAtLatitude(MercatorPoint._latToMercatorY(y));
|
|
52359
|
+
};
|
|
52360
|
+
MercatorPoint._latToMercatorY = function (y) {
|
|
52361
|
+
return (180 - (180 / Math.PI) * Math.log(Math.tan(Math.PI / 4 + (y * Math.PI) / 360))) / 360;
|
|
52362
|
+
};
|
|
52363
|
+
/*
|
|
52364
|
+
* The average circumference of the world in meters.
|
|
52365
|
+
*/
|
|
52366
|
+
MercatorPoint.earthCircumference = 2 * Math.PI * getEarthRadius(); // meters
|
|
52367
|
+
return MercatorPoint;
|
|
52368
|
+
}(Array));
|
|
52369
|
+
|
|
52225
52370
|
|
|
52226
52371
|
|
|
52227
52372
|
var index$1 = /*#__PURE__*/Object.freeze({
|
|
@@ -52233,6 +52378,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
52233
52378
|
Polygon: Polygon,
|
|
52234
52379
|
Position: Position,
|
|
52235
52380
|
BoundingBox: BoundingBox,
|
|
52381
|
+
MercatorPoint: MercatorPoint,
|
|
52236
52382
|
MultiLineString: MultiLineString,
|
|
52237
52383
|
MultiPoint: MultiPoint,
|
|
52238
52384
|
MultiPolygon: MultiPolygon,
|
|
@@ -52649,6 +52795,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
52649
52795
|
return this.container;
|
|
52650
52796
|
};
|
|
52651
52797
|
ZoomControl.prototype.onRemove = function () {
|
|
52798
|
+
_super.prototype.onRemove.call(this);
|
|
52652
52799
|
if (this.map) {
|
|
52653
52800
|
this.map.events.remove('zoom', this.zoomChanged);
|
|
52654
52801
|
this.map.events.remove('minzoomchanged', this.minZoomChanged);
|
|
@@ -55516,6 +55663,155 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
55516
55663
|
return TileLayer;
|
|
55517
55664
|
}(SourceBuildingLayer));
|
|
55518
55665
|
|
|
55666
|
+
/**
|
|
55667
|
+
* Options used to render graphics in a WebGLLayer.
|
|
55668
|
+
*/
|
|
55669
|
+
var WebGLLayerOptions = /** @class */ (function (_super) {
|
|
55670
|
+
__extends(WebGLLayerOptions, _super);
|
|
55671
|
+
function WebGLLayerOptions() {
|
|
55672
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
55673
|
+
/**
|
|
55674
|
+
* An object that contains the rendering logic.
|
|
55675
|
+
*/
|
|
55676
|
+
_this.renderer = undefined;
|
|
55677
|
+
return _this;
|
|
55678
|
+
}
|
|
55679
|
+
return WebGLLayerOptions;
|
|
55680
|
+
}(LayerOptions));
|
|
55681
|
+
|
|
55682
|
+
/**
|
|
55683
|
+
* Enables custom rendering logic with access to the WebGL context of the map.
|
|
55684
|
+
*/
|
|
55685
|
+
var WebGLLayer = /** @class */ (function (_super) {
|
|
55686
|
+
__extends(WebGLLayer, _super);
|
|
55687
|
+
/**
|
|
55688
|
+
* Constructs a new WebGLLayer.
|
|
55689
|
+
* @param id The id of the layer. If not specified a random one will be generated.
|
|
55690
|
+
* @param options The options of the WebGL layer.
|
|
55691
|
+
*/
|
|
55692
|
+
function WebGLLayer(id, options) {
|
|
55693
|
+
var _this = _super.call(this, id) || this;
|
|
55694
|
+
/**
|
|
55695
|
+
* Make sure the layer is available after a style change.
|
|
55696
|
+
* @internal
|
|
55697
|
+
*/
|
|
55698
|
+
_this._onStyleChange = function () {
|
|
55699
|
+
var _a;
|
|
55700
|
+
// Custom layers cannot be serialized and preserved by mapbox.
|
|
55701
|
+
// Add this layer again if the layer was removed by mapbox after a style change.
|
|
55702
|
+
if (!_this.map._getMap().getLayer(_this.id)) {
|
|
55703
|
+
var map = _this.map;
|
|
55704
|
+
var before_1 = (_a = _this.map.layers._getUserLayers().find(function (l) { return l.layer.getId() == _this.id; })) === null || _a === void 0 ? void 0 : _a.before;
|
|
55705
|
+
map.layers.remove(_this);
|
|
55706
|
+
map.layers.add(_this, before_1);
|
|
55707
|
+
}
|
|
55708
|
+
};
|
|
55709
|
+
_this.options = new WebGLLayerOptions().merge(cloneDeepWith_1(options, WebGLLayerOptions._cloneCustomizer));
|
|
55710
|
+
_this.source = new DataSource();
|
|
55711
|
+
return _this;
|
|
55712
|
+
}
|
|
55713
|
+
/**
|
|
55714
|
+
* Gets the options of the WebGL layer.
|
|
55715
|
+
*/
|
|
55716
|
+
WebGLLayer.prototype.getOptions = function () {
|
|
55717
|
+
// Copy the options so the user can't directly change options.
|
|
55718
|
+
// They must use setOptions(...).
|
|
55719
|
+
return cloneDeepWith_1(this.options, WebGLLayerOptions._cloneCustomizer);
|
|
55720
|
+
};
|
|
55721
|
+
/**
|
|
55722
|
+
* Sets the options of the WebGL layer.
|
|
55723
|
+
* @param options The new options of the WebGL layer.
|
|
55724
|
+
*/
|
|
55725
|
+
WebGLLayer.prototype.setOptions = function (options) {
|
|
55726
|
+
var newOptions = new WebGLLayerOptions().merge(this.options, cloneDeepWith_1(options, WebGLLayerOptions._cloneCustomizer));
|
|
55727
|
+
// Trigger a repaint of the map if the layer options have changed.
|
|
55728
|
+
if (this.map) {
|
|
55729
|
+
this.map.triggerRepaint();
|
|
55730
|
+
}
|
|
55731
|
+
this.options = newOptions;
|
|
55732
|
+
};
|
|
55733
|
+
WebGLLayer.prototype.onAdd = function (map) {
|
|
55734
|
+
var _a, _b;
|
|
55735
|
+
_super.prototype.onAdd.call(this, map);
|
|
55736
|
+
// Make sure the layer is available after a style change.
|
|
55737
|
+
this.map.events.add("stylechanged", this._onStyleChange);
|
|
55738
|
+
// Notify the renderer this layer has been added to the map.
|
|
55739
|
+
if (this.options.renderer && this.glContext) {
|
|
55740
|
+
(_b = (_a = this.options.renderer).onAdd) === null || _b === void 0 ? void 0 : _b.call(_a, map, this.glContext);
|
|
55741
|
+
}
|
|
55742
|
+
};
|
|
55743
|
+
WebGLLayer.prototype.onRemove = function () {
|
|
55744
|
+
var _a, _b;
|
|
55745
|
+
// Notify the renderer this layer has been removed from the map.
|
|
55746
|
+
if (this.options.renderer && this.glContext) {
|
|
55747
|
+
(_b = (_a = this.options.renderer).onRemove) === null || _b === void 0 ? void 0 : _b.call(_a, this.map, this.glContext);
|
|
55748
|
+
}
|
|
55749
|
+
// Cleanup
|
|
55750
|
+
this.map.events.remove("stylechanged", this._onStyleChange);
|
|
55751
|
+
this.glContext = null;
|
|
55752
|
+
_super.prototype.onRemove.call(this);
|
|
55753
|
+
};
|
|
55754
|
+
/**
|
|
55755
|
+
* @internal
|
|
55756
|
+
*/
|
|
55757
|
+
WebGLLayer.prototype._buildLayers = function () {
|
|
55758
|
+
var _this = this;
|
|
55759
|
+
if (!this.options.renderer) {
|
|
55760
|
+
throw new Error("Cannot build the WebGL layer because renderer was not set.");
|
|
55761
|
+
}
|
|
55762
|
+
return [
|
|
55763
|
+
{
|
|
55764
|
+
id: this.id,
|
|
55765
|
+
type: "custom",
|
|
55766
|
+
renderingMode: this.options.renderer.renderingMode,
|
|
55767
|
+
onAdd: function (m, gl) {
|
|
55768
|
+
// Capture the GL context to reuse it later.
|
|
55769
|
+
// renderer.onAdd will be called in the onAdd callback of this layer.
|
|
55770
|
+
_this.glContext = gl;
|
|
55771
|
+
},
|
|
55772
|
+
onRemove: function (m, gl) {
|
|
55773
|
+
// renderer.onRemove will be called in the onRemove callback of this layer.
|
|
55774
|
+
},
|
|
55775
|
+
prerender: function (gl, matrix) {
|
|
55776
|
+
var _a, _b;
|
|
55777
|
+
if (_this._shouldRender()) {
|
|
55778
|
+
(_b = (_a = _this.options.renderer).prerender) === null || _b === void 0 ? void 0 : _b.call(_a, gl, matrix);
|
|
55779
|
+
}
|
|
55780
|
+
},
|
|
55781
|
+
render: function (gl, matrix) {
|
|
55782
|
+
if (_this._shouldRender()) {
|
|
55783
|
+
_this.options.renderer.render(gl, matrix);
|
|
55784
|
+
}
|
|
55785
|
+
}
|
|
55786
|
+
}
|
|
55787
|
+
];
|
|
55788
|
+
};
|
|
55789
|
+
/**
|
|
55790
|
+
* @internal
|
|
55791
|
+
*/
|
|
55792
|
+
WebGLLayer.prototype._getLayerIds = function () {
|
|
55793
|
+
return [this.id];
|
|
55794
|
+
};
|
|
55795
|
+
/**
|
|
55796
|
+
* @internal
|
|
55797
|
+
*/
|
|
55798
|
+
WebGLLayer.prototype._getSourceIds = function () {
|
|
55799
|
+
return new Set().add(this.source.getId());
|
|
55800
|
+
};
|
|
55801
|
+
/**
|
|
55802
|
+
* Returns true if the next frame should be rendered
|
|
55803
|
+
* @internal
|
|
55804
|
+
*/
|
|
55805
|
+
WebGLLayer.prototype._shouldRender = function () {
|
|
55806
|
+
if (this.map) {
|
|
55807
|
+
var zoom = this.map.getCamera().zoom;
|
|
55808
|
+
return this.options.visible && this.options.minZoom <= zoom && this.options.maxZoom > zoom;
|
|
55809
|
+
}
|
|
55810
|
+
return false;
|
|
55811
|
+
};
|
|
55812
|
+
return WebGLLayer;
|
|
55813
|
+
}(Layer));
|
|
55814
|
+
|
|
55519
55815
|
|
|
55520
55816
|
|
|
55521
55817
|
var index$5 = /*#__PURE__*/Object.freeze({
|
|
@@ -55528,7 +55824,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
55528
55824
|
SymbolLayer: SymbolLayer,
|
|
55529
55825
|
TileLayer: TileLayer,
|
|
55530
55826
|
HeatMapLayer: HeatMapLayer,
|
|
55531
|
-
ImageLayer: ImageLayer
|
|
55827
|
+
ImageLayer: ImageLayer,
|
|
55828
|
+
WebGLLayer: WebGLLayer
|
|
55532
55829
|
});
|
|
55533
55830
|
|
|
55534
55831
|
var Html = /** @class */ (function () {
|
|
@@ -76234,6 +76531,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
76234
76531
|
|
|
76235
76532
|
// Disable unified signatures linter rule so we can generate separate docs for function overloads.
|
|
76236
76533
|
// tslint:disable:unified-signatures
|
|
76534
|
+
var MAP_CLIENT_EVENTS = ['maxzoomchanged', 'minzoomchanged', 'mapconfigurationchanged'];
|
|
76237
76535
|
/**
|
|
76238
76536
|
* A manager for the map control's events.
|
|
76239
76537
|
* Exposed through the events property of the atlas.Map class.
|
|
@@ -76345,6 +76643,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
76345
76643
|
* @private
|
|
76346
76644
|
*/
|
|
76347
76645
|
EventManager.prototype._addGlobalListener = function (eventType, callback, legacy, once) {
|
|
76646
|
+
// add our custom events emitted by Map client to the map (note: they don't utilize modifiedCallback)
|
|
76647
|
+
if (MAP_CLIENT_EVENTS.includes(eventType)) {
|
|
76648
|
+
this.map._addEventListener(eventType, callback, once);
|
|
76649
|
+
return;
|
|
76650
|
+
}
|
|
76348
76651
|
var oldModifiedCallback = this.mapCallbackHandler.getModifiedCallback(eventType, "", callback);
|
|
76349
76652
|
// Get a new modified callback.
|
|
76350
76653
|
this.mapCallbackHandler.addCallback(eventType, "", callback, legacy, once);
|
|
@@ -76369,9 +76672,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
76369
76672
|
setTimeout(function () { return modifiedCallback(readyData_1); });
|
|
76370
76673
|
}
|
|
76371
76674
|
}
|
|
76372
|
-
else if (["minzoomchanged", "maxzoomchanged", "stylesetchanged"].includes(eventType)) {
|
|
76373
|
-
this.map._addEventListener(eventType, callback, once);
|
|
76374
|
-
}
|
|
76375
76675
|
else {
|
|
76376
76676
|
// If a callback already exists disable it so the new one can replace it.
|
|
76377
76677
|
if (oldModifiedCallback) {
|
|
@@ -76468,6 +76768,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
76468
76768
|
*/
|
|
76469
76769
|
EventManager.prototype._removeListener = function (eventType, target, callback) {
|
|
76470
76770
|
var e_5, _a;
|
|
76771
|
+
// remove our custom events emitted by Map client to the map (note: they don't utilize modifiedCallback)
|
|
76772
|
+
if (MAP_CLIENT_EVENTS.includes(eventType)) {
|
|
76773
|
+
this.map._removeEventListener(eventType, callback);
|
|
76774
|
+
return;
|
|
76775
|
+
}
|
|
76471
76776
|
var layerId = target instanceof Layer ? target.getId() : target;
|
|
76472
76777
|
var modifiedCallback = this.mapCallbackHandler.getModifiedCallback(eventType, layerId, callback);
|
|
76473
76778
|
// If a callback already exists disable it so the new one can replace it.
|
|
@@ -77375,15 +77680,15 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
77375
77680
|
*/
|
|
77376
77681
|
LayerManager.prototype._removeLayer = function (layer) {
|
|
77377
77682
|
var layerId = layer instanceof Layer ? layer.getId() : layer;
|
|
77378
|
-
|
|
77683
|
+
var layerIndex = this.layerIndex.findIndex(function (l) { return l.getId() === layerId; });
|
|
77684
|
+
if (layerIndex == -1) {
|
|
77379
77685
|
throw new Error("The layer '" + layerId + "' has not been added to the map and cannot be removed.");
|
|
77380
77686
|
}
|
|
77381
|
-
var layerIndex = this.layerIndex.findIndex(function (l) { return l.getId() === layerId; });
|
|
77382
77687
|
var tempLayer = this.layerIndex[layerIndex];
|
|
77383
77688
|
this._removeMapboxLayers(tempLayer);
|
|
77384
77689
|
this.layerIndex.splice(layerIndex, 1);
|
|
77385
|
-
var userLayerIndex = this.userLayers.findIndex(function (ul) { return ul.layer.getId() ===
|
|
77386
|
-
if (userLayerIndex
|
|
77690
|
+
var userLayerIndex = this.userLayers.findIndex(function (ul) { return ul.layer.getId() === layerId; });
|
|
77691
|
+
if (userLayerIndex != -1) {
|
|
77387
77692
|
this.userLayers.splice(userLayerIndex, 1);
|
|
77388
77693
|
}
|
|
77389
77694
|
tempLayer.onRemove();
|
|
@@ -78359,6 +78664,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
78359
78664
|
__extends(StyleOptions, _super);
|
|
78360
78665
|
function StyleOptions() {
|
|
78361
78666
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
78667
|
+
/**
|
|
78668
|
+
* If true, the gl context will be created with MSAA antialiasing, which can be useful for antialiasing WebGL layers.
|
|
78669
|
+
*/
|
|
78670
|
+
_this.antialias = undefined;
|
|
78362
78671
|
/**
|
|
78363
78672
|
* If true the map will automatically resize whenever the window's size changes.
|
|
78364
78673
|
* Otherwise map.resize() must be called.
|
|
@@ -78555,10 +78864,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
78555
78864
|
*/
|
|
78556
78865
|
_this.styleAPIVersion = getStyleAPIVersion();
|
|
78557
78866
|
/**
|
|
78558
|
-
* The
|
|
78559
|
-
|
|
78560
|
-
|
|
78561
|
-
|
|
78867
|
+
* The map configuration defines the set of styles available to the map.
|
|
78868
|
+
*/
|
|
78869
|
+
_this.mapConfiguration = undefined;
|
|
78870
|
+
/**
|
|
78871
|
+
* @deprecated use mapConfiguration instead
|
|
78562
78872
|
*/
|
|
78563
78873
|
_this.styleSet = undefined;
|
|
78564
78874
|
/**
|
|
@@ -78729,6 +79039,14 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
78729
79039
|
if (merged.authOptions.authType !== exports.AuthenticationType.subscriptionKey) {
|
|
78730
79040
|
merged["subscription-key"] = merged.subscriptionKey = undefined;
|
|
78731
79041
|
}
|
|
79042
|
+
// if mapConfiguration is not set and legacy styleSet option is used, assign it to mapConfiguration
|
|
79043
|
+
if (merged.styleSet !== undefined && merged.mapConfiguration === undefined) {
|
|
79044
|
+
merged.mapConfiguration = merged.styleSet;
|
|
79045
|
+
}
|
|
79046
|
+
// reassign properties from legacy mapConfiguration to new structure if needed
|
|
79047
|
+
if (merged.mapConfiguration && typeof merged.mapConfiguration !== 'string') {
|
|
79048
|
+
merged.mapConfiguration = __assign(__assign({}, merged.mapConfiguration), { defaultConfiguration: merged.mapConfiguration.defaultConfiguration || merged.mapConfiguration['defaultStyle'], configurations: merged.mapConfiguration.configurations || merged.mapConfiguration['styles'] });
|
|
79049
|
+
}
|
|
78732
79050
|
this._transformers = __spread(currentTransforms || [], transformersToMerge.filter(function (toMerge) { return !currentTransforms.includes(toMerge); }));
|
|
78733
79051
|
if (this.transformRequest && !this._transformers.includes(this.transformRequest)) {
|
|
78734
79052
|
this._transformers.push(this.transformRequest);
|
|
@@ -78933,9 +79251,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
78933
79251
|
*/
|
|
78934
79252
|
this.indoorState = undefined;
|
|
78935
79253
|
/**
|
|
78936
|
-
* Preserve the
|
|
79254
|
+
* Preserve the map configuration that was used before the indoor map configuration was set
|
|
78937
79255
|
*/
|
|
78938
|
-
this.
|
|
79256
|
+
this.preservedPreindoorMapConfiguration = undefined;
|
|
78939
79257
|
this._onStyleData = function () {
|
|
78940
79258
|
_this._lookUpAsync(_this.map.getStyle()).then(function (style) {
|
|
78941
79259
|
_this.map.events.invoke("stylechanged", {
|
|
@@ -78958,11 +79276,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
78958
79276
|
return null;
|
|
78959
79277
|
}
|
|
78960
79278
|
else {
|
|
78961
|
-
return definitions.
|
|
79279
|
+
return definitions.configurations.find(function (style) { return style.name === (options.style || definitions.defaultConfiguration); })
|
|
78962
79280
|
// retrieve default style definition unless option.style's one was found
|
|
78963
|
-
|| definitions.
|
|
78964
|
-
// no default style in the
|
|
78965
|
-
|| definitions.
|
|
79281
|
+
|| definitions.configurations.find(function (style) { return style.name === definitions.defaultConfiguration; })
|
|
79282
|
+
// no default style in the mapConfiguration -> pick the first style
|
|
79283
|
+
|| definitions.configurations[0];
|
|
78966
79284
|
}
|
|
78967
79285
|
};
|
|
78968
79286
|
this._lookUpAsync = function (options) { return __awaiter(_this, void 0, void 0, function () {
|
|
@@ -78972,11 +79290,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
78972
79290
|
case 0: return [4 /*yield*/, this.definitions()];
|
|
78973
79291
|
case 1:
|
|
78974
79292
|
definitions = _a.sent();
|
|
78975
|
-
result = definitions.
|
|
79293
|
+
result = definitions.configurations.find(function (style) { return style.name === (options.style || definitions.defaultConfiguration); })
|
|
78976
79294
|
// retrieve default style definition unless option.style's one was found
|
|
78977
|
-
|| definitions.
|
|
78978
|
-
// no default style in the
|
|
78979
|
-
|| definitions.
|
|
79295
|
+
|| definitions.configurations.find(function (style) { return style.name === definitions.defaultConfiguration; })
|
|
79296
|
+
// no default style in the mapConfiguration -> pick the first style
|
|
79297
|
+
|| definitions.configurations[0];
|
|
78980
79298
|
return [2 /*return*/, result];
|
|
78981
79299
|
}
|
|
78982
79300
|
});
|
|
@@ -78987,13 +79305,13 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
78987
79305
|
StyleManager.prototype.updateIndoorState = function (theme, tilesetId) {
|
|
78988
79306
|
var _this = this;
|
|
78989
79307
|
var _a;
|
|
78990
|
-
var
|
|
78991
|
-
if (
|
|
78992
|
-
this.
|
|
79308
|
+
var mapConfiguration = this.map.styles.getMapConfiguration();
|
|
79309
|
+
if (mapConfiguration) {
|
|
79310
|
+
this.preservedPreindoorMapConfiguration = mapConfiguration;
|
|
78993
79311
|
// tilesetId fallback
|
|
78994
79312
|
// MAGIC: if we are on a default style set - match existing style to the one in the default indoor style set
|
|
78995
79313
|
var desiredIndoorStyle = this.map.getStyle().style ? this.map.getStyle().style + "_indoor" + (theme === 'dark' ? '_dark' : '') + "_tileset_" + tilesetId : undefined;
|
|
78996
|
-
this.map.styles.setMapConfiguration("defaultIndoor_" + tilesetId,
|
|
79314
|
+
this.map.styles.setMapConfiguration("defaultIndoor_" + tilesetId, mapConfiguration === 'microsoft-maps:default' ? desiredIndoorStyle : undefined);
|
|
78997
79315
|
}
|
|
78998
79316
|
else {
|
|
78999
79317
|
var didTilesetIdChange_1 = ((_a = this.indoorState) === null || _a === void 0 ? void 0 : _a.tilesetId) !== tilesetId;
|
|
@@ -79003,12 +79321,12 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
79003
79321
|
};
|
|
79004
79322
|
this.initStyleset();
|
|
79005
79323
|
this.definitions().then(function (definitions) {
|
|
79006
|
-
var currentStyle = (_this.map.getStyle().style || definitions.
|
|
79324
|
+
var currentStyle = (_this.map.getStyle().style || definitions.defaultConfiguration)
|
|
79007
79325
|
.replace('_indoor_dark', '')
|
|
79008
79326
|
.replace('_indoor', '');
|
|
79009
79327
|
// we cannot compose the precise style name for auto theme, search for prefix style name match
|
|
79010
79328
|
var targetStylePrefix = currentStyle + "_indoor";
|
|
79011
|
-
var candidateStyle = definitions.
|
|
79329
|
+
var candidateStyle = definitions.configurations.find(function (style) { return style.name.startsWith(targetStylePrefix); });
|
|
79012
79330
|
if (candidateStyle) {
|
|
79013
79331
|
// 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
|
|
79014
79332
|
_this.map.setStyle({ style: candidateStyle.name }, !didTilesetIdChange_1);
|
|
@@ -79018,10 +79336,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
79018
79336
|
};
|
|
79019
79337
|
StyleManager.prototype.unsetIndoorState = function () {
|
|
79020
79338
|
var _this = this;
|
|
79021
|
-
var
|
|
79022
|
-
if (
|
|
79339
|
+
var mapConfiguration = this.preservedPreindoorMapConfiguration;
|
|
79340
|
+
if (mapConfiguration) {
|
|
79023
79341
|
// we need to revert to the styleset that was ap
|
|
79024
|
-
this.map.styles.setMapConfiguration(
|
|
79342
|
+
this.map.styles.setMapConfiguration(mapConfiguration);
|
|
79025
79343
|
}
|
|
79026
79344
|
else {
|
|
79027
79345
|
this.indoorState = undefined;
|
|
@@ -79048,11 +79366,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
79048
79366
|
var baseName = _this.indoorState && styleName.includes('_indoor') ? styleName.split('_indoor')[0] : styleName;
|
|
79049
79367
|
return baseName in styleNamesMap ? styleNamesMap[baseName] : baseName;
|
|
79050
79368
|
};
|
|
79051
|
-
if (!this.serviceOptions.
|
|
79369
|
+
if (!this.serviceOptions.mapConfiguration) {
|
|
79052
79370
|
newPromise = new HijackablePromise(this._request(this.serviceOptions.staticAssetsDomain, constants.stylePath + "/" + constants.styleResourcePath, "StyleDefinitions", { version: this.serviceOptions.styleDefinitionsVersion }).then(function (definitions) { return ({
|
|
79053
79371
|
version: isNaN(definitions.version) ? 0 : parseFloat(definitions.version),
|
|
79054
|
-
|
|
79055
|
-
|
|
79372
|
+
defaultConfiguration: definitions.defaultStyle,
|
|
79373
|
+
configurations: definitions.styles
|
|
79056
79374
|
.filter(function (style) {
|
|
79057
79375
|
if (!_this.indoorState) {
|
|
79058
79376
|
return !style.name.includes('indoor');
|
|
@@ -79083,11 +79401,13 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
79083
79401
|
}); })
|
|
79084
79402
|
}); }));
|
|
79085
79403
|
}
|
|
79086
|
-
else if (typeof this.serviceOptions.
|
|
79087
|
-
newPromise = new HijackablePromise(this._request(this.serviceOptions.domain, constants.styleResourcePath + "/mapconfigurations/metadata/" + this.serviceOptions.
|
|
79404
|
+
else if (typeof this.serviceOptions.mapConfiguration === 'string') {
|
|
79405
|
+
newPromise = new HijackablePromise(this._request(this.serviceOptions.domain, constants.styleResourcePath + "/mapconfigurations/metadata/" + this.serviceOptions.mapConfiguration, "StyleDefinitions"
|
|
79406
|
+
// reassign properties from legacy mapConfiguration to new structure if needed
|
|
79407
|
+
).then(function (definitions) { return (__assign(__assign({}, definitions), { defaultConfiguration: definitions.defaultConfiguration || definitions['defaultStyle'], configurations: definitions.configurations || definitions['styles'] })); }));
|
|
79088
79408
|
}
|
|
79089
79409
|
else {
|
|
79090
|
-
newPromise = HijackablePromise.resolve(this.serviceOptions.
|
|
79410
|
+
newPromise = HijackablePromise.resolve(this.serviceOptions.mapConfiguration);
|
|
79091
79411
|
}
|
|
79092
79412
|
if (this.initPromise) {
|
|
79093
79413
|
this.initPromise.switchWith(newPromise);
|
|
@@ -79097,7 +79417,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
79097
79417
|
this.initPromise = newPromise;
|
|
79098
79418
|
}
|
|
79099
79419
|
// propagate styleset change
|
|
79100
|
-
this.initPromise.then(function (styleset) { return _this.map._invokeEvent("
|
|
79420
|
+
this.initPromise.then(function (styleset) { return _this.map._invokeEvent("mapconfigurationchanged", styleset); });
|
|
79101
79421
|
return this.initPromise;
|
|
79102
79422
|
};
|
|
79103
79423
|
/**
|
|
@@ -79156,30 +79476,30 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
79156
79476
|
/**
|
|
79157
79477
|
* Replaces the style set used. Very costly as it reloads all controls and resources.
|
|
79158
79478
|
*/
|
|
79159
|
-
StyleManager.prototype.setMapConfiguration = function (
|
|
79479
|
+
StyleManager.prototype.setMapConfiguration = function (mapConfiguration, styleName) {
|
|
79160
79480
|
var _this = this;
|
|
79161
|
-
this.serviceOptions.
|
|
79162
|
-
if (typeof
|
|
79481
|
+
this.serviceOptions.mapConfiguration = mapConfiguration;
|
|
79482
|
+
if (typeof mapConfiguration === 'string') {
|
|
79163
79483
|
this.initStyleset();
|
|
79164
79484
|
}
|
|
79165
79485
|
else {
|
|
79166
79486
|
if (this.initPromise) {
|
|
79167
|
-
this.initPromise.hijackAndResolve(
|
|
79487
|
+
this.initPromise.hijackAndResolve(mapConfiguration);
|
|
79168
79488
|
}
|
|
79169
79489
|
else {
|
|
79170
|
-
this.initPromise = HijackablePromise.resolve(
|
|
79490
|
+
this.initPromise = HijackablePromise.resolve(mapConfiguration);
|
|
79171
79491
|
}
|
|
79172
79492
|
}
|
|
79173
79493
|
this.definitions().then(function (definitions) {
|
|
79174
|
-
var targetStyleName = definitions.
|
|
79175
|
-
if (definitions.
|
|
79494
|
+
var targetStyleName = definitions.defaultConfiguration;
|
|
79495
|
+
if (definitions.configurations.find(function (s) { return s.name === styleName; })) {
|
|
79176
79496
|
targetStyleName = styleName;
|
|
79177
79497
|
}
|
|
79178
79498
|
_this.map.setStyle({ style: targetStyleName });
|
|
79179
79499
|
});
|
|
79180
79500
|
};
|
|
79181
79501
|
StyleManager.prototype.getMapConfiguration = function () {
|
|
79182
|
-
return this.serviceOptions.
|
|
79502
|
+
return this.serviceOptions.mapConfiguration;
|
|
79183
79503
|
};
|
|
79184
79504
|
// backward-compatibility: this method preserves the interface that azure-maps-indoor@2.0.6 assumes
|
|
79185
79505
|
StyleManager.prototype.setStyleSet = function (styleSet) {
|
|
@@ -79227,66 +79547,59 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
79227
79547
|
// A FundamentalMapLayer (grouped layer) representation of the next style must be built.
|
|
79228
79548
|
var previousLayers = this.map.layers.getLayers();
|
|
79229
79549
|
var nextLayers = [];
|
|
79230
|
-
var
|
|
79231
|
-
var currentLayerGroupLayers = [];
|
|
79232
|
-
var advanceLayerGroup = function (nextLayerGroup) {
|
|
79233
|
-
nextLayers.push(_this._buildFundamentalLayerFrom(currentLayerGroupLayers, currentLayerGroupId));
|
|
79234
|
-
currentLayerGroupId = nextLayerGroup;
|
|
79235
|
-
currentLayerGroupLayers = [];
|
|
79236
|
-
};
|
|
79550
|
+
var layerGroupLayers = {};
|
|
79237
79551
|
nextStyle.layers.forEach(function (nextLayer) {
|
|
79238
79552
|
var _a, _b, _c, _d, _e;
|
|
79239
79553
|
var layerGroup = LayerGroupComparator.getLayerGroup(nextLayer);
|
|
79240
|
-
|
|
79241
|
-
|
|
79242
|
-
|
|
79243
|
-
|
|
79244
|
-
|
|
79245
|
-
|
|
79246
|
-
}
|
|
79247
|
-
else if (nextLayer.type === "fill-extrusion") {
|
|
79248
|
-
updateLayoutProperty(nextLayer.id, "visibility", "visible");
|
|
79249
|
-
nextLayer.layout = (_b = nextLayer.layout) !== null && _b !== void 0 ? _b : {};
|
|
79250
|
-
nextLayer.layout.visibility = "visible";
|
|
79251
|
-
}
|
|
79252
|
-
// Set visibility of traffic layers depending on traffic settings.
|
|
79253
|
-
if (trafficOptions.flow !== "none" && layerGroup) {
|
|
79254
|
-
if (layerGroup === "traffic_" + trafficOptions.flow && nextLayer.type == "line") {
|
|
79255
|
-
updateLayoutProperty(nextLayer.id, "visibility", "visible");
|
|
79256
|
-
nextLayer.layout = (_c = nextLayer.layout) !== null && _c !== void 0 ? _c : {};
|
|
79257
|
-
nextLayer.layout.visibility = "visible";
|
|
79554
|
+
if (layerGroup) {
|
|
79555
|
+
// Set visiblity of fill-extrusion layers according to StyleOptions.showBuildingModels
|
|
79556
|
+
if (!styleOptions.showBuildingModels && nextLayer.type === "fill-extrusion") {
|
|
79557
|
+
updateLayoutProperty(nextLayer.id, "visibility", "none");
|
|
79558
|
+
nextLayer.layout = (_a = nextLayer.layout) !== null && _a !== void 0 ? _a : {};
|
|
79559
|
+
nextLayer.layout.visibility = "none";
|
|
79258
79560
|
}
|
|
79259
|
-
|
|
79260
|
-
// Set visibility of labels
|
|
79261
|
-
var isLabelLayerGroup = layerGroup === 'labels' || layerGroup === 'labels_places' || layerGroup === 'labels_indoor';
|
|
79262
|
-
if (isLabelLayerGroup && nextLayer.type === 'symbol') {
|
|
79263
|
-
if (styleOptions.showLabels) {
|
|
79561
|
+
else if (nextLayer.type === "fill-extrusion") {
|
|
79264
79562
|
updateLayoutProperty(nextLayer.id, "visibility", "visible");
|
|
79265
|
-
nextLayer.layout = (
|
|
79563
|
+
nextLayer.layout = (_b = nextLayer.layout) !== null && _b !== void 0 ? _b : {};
|
|
79266
79564
|
nextLayer.layout.visibility = "visible";
|
|
79267
79565
|
}
|
|
79268
|
-
|
|
79269
|
-
|
|
79270
|
-
|
|
79271
|
-
|
|
79566
|
+
// Set visibility of traffic layers depending on traffic settings.
|
|
79567
|
+
if (trafficOptions.flow !== "none" && layerGroup) {
|
|
79568
|
+
if (layerGroup === "traffic_" + trafficOptions.flow && nextLayer.type == "line") {
|
|
79569
|
+
updateLayoutProperty(nextLayer.id, "visibility", "visible");
|
|
79570
|
+
nextLayer.layout = (_c = nextLayer.layout) !== null && _c !== void 0 ? _c : {};
|
|
79571
|
+
nextLayer.layout.visibility = "visible";
|
|
79572
|
+
}
|
|
79272
79573
|
}
|
|
79273
|
-
|
|
79274
|
-
|
|
79275
|
-
|
|
79276
|
-
|
|
79277
|
-
|
|
79278
|
-
|
|
79279
|
-
|
|
79574
|
+
// Set visibility of labels
|
|
79575
|
+
var isLabelLayerGroup = layerGroup === 'labels' || layerGroup === 'labels_places' || layerGroup === 'labels_indoor';
|
|
79576
|
+
if (isLabelLayerGroup && nextLayer.type === 'symbol') {
|
|
79577
|
+
if (styleOptions.showLabels) {
|
|
79578
|
+
updateLayoutProperty(nextLayer.id, "visibility", "visible");
|
|
79579
|
+
nextLayer.layout = (_d = nextLayer.layout) !== null && _d !== void 0 ? _d : {};
|
|
79580
|
+
nextLayer.layout.visibility = "visible";
|
|
79581
|
+
}
|
|
79582
|
+
else {
|
|
79583
|
+
updateLayoutProperty(nextLayer.id, "visibility", "none");
|
|
79584
|
+
nextLayer.layout = (_e = nextLayer.layout) !== null && _e !== void 0 ? _e : {};
|
|
79585
|
+
nextLayer.layout.visibility = "none";
|
|
79586
|
+
}
|
|
79587
|
+
}
|
|
79588
|
+
// Once this _stylePatch returns control to maplibre the next style will be applied immediately in the same context.
|
|
79589
|
+
// To avoid potential data races update LayerManager with new a new set of FundamentalMapLayers from here instead of
|
|
79590
|
+
// waiting for a styledata.load event to trigger a sync in a different context.
|
|
79591
|
+
if (layerGroupLayers[layerGroup]) {
|
|
79592
|
+
layerGroupLayers[layerGroup].push(nextLayer);
|
|
79593
|
+
}
|
|
79594
|
+
else {
|
|
79595
|
+
layerGroupLayers[layerGroup] = [nextLayer];
|
|
79280
79596
|
}
|
|
79281
|
-
currentLayerGroupLayers.push(nextLayer);
|
|
79282
|
-
}
|
|
79283
|
-
else if (currentLayerGroupLayers.length > 0) {
|
|
79284
|
-
advanceLayerGroup(layerGroup);
|
|
79285
79597
|
}
|
|
79286
79598
|
});
|
|
79287
|
-
|
|
79288
|
-
|
|
79289
|
-
|
|
79599
|
+
Object.entries(layerGroupLayers).forEach(function (_a) {
|
|
79600
|
+
var _b = __read(_a, 2), layerGroupId = _b[0], layerGroupMapboxLayers = _b[1];
|
|
79601
|
+
nextLayers.push(_this._buildFundamentalLayerFrom(layerGroupMapboxLayers, layerGroupId));
|
|
79602
|
+
});
|
|
79290
79603
|
// Update FundamentalMapLayers in LayerManager
|
|
79291
79604
|
var userLayers = this.map.layers._getUserLayers();
|
|
79292
79605
|
var firstUserLayer = userLayers[0];
|
|
@@ -79322,6 +79635,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
79322
79635
|
// Layers added to mapbox through this SDK since loading the last style should be
|
|
79323
79636
|
// carried over to the next style.
|
|
79324
79637
|
userLayers.forEach(function (userLayer) {
|
|
79638
|
+
if (userLayer.layer instanceof WebGLLayer) {
|
|
79639
|
+
// mapbox custom layers cannot be serialized and preserved,
|
|
79640
|
+
// return to continue to the next user layer.
|
|
79641
|
+
return;
|
|
79642
|
+
}
|
|
79325
79643
|
var before = undefined;
|
|
79326
79644
|
if (_this.map.layers.getLayerById(userLayer.before)) {
|
|
79327
79645
|
var beforeCandidates = _this.map.layers.getLayerById(userLayer.before)._buildLayers();
|
|
@@ -79483,6 +79801,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
79483
79801
|
}
|
|
79484
79802
|
else {
|
|
79485
79803
|
var mapboxMapOptions = {
|
|
79804
|
+
antialias: _this.styleOptions.antialias,
|
|
79486
79805
|
attributionControl: false,
|
|
79487
79806
|
container: container,
|
|
79488
79807
|
fadeDuration: _this.serviceOptions.fadeDuration,
|
|
@@ -80473,6 +80792,16 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
80473
80792
|
Map.prototype.stop = function () {
|
|
80474
80793
|
this.map.stop();
|
|
80475
80794
|
};
|
|
80795
|
+
/**
|
|
80796
|
+
* Trigger the rendering of a single frame.
|
|
80797
|
+
* Use this method with WebGL layers to repaint the map when the layer's
|
|
80798
|
+
* properties or properties associated with the layer's source change.
|
|
80799
|
+
* Calling this multiple times before the next frame is rendered will still
|
|
80800
|
+
* result in only a single frame being rendered.
|
|
80801
|
+
*/
|
|
80802
|
+
Map.prototype.triggerRepaint = function () {
|
|
80803
|
+
this.map.triggerRepaint();
|
|
80804
|
+
};
|
|
80476
80805
|
/**
|
|
80477
80806
|
* @internal
|
|
80478
80807
|
*/
|
|
@@ -80604,9 +80933,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
80604
80933
|
return;
|
|
80605
80934
|
}
|
|
80606
80935
|
// Check if the default style is set by the client and if it exists in the current style set
|
|
80607
|
-
this.styles.definitions().then(function (
|
|
80608
|
-
if (!_this.styleOptions.style || !
|
|
80609
|
-
_this.styleOptions.style =
|
|
80936
|
+
this.styles.definitions().then(function (mapConfiguration) {
|
|
80937
|
+
if (!_this.styleOptions.style || !mapConfiguration.configurations.map(function (mapConfigurationStyle) { return mapConfigurationStyle.name; }).includes(_this.styleOptions.style)) {
|
|
80938
|
+
_this.styleOptions.style = mapConfiguration.defaultConfiguration;
|
|
80610
80939
|
}
|
|
80611
80940
|
_this.styleOptions = styleOptions;
|
|
80612
80941
|
_this._rebuildStyle(diff);
|