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-bare.js
CHANGED
|
@@ -64,7 +64,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
64
64
|
domain: "atlas.microsoft.com",
|
|
65
65
|
staticAssetsDomain: "atlas.microsoft.com",
|
|
66
66
|
stylePath: "styling",
|
|
67
|
-
styleDefinitionsVersion: "
|
|
67
|
+
styleDefinitionsVersion: "2022-08-05",
|
|
68
68
|
appInsightsKey: "e96cb745-c6f5-409c-a775-c4313e468c1d",
|
|
69
69
|
aadInstance: "https://login.microsoftonline.com/"
|
|
70
70
|
};
|
|
@@ -343,7 +343,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
343
343
|
return Url;
|
|
344
344
|
}());
|
|
345
345
|
|
|
346
|
-
var version = "2.
|
|
346
|
+
var version = "2.2.0";
|
|
347
347
|
|
|
348
348
|
/**
|
|
349
349
|
* A helper class that provides methods for getting various forms of the map controls current version.
|
|
@@ -4372,7 +4372,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
4372
4372
|
_this.setSelectedStyle(newStyle);
|
|
4373
4373
|
}
|
|
4374
4374
|
};
|
|
4375
|
-
_this.
|
|
4375
|
+
_this.onMapConfigurationChange = function (definitions) {
|
|
4376
4376
|
if (!_this.styleOpsGrid) {
|
|
4377
4377
|
return;
|
|
4378
4378
|
}
|
|
@@ -4380,8 +4380,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
4380
4380
|
_this.styleButtons.clear();
|
|
4381
4381
|
_this.populateOpsGridFromDefinitions(definitions);
|
|
4382
4382
|
};
|
|
4383
|
-
_this.mapToFriendlyStyleName = function (name,
|
|
4384
|
-
var style =
|
|
4383
|
+
_this.mapToFriendlyStyleName = function (name, mapConfiguration) {
|
|
4384
|
+
var style = mapConfiguration.configurations.find(function (style) { return style.name === name; });
|
|
4385
4385
|
return (style === null || style === void 0 ? void 0 : style.displayName) || name;
|
|
4386
4386
|
};
|
|
4387
4387
|
_this.options = new StyleControlOptions().merge(cloneDeep_1(options));
|
|
@@ -4477,7 +4477,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
4477
4477
|
this.styleOpsGrid = null;
|
|
4478
4478
|
this.styleButtons.clear();
|
|
4479
4479
|
this.map.events.remove("stylechanged", this.onStyleChange);
|
|
4480
|
-
this.map.events.remove("
|
|
4480
|
+
this.map.events.remove("mapconfigurationchanged", this.onMapConfigurationChange);
|
|
4481
4481
|
};
|
|
4482
4482
|
/**
|
|
4483
4483
|
* Set the style that need to be displayed as currently selected.
|
|
@@ -4496,8 +4496,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
4496
4496
|
var _b = __read(_a, 2), buttonStyleName = _b[0], button = _b[1];
|
|
4497
4497
|
return button.setAttribute('aria-current', buttonStyleName === styleName ? 'true' : 'false');
|
|
4498
4498
|
});
|
|
4499
|
-
this.map.styles.definitions().then(function (
|
|
4500
|
-
var newAlt = _this.mapToFriendlyStyleName(styleName,
|
|
4499
|
+
this.map.styles.definitions().then(function (mapConfiguration) {
|
|
4500
|
+
var newAlt = _this.mapToFriendlyStyleName(styleName, mapConfiguration);
|
|
4501
4501
|
if (image_1.alt !== newAlt) {
|
|
4502
4502
|
image_1.alt = newAlt;
|
|
4503
4503
|
}
|
|
@@ -4527,10 +4527,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
4527
4527
|
styleButton.removeAttribute("disabled");
|
|
4528
4528
|
}
|
|
4529
4529
|
};
|
|
4530
|
-
StyleControl.prototype.buildSelectStyleBtn = function (name,
|
|
4530
|
+
StyleControl.prototype.buildSelectStyleBtn = function (name, mapConfiguration, fetchIconPromise) {
|
|
4531
4531
|
var _this = this;
|
|
4532
4532
|
var styleOptionButton = document.createElement("button");
|
|
4533
|
-
var friendlyName = this.mapToFriendlyStyleName(name,
|
|
4533
|
+
var friendlyName = this.mapToFriendlyStyleName(name, mapConfiguration);
|
|
4534
4534
|
styleOptionButton.setAttribute("aria-label", friendlyName);
|
|
4535
4535
|
styleOptionButton.setAttribute("type", "button");
|
|
4536
4536
|
var styleIconImage = new Image();
|
|
@@ -4615,12 +4615,12 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
4615
4615
|
// If a style is one of those to be shown by the style picker also create it's element.
|
|
4616
4616
|
this.map.styles.definitions().then(function (definitions) { return __awaiter(_this, void 0, void 0, function () {
|
|
4617
4617
|
return __generator(this, function (_a) {
|
|
4618
|
-
this.
|
|
4618
|
+
this.onMapConfigurationChange(definitions);
|
|
4619
4619
|
this.map.events.add("stylechanged", this.onStyleChange);
|
|
4620
4620
|
return [2 /*return*/];
|
|
4621
4621
|
});
|
|
4622
4622
|
}); });
|
|
4623
|
-
this.map.events.add("
|
|
4623
|
+
this.map.events.add("mapconfigurationchanged", this.onMapConfigurationChange);
|
|
4624
4624
|
return styleOpsGrid;
|
|
4625
4625
|
};
|
|
4626
4626
|
StyleControl.prototype.populateOpsGridFromDefinitions = function (definitions) {
|
|
@@ -4628,7 +4628,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
4628
4628
|
if (!this.styleOpsGrid) {
|
|
4629
4629
|
return;
|
|
4630
4630
|
}
|
|
4631
|
-
var styles = definitions.
|
|
4631
|
+
var styles = definitions.configurations;
|
|
4632
4632
|
if (Array.isArray(this.options.mapStyles)) {
|
|
4633
4633
|
styles = styles.filter(function (style) { return _this.options.mapStyles.includes(style.name.split("_indoor")[0]); });
|
|
4634
4634
|
}
|
|
@@ -9095,6 +9095,151 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
9095
9095
|
return MultiPolygon;
|
|
9096
9096
|
}());
|
|
9097
9097
|
|
|
9098
|
+
//Based on: https://github.com/mapbox/mapbox-gl-js/blob/main/src/geo/mercator_coordinate.js
|
|
9099
|
+
/**
|
|
9100
|
+
* A `MercatorPoint` object represents a projected three dimensional position.
|
|
9101
|
+
*
|
|
9102
|
+
* `MercatorPoint` uses the web mercator projection ([EPSG:3857](https://epsg.io/3857)) with slightly different units:
|
|
9103
|
+
* - the size of 1 unit is the width of the projected world instead of the "mercator meter"
|
|
9104
|
+
* - the origin of the coordinate space is at the north-west corner instead of the middle.
|
|
9105
|
+
*
|
|
9106
|
+
* For example, `MercatorPoint(0, 0, 0)` is the north-west corner of the mercator world and
|
|
9107
|
+
* `MercatorPoint(1, 1, 0)` is the south-east corner. If you are familiar with
|
|
9108
|
+
* [vector tiles](https://github.com/mapbox/vector-tile-spec) it may be helpful to think
|
|
9109
|
+
* of the coordinate space as the `0/0/0` tile with an extent of `1`.
|
|
9110
|
+
*
|
|
9111
|
+
* The `z` dimension of `MercatorPoint` is conformal. A cube in the mercator coordinate space would be rendered as a cube.
|
|
9112
|
+
*/
|
|
9113
|
+
var MercatorPoint = /** @class */ (function (_super) {
|
|
9114
|
+
__extends(MercatorPoint, _super);
|
|
9115
|
+
/**
|
|
9116
|
+
* Constructs a MercatorPoint.
|
|
9117
|
+
* @param x A points x position in mercator units.
|
|
9118
|
+
* @param y A points y position in mercator units.
|
|
9119
|
+
* @param z A points z position in mercator units.
|
|
9120
|
+
*/
|
|
9121
|
+
function MercatorPoint(x, y, z) {
|
|
9122
|
+
return _super.call(this, x, y, z ? z : 0) || this;
|
|
9123
|
+
}
|
|
9124
|
+
/***********************************
|
|
9125
|
+
* Public static functions
|
|
9126
|
+
***********************************/
|
|
9127
|
+
/**
|
|
9128
|
+
* Converts a position into a mercator point.
|
|
9129
|
+
* @param position Position to convert.
|
|
9130
|
+
* @returns A mercator point.
|
|
9131
|
+
*/
|
|
9132
|
+
MercatorPoint.fromPosition = function (position) {
|
|
9133
|
+
if (position.length >= 2) {
|
|
9134
|
+
return new MercatorPoint((180 + position[0]) / 360, MercatorPoint._latToMercatorY(position[1]), position.length >= 3 ? MercatorPoint._altitudeToMercatorZ(position[2], position[1]) : 0);
|
|
9135
|
+
}
|
|
9136
|
+
return [0, 0, 0];
|
|
9137
|
+
};
|
|
9138
|
+
/**
|
|
9139
|
+
* Converts an array of positions into an array of mercator points.
|
|
9140
|
+
* @param positions Array of positions to convert.
|
|
9141
|
+
* @returns An array of mercator points.
|
|
9142
|
+
*/
|
|
9143
|
+
MercatorPoint.fromPositions = function (positions) {
|
|
9144
|
+
var mercators = [];
|
|
9145
|
+
for (var i = 0, len = positions.length; i < len; i++) {
|
|
9146
|
+
mercators.push(this.fromPosition(positions[i]));
|
|
9147
|
+
}
|
|
9148
|
+
return mercators;
|
|
9149
|
+
};
|
|
9150
|
+
/**
|
|
9151
|
+
* Converts an array of positions into a Float32Array of mercator xyz values.
|
|
9152
|
+
* @param positions Array of positions to convert.
|
|
9153
|
+
* @returns A Float32Array of mercator xyz values.
|
|
9154
|
+
*/
|
|
9155
|
+
MercatorPoint.toFloat32Array = function (positions) {
|
|
9156
|
+
var arr = new Float32Array(positions.length * 3);
|
|
9157
|
+
for (var i = 0, len = positions.length; i < len; i++) {
|
|
9158
|
+
var idx = i * 3;
|
|
9159
|
+
var p = positions[i];
|
|
9160
|
+
//x
|
|
9161
|
+
arr[idx] = (180 + p[0]) / 360;
|
|
9162
|
+
//y
|
|
9163
|
+
arr[idx + 1] = MercatorPoint._latToMercatorY(p[1]);
|
|
9164
|
+
//z
|
|
9165
|
+
arr[idx + 2] = p.length >= 3 ? MercatorPoint._altitudeToMercatorZ(p[2], p[1]) : 0;
|
|
9166
|
+
}
|
|
9167
|
+
return arr;
|
|
9168
|
+
};
|
|
9169
|
+
/**
|
|
9170
|
+
* Converts a mercator point into a map position.
|
|
9171
|
+
* @param mercator Mercator point to convert.
|
|
9172
|
+
* @returns A map position.
|
|
9173
|
+
*/
|
|
9174
|
+
MercatorPoint.toPosition = function (mercator) {
|
|
9175
|
+
if (mercator.length >= 2) {
|
|
9176
|
+
var lat = (360 / Math.PI) * Math.atan(Math.exp(((180 - mercator[1] * 360) * Math.PI) / 180)) - 90;
|
|
9177
|
+
return new Position(mercator[0] * 360 - 180, lat, mercator.length >= 3 ? MercatorPoint._mercatorZToAltitude(mercator[2], mercator[1]) : 0);
|
|
9178
|
+
}
|
|
9179
|
+
return [0, 0, 0];
|
|
9180
|
+
};
|
|
9181
|
+
/**
|
|
9182
|
+
* Converts an array of mercator points into an array of map positions.
|
|
9183
|
+
* @param mercators Mercator points to convert.
|
|
9184
|
+
* @returns An array of map positions.
|
|
9185
|
+
*/
|
|
9186
|
+
MercatorPoint.toPositions = function (mercators) {
|
|
9187
|
+
var positions = [];
|
|
9188
|
+
for (var i = 0, len = mercators.length; i < len; i++) {
|
|
9189
|
+
positions.push(this.toPosition(mercators[i]));
|
|
9190
|
+
}
|
|
9191
|
+
return positions;
|
|
9192
|
+
};
|
|
9193
|
+
/**
|
|
9194
|
+
* Determine the Mercator scale factor for a given latitude, see
|
|
9195
|
+
* https://en.wikipedia.org/wiki/Mercator_projection#Scale_factor
|
|
9196
|
+
*
|
|
9197
|
+
* At the equator the scale factor will be 1, which increases at higher latitudes.
|
|
9198
|
+
*
|
|
9199
|
+
* @param latitude Latitude
|
|
9200
|
+
* @returns The mercator scale factor.
|
|
9201
|
+
*/
|
|
9202
|
+
MercatorPoint.mercatorScale = function (latitude) {
|
|
9203
|
+
return 1 / Math.cos((latitude * Math.PI) / 180);
|
|
9204
|
+
};
|
|
9205
|
+
/**
|
|
9206
|
+
* Returns the distance of 1 meter in `MercatorPoint` units at this latitude.
|
|
9207
|
+
*
|
|
9208
|
+
* For coordinates in real world units using meters, this naturally provides the scale
|
|
9209
|
+
* to transform into `MercatorPoint`s.
|
|
9210
|
+
*
|
|
9211
|
+
* @returns {number} Distance of 1 meter in `MercatorPoint` units.
|
|
9212
|
+
*/
|
|
9213
|
+
MercatorPoint.meterInMercatorUnits = function (latitude) {
|
|
9214
|
+
// 1 meter / circumference at equator in meters * Mercator projection scale factor at this latitude
|
|
9215
|
+
return ((1 / MercatorPoint.earthCircumference) *
|
|
9216
|
+
MercatorPoint.mercatorScale(MercatorPoint._latToMercatorY(latitude)));
|
|
9217
|
+
};
|
|
9218
|
+
/***********************************
|
|
9219
|
+
* Private static functions
|
|
9220
|
+
***********************************/
|
|
9221
|
+
/*
|
|
9222
|
+
* The circumference at a line of latitude in meters.
|
|
9223
|
+
*/
|
|
9224
|
+
MercatorPoint._circumferenceAtLatitude = function (latitude) {
|
|
9225
|
+
return MercatorPoint.earthCircumference * Math.cos((latitude * Math.PI) / 180);
|
|
9226
|
+
};
|
|
9227
|
+
MercatorPoint._altitudeToMercatorZ = function (altitude, latitude) {
|
|
9228
|
+
return altitude / MercatorPoint._circumferenceAtLatitude(latitude);
|
|
9229
|
+
};
|
|
9230
|
+
MercatorPoint._mercatorZToAltitude = function (zoom, y) {
|
|
9231
|
+
return zoom * MercatorPoint._circumferenceAtLatitude(MercatorPoint._latToMercatorY(y));
|
|
9232
|
+
};
|
|
9233
|
+
MercatorPoint._latToMercatorY = function (y) {
|
|
9234
|
+
return (180 - (180 / Math.PI) * Math.log(Math.tan(Math.PI / 4 + (y * Math.PI) / 360))) / 360;
|
|
9235
|
+
};
|
|
9236
|
+
/*
|
|
9237
|
+
* The average circumference of the world in meters.
|
|
9238
|
+
*/
|
|
9239
|
+
MercatorPoint.earthCircumference = 2 * Math.PI * getEarthRadius(); // meters
|
|
9240
|
+
return MercatorPoint;
|
|
9241
|
+
}(Array));
|
|
9242
|
+
|
|
9098
9243
|
|
|
9099
9244
|
|
|
9100
9245
|
var index$1 = /*#__PURE__*/Object.freeze({
|
|
@@ -9106,6 +9251,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
9106
9251
|
Polygon: Polygon,
|
|
9107
9252
|
Position: Position,
|
|
9108
9253
|
BoundingBox: BoundingBox,
|
|
9254
|
+
MercatorPoint: MercatorPoint,
|
|
9109
9255
|
MultiLineString: MultiLineString,
|
|
9110
9256
|
MultiPoint: MultiPoint,
|
|
9111
9257
|
MultiPolygon: MultiPolygon,
|
|
@@ -9522,6 +9668,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
9522
9668
|
return this.container;
|
|
9523
9669
|
};
|
|
9524
9670
|
ZoomControl.prototype.onRemove = function () {
|
|
9671
|
+
_super.prototype.onRemove.call(this);
|
|
9525
9672
|
if (this.map) {
|
|
9526
9673
|
this.map.events.remove('zoom', this.zoomChanged);
|
|
9527
9674
|
this.map.events.remove('minzoomchanged', this.minZoomChanged);
|
|
@@ -12389,6 +12536,155 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
12389
12536
|
return TileLayer;
|
|
12390
12537
|
}(SourceBuildingLayer));
|
|
12391
12538
|
|
|
12539
|
+
/**
|
|
12540
|
+
* Options used to render graphics in a WebGLLayer.
|
|
12541
|
+
*/
|
|
12542
|
+
var WebGLLayerOptions = /** @class */ (function (_super) {
|
|
12543
|
+
__extends(WebGLLayerOptions, _super);
|
|
12544
|
+
function WebGLLayerOptions() {
|
|
12545
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
12546
|
+
/**
|
|
12547
|
+
* An object that contains the rendering logic.
|
|
12548
|
+
*/
|
|
12549
|
+
_this.renderer = undefined;
|
|
12550
|
+
return _this;
|
|
12551
|
+
}
|
|
12552
|
+
return WebGLLayerOptions;
|
|
12553
|
+
}(LayerOptions));
|
|
12554
|
+
|
|
12555
|
+
/**
|
|
12556
|
+
* Enables custom rendering logic with access to the WebGL context of the map.
|
|
12557
|
+
*/
|
|
12558
|
+
var WebGLLayer = /** @class */ (function (_super) {
|
|
12559
|
+
__extends(WebGLLayer, _super);
|
|
12560
|
+
/**
|
|
12561
|
+
* Constructs a new WebGLLayer.
|
|
12562
|
+
* @param id The id of the layer. If not specified a random one will be generated.
|
|
12563
|
+
* @param options The options of the WebGL layer.
|
|
12564
|
+
*/
|
|
12565
|
+
function WebGLLayer(id, options) {
|
|
12566
|
+
var _this = _super.call(this, id) || this;
|
|
12567
|
+
/**
|
|
12568
|
+
* Make sure the layer is available after a style change.
|
|
12569
|
+
* @internal
|
|
12570
|
+
*/
|
|
12571
|
+
_this._onStyleChange = function () {
|
|
12572
|
+
var _a;
|
|
12573
|
+
// Custom layers cannot be serialized and preserved by mapbox.
|
|
12574
|
+
// Add this layer again if the layer was removed by mapbox after a style change.
|
|
12575
|
+
if (!_this.map._getMap().getLayer(_this.id)) {
|
|
12576
|
+
var map = _this.map;
|
|
12577
|
+
var before_1 = (_a = _this.map.layers._getUserLayers().find(function (l) { return l.layer.getId() == _this.id; })) === null || _a === void 0 ? void 0 : _a.before;
|
|
12578
|
+
map.layers.remove(_this);
|
|
12579
|
+
map.layers.add(_this, before_1);
|
|
12580
|
+
}
|
|
12581
|
+
};
|
|
12582
|
+
_this.options = new WebGLLayerOptions().merge(cloneDeepWith_1(options, WebGLLayerOptions._cloneCustomizer));
|
|
12583
|
+
_this.source = new DataSource();
|
|
12584
|
+
return _this;
|
|
12585
|
+
}
|
|
12586
|
+
/**
|
|
12587
|
+
* Gets the options of the WebGL layer.
|
|
12588
|
+
*/
|
|
12589
|
+
WebGLLayer.prototype.getOptions = function () {
|
|
12590
|
+
// Copy the options so the user can't directly change options.
|
|
12591
|
+
// They must use setOptions(...).
|
|
12592
|
+
return cloneDeepWith_1(this.options, WebGLLayerOptions._cloneCustomizer);
|
|
12593
|
+
};
|
|
12594
|
+
/**
|
|
12595
|
+
* Sets the options of the WebGL layer.
|
|
12596
|
+
* @param options The new options of the WebGL layer.
|
|
12597
|
+
*/
|
|
12598
|
+
WebGLLayer.prototype.setOptions = function (options) {
|
|
12599
|
+
var newOptions = new WebGLLayerOptions().merge(this.options, cloneDeepWith_1(options, WebGLLayerOptions._cloneCustomizer));
|
|
12600
|
+
// Trigger a repaint of the map if the layer options have changed.
|
|
12601
|
+
if (this.map) {
|
|
12602
|
+
this.map.triggerRepaint();
|
|
12603
|
+
}
|
|
12604
|
+
this.options = newOptions;
|
|
12605
|
+
};
|
|
12606
|
+
WebGLLayer.prototype.onAdd = function (map) {
|
|
12607
|
+
var _a, _b;
|
|
12608
|
+
_super.prototype.onAdd.call(this, map);
|
|
12609
|
+
// Make sure the layer is available after a style change.
|
|
12610
|
+
this.map.events.add("stylechanged", this._onStyleChange);
|
|
12611
|
+
// Notify the renderer this layer has been added to the map.
|
|
12612
|
+
if (this.options.renderer && this.glContext) {
|
|
12613
|
+
(_b = (_a = this.options.renderer).onAdd) === null || _b === void 0 ? void 0 : _b.call(_a, map, this.glContext);
|
|
12614
|
+
}
|
|
12615
|
+
};
|
|
12616
|
+
WebGLLayer.prototype.onRemove = function () {
|
|
12617
|
+
var _a, _b;
|
|
12618
|
+
// Notify the renderer this layer has been removed from the map.
|
|
12619
|
+
if (this.options.renderer && this.glContext) {
|
|
12620
|
+
(_b = (_a = this.options.renderer).onRemove) === null || _b === void 0 ? void 0 : _b.call(_a, this.map, this.glContext);
|
|
12621
|
+
}
|
|
12622
|
+
// Cleanup
|
|
12623
|
+
this.map.events.remove("stylechanged", this._onStyleChange);
|
|
12624
|
+
this.glContext = null;
|
|
12625
|
+
_super.prototype.onRemove.call(this);
|
|
12626
|
+
};
|
|
12627
|
+
/**
|
|
12628
|
+
* @internal
|
|
12629
|
+
*/
|
|
12630
|
+
WebGLLayer.prototype._buildLayers = function () {
|
|
12631
|
+
var _this = this;
|
|
12632
|
+
if (!this.options.renderer) {
|
|
12633
|
+
throw new Error("Cannot build the WebGL layer because renderer was not set.");
|
|
12634
|
+
}
|
|
12635
|
+
return [
|
|
12636
|
+
{
|
|
12637
|
+
id: this.id,
|
|
12638
|
+
type: "custom",
|
|
12639
|
+
renderingMode: this.options.renderer.renderingMode,
|
|
12640
|
+
onAdd: function (m, gl) {
|
|
12641
|
+
// Capture the GL context to reuse it later.
|
|
12642
|
+
// renderer.onAdd will be called in the onAdd callback of this layer.
|
|
12643
|
+
_this.glContext = gl;
|
|
12644
|
+
},
|
|
12645
|
+
onRemove: function (m, gl) {
|
|
12646
|
+
// renderer.onRemove will be called in the onRemove callback of this layer.
|
|
12647
|
+
},
|
|
12648
|
+
prerender: function (gl, matrix) {
|
|
12649
|
+
var _a, _b;
|
|
12650
|
+
if (_this._shouldRender()) {
|
|
12651
|
+
(_b = (_a = _this.options.renderer).prerender) === null || _b === void 0 ? void 0 : _b.call(_a, gl, matrix);
|
|
12652
|
+
}
|
|
12653
|
+
},
|
|
12654
|
+
render: function (gl, matrix) {
|
|
12655
|
+
if (_this._shouldRender()) {
|
|
12656
|
+
_this.options.renderer.render(gl, matrix);
|
|
12657
|
+
}
|
|
12658
|
+
}
|
|
12659
|
+
}
|
|
12660
|
+
];
|
|
12661
|
+
};
|
|
12662
|
+
/**
|
|
12663
|
+
* @internal
|
|
12664
|
+
*/
|
|
12665
|
+
WebGLLayer.prototype._getLayerIds = function () {
|
|
12666
|
+
return [this.id];
|
|
12667
|
+
};
|
|
12668
|
+
/**
|
|
12669
|
+
* @internal
|
|
12670
|
+
*/
|
|
12671
|
+
WebGLLayer.prototype._getSourceIds = function () {
|
|
12672
|
+
return new Set().add(this.source.getId());
|
|
12673
|
+
};
|
|
12674
|
+
/**
|
|
12675
|
+
* Returns true if the next frame should be rendered
|
|
12676
|
+
* @internal
|
|
12677
|
+
*/
|
|
12678
|
+
WebGLLayer.prototype._shouldRender = function () {
|
|
12679
|
+
if (this.map) {
|
|
12680
|
+
var zoom = this.map.getCamera().zoom;
|
|
12681
|
+
return this.options.visible && this.options.minZoom <= zoom && this.options.maxZoom > zoom;
|
|
12682
|
+
}
|
|
12683
|
+
return false;
|
|
12684
|
+
};
|
|
12685
|
+
return WebGLLayer;
|
|
12686
|
+
}(Layer));
|
|
12687
|
+
|
|
12392
12688
|
|
|
12393
12689
|
|
|
12394
12690
|
var index$5 = /*#__PURE__*/Object.freeze({
|
|
@@ -12401,7 +12697,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
12401
12697
|
SymbolLayer: SymbolLayer,
|
|
12402
12698
|
TileLayer: TileLayer,
|
|
12403
12699
|
HeatMapLayer: HeatMapLayer,
|
|
12404
|
-
ImageLayer: ImageLayer
|
|
12700
|
+
ImageLayer: ImageLayer,
|
|
12701
|
+
WebGLLayer: WebGLLayer
|
|
12405
12702
|
});
|
|
12406
12703
|
|
|
12407
12704
|
var Html = /** @class */ (function () {
|
|
@@ -22926,6 +23223,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
22926
23223
|
|
|
22927
23224
|
// Disable unified signatures linter rule so we can generate separate docs for function overloads.
|
|
22928
23225
|
// tslint:disable:unified-signatures
|
|
23226
|
+
var MAP_CLIENT_EVENTS = ['maxzoomchanged', 'minzoomchanged', 'mapconfigurationchanged'];
|
|
22929
23227
|
/**
|
|
22930
23228
|
* A manager for the map control's events.
|
|
22931
23229
|
* Exposed through the events property of the atlas.Map class.
|
|
@@ -23037,6 +23335,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
23037
23335
|
* @private
|
|
23038
23336
|
*/
|
|
23039
23337
|
EventManager.prototype._addGlobalListener = function (eventType, callback, legacy, once) {
|
|
23338
|
+
// add our custom events emitted by Map client to the map (note: they don't utilize modifiedCallback)
|
|
23339
|
+
if (MAP_CLIENT_EVENTS.includes(eventType)) {
|
|
23340
|
+
this.map._addEventListener(eventType, callback, once);
|
|
23341
|
+
return;
|
|
23342
|
+
}
|
|
23040
23343
|
var oldModifiedCallback = this.mapCallbackHandler.getModifiedCallback(eventType, "", callback);
|
|
23041
23344
|
// Get a new modified callback.
|
|
23042
23345
|
this.mapCallbackHandler.addCallback(eventType, "", callback, legacy, once);
|
|
@@ -23061,9 +23364,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
23061
23364
|
setTimeout(function () { return modifiedCallback(readyData_1); });
|
|
23062
23365
|
}
|
|
23063
23366
|
}
|
|
23064
|
-
else if (["minzoomchanged", "maxzoomchanged", "stylesetchanged"].includes(eventType)) {
|
|
23065
|
-
this.map._addEventListener(eventType, callback, once);
|
|
23066
|
-
}
|
|
23067
23367
|
else {
|
|
23068
23368
|
// If a callback already exists disable it so the new one can replace it.
|
|
23069
23369
|
if (oldModifiedCallback) {
|
|
@@ -23160,6 +23460,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
23160
23460
|
*/
|
|
23161
23461
|
EventManager.prototype._removeListener = function (eventType, target, callback) {
|
|
23162
23462
|
var e_5, _a;
|
|
23463
|
+
// remove our custom events emitted by Map client to the map (note: they don't utilize modifiedCallback)
|
|
23464
|
+
if (MAP_CLIENT_EVENTS.includes(eventType)) {
|
|
23465
|
+
this.map._removeEventListener(eventType, callback);
|
|
23466
|
+
return;
|
|
23467
|
+
}
|
|
23163
23468
|
var layerId = target instanceof Layer ? target.getId() : target;
|
|
23164
23469
|
var modifiedCallback = this.mapCallbackHandler.getModifiedCallback(eventType, layerId, callback);
|
|
23165
23470
|
// If a callback already exists disable it so the new one can replace it.
|
|
@@ -24067,15 +24372,15 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
24067
24372
|
*/
|
|
24068
24373
|
LayerManager.prototype._removeLayer = function (layer) {
|
|
24069
24374
|
var layerId = layer instanceof Layer ? layer.getId() : layer;
|
|
24070
|
-
|
|
24375
|
+
var layerIndex = this.layerIndex.findIndex(function (l) { return l.getId() === layerId; });
|
|
24376
|
+
if (layerIndex == -1) {
|
|
24071
24377
|
throw new Error("The layer '" + layerId + "' has not been added to the map and cannot be removed.");
|
|
24072
24378
|
}
|
|
24073
|
-
var layerIndex = this.layerIndex.findIndex(function (l) { return l.getId() === layerId; });
|
|
24074
24379
|
var tempLayer = this.layerIndex[layerIndex];
|
|
24075
24380
|
this._removeMapboxLayers(tempLayer);
|
|
24076
24381
|
this.layerIndex.splice(layerIndex, 1);
|
|
24077
|
-
var userLayerIndex = this.userLayers.findIndex(function (ul) { return ul.layer.getId() ===
|
|
24078
|
-
if (userLayerIndex
|
|
24382
|
+
var userLayerIndex = this.userLayers.findIndex(function (ul) { return ul.layer.getId() === layerId; });
|
|
24383
|
+
if (userLayerIndex != -1) {
|
|
24079
24384
|
this.userLayers.splice(userLayerIndex, 1);
|
|
24080
24385
|
}
|
|
24081
24386
|
tempLayer.onRemove();
|
|
@@ -25051,6 +25356,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
25051
25356
|
__extends(StyleOptions, _super);
|
|
25052
25357
|
function StyleOptions() {
|
|
25053
25358
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
25359
|
+
/**
|
|
25360
|
+
* If true, the gl context will be created with MSAA antialiasing, which can be useful for antialiasing WebGL layers.
|
|
25361
|
+
*/
|
|
25362
|
+
_this.antialias = undefined;
|
|
25054
25363
|
/**
|
|
25055
25364
|
* If true the map will automatically resize whenever the window's size changes.
|
|
25056
25365
|
* Otherwise map.resize() must be called.
|
|
@@ -25247,10 +25556,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
25247
25556
|
*/
|
|
25248
25557
|
_this.styleAPIVersion = getStyleAPIVersion();
|
|
25249
25558
|
/**
|
|
25250
|
-
* The
|
|
25251
|
-
|
|
25252
|
-
|
|
25253
|
-
|
|
25559
|
+
* The map configuration defines the set of styles available to the map.
|
|
25560
|
+
*/
|
|
25561
|
+
_this.mapConfiguration = undefined;
|
|
25562
|
+
/**
|
|
25563
|
+
* @deprecated use mapConfiguration instead
|
|
25254
25564
|
*/
|
|
25255
25565
|
_this.styleSet = undefined;
|
|
25256
25566
|
/**
|
|
@@ -25421,6 +25731,14 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
25421
25731
|
if (merged.authOptions.authType !== exports.AuthenticationType.subscriptionKey) {
|
|
25422
25732
|
merged["subscription-key"] = merged.subscriptionKey = undefined;
|
|
25423
25733
|
}
|
|
25734
|
+
// if mapConfiguration is not set and legacy styleSet option is used, assign it to mapConfiguration
|
|
25735
|
+
if (merged.styleSet !== undefined && merged.mapConfiguration === undefined) {
|
|
25736
|
+
merged.mapConfiguration = merged.styleSet;
|
|
25737
|
+
}
|
|
25738
|
+
// reassign properties from legacy mapConfiguration to new structure if needed
|
|
25739
|
+
if (merged.mapConfiguration && typeof merged.mapConfiguration !== 'string') {
|
|
25740
|
+
merged.mapConfiguration = __assign(__assign({}, merged.mapConfiguration), { defaultConfiguration: merged.mapConfiguration.defaultConfiguration || merged.mapConfiguration['defaultStyle'], configurations: merged.mapConfiguration.configurations || merged.mapConfiguration['styles'] });
|
|
25741
|
+
}
|
|
25424
25742
|
this._transformers = __spread(currentTransforms || [], transformersToMerge.filter(function (toMerge) { return !currentTransforms.includes(toMerge); }));
|
|
25425
25743
|
if (this.transformRequest && !this._transformers.includes(this.transformRequest)) {
|
|
25426
25744
|
this._transformers.push(this.transformRequest);
|
|
@@ -25625,9 +25943,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
25625
25943
|
*/
|
|
25626
25944
|
this.indoorState = undefined;
|
|
25627
25945
|
/**
|
|
25628
|
-
* Preserve the
|
|
25946
|
+
* Preserve the map configuration that was used before the indoor map configuration was set
|
|
25629
25947
|
*/
|
|
25630
|
-
this.
|
|
25948
|
+
this.preservedPreindoorMapConfiguration = undefined;
|
|
25631
25949
|
this._onStyleData = function () {
|
|
25632
25950
|
_this._lookUpAsync(_this.map.getStyle()).then(function (style) {
|
|
25633
25951
|
_this.map.events.invoke("stylechanged", {
|
|
@@ -25650,11 +25968,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
25650
25968
|
return null;
|
|
25651
25969
|
}
|
|
25652
25970
|
else {
|
|
25653
|
-
return definitions.
|
|
25971
|
+
return definitions.configurations.find(function (style) { return style.name === (options.style || definitions.defaultConfiguration); })
|
|
25654
25972
|
// retrieve default style definition unless option.style's one was found
|
|
25655
|
-
|| definitions.
|
|
25656
|
-
// no default style in the
|
|
25657
|
-
|| definitions.
|
|
25973
|
+
|| definitions.configurations.find(function (style) { return style.name === definitions.defaultConfiguration; })
|
|
25974
|
+
// no default style in the mapConfiguration -> pick the first style
|
|
25975
|
+
|| definitions.configurations[0];
|
|
25658
25976
|
}
|
|
25659
25977
|
};
|
|
25660
25978
|
this._lookUpAsync = function (options) { return __awaiter(_this, void 0, void 0, function () {
|
|
@@ -25664,11 +25982,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
25664
25982
|
case 0: return [4 /*yield*/, this.definitions()];
|
|
25665
25983
|
case 1:
|
|
25666
25984
|
definitions = _a.sent();
|
|
25667
|
-
result = definitions.
|
|
25985
|
+
result = definitions.configurations.find(function (style) { return style.name === (options.style || definitions.defaultConfiguration); })
|
|
25668
25986
|
// retrieve default style definition unless option.style's one was found
|
|
25669
|
-
|| definitions.
|
|
25670
|
-
// no default style in the
|
|
25671
|
-
|| definitions.
|
|
25987
|
+
|| definitions.configurations.find(function (style) { return style.name === definitions.defaultConfiguration; })
|
|
25988
|
+
// no default style in the mapConfiguration -> pick the first style
|
|
25989
|
+
|| definitions.configurations[0];
|
|
25672
25990
|
return [2 /*return*/, result];
|
|
25673
25991
|
}
|
|
25674
25992
|
});
|
|
@@ -25679,13 +25997,13 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
25679
25997
|
StyleManager.prototype.updateIndoorState = function (theme, tilesetId) {
|
|
25680
25998
|
var _this = this;
|
|
25681
25999
|
var _a;
|
|
25682
|
-
var
|
|
25683
|
-
if (
|
|
25684
|
-
this.
|
|
26000
|
+
var mapConfiguration = this.map.styles.getMapConfiguration();
|
|
26001
|
+
if (mapConfiguration) {
|
|
26002
|
+
this.preservedPreindoorMapConfiguration = mapConfiguration;
|
|
25685
26003
|
// tilesetId fallback
|
|
25686
26004
|
// MAGIC: if we are on a default style set - match existing style to the one in the default indoor style set
|
|
25687
26005
|
var desiredIndoorStyle = this.map.getStyle().style ? this.map.getStyle().style + "_indoor" + (theme === 'dark' ? '_dark' : '') + "_tileset_" + tilesetId : undefined;
|
|
25688
|
-
this.map.styles.setMapConfiguration("defaultIndoor_" + tilesetId,
|
|
26006
|
+
this.map.styles.setMapConfiguration("defaultIndoor_" + tilesetId, mapConfiguration === 'microsoft-maps:default' ? desiredIndoorStyle : undefined);
|
|
25689
26007
|
}
|
|
25690
26008
|
else {
|
|
25691
26009
|
var didTilesetIdChange_1 = ((_a = this.indoorState) === null || _a === void 0 ? void 0 : _a.tilesetId) !== tilesetId;
|
|
@@ -25695,12 +26013,12 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
25695
26013
|
};
|
|
25696
26014
|
this.initStyleset();
|
|
25697
26015
|
this.definitions().then(function (definitions) {
|
|
25698
|
-
var currentStyle = (_this.map.getStyle().style || definitions.
|
|
26016
|
+
var currentStyle = (_this.map.getStyle().style || definitions.defaultConfiguration)
|
|
25699
26017
|
.replace('_indoor_dark', '')
|
|
25700
26018
|
.replace('_indoor', '');
|
|
25701
26019
|
// we cannot compose the precise style name for auto theme, search for prefix style name match
|
|
25702
26020
|
var targetStylePrefix = currentStyle + "_indoor";
|
|
25703
|
-
var candidateStyle = definitions.
|
|
26021
|
+
var candidateStyle = definitions.configurations.find(function (style) { return style.name.startsWith(targetStylePrefix); });
|
|
25704
26022
|
if (candidateStyle) {
|
|
25705
26023
|
// force style reload if tileset id has changed to make sure the tiles will be re-requested with new tileset applied in indoor source placeholder
|
|
25706
26024
|
_this.map.setStyle({ style: candidateStyle.name }, !didTilesetIdChange_1);
|
|
@@ -25710,10 +26028,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
25710
26028
|
};
|
|
25711
26029
|
StyleManager.prototype.unsetIndoorState = function () {
|
|
25712
26030
|
var _this = this;
|
|
25713
|
-
var
|
|
25714
|
-
if (
|
|
26031
|
+
var mapConfiguration = this.preservedPreindoorMapConfiguration;
|
|
26032
|
+
if (mapConfiguration) {
|
|
25715
26033
|
// we need to revert to the styleset that was ap
|
|
25716
|
-
this.map.styles.setMapConfiguration(
|
|
26034
|
+
this.map.styles.setMapConfiguration(mapConfiguration);
|
|
25717
26035
|
}
|
|
25718
26036
|
else {
|
|
25719
26037
|
this.indoorState = undefined;
|
|
@@ -25740,11 +26058,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
25740
26058
|
var baseName = _this.indoorState && styleName.includes('_indoor') ? styleName.split('_indoor')[0] : styleName;
|
|
25741
26059
|
return baseName in styleNamesMap ? styleNamesMap[baseName] : baseName;
|
|
25742
26060
|
};
|
|
25743
|
-
if (!this.serviceOptions.
|
|
26061
|
+
if (!this.serviceOptions.mapConfiguration) {
|
|
25744
26062
|
newPromise = new HijackablePromise(this._request(this.serviceOptions.staticAssetsDomain, constants.stylePath + "/" + constants.styleResourcePath, "StyleDefinitions", { version: this.serviceOptions.styleDefinitionsVersion }).then(function (definitions) { return ({
|
|
25745
26063
|
version: isNaN(definitions.version) ? 0 : parseFloat(definitions.version),
|
|
25746
|
-
|
|
25747
|
-
|
|
26064
|
+
defaultConfiguration: definitions.defaultStyle,
|
|
26065
|
+
configurations: definitions.styles
|
|
25748
26066
|
.filter(function (style) {
|
|
25749
26067
|
if (!_this.indoorState) {
|
|
25750
26068
|
return !style.name.includes('indoor');
|
|
@@ -25775,11 +26093,13 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
25775
26093
|
}); })
|
|
25776
26094
|
}); }));
|
|
25777
26095
|
}
|
|
25778
|
-
else if (typeof this.serviceOptions.
|
|
25779
|
-
newPromise = new HijackablePromise(this._request(this.serviceOptions.domain, constants.styleResourcePath + "/mapconfigurations/metadata/" + this.serviceOptions.
|
|
26096
|
+
else if (typeof this.serviceOptions.mapConfiguration === 'string') {
|
|
26097
|
+
newPromise = new HijackablePromise(this._request(this.serviceOptions.domain, constants.styleResourcePath + "/mapconfigurations/metadata/" + this.serviceOptions.mapConfiguration, "StyleDefinitions"
|
|
26098
|
+
// reassign properties from legacy mapConfiguration to new structure if needed
|
|
26099
|
+
).then(function (definitions) { return (__assign(__assign({}, definitions), { defaultConfiguration: definitions.defaultConfiguration || definitions['defaultStyle'], configurations: definitions.configurations || definitions['styles'] })); }));
|
|
25780
26100
|
}
|
|
25781
26101
|
else {
|
|
25782
|
-
newPromise = HijackablePromise.resolve(this.serviceOptions.
|
|
26102
|
+
newPromise = HijackablePromise.resolve(this.serviceOptions.mapConfiguration);
|
|
25783
26103
|
}
|
|
25784
26104
|
if (this.initPromise) {
|
|
25785
26105
|
this.initPromise.switchWith(newPromise);
|
|
@@ -25789,7 +26109,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
25789
26109
|
this.initPromise = newPromise;
|
|
25790
26110
|
}
|
|
25791
26111
|
// propagate styleset change
|
|
25792
|
-
this.initPromise.then(function (styleset) { return _this.map._invokeEvent("
|
|
26112
|
+
this.initPromise.then(function (styleset) { return _this.map._invokeEvent("mapconfigurationchanged", styleset); });
|
|
25793
26113
|
return this.initPromise;
|
|
25794
26114
|
};
|
|
25795
26115
|
/**
|
|
@@ -25848,30 +26168,30 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
25848
26168
|
/**
|
|
25849
26169
|
* Replaces the style set used. Very costly as it reloads all controls and resources.
|
|
25850
26170
|
*/
|
|
25851
|
-
StyleManager.prototype.setMapConfiguration = function (
|
|
26171
|
+
StyleManager.prototype.setMapConfiguration = function (mapConfiguration, styleName) {
|
|
25852
26172
|
var _this = this;
|
|
25853
|
-
this.serviceOptions.
|
|
25854
|
-
if (typeof
|
|
26173
|
+
this.serviceOptions.mapConfiguration = mapConfiguration;
|
|
26174
|
+
if (typeof mapConfiguration === 'string') {
|
|
25855
26175
|
this.initStyleset();
|
|
25856
26176
|
}
|
|
25857
26177
|
else {
|
|
25858
26178
|
if (this.initPromise) {
|
|
25859
|
-
this.initPromise.hijackAndResolve(
|
|
26179
|
+
this.initPromise.hijackAndResolve(mapConfiguration);
|
|
25860
26180
|
}
|
|
25861
26181
|
else {
|
|
25862
|
-
this.initPromise = HijackablePromise.resolve(
|
|
26182
|
+
this.initPromise = HijackablePromise.resolve(mapConfiguration);
|
|
25863
26183
|
}
|
|
25864
26184
|
}
|
|
25865
26185
|
this.definitions().then(function (definitions) {
|
|
25866
|
-
var targetStyleName = definitions.
|
|
25867
|
-
if (definitions.
|
|
26186
|
+
var targetStyleName = definitions.defaultConfiguration;
|
|
26187
|
+
if (definitions.configurations.find(function (s) { return s.name === styleName; })) {
|
|
25868
26188
|
targetStyleName = styleName;
|
|
25869
26189
|
}
|
|
25870
26190
|
_this.map.setStyle({ style: targetStyleName });
|
|
25871
26191
|
});
|
|
25872
26192
|
};
|
|
25873
26193
|
StyleManager.prototype.getMapConfiguration = function () {
|
|
25874
|
-
return this.serviceOptions.
|
|
26194
|
+
return this.serviceOptions.mapConfiguration;
|
|
25875
26195
|
};
|
|
25876
26196
|
// backward-compatibility: this method preserves the interface that azure-maps-indoor@2.0.6 assumes
|
|
25877
26197
|
StyleManager.prototype.setStyleSet = function (styleSet) {
|
|
@@ -25919,66 +26239,59 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
25919
26239
|
// A FundamentalMapLayer (grouped layer) representation of the next style must be built.
|
|
25920
26240
|
var previousLayers = this.map.layers.getLayers();
|
|
25921
26241
|
var nextLayers = [];
|
|
25922
|
-
var
|
|
25923
|
-
var currentLayerGroupLayers = [];
|
|
25924
|
-
var advanceLayerGroup = function (nextLayerGroup) {
|
|
25925
|
-
nextLayers.push(_this._buildFundamentalLayerFrom(currentLayerGroupLayers, currentLayerGroupId));
|
|
25926
|
-
currentLayerGroupId = nextLayerGroup;
|
|
25927
|
-
currentLayerGroupLayers = [];
|
|
25928
|
-
};
|
|
26242
|
+
var layerGroupLayers = {};
|
|
25929
26243
|
nextStyle.layers.forEach(function (nextLayer) {
|
|
25930
26244
|
var _a, _b, _c, _d, _e;
|
|
25931
26245
|
var layerGroup = LayerGroupComparator.getLayerGroup(nextLayer);
|
|
25932
|
-
|
|
25933
|
-
|
|
25934
|
-
|
|
25935
|
-
|
|
25936
|
-
|
|
25937
|
-
|
|
25938
|
-
}
|
|
25939
|
-
else if (nextLayer.type === "fill-extrusion") {
|
|
25940
|
-
updateLayoutProperty(nextLayer.id, "visibility", "visible");
|
|
25941
|
-
nextLayer.layout = (_b = nextLayer.layout) !== null && _b !== void 0 ? _b : {};
|
|
25942
|
-
nextLayer.layout.visibility = "visible";
|
|
25943
|
-
}
|
|
25944
|
-
// Set visibility of traffic layers depending on traffic settings.
|
|
25945
|
-
if (trafficOptions.flow !== "none" && layerGroup) {
|
|
25946
|
-
if (layerGroup === "traffic_" + trafficOptions.flow && nextLayer.type == "line") {
|
|
25947
|
-
updateLayoutProperty(nextLayer.id, "visibility", "visible");
|
|
25948
|
-
nextLayer.layout = (_c = nextLayer.layout) !== null && _c !== void 0 ? _c : {};
|
|
25949
|
-
nextLayer.layout.visibility = "visible";
|
|
26246
|
+
if (layerGroup) {
|
|
26247
|
+
// Set visiblity of fill-extrusion layers according to StyleOptions.showBuildingModels
|
|
26248
|
+
if (!styleOptions.showBuildingModels && nextLayer.type === "fill-extrusion") {
|
|
26249
|
+
updateLayoutProperty(nextLayer.id, "visibility", "none");
|
|
26250
|
+
nextLayer.layout = (_a = nextLayer.layout) !== null && _a !== void 0 ? _a : {};
|
|
26251
|
+
nextLayer.layout.visibility = "none";
|
|
25950
26252
|
}
|
|
25951
|
-
|
|
25952
|
-
// Set visibility of labels
|
|
25953
|
-
var isLabelLayerGroup = layerGroup === 'labels' || layerGroup === 'labels_places' || layerGroup === 'labels_indoor';
|
|
25954
|
-
if (isLabelLayerGroup && nextLayer.type === 'symbol') {
|
|
25955
|
-
if (styleOptions.showLabels) {
|
|
26253
|
+
else if (nextLayer.type === "fill-extrusion") {
|
|
25956
26254
|
updateLayoutProperty(nextLayer.id, "visibility", "visible");
|
|
25957
|
-
nextLayer.layout = (
|
|
26255
|
+
nextLayer.layout = (_b = nextLayer.layout) !== null && _b !== void 0 ? _b : {};
|
|
25958
26256
|
nextLayer.layout.visibility = "visible";
|
|
25959
26257
|
}
|
|
25960
|
-
|
|
25961
|
-
|
|
25962
|
-
|
|
25963
|
-
|
|
26258
|
+
// Set visibility of traffic layers depending on traffic settings.
|
|
26259
|
+
if (trafficOptions.flow !== "none" && layerGroup) {
|
|
26260
|
+
if (layerGroup === "traffic_" + trafficOptions.flow && nextLayer.type == "line") {
|
|
26261
|
+
updateLayoutProperty(nextLayer.id, "visibility", "visible");
|
|
26262
|
+
nextLayer.layout = (_c = nextLayer.layout) !== null && _c !== void 0 ? _c : {};
|
|
26263
|
+
nextLayer.layout.visibility = "visible";
|
|
26264
|
+
}
|
|
25964
26265
|
}
|
|
25965
|
-
|
|
25966
|
-
|
|
25967
|
-
|
|
25968
|
-
|
|
25969
|
-
|
|
25970
|
-
|
|
25971
|
-
|
|
26266
|
+
// Set visibility of labels
|
|
26267
|
+
var isLabelLayerGroup = layerGroup === 'labels' || layerGroup === 'labels_places' || layerGroup === 'labels_indoor';
|
|
26268
|
+
if (isLabelLayerGroup && nextLayer.type === 'symbol') {
|
|
26269
|
+
if (styleOptions.showLabels) {
|
|
26270
|
+
updateLayoutProperty(nextLayer.id, "visibility", "visible");
|
|
26271
|
+
nextLayer.layout = (_d = nextLayer.layout) !== null && _d !== void 0 ? _d : {};
|
|
26272
|
+
nextLayer.layout.visibility = "visible";
|
|
26273
|
+
}
|
|
26274
|
+
else {
|
|
26275
|
+
updateLayoutProperty(nextLayer.id, "visibility", "none");
|
|
26276
|
+
nextLayer.layout = (_e = nextLayer.layout) !== null && _e !== void 0 ? _e : {};
|
|
26277
|
+
nextLayer.layout.visibility = "none";
|
|
26278
|
+
}
|
|
26279
|
+
}
|
|
26280
|
+
// Once this _stylePatch returns control to maplibre the next style will be applied immediately in the same context.
|
|
26281
|
+
// To avoid potential data races update LayerManager with new a new set of FundamentalMapLayers from here instead of
|
|
26282
|
+
// waiting for a styledata.load event to trigger a sync in a different context.
|
|
26283
|
+
if (layerGroupLayers[layerGroup]) {
|
|
26284
|
+
layerGroupLayers[layerGroup].push(nextLayer);
|
|
26285
|
+
}
|
|
26286
|
+
else {
|
|
26287
|
+
layerGroupLayers[layerGroup] = [nextLayer];
|
|
25972
26288
|
}
|
|
25973
|
-
currentLayerGroupLayers.push(nextLayer);
|
|
25974
|
-
}
|
|
25975
|
-
else if (currentLayerGroupLayers.length > 0) {
|
|
25976
|
-
advanceLayerGroup(layerGroup);
|
|
25977
26289
|
}
|
|
25978
26290
|
});
|
|
25979
|
-
|
|
25980
|
-
|
|
25981
|
-
|
|
26291
|
+
Object.entries(layerGroupLayers).forEach(function (_a) {
|
|
26292
|
+
var _b = __read(_a, 2), layerGroupId = _b[0], layerGroupMapboxLayers = _b[1];
|
|
26293
|
+
nextLayers.push(_this._buildFundamentalLayerFrom(layerGroupMapboxLayers, layerGroupId));
|
|
26294
|
+
});
|
|
25982
26295
|
// Update FundamentalMapLayers in LayerManager
|
|
25983
26296
|
var userLayers = this.map.layers._getUserLayers();
|
|
25984
26297
|
var firstUserLayer = userLayers[0];
|
|
@@ -26014,6 +26327,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
26014
26327
|
// Layers added to mapbox through this SDK since loading the last style should be
|
|
26015
26328
|
// carried over to the next style.
|
|
26016
26329
|
userLayers.forEach(function (userLayer) {
|
|
26330
|
+
if (userLayer.layer instanceof WebGLLayer) {
|
|
26331
|
+
// mapbox custom layers cannot be serialized and preserved,
|
|
26332
|
+
// return to continue to the next user layer.
|
|
26333
|
+
return;
|
|
26334
|
+
}
|
|
26017
26335
|
var before = undefined;
|
|
26018
26336
|
if (_this.map.layers.getLayerById(userLayer.before)) {
|
|
26019
26337
|
var beforeCandidates = _this.map.layers.getLayerById(userLayer.before)._buildLayers();
|
|
@@ -26172,6 +26490,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
26172
26490
|
}
|
|
26173
26491
|
else {
|
|
26174
26492
|
var mapboxMapOptions = {
|
|
26493
|
+
antialias: _this.styleOptions.antialias,
|
|
26175
26494
|
attributionControl: false,
|
|
26176
26495
|
container: container,
|
|
26177
26496
|
fadeDuration: _this.serviceOptions.fadeDuration,
|
|
@@ -27162,6 +27481,16 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
27162
27481
|
Map.prototype.stop = function () {
|
|
27163
27482
|
this.map.stop();
|
|
27164
27483
|
};
|
|
27484
|
+
/**
|
|
27485
|
+
* Trigger the rendering of a single frame.
|
|
27486
|
+
* Use this method with WebGL layers to repaint the map when the layer's
|
|
27487
|
+
* properties or properties associated with the layer's source change.
|
|
27488
|
+
* Calling this multiple times before the next frame is rendered will still
|
|
27489
|
+
* result in only a single frame being rendered.
|
|
27490
|
+
*/
|
|
27491
|
+
Map.prototype.triggerRepaint = function () {
|
|
27492
|
+
this.map.triggerRepaint();
|
|
27493
|
+
};
|
|
27165
27494
|
/**
|
|
27166
27495
|
* @internal
|
|
27167
27496
|
*/
|
|
@@ -27293,9 +27622,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
27293
27622
|
return;
|
|
27294
27623
|
}
|
|
27295
27624
|
// Check if the default style is set by the client and if it exists in the current style set
|
|
27296
|
-
this.styles.definitions().then(function (
|
|
27297
|
-
if (!_this.styleOptions.style || !
|
|
27298
|
-
_this.styleOptions.style =
|
|
27625
|
+
this.styles.definitions().then(function (mapConfiguration) {
|
|
27626
|
+
if (!_this.styleOptions.style || !mapConfiguration.configurations.map(function (mapConfigurationStyle) { return mapConfigurationStyle.name; }).includes(_this.styleOptions.style)) {
|
|
27627
|
+
_this.styleOptions.style = mapConfiguration.defaultConfiguration;
|
|
27299
27628
|
}
|
|
27300
27629
|
_this.styleOptions = styleOptions;
|
|
27301
27630
|
_this._rebuildStyle(diff);
|