azure-maps-control 2.1.16 → 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 +719 -155
- package/dist/atlas-core-bare.min.js +1 -1
- package/dist/atlas-core.js +719 -155
- package/dist/atlas-core.min.js +1 -1
- package/dist/atlas.css +1 -1
- package/dist/atlas.js +719 -155
- package/dist/atlas.min.css +1 -1
- package/dist/atlas.min.js +1 -1
- package/package.json +6 -4
- package/thirdpartynotices.txt +0 -0
- package/typings/index.d.ts +222 -16
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
|
};
|
|
@@ -72,6 +72,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
72
72
|
apiVersionQueryParameter: "api-version",
|
|
73
73
|
authorizationHeaderName: "Authorization",
|
|
74
74
|
authorizationTokenPrefix: "Bearer ",
|
|
75
|
+
jwtSasPrefix: "jwt-sas ",
|
|
75
76
|
domainPlaceHolder: "{{azMapsDomain}}",
|
|
76
77
|
legacyDomainPlaceHolder: "{azMapsDomain}",
|
|
77
78
|
viewPlaceHolder: "{{azMapsView}}",
|
|
@@ -342,7 +343,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
342
343
|
return Url;
|
|
343
344
|
}());
|
|
344
345
|
|
|
345
|
-
var version = "2.
|
|
346
|
+
var version = "2.2.0";
|
|
346
347
|
|
|
347
348
|
/**
|
|
348
349
|
* A helper class that provides methods for getting various forms of the map controls current version.
|
|
@@ -700,7 +701,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
700
701
|
delete this._container;
|
|
701
702
|
}
|
|
702
703
|
if (this._map) {
|
|
703
|
-
this._map.events.remove("
|
|
704
|
+
this._map.events.remove("stylechanged", this._onStyleChange);
|
|
704
705
|
delete this._map;
|
|
705
706
|
}
|
|
706
707
|
if (this._observer) {
|
|
@@ -724,7 +725,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
724
725
|
if (style.toLowerCase() === exports.ControlStyle.auto) {
|
|
725
726
|
this._map.styles.definitions().then(function (definitions) {
|
|
726
727
|
if (_this._map) {
|
|
727
|
-
_this._map.events.add("
|
|
728
|
+
_this._map.events.add("stylechanged", _this._onStyleChange);
|
|
728
729
|
}
|
|
729
730
|
});
|
|
730
731
|
}
|
|
@@ -837,6 +838,15 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
837
838
|
}
|
|
838
839
|
}
|
|
839
840
|
});
|
|
841
|
+
// Keep the focus on this control when esc key is pressed on the grid
|
|
842
|
+
grid.addEventListener("keydown", function (event) {
|
|
843
|
+
if (event.key === "Escape" || event.key === "Esc") {
|
|
844
|
+
event.stopPropagation();
|
|
845
|
+
rotationButton.focus();
|
|
846
|
+
container.classList.remove("in-use");
|
|
847
|
+
grid.classList.add("hidden-accessible-element");
|
|
848
|
+
}
|
|
849
|
+
});
|
|
840
850
|
// If the control's position will require inverting the element order
|
|
841
851
|
// add them in the opposite order to preserve tabindex.
|
|
842
852
|
if (options && CompassControl.InvertOrderPositions.includes(options.position)) {
|
|
@@ -984,6 +994,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
984
994
|
var _this = _super.call(this) || this;
|
|
985
995
|
_this.container = null;
|
|
986
996
|
_this.map = null;
|
|
997
|
+
_this.pitchButton = null;
|
|
987
998
|
_this.pitchIncrementButton = null;
|
|
988
999
|
_this.pitchDecrementButton = null;
|
|
989
1000
|
_this.hasMouse = false;
|
|
@@ -992,6 +1003,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
992
1003
|
_this.updatePitchButtonsState = function () {
|
|
993
1004
|
var minPitchReached = _this.map.getCamera().pitch <= 0;
|
|
994
1005
|
var maxPitchReached = _this.map.getCamera().pitch >= 60;
|
|
1006
|
+
// Keep the focus on this control when max/min pitch is reached
|
|
1007
|
+
if (_this.hasFocus && _this.pitchButton && (minPitchReached || maxPitchReached)) {
|
|
1008
|
+
_this.pitchButton.focus();
|
|
1009
|
+
}
|
|
995
1010
|
if (_this.options.inverted) {
|
|
996
1011
|
if (_this.pitchIncrementButton && _this.pitchIncrementButton.disabled != minPitchReached) {
|
|
997
1012
|
_this.pitchIncrementButton.disabled = minPitchReached;
|
|
@@ -1054,6 +1069,15 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
1054
1069
|
}
|
|
1055
1070
|
}
|
|
1056
1071
|
});
|
|
1072
|
+
// Keep the focus on this control when esc key is pressed on the grid
|
|
1073
|
+
grid.addEventListener("keydown", function (event) {
|
|
1074
|
+
if (event.key === "Escape" || event.key === "Esc") {
|
|
1075
|
+
event.stopPropagation();
|
|
1076
|
+
pitchButton.focus();
|
|
1077
|
+
container.classList.remove("in-use");
|
|
1078
|
+
grid.classList.add("hidden-accessible-element");
|
|
1079
|
+
}
|
|
1080
|
+
});
|
|
1057
1081
|
// If the control's position will require inverting the element order
|
|
1058
1082
|
// add them in the opposite order to preserve tabindex.
|
|
1059
1083
|
if (options && PitchControl.INVERT_ORDER_POSITIONS.includes(options.position)) {
|
|
@@ -1070,6 +1094,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
1070
1094
|
}
|
|
1071
1095
|
this.map = map;
|
|
1072
1096
|
this.container = container;
|
|
1097
|
+
this.pitchButton = pitchButton;
|
|
1073
1098
|
map.events.add('pitch', this.pitchChanged);
|
|
1074
1099
|
this.updatePitchButtonsState();
|
|
1075
1100
|
return container;
|
|
@@ -1078,6 +1103,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
1078
1103
|
if (this.container) {
|
|
1079
1104
|
this.container.remove();
|
|
1080
1105
|
this.container = null;
|
|
1106
|
+
this.pitchButton = null;
|
|
1081
1107
|
this.pitchIncrementButton = null;
|
|
1082
1108
|
this.pitchDecrementButton = null;
|
|
1083
1109
|
}
|
|
@@ -4346,7 +4372,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
4346
4372
|
_this.setSelectedStyle(newStyle);
|
|
4347
4373
|
}
|
|
4348
4374
|
};
|
|
4349
|
-
_this.
|
|
4375
|
+
_this.onMapConfigurationChange = function (definitions) {
|
|
4350
4376
|
if (!_this.styleOpsGrid) {
|
|
4351
4377
|
return;
|
|
4352
4378
|
}
|
|
@@ -4354,8 +4380,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
4354
4380
|
_this.styleButtons.clear();
|
|
4355
4381
|
_this.populateOpsGridFromDefinitions(definitions);
|
|
4356
4382
|
};
|
|
4357
|
-
_this.mapToFriendlyStyleName = function (name,
|
|
4358
|
-
var style =
|
|
4383
|
+
_this.mapToFriendlyStyleName = function (name, mapConfiguration) {
|
|
4384
|
+
var style = mapConfiguration.configurations.find(function (style) { return style.name === name; });
|
|
4359
4385
|
return (style === null || style === void 0 ? void 0 : style.displayName) || name;
|
|
4360
4386
|
};
|
|
4361
4387
|
_this.options = new StyleControlOptions().merge(cloneDeep_1(options));
|
|
@@ -4450,8 +4476,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
4450
4476
|
_super.prototype.onRemove.call(this);
|
|
4451
4477
|
this.styleOpsGrid = null;
|
|
4452
4478
|
this.styleButtons.clear();
|
|
4453
|
-
this.map.events.remove("
|
|
4454
|
-
this.map.events.remove("
|
|
4479
|
+
this.map.events.remove("stylechanged", this.onStyleChange);
|
|
4480
|
+
this.map.events.remove("mapconfigurationchanged", this.onMapConfigurationChange);
|
|
4455
4481
|
};
|
|
4456
4482
|
/**
|
|
4457
4483
|
* Set the style that need to be displayed as currently selected.
|
|
@@ -4470,8 +4496,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
4470
4496
|
var _b = __read(_a, 2), buttonStyleName = _b[0], button = _b[1];
|
|
4471
4497
|
return button.setAttribute('aria-current', buttonStyleName === styleName ? 'true' : 'false');
|
|
4472
4498
|
});
|
|
4473
|
-
this.map.styles.definitions().then(function (
|
|
4474
|
-
var newAlt = _this.mapToFriendlyStyleName(styleName,
|
|
4499
|
+
this.map.styles.definitions().then(function (mapConfiguration) {
|
|
4500
|
+
var newAlt = _this.mapToFriendlyStyleName(styleName, mapConfiguration);
|
|
4475
4501
|
if (image_1.alt !== newAlt) {
|
|
4476
4502
|
image_1.alt = newAlt;
|
|
4477
4503
|
}
|
|
@@ -4501,11 +4527,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
4501
4527
|
styleButton.removeAttribute("disabled");
|
|
4502
4528
|
}
|
|
4503
4529
|
};
|
|
4504
|
-
StyleControl.prototype.buildSelectStyleBtn = function (name,
|
|
4530
|
+
StyleControl.prototype.buildSelectStyleBtn = function (name, mapConfiguration, fetchIconPromise) {
|
|
4505
4531
|
var _this = this;
|
|
4506
4532
|
var styleOptionButton = document.createElement("button");
|
|
4507
|
-
var friendlyName = this.mapToFriendlyStyleName(name,
|
|
4508
|
-
styleOptionButton.setAttribute("
|
|
4533
|
+
var friendlyName = this.mapToFriendlyStyleName(name, mapConfiguration);
|
|
4534
|
+
styleOptionButton.setAttribute("aria-label", friendlyName);
|
|
4509
4535
|
styleOptionButton.setAttribute("type", "button");
|
|
4510
4536
|
var styleIconImage = new Image();
|
|
4511
4537
|
fetchIconPromise
|
|
@@ -4525,9 +4551,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
4525
4551
|
}
|
|
4526
4552
|
_this.styleIcons.set(name, iconUrl);
|
|
4527
4553
|
});
|
|
4528
|
-
|
|
4529
|
-
styleIconImage.alt = friendlyName;
|
|
4530
|
-
}
|
|
4554
|
+
styleIconImage.setAttribute("aria-hidden", "true");
|
|
4531
4555
|
styleOptionButton.appendChild(styleIconImage);
|
|
4532
4556
|
if (this.options.layout === "icons") {
|
|
4533
4557
|
styleOptionButton.classList.add(StyleControl.Css.button);
|
|
@@ -4567,7 +4591,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
4567
4591
|
}
|
|
4568
4592
|
selectCurrButton.classList.add(StyleControl.Css.currentStyle);
|
|
4569
4593
|
selectCurrButton.setAttribute("aria-label", "Select Style");
|
|
4570
|
-
selectCurrButton.setAttribute("alt", "Select Style");
|
|
4571
4594
|
selectCurrButton.setAttribute("tabindex", "-1");
|
|
4572
4595
|
this.currStyleImage = new Image();
|
|
4573
4596
|
selectCurrButton.appendChild(this.currStyleImage);
|
|
@@ -4592,12 +4615,12 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
4592
4615
|
// If a style is one of those to be shown by the style picker also create it's element.
|
|
4593
4616
|
this.map.styles.definitions().then(function (definitions) { return __awaiter(_this, void 0, void 0, function () {
|
|
4594
4617
|
return __generator(this, function (_a) {
|
|
4595
|
-
this.
|
|
4596
|
-
this.map.events.add("
|
|
4618
|
+
this.onMapConfigurationChange(definitions);
|
|
4619
|
+
this.map.events.add("stylechanged", this.onStyleChange);
|
|
4597
4620
|
return [2 /*return*/];
|
|
4598
4621
|
});
|
|
4599
4622
|
}); });
|
|
4600
|
-
this.map.events.add("
|
|
4623
|
+
this.map.events.add("mapconfigurationchanged", this.onMapConfigurationChange);
|
|
4601
4624
|
return styleOpsGrid;
|
|
4602
4625
|
};
|
|
4603
4626
|
StyleControl.prototype.populateOpsGridFromDefinitions = function (definitions) {
|
|
@@ -4605,7 +4628,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
4605
4628
|
if (!this.styleOpsGrid) {
|
|
4606
4629
|
return;
|
|
4607
4630
|
}
|
|
4608
|
-
var styles = definitions.
|
|
4631
|
+
var styles = definitions.configurations;
|
|
4609
4632
|
if (Array.isArray(this.options.mapStyles)) {
|
|
4610
4633
|
styles = styles.filter(function (style) { return _this.options.mapStyles.includes(style.name.split("_indoor")[0]); });
|
|
4611
4634
|
}
|
|
@@ -4843,6 +4866,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
4843
4866
|
_this.table = ["Fast",
|
|
4844
4867
|
["green", "yellow", "red", "dark-red"],
|
|
4845
4868
|
"Slow"];
|
|
4869
|
+
_this.map = null;
|
|
4870
|
+
_this.syncHiddenState = null;
|
|
4846
4871
|
return _this;
|
|
4847
4872
|
}
|
|
4848
4873
|
/**
|
|
@@ -4852,11 +4877,21 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
4852
4877
|
* @return An HTMLElement to be placed on the map for the control.
|
|
4853
4878
|
*/
|
|
4854
4879
|
TrafficLegendControl.prototype.onAdd = function (map) {
|
|
4880
|
+
this.map = map;
|
|
4855
4881
|
var container = this.buildContainer(map, exports.ControlStyle.auto, "Traffic Legend");
|
|
4856
4882
|
var TrafficLegendDiv = this.buildTrafficLegendDiv(map);
|
|
4883
|
+
container.setAttribute("role", "definition");
|
|
4857
4884
|
container.appendChild(TrafficLegendDiv);
|
|
4858
4885
|
return container;
|
|
4859
4886
|
};
|
|
4887
|
+
TrafficLegendControl.prototype.onRemove = function () {
|
|
4888
|
+
_super.prototype.onRemove.call(this);
|
|
4889
|
+
if (this.syncHiddenState) {
|
|
4890
|
+
this.map.events.remove('styledata', this.syncHiddenState);
|
|
4891
|
+
this.syncHiddenState = null;
|
|
4892
|
+
}
|
|
4893
|
+
this.map = null;
|
|
4894
|
+
};
|
|
4860
4895
|
TrafficLegendControl.prototype.buildTrafficLegendDiv = function (map) {
|
|
4861
4896
|
var e_1, _a, e_2, _b;
|
|
4862
4897
|
var trafficLegend = document.createElement("div");
|
|
@@ -4921,8 +4956,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
4921
4956
|
}
|
|
4922
4957
|
trafficLegendTable.appendChild(tr2);
|
|
4923
4958
|
trafficLegend.appendChild(trafficLegendTable);
|
|
4924
|
-
|
|
4925
|
-
map.events.add("styledata", function (eventData) {
|
|
4959
|
+
this.syncHiddenState = function (eventData) {
|
|
4926
4960
|
if (eventData.dataType === "style") {
|
|
4927
4961
|
var trafficOptions = map.getTraffic();
|
|
4928
4962
|
if (trafficOptions.flow && trafficOptions.flow !== "none") {
|
|
@@ -4932,7 +4966,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
4932
4966
|
trafficLegend.classList.add("hidden");
|
|
4933
4967
|
}
|
|
4934
4968
|
}
|
|
4935
|
-
}
|
|
4969
|
+
};
|
|
4970
|
+
// display legend when the traffic flow is shown, hide it otherwise
|
|
4971
|
+
this.syncHiddenState({ dataType: 'style' });
|
|
4972
|
+
map.events.add("styledata", this.syncHiddenState);
|
|
4936
4973
|
return trafficLegend;
|
|
4937
4974
|
};
|
|
4938
4975
|
return TrafficLegendControl;
|
|
@@ -9058,6 +9095,151 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
9058
9095
|
return MultiPolygon;
|
|
9059
9096
|
}());
|
|
9060
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
|
+
|
|
9061
9243
|
|
|
9062
9244
|
|
|
9063
9245
|
var index$1 = /*#__PURE__*/Object.freeze({
|
|
@@ -9069,6 +9251,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
9069
9251
|
Polygon: Polygon,
|
|
9070
9252
|
Position: Position,
|
|
9071
9253
|
BoundingBox: BoundingBox,
|
|
9254
|
+
MercatorPoint: MercatorPoint,
|
|
9072
9255
|
MultiLineString: MultiLineString,
|
|
9073
9256
|
MultiPoint: MultiPoint,
|
|
9074
9257
|
MultiPolygon: MultiPolygon,
|
|
@@ -9485,6 +9668,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
9485
9668
|
return this.container;
|
|
9486
9669
|
};
|
|
9487
9670
|
ZoomControl.prototype.onRemove = function () {
|
|
9671
|
+
_super.prototype.onRemove.call(this);
|
|
9488
9672
|
if (this.map) {
|
|
9489
9673
|
this.map.events.remove('zoom', this.zoomChanged);
|
|
9490
9674
|
this.map.events.remove('minzoomchanged', this.minZoomChanged);
|
|
@@ -12352,6 +12536,155 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
12352
12536
|
return TileLayer;
|
|
12353
12537
|
}(SourceBuildingLayer));
|
|
12354
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
|
+
|
|
12355
12688
|
|
|
12356
12689
|
|
|
12357
12690
|
var index$5 = /*#__PURE__*/Object.freeze({
|
|
@@ -12364,7 +12697,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
12364
12697
|
SymbolLayer: SymbolLayer,
|
|
12365
12698
|
TileLayer: TileLayer,
|
|
12366
12699
|
HeatMapLayer: HeatMapLayer,
|
|
12367
|
-
ImageLayer: ImageLayer
|
|
12700
|
+
ImageLayer: ImageLayer,
|
|
12701
|
+
WebGLLayer: WebGLLayer
|
|
12368
12702
|
});
|
|
12369
12703
|
|
|
12370
12704
|
var Html = /** @class */ (function () {
|
|
@@ -12763,6 +13097,12 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
12763
13097
|
// They must use setOptions(...).
|
|
12764
13098
|
return cloneDeepWith_1(this.options, PopupOptions._cloneCustomizer);
|
|
12765
13099
|
};
|
|
13100
|
+
/**
|
|
13101
|
+
* Returns popup container element.
|
|
13102
|
+
*/
|
|
13103
|
+
Popup.prototype.getPopupContainer = function () {
|
|
13104
|
+
return this.containerDiv;
|
|
13105
|
+
};
|
|
12766
13106
|
/**
|
|
12767
13107
|
* Drags the popup to the specified pixel.
|
|
12768
13108
|
* Accounts for the pixel offset when dragging started.
|
|
@@ -13792,6 +14132,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
13792
14132
|
* Literal value `"anonymous"`
|
|
13793
14133
|
*/
|
|
13794
14134
|
AuthenticationType["anonymous"] = "anonymous";
|
|
14135
|
+
/**
|
|
14136
|
+
* The shared access signature authentication mechanism. Allows a callback responsible for acquiring a token to be provided on requests.
|
|
14137
|
+
* Literal value `"sas"`.
|
|
14138
|
+
*/
|
|
14139
|
+
AuthenticationType["sas"] = "sas";
|
|
13795
14140
|
})(exports.AuthenticationType || (exports.AuthenticationType = {}));
|
|
13796
14141
|
/**
|
|
13797
14142
|
* Options for specifying how the map control should authenticate with the Azure Maps services.
|
|
@@ -13831,11 +14176,15 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
13831
14176
|
*/
|
|
13832
14177
|
_this.aadInstance = undefined;
|
|
13833
14178
|
/**
|
|
13834
|
-
* A callback to use with the anonymous authentication mechanism.
|
|
14179
|
+
* A callback to use with the anonymous/sas authentication mechanism.
|
|
13835
14180
|
* This callback will be responsible for resolving to a authentication token.
|
|
13836
14181
|
* E.g. fetching a CORS protected token from an endpoint.
|
|
13837
14182
|
*/
|
|
13838
14183
|
_this.getToken = undefined;
|
|
14184
|
+
/**
|
|
14185
|
+
* Optionally provide an initial token for sas authentication.
|
|
14186
|
+
*/
|
|
14187
|
+
_this.sasToken = undefined;
|
|
13839
14188
|
/**
|
|
13840
14189
|
* Optionally provide an existing `AuthenticationContext` from the ADAL.js library.
|
|
13841
14190
|
* This authentication context will be used to acquire the AAD token.
|
|
@@ -13878,6 +14227,14 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
13878
14227
|
this.authType = exports.AuthenticationType.anonymous;
|
|
13879
14228
|
this.getToken = getTokenCallback;
|
|
13880
14229
|
};
|
|
14230
|
+
/**
|
|
14231
|
+
* Sets the required options to configure the sas authentication method.
|
|
14232
|
+
* @param getTokenCallback Callback function responsible for resolving to an authentication token.
|
|
14233
|
+
*/
|
|
14234
|
+
AuthenticationOptions.prototype.setSasCallbackFunction = function (getTokenCallback) {
|
|
14235
|
+
this.authType = exports.AuthenticationType.sas;
|
|
14236
|
+
this.getToken = getTokenCallback;
|
|
14237
|
+
};
|
|
13881
14238
|
/**
|
|
13882
14239
|
* Override the standard merge behavior to handle mutually exclusive options.
|
|
13883
14240
|
* @internal
|
|
@@ -13897,6 +14254,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
13897
14254
|
else if (merged.authType === exports.AuthenticationType.anonymous) {
|
|
13898
14255
|
merged.subscriptionKey = merged.authContext = merged.aadAppId = undefined;
|
|
13899
14256
|
}
|
|
14257
|
+
else if (merged.authType === exports.AuthenticationType.sas) {
|
|
14258
|
+
merged.authContext = merged.subscriptionKey = merged.aadAppId = undefined;
|
|
14259
|
+
}
|
|
13900
14260
|
return merged;
|
|
13901
14261
|
};
|
|
13902
14262
|
return AuthenticationOptions;
|
|
@@ -14623,7 +14983,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
14623
14983
|
path: "search/address/reverse/json",
|
|
14624
14984
|
queryParams: __assign({ "api-version": "1.0", "language": options.style.language, "limit": 1, "query": normalizeLatitude(options.position[1]) + "," + normalizeLongitude(options.position[0]) }, (options.style.view && { view: options.style.view }))
|
|
14625
14985
|
};
|
|
14626
|
-
return new Url((_a = this.map.authentication) === null || _a === void 0 ? void 0 : _a.signRequest(urlOptions)).get();
|
|
14986
|
+
return new Url(((_a = this.map.authentication) === null || _a === void 0 ? void 0 : _a.signRequest(urlOptions)) || urlOptions).get();
|
|
14627
14987
|
};
|
|
14628
14988
|
return NearbyGeographySearchService;
|
|
14629
14989
|
}());
|
|
@@ -15827,8 +16187,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
15827
16187
|
_this.createMapKeyBindingInfo();
|
|
15828
16188
|
_this.map.getMapContainer().setAttribute("role", "application");
|
|
15829
16189
|
_this.map.getMapContainer().setAttribute("aria-label", "Map Application");
|
|
16190
|
+
_this.map.getCanvasContainer().setAttribute("aria-live", "polite");
|
|
16191
|
+
_this.map.getCanvasContainer().setAttribute("aria-describedby", "atlas-map-state atlas-map-style");
|
|
15830
16192
|
_this.map.getCanvas().setAttribute("aria-label", "Interactive Map");
|
|
15831
|
-
_this.map.getCanvas().setAttribute("aria-describedby", "atlas-map-
|
|
16193
|
+
_this.map.getCanvas().setAttribute("aria-describedby", "atlas-map-shortcuts");
|
|
15832
16194
|
_this.map.getCanvas().setAttribute("alt", "Interactive Map");
|
|
15833
16195
|
};
|
|
15834
16196
|
this.removeFromMap = function () {
|
|
@@ -15850,10 +16212,12 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
15850
16212
|
delete _this.atlasMapStyleInfo;
|
|
15851
16213
|
_this.map.getMapContainer().removeAttribute("role");
|
|
15852
16214
|
_this.map.getMapContainer().removeAttribute("aria-label");
|
|
16215
|
+
_this.map.getCanvasContainer().removeAttribute("aria-live");
|
|
16216
|
+
_this.map.getCanvasContainer().removeAttribute("aria-describedby");
|
|
15853
16217
|
_this.map.getCanvas().removeAttribute("aria-label");
|
|
15854
16218
|
_this.map.getCanvas().removeAttribute("aria-describedby");
|
|
15855
16219
|
_this.map.getCanvas().removeAttribute("alt");
|
|
15856
|
-
_this.map.events.remove("
|
|
16220
|
+
_this.map.events.remove("stylechanged", _this.updateMapStyle);
|
|
15857
16221
|
};
|
|
15858
16222
|
this.createMapKeyBindingInfo = function () {
|
|
15859
16223
|
_this.atlasMapKeyBindings = document.createElement("div");
|
|
@@ -15878,7 +16242,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
15878
16242
|
"Jump focus to the map: Escape."
|
|
15879
16243
|
].join("\n");
|
|
15880
16244
|
_this.map.getCanvasContainer().appendChild(_this.atlasMapKeyBindings);
|
|
15881
|
-
_this.atlasMapKeyBindings.setAttribute("aria-live", "polite");
|
|
15882
16245
|
var baseShortcutKeyCodes = [
|
|
15883
16246
|
// - (zoom out)
|
|
15884
16247
|
189,
|
|
@@ -15910,7 +16273,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
15910
16273
|
_this.atlasMapLiveStateInfo.id = "atlas-map-state";
|
|
15911
16274
|
_this.atlasMapLiveStateInfo.classList.add("hidden-accessible-element");
|
|
15912
16275
|
_this.map.getCanvasContainer().appendChild(_this.atlasMapLiveStateInfo);
|
|
15913
|
-
_this.atlasMapLiveStateInfo.setAttribute("aria-live", "assertive");
|
|
15914
16276
|
}
|
|
15915
16277
|
};
|
|
15916
16278
|
this.initializeMapStyleInfo = function () {
|
|
@@ -15919,10 +16281,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
15919
16281
|
_this.atlasMapStyleInfo.setAttribute("aria-hidden", "true");
|
|
15920
16282
|
_this.atlasMapStyleInfo.id = "atlas-map-style";
|
|
15921
16283
|
_this.atlasMapStyleInfo.classList.add("hidden-accessible-element");
|
|
15922
|
-
_this.updateMapStyle
|
|
15923
|
-
_this.map.events.add("styledata", _this.updateMapStyle);
|
|
16284
|
+
_this.map.events.add("stylechanged", _this.updateMapStyle);
|
|
15924
16285
|
_this.map.getCanvasContainer().appendChild(_this.atlasMapStyleInfo);
|
|
15925
|
-
_this.atlasMapStyleInfo.setAttribute("aria-live", "polite");
|
|
15926
16286
|
};
|
|
15927
16287
|
this.updateMapStyle = function () {
|
|
15928
16288
|
_this.atlasMapStyleInfo.innerHTML = "<p>Map style: " + _this.map.getStyle().style + ".</p>";
|
|
@@ -16220,15 +16580,106 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
16220
16580
|
_this.map.layers.add(_this.incidentLayer, "labels");
|
|
16221
16581
|
}
|
|
16222
16582
|
//Create a popup but leave it closed so we can update it and display it later.
|
|
16223
|
-
_this.
|
|
16583
|
+
_this.clickPopup = new Popup({
|
|
16224
16584
|
position: [0, 0],
|
|
16225
16585
|
pixelOffset: [0, -18]
|
|
16226
16586
|
});
|
|
16227
16587
|
_this.map.addEventListener("mouseover", _this.incidentLayerName, _this.cursorToPointer);
|
|
16228
16588
|
_this.map.addEventListener("mouseleave", _this.incidentLayerName, _this.cursorToDefault);
|
|
16229
16589
|
_this.map.addEventListener("click", _this.incidentLayerName, _this.openIncidentPopup);
|
|
16590
|
+
_this.map.events.addOnce('idle', _this.setAccessiblePopups);
|
|
16591
|
+
_this.map.events.add('moveend', _this.setAccessiblePopups);
|
|
16230
16592
|
};
|
|
16593
|
+
this.accessiblePopups = [];
|
|
16594
|
+
this.setAccessiblePopups = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
16595
|
+
var features, localizedStrings, createPopup, insertHiddenBefore, insertHiddenInFront, addHidden;
|
|
16596
|
+
var _this = this;
|
|
16597
|
+
return __generator(this, function (_a) {
|
|
16598
|
+
switch (_a.label) {
|
|
16599
|
+
case 0:
|
|
16600
|
+
this.accessiblePopups.forEach(function (popup) { return popup.remove(); });
|
|
16601
|
+
this.accessiblePopups = [];
|
|
16602
|
+
features = this.map.layers.getRenderedShapes(this.map.getCamera().bounds, this.incidentLayer);
|
|
16603
|
+
return [4 /*yield*/, this.map._getLocalizedStrings()];
|
|
16604
|
+
case 1:
|
|
16605
|
+
localizedStrings = _a.sent();
|
|
16606
|
+
createPopup = function (features, idx) {
|
|
16607
|
+
var incidentFeature = features[idx];
|
|
16608
|
+
var incidentPosition = incidentFeature.geometry.coordinates;
|
|
16609
|
+
var point = new Point(new Position(incidentPosition[0], incidentPosition[1]));
|
|
16610
|
+
var incident = new Incident(incidentFeature.properties, point, localizedStrings);
|
|
16611
|
+
var popup = IncidentPopupFactory.build(incident, _this.incidentLanguage);
|
|
16612
|
+
var element = popup.getPopupContainer();
|
|
16613
|
+
element.addEventListener('focusin', function (event) {
|
|
16614
|
+
// side effects: clear other managed popups
|
|
16615
|
+
_this.clickPopup.remove();
|
|
16616
|
+
_this.accessiblePopups.filter(function (p) { return p !== popup; }).forEach(function (popup) { return popup.remove(); });
|
|
16617
|
+
// insert previous and next popups
|
|
16618
|
+
if (idx - 1 >= 0) {
|
|
16619
|
+
insertHiddenBefore(popup, createPopup(features, idx - 1));
|
|
16620
|
+
}
|
|
16621
|
+
if (idx + 1 < features.length) {
|
|
16622
|
+
addHidden(createPopup(features, idx + 1));
|
|
16623
|
+
}
|
|
16624
|
+
// if we are on boundaries: add the first / last popup
|
|
16625
|
+
// to maintain popups on full page navigation cycle
|
|
16626
|
+
if (idx >= 2 && idx == features.length - 1) {
|
|
16627
|
+
insertHiddenInFront(createPopup(features, 0));
|
|
16628
|
+
}
|
|
16629
|
+
if (idx == 0 && features.length >= 2) {
|
|
16630
|
+
addHidden(createPopup(features, features.length - 1));
|
|
16631
|
+
}
|
|
16632
|
+
});
|
|
16633
|
+
if (idx == features.length - 1) {
|
|
16634
|
+
element.addEventListener('focusout', function (event) {
|
|
16635
|
+
// close the popup if we detect the focus moving away from the page (relatedTarget === null)
|
|
16636
|
+
// (will remain open otherwise)
|
|
16637
|
+
if (event.relatedTarget === null) {
|
|
16638
|
+
popup.close();
|
|
16639
|
+
}
|
|
16640
|
+
});
|
|
16641
|
+
}
|
|
16642
|
+
_this.accessiblePopups.push(popup);
|
|
16643
|
+
return popup;
|
|
16644
|
+
};
|
|
16645
|
+
insertHiddenBefore = function (base, toInsert) {
|
|
16646
|
+
toInsert.open(_this.map);
|
|
16647
|
+
toInsert.close();
|
|
16648
|
+
var containerToSwapIn = toInsert.getPopupContainer();
|
|
16649
|
+
var baseContainer = base.getPopupContainer();
|
|
16650
|
+
baseContainer.parentElement.insertBefore(containerToSwapIn, baseContainer);
|
|
16651
|
+
};
|
|
16652
|
+
insertHiddenInFront = function (toInsert) {
|
|
16653
|
+
toInsert.open(_this.map);
|
|
16654
|
+
toInsert.close();
|
|
16655
|
+
var containerToSwapIn = toInsert.getPopupContainer();
|
|
16656
|
+
var parent = containerToSwapIn.parentElement;
|
|
16657
|
+
parent.insertBefore(containerToSwapIn, parent.firstElementChild);
|
|
16658
|
+
};
|
|
16659
|
+
addHidden = function (popup) {
|
|
16660
|
+
popup.open(_this.map);
|
|
16661
|
+
popup.close();
|
|
16662
|
+
};
|
|
16663
|
+
if (features.length > 0) {
|
|
16664
|
+
addHidden(createPopup(features, 0));
|
|
16665
|
+
}
|
|
16666
|
+
if (features.length > 1) {
|
|
16667
|
+
addHidden(createPopup(features, features.length - 1));
|
|
16668
|
+
}
|
|
16669
|
+
return [2 /*return*/];
|
|
16670
|
+
}
|
|
16671
|
+
});
|
|
16672
|
+
}); };
|
|
16231
16673
|
this.removeFromMap = function () {
|
|
16674
|
+
var _a;
|
|
16675
|
+
_this.map.removeEventListener("mouseover", _this.incidentLayerName, _this.cursorToPointer);
|
|
16676
|
+
_this.map.removeEventListener("mouseleave", _this.incidentLayerName, _this.cursorToDefault);
|
|
16677
|
+
_this.map.removeEventListener("click", _this.incidentLayerName, _this.openIncidentPopup);
|
|
16678
|
+
_this.map.events.remove('idle', _this.setAccessiblePopups);
|
|
16679
|
+
_this.map.events.remove('moveend', _this.setAccessiblePopups);
|
|
16680
|
+
_this.accessiblePopups.forEach(function (popup) { return popup.remove(); });
|
|
16681
|
+
_this.accessiblePopups = [];
|
|
16682
|
+
(_a = _this.clickPopup) === null || _a === void 0 ? void 0 : _a.remove();
|
|
16232
16683
|
if (_this.map.layers.getLayerById(_this.incidentLayerName) != null) {
|
|
16233
16684
|
_this.map.layers.remove(_this.incidentLayerName);
|
|
16234
16685
|
}
|
|
@@ -16243,14 +16694,22 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
16243
16694
|
_this.map.getCanvas().style.cursor = "";
|
|
16244
16695
|
};
|
|
16245
16696
|
this.openIncidentPopup = function (data) {
|
|
16246
|
-
_this.
|
|
16697
|
+
_this.clickPopup.remove();
|
|
16698
|
+
_this.accessiblePopups.forEach(function (popup) { return popup.close(); });
|
|
16247
16699
|
var incidentPosition = data.position;
|
|
16248
16700
|
var incidentFeature = data.features[0];
|
|
16249
16701
|
_this.map._getLocalizedStrings().then(function (localizedStrings) {
|
|
16250
16702
|
var point = new Point(new Position(incidentPosition[0], incidentPosition[1]));
|
|
16251
16703
|
var incident = new Incident(incidentFeature.properties, point, localizedStrings);
|
|
16252
|
-
_this.
|
|
16253
|
-
_this.
|
|
16704
|
+
_this.clickPopup = IncidentPopupFactory.build(incident, _this.incidentLanguage);
|
|
16705
|
+
_this.clickPopup.open(_this.map);
|
|
16706
|
+
var element = _this.clickPopup.getPopupContainer();
|
|
16707
|
+
// ensures popup is closed on tabbing when the focus is moved away from the window
|
|
16708
|
+
element.addEventListener('focusout', function (event) {
|
|
16709
|
+
if (event.relatedTarget === null) {
|
|
16710
|
+
_this.clickPopup.close();
|
|
16711
|
+
}
|
|
16712
|
+
});
|
|
16254
16713
|
});
|
|
16255
16714
|
};
|
|
16256
16715
|
this.map = map;
|
|
@@ -21958,17 +22417,19 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
21958
22417
|
* Triggers the user provided function to fetch the token and stores it.
|
|
21959
22418
|
* @internal
|
|
21960
22419
|
*/
|
|
21961
|
-
this._triggerTokenFetch = function () {
|
|
22420
|
+
this._triggerTokenFetch = function (isAnonymousAuth) {
|
|
22421
|
+
if (isAnonymousAuth === void 0) { isAnonymousAuth = false; }
|
|
21962
22422
|
return new Promise(function (resolve, reject) {
|
|
22423
|
+
if (typeof _this.options.getToken !== "function") {
|
|
22424
|
+
reject(new Error("Token cannot be " + (isAnonymousAuth ? 'fetched' : 'renewed') + " because getToken was not set or is not a function."));
|
|
22425
|
+
return;
|
|
22426
|
+
}
|
|
21963
22427
|
_this.options.getToken(function (token) {
|
|
21964
22428
|
try {
|
|
21965
22429
|
// Try to get the timeout first as this will guarantee the token is correctly formatted.
|
|
21966
22430
|
var timeout = _this._getTokenExpiry(token) - AuthenticationManager.constants.tokenRefreshClockSkew;
|
|
21967
|
-
_this.
|
|
21968
|
-
|
|
21969
|
-
// @ts-ignore
|
|
21970
|
-
// tslint:disable-next-line: no-string-based-set-timeout
|
|
21971
|
-
_this.tokenTimeOutHandle = setTimeout(_this._triggerTokenFetch, timeout * 1000);
|
|
22431
|
+
_this._storeToken(token);
|
|
22432
|
+
_this._setTimeoutTokenFetch(timeout);
|
|
21972
22433
|
resolve();
|
|
21973
22434
|
}
|
|
21974
22435
|
catch (_a) {
|
|
@@ -21979,6 +22440,18 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
21979
22440
|
}, _this.map);
|
|
21980
22441
|
});
|
|
21981
22442
|
};
|
|
22443
|
+
/**
|
|
22444
|
+
* Create a timer to trigger the user provided function to fetch the token.
|
|
22445
|
+
* @param seconds delay in seconds
|
|
22446
|
+
* @internal
|
|
22447
|
+
*/
|
|
22448
|
+
this._setTimeoutTokenFetch = function (seconds) {
|
|
22449
|
+
clearTimeout(_this.tokenTimeOutHandle); // Clear the previous refresh timeout in case it hadn't triggered yet.
|
|
22450
|
+
// @ts-ignore
|
|
22451
|
+
// tslint:disable-next-line: no-string-based-set-timeout
|
|
22452
|
+
_this.tokenTimeOutHandle = setTimeout(_this._triggerTokenFetch, Math.min(seconds * 1000, 0x7fffffff) // setTimeout will fire immediately if the delay is greater than 2^31-1.
|
|
22453
|
+
);
|
|
22454
|
+
};
|
|
21982
22455
|
var serviceOptions = map.getServiceOptions();
|
|
21983
22456
|
this.options = serviceOptions.authOptions;
|
|
21984
22457
|
this.sessionId = serviceOptions.sessionId;
|
|
@@ -22020,6 +22493,28 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
22020
22493
|
}
|
|
22021
22494
|
else if (_this.options.authType === exports.AuthenticationType.anonymous) {
|
|
22022
22495
|
// Anonymous authentication, just call the users provided callback.
|
|
22496
|
+
resolve(_this._triggerTokenFetch(true));
|
|
22497
|
+
}
|
|
22498
|
+
else if (_this.options.authType === exports.AuthenticationType.sas) {
|
|
22499
|
+
if (_this.options.sasToken) {
|
|
22500
|
+
var expiresIn = -1;
|
|
22501
|
+
try {
|
|
22502
|
+
expiresIn = _this._getTokenExpiry(_this.options.sasToken);
|
|
22503
|
+
}
|
|
22504
|
+
catch (_a) {
|
|
22505
|
+
reject(new Error("An invalid sasToken was provided."));
|
|
22506
|
+
return;
|
|
22507
|
+
}
|
|
22508
|
+
if (expiresIn > AuthenticationManager.constants.tokenRefreshClockSkew) {
|
|
22509
|
+
// Save the initial token
|
|
22510
|
+
_this._storeToken(_this.options.sasToken);
|
|
22511
|
+
// Create a timer to refresh the token
|
|
22512
|
+
_this._setTimeoutTokenFetch(expiresIn - AuthenticationManager.constants.tokenRefreshClockSkew);
|
|
22513
|
+
resolve();
|
|
22514
|
+
return;
|
|
22515
|
+
}
|
|
22516
|
+
}
|
|
22517
|
+
// Call the users provided callback to fetch the token.
|
|
22023
22518
|
resolve(_this._triggerTokenFetch());
|
|
22024
22519
|
}
|
|
22025
22520
|
else {
|
|
@@ -22145,8 +22640,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
22145
22640
|
}
|
|
22146
22641
|
return token_1;
|
|
22147
22642
|
}
|
|
22148
|
-
else if (this.options.authType === exports.AuthenticationType.anonymous
|
|
22149
|
-
|
|
22643
|
+
else if (this.options.authType === exports.AuthenticationType.anonymous
|
|
22644
|
+
|| this.options.authType === exports.AuthenticationType.sas) {
|
|
22645
|
+
var token = this._getItem(AuthenticationManager.constants.storage.tokenKey);
|
|
22150
22646
|
if (!token) {
|
|
22151
22647
|
// Cached Token not present, invoke the user provided callback function to fetch function
|
|
22152
22648
|
this._triggerTokenFetch();
|
|
@@ -22161,7 +22657,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
22161
22657
|
}
|
|
22162
22658
|
else if (expiresIn <= 0) {
|
|
22163
22659
|
// token renew failed and dont have a token.
|
|
22164
|
-
this._saveItem(AuthenticationManager.constants.storage.
|
|
22660
|
+
this._saveItem(AuthenticationManager.constants.storage.tokenKey, "");
|
|
22165
22661
|
throw new Error(AuthenticationManager.constants.errors.tokenExpired);
|
|
22166
22662
|
}
|
|
22167
22663
|
}
|
|
@@ -22190,9 +22686,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
22190
22686
|
* @param token token fetched from the user's server endpoint
|
|
22191
22687
|
* @internal
|
|
22192
22688
|
*/
|
|
22193
|
-
AuthenticationManager.prototype.
|
|
22689
|
+
AuthenticationManager.prototype._storeToken = function (token) {
|
|
22194
22690
|
// Store the value
|
|
22195
|
-
this._saveItem(AuthenticationManager.constants.storage.
|
|
22691
|
+
this._saveItem(AuthenticationManager.constants.storage.tokenKey, token);
|
|
22196
22692
|
var tokenEvent = {
|
|
22197
22693
|
map: this.map,
|
|
22198
22694
|
type: AuthenticationManager.constants.events.tokenAcquired
|
|
@@ -22281,7 +22777,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
22281
22777
|
}
|
|
22282
22778
|
};
|
|
22283
22779
|
/**
|
|
22284
|
-
* Return the number of
|
|
22780
|
+
* Return the number of seconds since 1970/01/01
|
|
22285
22781
|
* @ignore
|
|
22286
22782
|
*/
|
|
22287
22783
|
AuthenticationManager.prototype._getCurrentTime = function () {
|
|
@@ -22300,6 +22796,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
22300
22796
|
request.headers[constants.msClientIdHeaderName] = this.options.clientId;
|
|
22301
22797
|
request.headers[constants.authorizationHeaderName] = constants.authorizationTokenPrefix + token;
|
|
22302
22798
|
break;
|
|
22799
|
+
case exports.AuthenticationType.sas:
|
|
22800
|
+
request.headers[constants.authorizationHeaderName] = constants.jwtSasPrefix + token;
|
|
22801
|
+
break;
|
|
22303
22802
|
case exports.AuthenticationType.subscriptionKey:
|
|
22304
22803
|
request.headers["subscription-key"] = token;
|
|
22305
22804
|
break;
|
|
@@ -22315,7 +22814,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
22315
22814
|
// Enable localStorage for IE, as sessionStorage does not work for localhost.
|
|
22316
22815
|
preferredCacheLocation: "localStorage",
|
|
22317
22816
|
storage: {
|
|
22318
|
-
|
|
22817
|
+
tokenKey: "access.token.key",
|
|
22319
22818
|
testStorageKey: "testStorage"
|
|
22320
22819
|
},
|
|
22321
22820
|
events: {
|
|
@@ -22724,6 +23223,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
22724
23223
|
|
|
22725
23224
|
// Disable unified signatures linter rule so we can generate separate docs for function overloads.
|
|
22726
23225
|
// tslint:disable:unified-signatures
|
|
23226
|
+
var MAP_CLIENT_EVENTS = ['maxzoomchanged', 'minzoomchanged', 'mapconfigurationchanged'];
|
|
22727
23227
|
/**
|
|
22728
23228
|
* A manager for the map control's events.
|
|
22729
23229
|
* Exposed through the events property of the atlas.Map class.
|
|
@@ -22835,6 +23335,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
22835
23335
|
* @private
|
|
22836
23336
|
*/
|
|
22837
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
|
+
}
|
|
22838
23343
|
var oldModifiedCallback = this.mapCallbackHandler.getModifiedCallback(eventType, "", callback);
|
|
22839
23344
|
// Get a new modified callback.
|
|
22840
23345
|
this.mapCallbackHandler.addCallback(eventType, "", callback, legacy, once);
|
|
@@ -22859,9 +23364,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
22859
23364
|
setTimeout(function () { return modifiedCallback(readyData_1); });
|
|
22860
23365
|
}
|
|
22861
23366
|
}
|
|
22862
|
-
else if (["minzoomchanged", "maxzoomchanged", "stylesetchanged"].includes(eventType)) {
|
|
22863
|
-
this.map._addEventListener(eventType, callback, once);
|
|
22864
|
-
}
|
|
22865
23367
|
else {
|
|
22866
23368
|
// If a callback already exists disable it so the new one can replace it.
|
|
22867
23369
|
if (oldModifiedCallback) {
|
|
@@ -22958,6 +23460,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
22958
23460
|
*/
|
|
22959
23461
|
EventManager.prototype._removeListener = function (eventType, target, callback) {
|
|
22960
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
|
+
}
|
|
22961
23468
|
var layerId = target instanceof Layer ? target.getId() : target;
|
|
22962
23469
|
var modifiedCallback = this.mapCallbackHandler.getModifiedCallback(eventType, layerId, callback);
|
|
22963
23470
|
// If a callback already exists disable it so the new one can replace it.
|
|
@@ -23865,15 +24372,15 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
23865
24372
|
*/
|
|
23866
24373
|
LayerManager.prototype._removeLayer = function (layer) {
|
|
23867
24374
|
var layerId = layer instanceof Layer ? layer.getId() : layer;
|
|
23868
|
-
|
|
24375
|
+
var layerIndex = this.layerIndex.findIndex(function (l) { return l.getId() === layerId; });
|
|
24376
|
+
if (layerIndex == -1) {
|
|
23869
24377
|
throw new Error("The layer '" + layerId + "' has not been added to the map and cannot be removed.");
|
|
23870
24378
|
}
|
|
23871
|
-
var layerIndex = this.layerIndex.findIndex(function (l) { return l.getId() === layerId; });
|
|
23872
24379
|
var tempLayer = this.layerIndex[layerIndex];
|
|
23873
24380
|
this._removeMapboxLayers(tempLayer);
|
|
23874
24381
|
this.layerIndex.splice(layerIndex, 1);
|
|
23875
|
-
var userLayerIndex = this.userLayers.findIndex(function (ul) { return ul.layer.getId() ===
|
|
23876
|
-
if (userLayerIndex
|
|
24382
|
+
var userLayerIndex = this.userLayers.findIndex(function (ul) { return ul.layer.getId() === layerId; });
|
|
24383
|
+
if (userLayerIndex != -1) {
|
|
23877
24384
|
this.userLayers.splice(userLayerIndex, 1);
|
|
23878
24385
|
}
|
|
23879
24386
|
tempLayer.onRemove();
|
|
@@ -24849,6 +25356,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
24849
25356
|
__extends(StyleOptions, _super);
|
|
24850
25357
|
function StyleOptions() {
|
|
24851
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;
|
|
24852
25363
|
/**
|
|
24853
25364
|
* If true the map will automatically resize whenever the window's size changes.
|
|
24854
25365
|
* Otherwise map.resize() must be called.
|
|
@@ -24900,6 +25411,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
24900
25411
|
* @default true
|
|
24901
25412
|
*/
|
|
24902
25413
|
_this.showLogo = true;
|
|
25414
|
+
/**
|
|
25415
|
+
* Specifies if the map should display labels
|
|
25416
|
+
* @default true
|
|
25417
|
+
*/
|
|
25418
|
+
_this.showLabels = true;
|
|
24903
25419
|
/**
|
|
24904
25420
|
* Additional custom attribution appended to map attribution.
|
|
24905
25421
|
* Default `undefined`
|
|
@@ -25040,10 +25556,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
25040
25556
|
*/
|
|
25041
25557
|
_this.styleAPIVersion = getStyleAPIVersion();
|
|
25042
25558
|
/**
|
|
25043
|
-
* The
|
|
25044
|
-
|
|
25045
|
-
|
|
25046
|
-
|
|
25559
|
+
* The map configuration defines the set of styles available to the map.
|
|
25560
|
+
*/
|
|
25561
|
+
_this.mapConfiguration = undefined;
|
|
25562
|
+
/**
|
|
25563
|
+
* @deprecated use mapConfiguration instead
|
|
25047
25564
|
*/
|
|
25048
25565
|
_this.styleSet = undefined;
|
|
25049
25566
|
/**
|
|
@@ -25214,6 +25731,14 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
25214
25731
|
if (merged.authOptions.authType !== exports.AuthenticationType.subscriptionKey) {
|
|
25215
25732
|
merged["subscription-key"] = merged.subscriptionKey = undefined;
|
|
25216
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
|
+
}
|
|
25217
25742
|
this._transformers = __spread(currentTransforms || [], transformersToMerge.filter(function (toMerge) { return !currentTransforms.includes(toMerge); }));
|
|
25218
25743
|
if (this.transformRequest && !this._transformers.includes(this.transformRequest)) {
|
|
25219
25744
|
this._transformers.push(this.transformRequest);
|
|
@@ -25418,9 +25943,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
25418
25943
|
*/
|
|
25419
25944
|
this.indoorState = undefined;
|
|
25420
25945
|
/**
|
|
25421
|
-
* Preserve the
|
|
25946
|
+
* Preserve the map configuration that was used before the indoor map configuration was set
|
|
25422
25947
|
*/
|
|
25423
|
-
this.
|
|
25948
|
+
this.preservedPreindoorMapConfiguration = undefined;
|
|
25424
25949
|
this._onStyleData = function () {
|
|
25425
25950
|
_this._lookUpAsync(_this.map.getStyle()).then(function (style) {
|
|
25426
25951
|
_this.map.events.invoke("stylechanged", {
|
|
@@ -25443,11 +25968,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
25443
25968
|
return null;
|
|
25444
25969
|
}
|
|
25445
25970
|
else {
|
|
25446
|
-
return definitions.
|
|
25971
|
+
return definitions.configurations.find(function (style) { return style.name === (options.style || definitions.defaultConfiguration); })
|
|
25447
25972
|
// retrieve default style definition unless option.style's one was found
|
|
25448
|
-
|| definitions.
|
|
25449
|
-
// no default style in the
|
|
25450
|
-
|| 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];
|
|
25451
25976
|
}
|
|
25452
25977
|
};
|
|
25453
25978
|
this._lookUpAsync = function (options) { return __awaiter(_this, void 0, void 0, function () {
|
|
@@ -25457,11 +25982,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
25457
25982
|
case 0: return [4 /*yield*/, this.definitions()];
|
|
25458
25983
|
case 1:
|
|
25459
25984
|
definitions = _a.sent();
|
|
25460
|
-
result = definitions.
|
|
25985
|
+
result = definitions.configurations.find(function (style) { return style.name === (options.style || definitions.defaultConfiguration); })
|
|
25461
25986
|
// retrieve default style definition unless option.style's one was found
|
|
25462
|
-
|| definitions.
|
|
25463
|
-
// no default style in the
|
|
25464
|
-
|| 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];
|
|
25465
25990
|
return [2 /*return*/, result];
|
|
25466
25991
|
}
|
|
25467
25992
|
});
|
|
@@ -25471,39 +25996,42 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
25471
25996
|
}
|
|
25472
25997
|
StyleManager.prototype.updateIndoorState = function (theme, tilesetId) {
|
|
25473
25998
|
var _this = this;
|
|
25474
|
-
var
|
|
25475
|
-
|
|
25476
|
-
|
|
25999
|
+
var _a;
|
|
26000
|
+
var mapConfiguration = this.map.styles.getMapConfiguration();
|
|
26001
|
+
if (mapConfiguration) {
|
|
26002
|
+
this.preservedPreindoorMapConfiguration = mapConfiguration;
|
|
25477
26003
|
// tilesetId fallback
|
|
25478
26004
|
// MAGIC: if we are on a default style set - match existing style to the one in the default indoor style set
|
|
25479
26005
|
var desiredIndoorStyle = this.map.getStyle().style ? this.map.getStyle().style + "_indoor" + (theme === 'dark' ? '_dark' : '') + "_tileset_" + tilesetId : undefined;
|
|
25480
|
-
this.map.styles.setMapConfiguration("defaultIndoor_" + tilesetId,
|
|
26006
|
+
this.map.styles.setMapConfiguration("defaultIndoor_" + tilesetId, mapConfiguration === 'microsoft-maps:default' ? desiredIndoorStyle : undefined);
|
|
25481
26007
|
}
|
|
25482
26008
|
else {
|
|
26009
|
+
var didTilesetIdChange_1 = ((_a = this.indoorState) === null || _a === void 0 ? void 0 : _a.tilesetId) !== tilesetId;
|
|
25483
26010
|
this.indoorState = {
|
|
25484
26011
|
tilesetId: tilesetId,
|
|
25485
26012
|
theme: theme
|
|
25486
26013
|
};
|
|
25487
26014
|
this.initStyleset();
|
|
25488
26015
|
this.definitions().then(function (definitions) {
|
|
25489
|
-
var currentStyle = (_this.map.getStyle().style || definitions.
|
|
26016
|
+
var currentStyle = (_this.map.getStyle().style || definitions.defaultConfiguration)
|
|
25490
26017
|
.replace('_indoor_dark', '')
|
|
25491
26018
|
.replace('_indoor', '');
|
|
25492
26019
|
// we cannot compose the precise style name for auto theme, search for prefix style name match
|
|
25493
26020
|
var targetStylePrefix = currentStyle + "_indoor";
|
|
25494
|
-
var candidateStyle = definitions.
|
|
26021
|
+
var candidateStyle = definitions.configurations.find(function (style) { return style.name.startsWith(targetStylePrefix); });
|
|
25495
26022
|
if (candidateStyle) {
|
|
25496
|
-
|
|
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
|
|
26024
|
+
_this.map.setStyle({ style: candidateStyle.name }, !didTilesetIdChange_1);
|
|
25497
26025
|
}
|
|
25498
26026
|
});
|
|
25499
26027
|
}
|
|
25500
26028
|
};
|
|
25501
26029
|
StyleManager.prototype.unsetIndoorState = function () {
|
|
25502
26030
|
var _this = this;
|
|
25503
|
-
var
|
|
25504
|
-
if (
|
|
26031
|
+
var mapConfiguration = this.preservedPreindoorMapConfiguration;
|
|
26032
|
+
if (mapConfiguration) {
|
|
25505
26033
|
// we need to revert to the styleset that was ap
|
|
25506
|
-
this.map.styles.setMapConfiguration(
|
|
26034
|
+
this.map.styles.setMapConfiguration(mapConfiguration);
|
|
25507
26035
|
}
|
|
25508
26036
|
else {
|
|
25509
26037
|
this.indoorState = undefined;
|
|
@@ -25530,11 +26058,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
25530
26058
|
var baseName = _this.indoorState && styleName.includes('_indoor') ? styleName.split('_indoor')[0] : styleName;
|
|
25531
26059
|
return baseName in styleNamesMap ? styleNamesMap[baseName] : baseName;
|
|
25532
26060
|
};
|
|
25533
|
-
if (!this.serviceOptions.
|
|
25534
|
-
newPromise = new HijackablePromise(this._request(this.serviceOptions.staticAssetsDomain, constants.stylePath + "/" + constants.styleResourcePath, "StyleDefinitions").then(function (definitions) { return ({
|
|
26061
|
+
if (!this.serviceOptions.mapConfiguration) {
|
|
26062
|
+
newPromise = new HijackablePromise(this._request(this.serviceOptions.staticAssetsDomain, constants.stylePath + "/" + constants.styleResourcePath, "StyleDefinitions", { version: this.serviceOptions.styleDefinitionsVersion }).then(function (definitions) { return ({
|
|
25535
26063
|
version: isNaN(definitions.version) ? 0 : parseFloat(definitions.version),
|
|
25536
|
-
|
|
25537
|
-
|
|
26064
|
+
defaultConfiguration: definitions.defaultStyle,
|
|
26065
|
+
configurations: definitions.styles
|
|
25538
26066
|
.filter(function (style) {
|
|
25539
26067
|
if (!_this.indoorState) {
|
|
25540
26068
|
return !style.name.includes('indoor');
|
|
@@ -25558,20 +26086,20 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
25558
26086
|
domain: _this.serviceOptions.staticAssetsDomain,
|
|
25559
26087
|
path: constants.stylePath + "/" + constants.styleResourcePath + "/" + style.name,
|
|
25560
26088
|
queryParams: {
|
|
25561
|
-
|
|
25562
|
-
// thus far we don't need to differentiate based on parameter here, as stylePatch will be called on cached styles as well
|
|
25563
|
-
//language: styleOptions.language
|
|
26089
|
+
styleVersion: _this.serviceOptions.styleDefinitionsVersion,
|
|
25564
26090
|
},
|
|
25565
26091
|
protocol: "https"
|
|
25566
26092
|
}).toString(),
|
|
25567
26093
|
}); })
|
|
25568
26094
|
}); }));
|
|
25569
26095
|
}
|
|
25570
|
-
else if (typeof this.serviceOptions.
|
|
25571
|
-
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'] })); }));
|
|
25572
26100
|
}
|
|
25573
26101
|
else {
|
|
25574
|
-
newPromise = HijackablePromise.resolve(this.serviceOptions.
|
|
26102
|
+
newPromise = HijackablePromise.resolve(this.serviceOptions.mapConfiguration);
|
|
25575
26103
|
}
|
|
25576
26104
|
if (this.initPromise) {
|
|
25577
26105
|
this.initPromise.switchWith(newPromise);
|
|
@@ -25581,7 +26109,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
25581
26109
|
this.initPromise = newPromise;
|
|
25582
26110
|
}
|
|
25583
26111
|
// propagate styleset change
|
|
25584
|
-
this.initPromise.then(function (styleset) { return _this.map._invokeEvent("
|
|
26112
|
+
this.initPromise.then(function (styleset) { return _this.map._invokeEvent("mapconfigurationchanged", styleset); });
|
|
25585
26113
|
return this.initPromise;
|
|
25586
26114
|
};
|
|
25587
26115
|
/**
|
|
@@ -25604,10 +26132,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
25604
26132
|
/**
|
|
25605
26133
|
* @internal
|
|
25606
26134
|
*/
|
|
25607
|
-
StyleManager.prototype.setStyle = function (styleOptions) {
|
|
26135
|
+
StyleManager.prototype.setStyle = function (styleOptions, diff) {
|
|
26136
|
+
if (diff === void 0) { diff = true; }
|
|
25608
26137
|
try {
|
|
25609
26138
|
this.map._getMap().setStyle(this.getStyle(styleOptions), {
|
|
25610
|
-
diff:
|
|
26139
|
+
diff: diff,
|
|
25611
26140
|
stylePatch: this._stylePatch.bind(this),
|
|
25612
26141
|
validate: this.serviceOptions.validateStyle
|
|
25613
26142
|
});
|
|
@@ -25639,30 +26168,30 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
25639
26168
|
/**
|
|
25640
26169
|
* Replaces the style set used. Very costly as it reloads all controls and resources.
|
|
25641
26170
|
*/
|
|
25642
|
-
StyleManager.prototype.setMapConfiguration = function (
|
|
26171
|
+
StyleManager.prototype.setMapConfiguration = function (mapConfiguration, styleName) {
|
|
25643
26172
|
var _this = this;
|
|
25644
|
-
this.serviceOptions.
|
|
25645
|
-
if (typeof
|
|
26173
|
+
this.serviceOptions.mapConfiguration = mapConfiguration;
|
|
26174
|
+
if (typeof mapConfiguration === 'string') {
|
|
25646
26175
|
this.initStyleset();
|
|
25647
26176
|
}
|
|
25648
26177
|
else {
|
|
25649
26178
|
if (this.initPromise) {
|
|
25650
|
-
this.initPromise.hijackAndResolve(
|
|
26179
|
+
this.initPromise.hijackAndResolve(mapConfiguration);
|
|
25651
26180
|
}
|
|
25652
26181
|
else {
|
|
25653
|
-
this.initPromise = HijackablePromise.resolve(
|
|
26182
|
+
this.initPromise = HijackablePromise.resolve(mapConfiguration);
|
|
25654
26183
|
}
|
|
25655
26184
|
}
|
|
25656
26185
|
this.definitions().then(function (definitions) {
|
|
25657
|
-
var targetStyleName = definitions.
|
|
25658
|
-
if (definitions.
|
|
26186
|
+
var targetStyleName = definitions.defaultConfiguration;
|
|
26187
|
+
if (definitions.configurations.find(function (s) { return s.name === styleName; })) {
|
|
25659
26188
|
targetStyleName = styleName;
|
|
25660
26189
|
}
|
|
25661
26190
|
_this.map.setStyle({ style: targetStyleName });
|
|
25662
26191
|
});
|
|
25663
26192
|
};
|
|
25664
26193
|
StyleManager.prototype.getMapConfiguration = function () {
|
|
25665
|
-
return this.serviceOptions.
|
|
26194
|
+
return this.serviceOptions.mapConfiguration;
|
|
25666
26195
|
};
|
|
25667
26196
|
// backward-compatibility: this method preserves the interface that azure-maps-indoor@2.0.6 assumes
|
|
25668
26197
|
StyleManager.prototype.setStyleSet = function (styleSet) {
|
|
@@ -25710,52 +26239,59 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
25710
26239
|
// A FundamentalMapLayer (grouped layer) representation of the next style must be built.
|
|
25711
26240
|
var previousLayers = this.map.layers.getLayers();
|
|
25712
26241
|
var nextLayers = [];
|
|
25713
|
-
var
|
|
25714
|
-
var currentLayerGroupLayers = [];
|
|
25715
|
-
var advanceLayerGroup = function (nextLayerGroup) {
|
|
25716
|
-
nextLayers.push(_this._buildFundamentalLayerFrom(currentLayerGroupLayers, currentLayerGroupId));
|
|
25717
|
-
currentLayerGroupId = nextLayerGroup;
|
|
25718
|
-
currentLayerGroupLayers = [];
|
|
25719
|
-
};
|
|
26242
|
+
var layerGroupLayers = {};
|
|
25720
26243
|
nextStyle.layers.forEach(function (nextLayer) {
|
|
25721
|
-
var _a, _b, _c;
|
|
26244
|
+
var _a, _b, _c, _d, _e;
|
|
25722
26245
|
var layerGroup = LayerGroupComparator.getLayerGroup(nextLayer);
|
|
25723
|
-
|
|
25724
|
-
|
|
25725
|
-
|
|
25726
|
-
|
|
25727
|
-
|
|
25728
|
-
|
|
25729
|
-
|
|
25730
|
-
|
|
25731
|
-
updateLayoutProperty(nextLayer.id, "visibility", "visible");
|
|
25732
|
-
nextLayer.layout = (_b = nextLayer.layout) !== null && _b !== void 0 ? _b : {};
|
|
25733
|
-
nextLayer.layout.visibility = "visible";
|
|
25734
|
-
}
|
|
25735
|
-
// Set visibility of traffic layers depending on traffic settings.
|
|
25736
|
-
if (trafficOptions.flow !== "none" && layerGroup) {
|
|
25737
|
-
if (layerGroup === "traffic_" + trafficOptions.flow && nextLayer.type == "line") {
|
|
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";
|
|
26252
|
+
}
|
|
26253
|
+
else if (nextLayer.type === "fill-extrusion") {
|
|
25738
26254
|
updateLayoutProperty(nextLayer.id, "visibility", "visible");
|
|
25739
|
-
nextLayer.layout = (
|
|
26255
|
+
nextLayer.layout = (_b = nextLayer.layout) !== null && _b !== void 0 ? _b : {};
|
|
25740
26256
|
nextLayer.layout.visibility = "visible";
|
|
25741
26257
|
}
|
|
25742
|
-
|
|
25743
|
-
|
|
25744
|
-
|
|
25745
|
-
|
|
25746
|
-
|
|
25747
|
-
|
|
25748
|
-
|
|
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
|
+
}
|
|
26265
|
+
}
|
|
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];
|
|
25749
26288
|
}
|
|
25750
|
-
currentLayerGroupLayers.push(nextLayer);
|
|
25751
|
-
}
|
|
25752
|
-
else if (currentLayerGroupLayers.length > 0) {
|
|
25753
|
-
advanceLayerGroup(layerGroup);
|
|
25754
26289
|
}
|
|
25755
26290
|
});
|
|
25756
|
-
|
|
25757
|
-
|
|
25758
|
-
|
|
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
|
+
});
|
|
25759
26295
|
// Update FundamentalMapLayers in LayerManager
|
|
25760
26296
|
var userLayers = this.map.layers._getUserLayers();
|
|
25761
26297
|
var firstUserLayer = userLayers[0];
|
|
@@ -25791,6 +26327,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
25791
26327
|
// Layers added to mapbox through this SDK since loading the last style should be
|
|
25792
26328
|
// carried over to the next style.
|
|
25793
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
|
+
}
|
|
25794
26335
|
var before = undefined;
|
|
25795
26336
|
if (_this.map.layers.getLayerById(userLayer.before)) {
|
|
25796
26337
|
var beforeCandidates = _this.map.layers.getLayerById(userLayer.before)._buildLayers();
|
|
@@ -25802,7 +26343,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
25802
26343
|
// If there was a previous styledata change event attached, remove it.
|
|
25803
26344
|
// When the sprite url changes between style changes then mapbox can't perform the diff
|
|
25804
26345
|
// In such cases it recalculate the style again. Removing previous attached
|
|
25805
|
-
// event
|
|
26346
|
+
// event listener makes sure that style changed event is not fired twice in these cases.
|
|
25806
26347
|
this.map.events.remove("styledata", this._onStyleData);
|
|
25807
26348
|
this.map.events.addOnce("styledata", this._onStyleData);
|
|
25808
26349
|
};
|
|
@@ -25831,8 +26372,16 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
25831
26372
|
if (url.includes(constants.styleResourcePlaceholder)) {
|
|
25832
26373
|
params.url = params.url.replace(constants.styleResourcePlaceholder, constants.styleResourcePath);
|
|
25833
26374
|
}
|
|
25834
|
-
params.url
|
|
25835
|
-
|
|
26375
|
+
if (params.url.toLocaleLowerCase().includes(this.serviceOptions.domain.toLocaleLowerCase()) ||
|
|
26376
|
+
params.url.toLocaleLowerCase().includes(this.serviceOptions.staticAssetsDomain.toLocaleLowerCase())) {
|
|
26377
|
+
// Only add API version param for Azure maps domain requests
|
|
26378
|
+
var targetUrl = new URL(params.url);
|
|
26379
|
+
if (!targetUrl.searchParams.get(constants.apiVersionQueryParameter)) {
|
|
26380
|
+
targetUrl.searchParams.set(constants.apiVersionQueryParameter, this.serviceOptions.styleAPIVersion);
|
|
26381
|
+
params.url = targetUrl.href;
|
|
26382
|
+
}
|
|
26383
|
+
(_a = this.map.authentication) === null || _a === void 0 ? void 0 : _a.signRequest(params);
|
|
26384
|
+
}
|
|
25836
26385
|
};
|
|
25837
26386
|
/**
|
|
25838
26387
|
* Fetches a json resource at the specified domain and path.
|
|
@@ -25941,6 +26490,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
25941
26490
|
}
|
|
25942
26491
|
else {
|
|
25943
26492
|
var mapboxMapOptions = {
|
|
26493
|
+
antialias: _this.styleOptions.antialias,
|
|
25944
26494
|
attributionControl: false,
|
|
25945
26495
|
container: container,
|
|
25946
26496
|
fadeDuration: _this.serviceOptions.fadeDuration,
|
|
@@ -26237,8 +26787,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
26237
26787
|
/**
|
|
26238
26788
|
* Set the map control's style options. Any options not specified will default to their current values.
|
|
26239
26789
|
* @param options The options for setting the style of the map control.
|
|
26790
|
+
* @param diff [true] If false, forces a 'full' style update, removing the current style and building the given one instead of attempting a diff-based update. Defaults to true.
|
|
26240
26791
|
*/
|
|
26241
|
-
Map.prototype.setStyle = function (options) {
|
|
26792
|
+
Map.prototype.setStyle = function (options, diff) {
|
|
26793
|
+
if (diff === void 0) { diff = true; }
|
|
26242
26794
|
// This option may only be set when initializing the map.
|
|
26243
26795
|
// The delete operation will handle non-exist property.
|
|
26244
26796
|
delete options.preserveDrawingBuffer;
|
|
@@ -26276,7 +26828,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
26276
26828
|
// if the language is changed, then either those delegates need changed
|
|
26277
26829
|
// or the styledata event manually invoked.
|
|
26278
26830
|
this.styleOptions = newOptions;
|
|
26279
|
-
this._setStyleComponents(newOptions);
|
|
26831
|
+
this._setStyleComponents(newOptions, diff);
|
|
26280
26832
|
};
|
|
26281
26833
|
/**
|
|
26282
26834
|
* Returns the map control's current style settings.
|
|
@@ -26929,6 +27481,16 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
26929
27481
|
Map.prototype.stop = function () {
|
|
26930
27482
|
this.map.stop();
|
|
26931
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
|
+
};
|
|
26932
27494
|
/**
|
|
26933
27495
|
* @internal
|
|
26934
27496
|
*/
|
|
@@ -26938,10 +27500,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
26938
27500
|
/**
|
|
26939
27501
|
* @internal
|
|
26940
27502
|
*/
|
|
26941
|
-
Map.prototype._rebuildStyle = function () {
|
|
27503
|
+
Map.prototype._rebuildStyle = function (diff) {
|
|
27504
|
+
if (diff === void 0) { diff = true; }
|
|
26942
27505
|
return __awaiter(this, void 0, void 0, function () {
|
|
26943
27506
|
return __generator(this, function (_a) {
|
|
26944
|
-
this.styles.setStyle(this.styleOptions);
|
|
27507
|
+
this.styles.setStyle(this.styleOptions, diff);
|
|
26945
27508
|
this.imageSprite._restoreImages();
|
|
26946
27509
|
return [2 /*return*/];
|
|
26947
27510
|
});
|
|
@@ -27052,18 +27615,19 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
27052
27615
|
* Removes sources and layers that aren't used by the new style or any remaining layers.
|
|
27053
27616
|
* @private
|
|
27054
27617
|
*/
|
|
27055
|
-
Map.prototype._setStyleComponents = function (styleOptions) {
|
|
27618
|
+
Map.prototype._setStyleComponents = function (styleOptions, diff) {
|
|
27056
27619
|
var _this = this;
|
|
27620
|
+
if (diff === void 0) { diff = true; }
|
|
27057
27621
|
if (this.removed) {
|
|
27058
27622
|
return;
|
|
27059
27623
|
}
|
|
27060
27624
|
// Check if the default style is set by the client and if it exists in the current style set
|
|
27061
|
-
this.styles.definitions().then(function (
|
|
27062
|
-
if (!_this.styleOptions.style || !
|
|
27063
|
-
_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;
|
|
27064
27628
|
}
|
|
27065
27629
|
_this.styleOptions = styleOptions;
|
|
27066
|
-
_this._rebuildStyle();
|
|
27630
|
+
_this._rebuildStyle(diff);
|
|
27067
27631
|
});
|
|
27068
27632
|
return;
|
|
27069
27633
|
};
|
|
@@ -27109,7 +27673,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
|
|
|
27109
27673
|
var w = BoundingBox.getWest(bounds);
|
|
27110
27674
|
var n = BoundingBox.getNorth(bounds);
|
|
27111
27675
|
var e = BoundingBox.getEast(bounds);
|
|
27112
|
-
if (
|
|
27676
|
+
if (!isFinite(s) || !isFinite(w) || !isFinite(n) || !isFinite(e)) {
|
|
27113
27677
|
throw new Error("The bounds specified are invalid: [" + bounds + "]");
|
|
27114
27678
|
}
|
|
27115
27679
|
while (w > e) {
|