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-core.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 () {
|
|
@@ -66053,6 +66350,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
66053
66350
|
|
|
66054
66351
|
// Disable unified signatures linter rule so we can generate separate docs for function overloads.
|
|
66055
66352
|
// tslint:disable:unified-signatures
|
|
66353
|
+
var MAP_CLIENT_EVENTS = ['maxzoomchanged', 'minzoomchanged', 'mapconfigurationchanged'];
|
|
66056
66354
|
/**
|
|
66057
66355
|
* A manager for the map control's events.
|
|
66058
66356
|
* Exposed through the events property of the atlas.Map class.
|
|
@@ -66164,6 +66462,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
66164
66462
|
* @private
|
|
66165
66463
|
*/
|
|
66166
66464
|
EventManager.prototype._addGlobalListener = function (eventType, callback, legacy, once) {
|
|
66465
|
+
// add our custom events emitted by Map client to the map (note: they don't utilize modifiedCallback)
|
|
66466
|
+
if (MAP_CLIENT_EVENTS.includes(eventType)) {
|
|
66467
|
+
this.map._addEventListener(eventType, callback, once);
|
|
66468
|
+
return;
|
|
66469
|
+
}
|
|
66167
66470
|
var oldModifiedCallback = this.mapCallbackHandler.getModifiedCallback(eventType, "", callback);
|
|
66168
66471
|
// Get a new modified callback.
|
|
66169
66472
|
this.mapCallbackHandler.addCallback(eventType, "", callback, legacy, once);
|
|
@@ -66188,9 +66491,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
66188
66491
|
setTimeout(function () { return modifiedCallback(readyData_1); });
|
|
66189
66492
|
}
|
|
66190
66493
|
}
|
|
66191
|
-
else if (["minzoomchanged", "maxzoomchanged", "stylesetchanged"].includes(eventType)) {
|
|
66192
|
-
this.map._addEventListener(eventType, callback, once);
|
|
66193
|
-
}
|
|
66194
66494
|
else {
|
|
66195
66495
|
// If a callback already exists disable it so the new one can replace it.
|
|
66196
66496
|
if (oldModifiedCallback) {
|
|
@@ -66287,6 +66587,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
66287
66587
|
*/
|
|
66288
66588
|
EventManager.prototype._removeListener = function (eventType, target, callback) {
|
|
66289
66589
|
var e_5, _a;
|
|
66590
|
+
// remove our custom events emitted by Map client to the map (note: they don't utilize modifiedCallback)
|
|
66591
|
+
if (MAP_CLIENT_EVENTS.includes(eventType)) {
|
|
66592
|
+
this.map._removeEventListener(eventType, callback);
|
|
66593
|
+
return;
|
|
66594
|
+
}
|
|
66290
66595
|
var layerId = target instanceof Layer ? target.getId() : target;
|
|
66291
66596
|
var modifiedCallback = this.mapCallbackHandler.getModifiedCallback(eventType, layerId, callback);
|
|
66292
66597
|
// If a callback already exists disable it so the new one can replace it.
|
|
@@ -67194,15 +67499,15 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
67194
67499
|
*/
|
|
67195
67500
|
LayerManager.prototype._removeLayer = function (layer) {
|
|
67196
67501
|
var layerId = layer instanceof Layer ? layer.getId() : layer;
|
|
67197
|
-
|
|
67502
|
+
var layerIndex = this.layerIndex.findIndex(function (l) { return l.getId() === layerId; });
|
|
67503
|
+
if (layerIndex == -1) {
|
|
67198
67504
|
throw new Error("The layer '" + layerId + "' has not been added to the map and cannot be removed.");
|
|
67199
67505
|
}
|
|
67200
|
-
var layerIndex = this.layerIndex.findIndex(function (l) { return l.getId() === layerId; });
|
|
67201
67506
|
var tempLayer = this.layerIndex[layerIndex];
|
|
67202
67507
|
this._removeMapboxLayers(tempLayer);
|
|
67203
67508
|
this.layerIndex.splice(layerIndex, 1);
|
|
67204
|
-
var userLayerIndex = this.userLayers.findIndex(function (ul) { return ul.layer.getId() ===
|
|
67205
|
-
if (userLayerIndex
|
|
67509
|
+
var userLayerIndex = this.userLayers.findIndex(function (ul) { return ul.layer.getId() === layerId; });
|
|
67510
|
+
if (userLayerIndex != -1) {
|
|
67206
67511
|
this.userLayers.splice(userLayerIndex, 1);
|
|
67207
67512
|
}
|
|
67208
67513
|
tempLayer.onRemove();
|
|
@@ -68178,6 +68483,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
68178
68483
|
__extends(StyleOptions, _super);
|
|
68179
68484
|
function StyleOptions() {
|
|
68180
68485
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
68486
|
+
/**
|
|
68487
|
+
* If true, the gl context will be created with MSAA antialiasing, which can be useful for antialiasing WebGL layers.
|
|
68488
|
+
*/
|
|
68489
|
+
_this.antialias = undefined;
|
|
68181
68490
|
/**
|
|
68182
68491
|
* If true the map will automatically resize whenever the window's size changes.
|
|
68183
68492
|
* Otherwise map.resize() must be called.
|
|
@@ -68374,10 +68683,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
68374
68683
|
*/
|
|
68375
68684
|
_this.styleAPIVersion = getStyleAPIVersion();
|
|
68376
68685
|
/**
|
|
68377
|
-
* The
|
|
68378
|
-
|
|
68379
|
-
|
|
68380
|
-
|
|
68686
|
+
* The map configuration defines the set of styles available to the map.
|
|
68687
|
+
*/
|
|
68688
|
+
_this.mapConfiguration = undefined;
|
|
68689
|
+
/**
|
|
68690
|
+
* @deprecated use mapConfiguration instead
|
|
68381
68691
|
*/
|
|
68382
68692
|
_this.styleSet = undefined;
|
|
68383
68693
|
/**
|
|
@@ -68548,6 +68858,14 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
68548
68858
|
if (merged.authOptions.authType !== exports.AuthenticationType.subscriptionKey) {
|
|
68549
68859
|
merged["subscription-key"] = merged.subscriptionKey = undefined;
|
|
68550
68860
|
}
|
|
68861
|
+
// if mapConfiguration is not set and legacy styleSet option is used, assign it to mapConfiguration
|
|
68862
|
+
if (merged.styleSet !== undefined && merged.mapConfiguration === undefined) {
|
|
68863
|
+
merged.mapConfiguration = merged.styleSet;
|
|
68864
|
+
}
|
|
68865
|
+
// reassign properties from legacy mapConfiguration to new structure if needed
|
|
68866
|
+
if (merged.mapConfiguration && typeof merged.mapConfiguration !== 'string') {
|
|
68867
|
+
merged.mapConfiguration = __assign(__assign({}, merged.mapConfiguration), { defaultConfiguration: merged.mapConfiguration.defaultConfiguration || merged.mapConfiguration['defaultStyle'], configurations: merged.mapConfiguration.configurations || merged.mapConfiguration['styles'] });
|
|
68868
|
+
}
|
|
68551
68869
|
this._transformers = __spread(currentTransforms || [], transformersToMerge.filter(function (toMerge) { return !currentTransforms.includes(toMerge); }));
|
|
68552
68870
|
if (this.transformRequest && !this._transformers.includes(this.transformRequest)) {
|
|
68553
68871
|
this._transformers.push(this.transformRequest);
|
|
@@ -68752,9 +69070,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
68752
69070
|
*/
|
|
68753
69071
|
this.indoorState = undefined;
|
|
68754
69072
|
/**
|
|
68755
|
-
* Preserve the
|
|
69073
|
+
* Preserve the map configuration that was used before the indoor map configuration was set
|
|
68756
69074
|
*/
|
|
68757
|
-
this.
|
|
69075
|
+
this.preservedPreindoorMapConfiguration = undefined;
|
|
68758
69076
|
this._onStyleData = function () {
|
|
68759
69077
|
_this._lookUpAsync(_this.map.getStyle()).then(function (style) {
|
|
68760
69078
|
_this.map.events.invoke("stylechanged", {
|
|
@@ -68777,11 +69095,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
68777
69095
|
return null;
|
|
68778
69096
|
}
|
|
68779
69097
|
else {
|
|
68780
|
-
return definitions.
|
|
69098
|
+
return definitions.configurations.find(function (style) { return style.name === (options.style || definitions.defaultConfiguration); })
|
|
68781
69099
|
// retrieve default style definition unless option.style's one was found
|
|
68782
|
-
|| definitions.
|
|
68783
|
-
// no default style in the
|
|
68784
|
-
|| definitions.
|
|
69100
|
+
|| definitions.configurations.find(function (style) { return style.name === definitions.defaultConfiguration; })
|
|
69101
|
+
// no default style in the mapConfiguration -> pick the first style
|
|
69102
|
+
|| definitions.configurations[0];
|
|
68785
69103
|
}
|
|
68786
69104
|
};
|
|
68787
69105
|
this._lookUpAsync = function (options) { return __awaiter(_this, void 0, void 0, function () {
|
|
@@ -68791,11 +69109,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
68791
69109
|
case 0: return [4 /*yield*/, this.definitions()];
|
|
68792
69110
|
case 1:
|
|
68793
69111
|
definitions = _a.sent();
|
|
68794
|
-
result = definitions.
|
|
69112
|
+
result = definitions.configurations.find(function (style) { return style.name === (options.style || definitions.defaultConfiguration); })
|
|
68795
69113
|
// retrieve default style definition unless option.style's one was found
|
|
68796
|
-
|| definitions.
|
|
68797
|
-
// no default style in the
|
|
68798
|
-
|| definitions.
|
|
69114
|
+
|| definitions.configurations.find(function (style) { return style.name === definitions.defaultConfiguration; })
|
|
69115
|
+
// no default style in the mapConfiguration -> pick the first style
|
|
69116
|
+
|| definitions.configurations[0];
|
|
68799
69117
|
return [2 /*return*/, result];
|
|
68800
69118
|
}
|
|
68801
69119
|
});
|
|
@@ -68806,13 +69124,13 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
68806
69124
|
StyleManager.prototype.updateIndoorState = function (theme, tilesetId) {
|
|
68807
69125
|
var _this = this;
|
|
68808
69126
|
var _a;
|
|
68809
|
-
var
|
|
68810
|
-
if (
|
|
68811
|
-
this.
|
|
69127
|
+
var mapConfiguration = this.map.styles.getMapConfiguration();
|
|
69128
|
+
if (mapConfiguration) {
|
|
69129
|
+
this.preservedPreindoorMapConfiguration = mapConfiguration;
|
|
68812
69130
|
// tilesetId fallback
|
|
68813
69131
|
// MAGIC: if we are on a default style set - match existing style to the one in the default indoor style set
|
|
68814
69132
|
var desiredIndoorStyle = this.map.getStyle().style ? this.map.getStyle().style + "_indoor" + (theme === 'dark' ? '_dark' : '') + "_tileset_" + tilesetId : undefined;
|
|
68815
|
-
this.map.styles.setMapConfiguration("defaultIndoor_" + tilesetId,
|
|
69133
|
+
this.map.styles.setMapConfiguration("defaultIndoor_" + tilesetId, mapConfiguration === 'microsoft-maps:default' ? desiredIndoorStyle : undefined);
|
|
68816
69134
|
}
|
|
68817
69135
|
else {
|
|
68818
69136
|
var didTilesetIdChange_1 = ((_a = this.indoorState) === null || _a === void 0 ? void 0 : _a.tilesetId) !== tilesetId;
|
|
@@ -68822,12 +69140,12 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
68822
69140
|
};
|
|
68823
69141
|
this.initStyleset();
|
|
68824
69142
|
this.definitions().then(function (definitions) {
|
|
68825
|
-
var currentStyle = (_this.map.getStyle().style || definitions.
|
|
69143
|
+
var currentStyle = (_this.map.getStyle().style || definitions.defaultConfiguration)
|
|
68826
69144
|
.replace('_indoor_dark', '')
|
|
68827
69145
|
.replace('_indoor', '');
|
|
68828
69146
|
// we cannot compose the precise style name for auto theme, search for prefix style name match
|
|
68829
69147
|
var targetStylePrefix = currentStyle + "_indoor";
|
|
68830
|
-
var candidateStyle = definitions.
|
|
69148
|
+
var candidateStyle = definitions.configurations.find(function (style) { return style.name.startsWith(targetStylePrefix); });
|
|
68831
69149
|
if (candidateStyle) {
|
|
68832
69150
|
// 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
|
|
68833
69151
|
_this.map.setStyle({ style: candidateStyle.name }, !didTilesetIdChange_1);
|
|
@@ -68837,10 +69155,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
68837
69155
|
};
|
|
68838
69156
|
StyleManager.prototype.unsetIndoorState = function () {
|
|
68839
69157
|
var _this = this;
|
|
68840
|
-
var
|
|
68841
|
-
if (
|
|
69158
|
+
var mapConfiguration = this.preservedPreindoorMapConfiguration;
|
|
69159
|
+
if (mapConfiguration) {
|
|
68842
69160
|
// we need to revert to the styleset that was ap
|
|
68843
|
-
this.map.styles.setMapConfiguration(
|
|
69161
|
+
this.map.styles.setMapConfiguration(mapConfiguration);
|
|
68844
69162
|
}
|
|
68845
69163
|
else {
|
|
68846
69164
|
this.indoorState = undefined;
|
|
@@ -68867,11 +69185,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
68867
69185
|
var baseName = _this.indoorState && styleName.includes('_indoor') ? styleName.split('_indoor')[0] : styleName;
|
|
68868
69186
|
return baseName in styleNamesMap ? styleNamesMap[baseName] : baseName;
|
|
68869
69187
|
};
|
|
68870
|
-
if (!this.serviceOptions.
|
|
69188
|
+
if (!this.serviceOptions.mapConfiguration) {
|
|
68871
69189
|
newPromise = new HijackablePromise(this._request(this.serviceOptions.staticAssetsDomain, constants.stylePath + "/" + constants.styleResourcePath, "StyleDefinitions", { version: this.serviceOptions.styleDefinitionsVersion }).then(function (definitions) { return ({
|
|
68872
69190
|
version: isNaN(definitions.version) ? 0 : parseFloat(definitions.version),
|
|
68873
|
-
|
|
68874
|
-
|
|
69191
|
+
defaultConfiguration: definitions.defaultStyle,
|
|
69192
|
+
configurations: definitions.styles
|
|
68875
69193
|
.filter(function (style) {
|
|
68876
69194
|
if (!_this.indoorState) {
|
|
68877
69195
|
return !style.name.includes('indoor');
|
|
@@ -68902,11 +69220,13 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
68902
69220
|
}); })
|
|
68903
69221
|
}); }));
|
|
68904
69222
|
}
|
|
68905
|
-
else if (typeof this.serviceOptions.
|
|
68906
|
-
newPromise = new HijackablePromise(this._request(this.serviceOptions.domain, constants.styleResourcePath + "/mapconfigurations/metadata/" + this.serviceOptions.
|
|
69223
|
+
else if (typeof this.serviceOptions.mapConfiguration === 'string') {
|
|
69224
|
+
newPromise = new HijackablePromise(this._request(this.serviceOptions.domain, constants.styleResourcePath + "/mapconfigurations/metadata/" + this.serviceOptions.mapConfiguration, "StyleDefinitions"
|
|
69225
|
+
// reassign properties from legacy mapConfiguration to new structure if needed
|
|
69226
|
+
).then(function (definitions) { return (__assign(__assign({}, definitions), { defaultConfiguration: definitions.defaultConfiguration || definitions['defaultStyle'], configurations: definitions.configurations || definitions['styles'] })); }));
|
|
68907
69227
|
}
|
|
68908
69228
|
else {
|
|
68909
|
-
newPromise = HijackablePromise.resolve(this.serviceOptions.
|
|
69229
|
+
newPromise = HijackablePromise.resolve(this.serviceOptions.mapConfiguration);
|
|
68910
69230
|
}
|
|
68911
69231
|
if (this.initPromise) {
|
|
68912
69232
|
this.initPromise.switchWith(newPromise);
|
|
@@ -68916,7 +69236,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
68916
69236
|
this.initPromise = newPromise;
|
|
68917
69237
|
}
|
|
68918
69238
|
// propagate styleset change
|
|
68919
|
-
this.initPromise.then(function (styleset) { return _this.map._invokeEvent("
|
|
69239
|
+
this.initPromise.then(function (styleset) { return _this.map._invokeEvent("mapconfigurationchanged", styleset); });
|
|
68920
69240
|
return this.initPromise;
|
|
68921
69241
|
};
|
|
68922
69242
|
/**
|
|
@@ -68975,30 +69295,30 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
68975
69295
|
/**
|
|
68976
69296
|
* Replaces the style set used. Very costly as it reloads all controls and resources.
|
|
68977
69297
|
*/
|
|
68978
|
-
StyleManager.prototype.setMapConfiguration = function (
|
|
69298
|
+
StyleManager.prototype.setMapConfiguration = function (mapConfiguration, styleName) {
|
|
68979
69299
|
var _this = this;
|
|
68980
|
-
this.serviceOptions.
|
|
68981
|
-
if (typeof
|
|
69300
|
+
this.serviceOptions.mapConfiguration = mapConfiguration;
|
|
69301
|
+
if (typeof mapConfiguration === 'string') {
|
|
68982
69302
|
this.initStyleset();
|
|
68983
69303
|
}
|
|
68984
69304
|
else {
|
|
68985
69305
|
if (this.initPromise) {
|
|
68986
|
-
this.initPromise.hijackAndResolve(
|
|
69306
|
+
this.initPromise.hijackAndResolve(mapConfiguration);
|
|
68987
69307
|
}
|
|
68988
69308
|
else {
|
|
68989
|
-
this.initPromise = HijackablePromise.resolve(
|
|
69309
|
+
this.initPromise = HijackablePromise.resolve(mapConfiguration);
|
|
68990
69310
|
}
|
|
68991
69311
|
}
|
|
68992
69312
|
this.definitions().then(function (definitions) {
|
|
68993
|
-
var targetStyleName = definitions.
|
|
68994
|
-
if (definitions.
|
|
69313
|
+
var targetStyleName = definitions.defaultConfiguration;
|
|
69314
|
+
if (definitions.configurations.find(function (s) { return s.name === styleName; })) {
|
|
68995
69315
|
targetStyleName = styleName;
|
|
68996
69316
|
}
|
|
68997
69317
|
_this.map.setStyle({ style: targetStyleName });
|
|
68998
69318
|
});
|
|
68999
69319
|
};
|
|
69000
69320
|
StyleManager.prototype.getMapConfiguration = function () {
|
|
69001
|
-
return this.serviceOptions.
|
|
69321
|
+
return this.serviceOptions.mapConfiguration;
|
|
69002
69322
|
};
|
|
69003
69323
|
// backward-compatibility: this method preserves the interface that azure-maps-indoor@2.0.6 assumes
|
|
69004
69324
|
StyleManager.prototype.setStyleSet = function (styleSet) {
|
|
@@ -69046,66 +69366,59 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
69046
69366
|
// A FundamentalMapLayer (grouped layer) representation of the next style must be built.
|
|
69047
69367
|
var previousLayers = this.map.layers.getLayers();
|
|
69048
69368
|
var nextLayers = [];
|
|
69049
|
-
var
|
|
69050
|
-
var currentLayerGroupLayers = [];
|
|
69051
|
-
var advanceLayerGroup = function (nextLayerGroup) {
|
|
69052
|
-
nextLayers.push(_this._buildFundamentalLayerFrom(currentLayerGroupLayers, currentLayerGroupId));
|
|
69053
|
-
currentLayerGroupId = nextLayerGroup;
|
|
69054
|
-
currentLayerGroupLayers = [];
|
|
69055
|
-
};
|
|
69369
|
+
var layerGroupLayers = {};
|
|
69056
69370
|
nextStyle.layers.forEach(function (nextLayer) {
|
|
69057
69371
|
var _a, _b, _c, _d, _e;
|
|
69058
69372
|
var layerGroup = LayerGroupComparator.getLayerGroup(nextLayer);
|
|
69059
|
-
|
|
69060
|
-
|
|
69061
|
-
|
|
69062
|
-
|
|
69063
|
-
|
|
69064
|
-
|
|
69065
|
-
}
|
|
69066
|
-
else if (nextLayer.type === "fill-extrusion") {
|
|
69067
|
-
updateLayoutProperty(nextLayer.id, "visibility", "visible");
|
|
69068
|
-
nextLayer.layout = (_b = nextLayer.layout) !== null && _b !== void 0 ? _b : {};
|
|
69069
|
-
nextLayer.layout.visibility = "visible";
|
|
69070
|
-
}
|
|
69071
|
-
// Set visibility of traffic layers depending on traffic settings.
|
|
69072
|
-
if (trafficOptions.flow !== "none" && layerGroup) {
|
|
69073
|
-
if (layerGroup === "traffic_" + trafficOptions.flow && nextLayer.type == "line") {
|
|
69074
|
-
updateLayoutProperty(nextLayer.id, "visibility", "visible");
|
|
69075
|
-
nextLayer.layout = (_c = nextLayer.layout) !== null && _c !== void 0 ? _c : {};
|
|
69076
|
-
nextLayer.layout.visibility = "visible";
|
|
69373
|
+
if (layerGroup) {
|
|
69374
|
+
// Set visiblity of fill-extrusion layers according to StyleOptions.showBuildingModels
|
|
69375
|
+
if (!styleOptions.showBuildingModels && nextLayer.type === "fill-extrusion") {
|
|
69376
|
+
updateLayoutProperty(nextLayer.id, "visibility", "none");
|
|
69377
|
+
nextLayer.layout = (_a = nextLayer.layout) !== null && _a !== void 0 ? _a : {};
|
|
69378
|
+
nextLayer.layout.visibility = "none";
|
|
69077
69379
|
}
|
|
69078
|
-
|
|
69079
|
-
// Set visibility of labels
|
|
69080
|
-
var isLabelLayerGroup = layerGroup === 'labels' || layerGroup === 'labels_places' || layerGroup === 'labels_indoor';
|
|
69081
|
-
if (isLabelLayerGroup && nextLayer.type === 'symbol') {
|
|
69082
|
-
if (styleOptions.showLabels) {
|
|
69380
|
+
else if (nextLayer.type === "fill-extrusion") {
|
|
69083
69381
|
updateLayoutProperty(nextLayer.id, "visibility", "visible");
|
|
69084
|
-
nextLayer.layout = (
|
|
69382
|
+
nextLayer.layout = (_b = nextLayer.layout) !== null && _b !== void 0 ? _b : {};
|
|
69085
69383
|
nextLayer.layout.visibility = "visible";
|
|
69086
69384
|
}
|
|
69087
|
-
|
|
69088
|
-
|
|
69089
|
-
|
|
69090
|
-
|
|
69385
|
+
// Set visibility of traffic layers depending on traffic settings.
|
|
69386
|
+
if (trafficOptions.flow !== "none" && layerGroup) {
|
|
69387
|
+
if (layerGroup === "traffic_" + trafficOptions.flow && nextLayer.type == "line") {
|
|
69388
|
+
updateLayoutProperty(nextLayer.id, "visibility", "visible");
|
|
69389
|
+
nextLayer.layout = (_c = nextLayer.layout) !== null && _c !== void 0 ? _c : {};
|
|
69390
|
+
nextLayer.layout.visibility = "visible";
|
|
69391
|
+
}
|
|
69091
69392
|
}
|
|
69092
|
-
|
|
69093
|
-
|
|
69094
|
-
|
|
69095
|
-
|
|
69096
|
-
|
|
69097
|
-
|
|
69098
|
-
|
|
69393
|
+
// Set visibility of labels
|
|
69394
|
+
var isLabelLayerGroup = layerGroup === 'labels' || layerGroup === 'labels_places' || layerGroup === 'labels_indoor';
|
|
69395
|
+
if (isLabelLayerGroup && nextLayer.type === 'symbol') {
|
|
69396
|
+
if (styleOptions.showLabels) {
|
|
69397
|
+
updateLayoutProperty(nextLayer.id, "visibility", "visible");
|
|
69398
|
+
nextLayer.layout = (_d = nextLayer.layout) !== null && _d !== void 0 ? _d : {};
|
|
69399
|
+
nextLayer.layout.visibility = "visible";
|
|
69400
|
+
}
|
|
69401
|
+
else {
|
|
69402
|
+
updateLayoutProperty(nextLayer.id, "visibility", "none");
|
|
69403
|
+
nextLayer.layout = (_e = nextLayer.layout) !== null && _e !== void 0 ? _e : {};
|
|
69404
|
+
nextLayer.layout.visibility = "none";
|
|
69405
|
+
}
|
|
69406
|
+
}
|
|
69407
|
+
// Once this _stylePatch returns control to maplibre the next style will be applied immediately in the same context.
|
|
69408
|
+
// To avoid potential data races update LayerManager with new a new set of FundamentalMapLayers from here instead of
|
|
69409
|
+
// waiting for a styledata.load event to trigger a sync in a different context.
|
|
69410
|
+
if (layerGroupLayers[layerGroup]) {
|
|
69411
|
+
layerGroupLayers[layerGroup].push(nextLayer);
|
|
69412
|
+
}
|
|
69413
|
+
else {
|
|
69414
|
+
layerGroupLayers[layerGroup] = [nextLayer];
|
|
69099
69415
|
}
|
|
69100
|
-
currentLayerGroupLayers.push(nextLayer);
|
|
69101
|
-
}
|
|
69102
|
-
else if (currentLayerGroupLayers.length > 0) {
|
|
69103
|
-
advanceLayerGroup(layerGroup);
|
|
69104
69416
|
}
|
|
69105
69417
|
});
|
|
69106
|
-
|
|
69107
|
-
|
|
69108
|
-
|
|
69418
|
+
Object.entries(layerGroupLayers).forEach(function (_a) {
|
|
69419
|
+
var _b = __read(_a, 2), layerGroupId = _b[0], layerGroupMapboxLayers = _b[1];
|
|
69420
|
+
nextLayers.push(_this._buildFundamentalLayerFrom(layerGroupMapboxLayers, layerGroupId));
|
|
69421
|
+
});
|
|
69109
69422
|
// Update FundamentalMapLayers in LayerManager
|
|
69110
69423
|
var userLayers = this.map.layers._getUserLayers();
|
|
69111
69424
|
var firstUserLayer = userLayers[0];
|
|
@@ -69141,6 +69454,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
69141
69454
|
// Layers added to mapbox through this SDK since loading the last style should be
|
|
69142
69455
|
// carried over to the next style.
|
|
69143
69456
|
userLayers.forEach(function (userLayer) {
|
|
69457
|
+
if (userLayer.layer instanceof WebGLLayer) {
|
|
69458
|
+
// mapbox custom layers cannot be serialized and preserved,
|
|
69459
|
+
// return to continue to the next user layer.
|
|
69460
|
+
return;
|
|
69461
|
+
}
|
|
69144
69462
|
var before = undefined;
|
|
69145
69463
|
if (_this.map.layers.getLayerById(userLayer.before)) {
|
|
69146
69464
|
var beforeCandidates = _this.map.layers.getLayerById(userLayer.before)._buildLayers();
|
|
@@ -69299,6 +69617,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
69299
69617
|
}
|
|
69300
69618
|
else {
|
|
69301
69619
|
var mapboxMapOptions = {
|
|
69620
|
+
antialias: _this.styleOptions.antialias,
|
|
69302
69621
|
attributionControl: false,
|
|
69303
69622
|
container: container,
|
|
69304
69623
|
fadeDuration: _this.serviceOptions.fadeDuration,
|
|
@@ -70289,6 +70608,16 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
70289
70608
|
Map.prototype.stop = function () {
|
|
70290
70609
|
this.map.stop();
|
|
70291
70610
|
};
|
|
70611
|
+
/**
|
|
70612
|
+
* Trigger the rendering of a single frame.
|
|
70613
|
+
* Use this method with WebGL layers to repaint the map when the layer's
|
|
70614
|
+
* properties or properties associated with the layer's source change.
|
|
70615
|
+
* Calling this multiple times before the next frame is rendered will still
|
|
70616
|
+
* result in only a single frame being rendered.
|
|
70617
|
+
*/
|
|
70618
|
+
Map.prototype.triggerRepaint = function () {
|
|
70619
|
+
this.map.triggerRepaint();
|
|
70620
|
+
};
|
|
70292
70621
|
/**
|
|
70293
70622
|
* @internal
|
|
70294
70623
|
*/
|
|
@@ -70420,9 +70749,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
70420
70749
|
return;
|
|
70421
70750
|
}
|
|
70422
70751
|
// Check if the default style is set by the client and if it exists in the current style set
|
|
70423
|
-
this.styles.definitions().then(function (
|
|
70424
|
-
if (!_this.styleOptions.style || !
|
|
70425
|
-
_this.styleOptions.style =
|
|
70752
|
+
this.styles.definitions().then(function (mapConfiguration) {
|
|
70753
|
+
if (!_this.styleOptions.style || !mapConfiguration.configurations.map(function (mapConfigurationStyle) { return mapConfigurationStyle.name; }).includes(_this.styleOptions.style)) {
|
|
70754
|
+
_this.styleOptions.style = mapConfiguration.defaultConfiguration;
|
|
70426
70755
|
}
|
|
70427
70756
|
_this.styleOptions = styleOptions;
|
|
70428
70757
|
_this._rebuildStyle(diff);
|