@mapbox/mapbox-gl-style-spec 14.11.0-beta.2 → 14.12.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/diff.ts +47 -11
  2. package/dist/index.cjs +687 -30
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.ts +186 -13
  5. package/dist/index.es.js +687 -30
  6. package/dist/index.es.js.map +1 -1
  7. package/expression/compound_expression.ts +1 -1
  8. package/expression/definitions/coalesce.ts +2 -2
  9. package/expression/definitions/config.ts +1 -1
  10. package/expression/definitions/image.ts +1 -11
  11. package/expression/definitions/index.ts +3 -2
  12. package/expression/definitions/interpolate.ts +3 -3
  13. package/expression/definitions/match.ts +1 -1
  14. package/expression/definitions/step.ts +1 -1
  15. package/expression/evaluation_context.ts +3 -5
  16. package/expression/index.ts +4 -8
  17. package/expression/parsing_context.ts +1 -1
  18. package/expression/types/image_id.ts +6 -8
  19. package/expression/types.ts +1 -1
  20. package/expression/values.ts +1 -3
  21. package/feature_filter/index.ts +1 -1
  22. package/function/index.ts +3 -3
  23. package/migrate/expressions.ts +1 -1
  24. package/migrate/v8.ts +1 -1
  25. package/migrate/v9.ts +1 -1
  26. package/migrate.ts +1 -1
  27. package/package.json +1 -1
  28. package/read_style.ts +4 -6
  29. package/reference/v8.json +313 -0
  30. package/test.js +2 -5
  31. package/types.ts +195 -0
  32. package/util/extend.ts +1 -1
  33. package/util/geometry_util.ts +19 -2
  34. package/util/interpolate.ts +4 -0
  35. package/validate/validate_fog.ts +1 -1
  36. package/validate/validate_glyphs_url.ts +1 -1
  37. package/validate/validate_layer.ts +2 -2
  38. package/validate/validate_light.ts +1 -1
  39. package/validate/validate_lights.ts +1 -1
  40. package/validate/validate_property.ts +1 -1
  41. package/validate/validate_source.ts +2 -4
  42. package/validate/validate_style.ts +2 -1
  43. package/validate/validate_terrain.ts +1 -1
  44. package/validate_mapbox_api_supported.ts +1 -1
  45. package/validate_style.min.ts +17 -15
  46. package/validate_style.ts +3 -3
  47. package/visit.ts +1 -1
package/dist/index.es.js CHANGED
@@ -148,6 +148,7 @@ var $root = {
148
148
  doc: "A collection of icon sets",
149
149
  "sdk-support": {
150
150
  "basic functionality": {
151
+ js: "3.11.0",
151
152
  android: "11.11.0",
152
153
  ios: "11.11.0"
153
154
  }
@@ -1320,6 +1321,13 @@ var layer = {
1320
1321
  }
1321
1322
  }
1322
1323
  },
1324
+ building: {
1325
+ doc: "A procedural 3D building.",
1326
+ "sdk-support": {
1327
+ },
1328
+ experimental: true,
1329
+ "private": true
1330
+ },
1323
1331
  raster: {
1324
1332
  doc: "Raster map textures such as satellite imagery.",
1325
1333
  "sdk-support": {
@@ -1461,6 +1469,7 @@ var layout = [
1461
1469
  "layout_circle",
1462
1470
  "layout_heatmap",
1463
1471
  "layout_fill-extrusion",
1472
+ "layout_building",
1464
1473
  "layout_symbol",
1465
1474
  "layout_raster",
1466
1475
  "layout_raster-particle",
@@ -1858,6 +1867,115 @@ var layout_heatmap = {
1858
1867
  "property-type": "constant"
1859
1868
  }
1860
1869
  };
1870
+ var layout_building = {
1871
+ visibility: {
1872
+ type: "enum",
1873
+ values: {
1874
+ visible: {
1875
+ doc: "The layer is shown."
1876
+ },
1877
+ none: {
1878
+ doc: "The layer is not shown."
1879
+ }
1880
+ },
1881
+ "default": "visible",
1882
+ doc: "Whether this layer is displayed.",
1883
+ "sdk-support": {
1884
+ "basic functionality": {
1885
+ }
1886
+ },
1887
+ expression: {
1888
+ interpolated: false
1889
+ },
1890
+ "property-type": "constant"
1891
+ },
1892
+ "building-roof-shape": {
1893
+ type: "enum",
1894
+ values: {
1895
+ flat: {
1896
+ doc: "Use regular extruded buildings with flat roofs."
1897
+ },
1898
+ hipped: {
1899
+ doc: "Use hipped roof for the procedurally generated buildings."
1900
+ },
1901
+ gabled: {
1902
+ doc: "Use gabled roof for the procedurally generated buildings."
1903
+ },
1904
+ parapet: {
1905
+ doc: "Use parapet roof for the procedurally generated buildings."
1906
+ },
1907
+ mansard: {
1908
+ doc: "Use mansard roof for the procedurally generated buildings."
1909
+ },
1910
+ skillion: {
1911
+ doc: "Use skillion roof for the procedurally generated buildings."
1912
+ },
1913
+ pyramidal: {
1914
+ doc: "Use pyramidal roof for the procedurally generated buildings."
1915
+ }
1916
+ },
1917
+ "default": "flat",
1918
+ doc: "Roof type to use for the procedural buildings.",
1919
+ experimental: true,
1920
+ "private": true,
1921
+ "sdk-support": {
1922
+ "basic functionality": {
1923
+ },
1924
+ "data-driven styling": {
1925
+ }
1926
+ },
1927
+ expression: {
1928
+ interpolated: false,
1929
+ parameters: [
1930
+ "feature"
1931
+ ]
1932
+ },
1933
+ "property-type": "data-driven"
1934
+ },
1935
+ "building-height": {
1936
+ type: "number",
1937
+ "default": 0,
1938
+ minimum: 0,
1939
+ units: "meters",
1940
+ doc: "The height of the procedural buildings.",
1941
+ transition: true,
1942
+ experimental: true,
1943
+ "private": true,
1944
+ "sdk-support": {
1945
+ "basic functionality": {
1946
+ },
1947
+ "data-driven styling": {
1948
+ }
1949
+ },
1950
+ expression: {
1951
+ interpolated: false
1952
+ },
1953
+ "property-type": "data-driven"
1954
+ },
1955
+ "building-base": {
1956
+ type: "number",
1957
+ "default": 0,
1958
+ minimum: 0,
1959
+ units: "meters",
1960
+ doc: "The height with which to extrude the base of this layer. Must be less than or equal to `building-height`.",
1961
+ transition: true,
1962
+ requires: [
1963
+ "building-height"
1964
+ ],
1965
+ experimental: true,
1966
+ "private": true,
1967
+ "sdk-support": {
1968
+ "basic functionality": {
1969
+ },
1970
+ "data-driven styling": {
1971
+ }
1972
+ },
1973
+ expression: {
1974
+ interpolated: false
1975
+ },
1976
+ "property-type": "data-driven"
1977
+ }
1978
+ };
1861
1979
  var layout_line = {
1862
1980
  "line-cap": {
1863
1981
  type: "enum",
@@ -3799,6 +3917,20 @@ var filter_circle = {
3799
3917
  ]
3800
3918
  }
3801
3919
  };
3920
+ var filter_building = {
3921
+ type: "boolean",
3922
+ doc: "Expression which determines whether or not to display a Polygon. Building layer does NOT support dynamic filtering, meaning this expression can NOT use the `[\"pitch\"]` and `[\"distance-from-center\"]` expressions to reference the current state of the view.",
3923
+ "default": false,
3924
+ transition: false,
3925
+ "property-type": "data-driven",
3926
+ expression: {
3927
+ interpolated: false,
3928
+ parameters: [
3929
+ "zoom",
3930
+ "feature"
3931
+ ]
3932
+ }
3933
+ };
3802
3934
  var filter_heatmap = {
3803
3935
  type: "boolean",
3804
3936
  doc: "Expression used to determine whether a point is being displayed or not. Heatmap layer does NOT support dynamic filtering, meaning this expression can NOT use the `[\"pitch\"]` and `[\"distance-from-center\"]` expressions to reference the current state of the view.",
@@ -6104,6 +6236,7 @@ var paint = [
6104
6236
  "paint_circle",
6105
6237
  "paint_heatmap",
6106
6238
  "paint_fill-extrusion",
6239
+ "paint_building",
6107
6240
  "paint_symbol",
6108
6241
  "paint_raster",
6109
6242
  "paint_raster-particle",
@@ -6416,6 +6549,189 @@ var paint_fill = {
6416
6549
  "property-type": "data-driven"
6417
6550
  }
6418
6551
  };
6552
+ var paint_building = {
6553
+ "building-opacity": {
6554
+ type: "number",
6555
+ "default": 1,
6556
+ minimum: 0,
6557
+ maximum: 1,
6558
+ doc: "The opacity of the entire procedural buildings layer. This is rendered on a per-layer, not per-feature, basis, and data-driven styling is not available.",
6559
+ transition: true,
6560
+ experimental: true,
6561
+ "private": true,
6562
+ "sdk-support": {
6563
+ "basic functionality": {
6564
+ }
6565
+ },
6566
+ expression: {
6567
+ interpolated: true,
6568
+ parameters: [
6569
+ "zoom"
6570
+ ]
6571
+ },
6572
+ "property-type": "data-constant"
6573
+ },
6574
+ "building-ambient-occlusion-wall-intensity": {
6575
+ "property-type": "data-constant",
6576
+ type: "number",
6577
+ "default": 0,
6578
+ minimum: 0,
6579
+ maximum: 1,
6580
+ experimental: true,
6581
+ "private": true,
6582
+ expression: {
6583
+ interpolated: true,
6584
+ parameters: [
6585
+ "zoom"
6586
+ ]
6587
+ },
6588
+ transition: true,
6589
+ doc: "Controls the intensity of shading concave angles between walls and building elements, such as facades and rooftop.",
6590
+ "sdk-support": {
6591
+ "basic functionality": {
6592
+ }
6593
+ }
6594
+ },
6595
+ "building-ambient-occlusion-ground-intensity": {
6596
+ "property-type": "data-constant",
6597
+ type: "number",
6598
+ "default": 0,
6599
+ minimum: 0,
6600
+ maximum: 1,
6601
+ experimental: true,
6602
+ "private": true,
6603
+ expression: {
6604
+ interpolated: true,
6605
+ parameters: [
6606
+ "zoom"
6607
+ ]
6608
+ },
6609
+ transition: true,
6610
+ doc: "Controls the intensity of shading near ground",
6611
+ "sdk-support": {
6612
+ "basic functionality": {
6613
+ }
6614
+ }
6615
+ },
6616
+ "building-ambient-occlusion-ground-radius": {
6617
+ "property-type": "data-constant",
6618
+ type: "number",
6619
+ experimental: true,
6620
+ "private": true,
6621
+ "default": 3,
6622
+ minimum: 0,
6623
+ expression: {
6624
+ interpolated: true,
6625
+ parameters: [
6626
+ "zoom"
6627
+ ]
6628
+ },
6629
+ transition: true,
6630
+ doc: "The extent of the ambient occlusion effect on the ground beneath the procedural buildings in meters.",
6631
+ "sdk-support": {
6632
+ "basic functionality": {
6633
+ }
6634
+ }
6635
+ },
6636
+ "building-ambient-occlusion-ground-attenuation": {
6637
+ "property-type": "data-constant",
6638
+ type: "number",
6639
+ experimental: true,
6640
+ "private": true,
6641
+ "default": 0.69,
6642
+ minimum: 0,
6643
+ maximum: 1,
6644
+ doc: "Provides a control to further fine-tune the look of the ambient occlusion on the ground beneath the procedural buildings. Lower values give the effect a more solid look while higher values make it smoother.",
6645
+ transition: true,
6646
+ expression: {
6647
+ interpolated: true,
6648
+ parameters: [
6649
+ "zoom"
6650
+ ]
6651
+ },
6652
+ "sdk-support": {
6653
+ "basic functionality": {
6654
+ }
6655
+ }
6656
+ },
6657
+ "building-vertical-scale": {
6658
+ "property-type": "data-constant",
6659
+ type: "number",
6660
+ experimental: true,
6661
+ "private": true,
6662
+ "default": 1,
6663
+ minimum: 0,
6664
+ doc: "A global multiplier that can be used to scale base and height of the procedural buildings.",
6665
+ transition: true,
6666
+ expression: {
6667
+ interpolated: true,
6668
+ parameters: [
6669
+ "zoom"
6670
+ ]
6671
+ },
6672
+ "sdk-support": {
6673
+ "basic functionality": {
6674
+ }
6675
+ }
6676
+ },
6677
+ "building-cast-shadows": {
6678
+ type: "boolean",
6679
+ "default": true,
6680
+ doc: "Enable/Disable shadow casting for this layer",
6681
+ transition: false,
6682
+ experimental: true,
6683
+ "private": true,
6684
+ "sdk-support": {
6685
+ "basic functionality": {
6686
+ }
6687
+ },
6688
+ "property-type": "data-constant"
6689
+ },
6690
+ "building-color": {
6691
+ type: "color",
6692
+ "default": "rgba(193, 154, 127, 1)",
6693
+ doc: "Color buildings. This can be styled using different building parts (e.g. windows, wall, roof, etc.). This won't be used if `building-roof-shape` has a value `flat`.",
6694
+ experimental: true,
6695
+ "private": true,
6696
+ "sdk-support": {
6697
+ "basic functionality": {
6698
+ },
6699
+ "data-driven styling": {
6700
+ }
6701
+ },
6702
+ expression: {
6703
+ interpolated: true,
6704
+ parameters: [
6705
+ "feature",
6706
+ "feature-state"
6707
+ ]
6708
+ },
6709
+ "property-type": "data-driven"
6710
+ },
6711
+ "building-emissive-strength": {
6712
+ type: "number",
6713
+ "default": 0,
6714
+ minimum: 0,
6715
+ doc: "Controls the intensity of light emitted on the source features.",
6716
+ experimental: true,
6717
+ "private": true,
6718
+ "sdk-support": {
6719
+ "basic functionality": {
6720
+ },
6721
+ "data-driven styling": {
6722
+ }
6723
+ },
6724
+ expression: {
6725
+ interpolated: true,
6726
+ parameters: [
6727
+ "feature",
6728
+ "feature-state",
6729
+ "measure-light"
6730
+ ]
6731
+ },
6732
+ "property-type": "data-driven"
6733
+ }
6734
+ };
6419
6735
  var paint_line = {
6420
6736
  "line-opacity": {
6421
6737
  type: "number",
@@ -9646,6 +9962,7 @@ var v8 = {
9646
9962
  "property-type": "constant"
9647
9963
  }
9648
9964
  },
9965
+ layout_building: layout_building,
9649
9966
  layout_line: layout_line,
9650
9967
  layout_symbol: layout_symbol,
9651
9968
  layout_raster: layout_raster,
@@ -9718,6 +10035,7 @@ var v8 = {
9718
10035
  ]
9719
10036
  }
9720
10037
  },
10038
+ filter_building: filter_building,
9721
10039
  filter_heatmap: filter_heatmap,
9722
10040
  filter_operator: filter_operator,
9723
10041
  geometry_type: geometry_type,
@@ -10472,6 +10790,7 @@ var v8 = {
10472
10790
  "property-type": "data-constant"
10473
10791
  }
10474
10792
  },
10793
+ paint_building: paint_building,
10475
10794
  paint_line: paint_line,
10476
10795
  paint_circle: paint_circle,
10477
10796
  paint_heatmap: paint_heatmap,
@@ -12142,11 +12461,15 @@ function array(from, to, t) {
12142
12461
  return number(d, to[i], t);
12143
12462
  });
12144
12463
  }
12464
+ function easeIn(x) {
12465
+ return x * x * x * x * x;
12466
+ }
12145
12467
 
12146
12468
  var interpolate$1 = /*#__PURE__*/Object.freeze({
12147
12469
  __proto__: null,
12148
12470
  array: array,
12149
12471
  color: color,
12472
+ easeIn: easeIn,
12150
12473
  number: number
12151
12474
  });
12152
12475
 
@@ -12492,6 +12815,7 @@ class Formatted {
12492
12815
  }
12493
12816
  }
12494
12817
 
12818
+ const separator = '\x1F';
12495
12819
  class ImageId {
12496
12820
  constructor(id) {
12497
12821
  if (typeof id === 'string') {
@@ -12505,30 +12829,20 @@ class ImageId {
12505
12829
  return new ImageId(id);
12506
12830
  }
12507
12831
  static toString(id) {
12508
- return JSON.stringify({
12509
- name: id.name,
12510
- iconsetId: id.iconsetId
12511
- });
12832
+ return id.iconsetId ? `${ id.name }${ separator }${ id.iconsetId }` : id.name;
12512
12833
  }
12513
12834
  static parse(str) {
12514
- try {
12515
- const {name, iconsetId} = JSON.parse(str);
12516
- return new ImageId({
12517
- name,
12518
- iconsetId
12519
- });
12520
- } catch (e) {
12521
- return null;
12522
- }
12835
+ const [name, iconsetId] = str.split(separator);
12836
+ return new ImageId({
12837
+ name,
12838
+ iconsetId
12839
+ });
12523
12840
  }
12524
12841
  static isEqual(a, b) {
12525
12842
  return a.name === b.name && a.iconsetId === b.iconsetId;
12526
12843
  }
12527
12844
  toString() {
12528
- return JSON.stringify({
12529
- name: this.name,
12530
- iconsetId: this.iconsetId
12531
- });
12845
+ return ImageId.toString(this);
12532
12846
  }
12533
12847
  serialize() {
12534
12848
  return {
@@ -13143,16 +13457,7 @@ class ImageExpression {
13143
13457
  for (const key in params) {
13144
13458
  if (params[key]) {
13145
13459
  try {
13146
- const color = params[key].evaluate(ctx);
13147
- const msg = `Ignoring image parameter "${ key }" with semi-transparent color ${ color.toString() }`;
13148
- if (color.a !== 1) {
13149
- if (!this._imageWarnHistory[msg]) {
13150
- console.warn(msg);
13151
- this._imageWarnHistory[msg] = true;
13152
- }
13153
- continue;
13154
- }
13155
- result[key] = color;
13460
+ result[key] = params[key].evaluate(ctx);
13156
13461
  } catch (err) {
13157
13462
  continue;
13158
13463
  }
@@ -13630,6 +13935,306 @@ class CollatorExpression {
13630
13935
  }
13631
13936
  }
13632
13937
 
13938
+ var pointGeometry;
13939
+ var hasRequiredPointGeometry;
13940
+
13941
+ function requirePointGeometry () {
13942
+ if (hasRequiredPointGeometry) return pointGeometry;
13943
+ hasRequiredPointGeometry = 1;
13944
+ pointGeometry = Point;
13945
+ /**
13946
+ * A standalone point geometry with useful accessor, comparison, and
13947
+ * modification methods.
13948
+ *
13949
+ * @class Point
13950
+ * @param {Number} x the x-coordinate. this could be longitude or screen
13951
+ * pixels, or any other sort of unit.
13952
+ * @param {Number} y the y-coordinate. this could be latitude or screen
13953
+ * pixels, or any other sort of unit.
13954
+ * @example
13955
+ * var point = new Point(-77, 38);
13956
+ */
13957
+ function Point(x, y) {
13958
+ this.x = x;
13959
+ this.y = y;
13960
+ }
13961
+ Point.prototype = {
13962
+ /**
13963
+ * Clone this point, returning a new point that can be modified
13964
+ * without affecting the old one.
13965
+ * @return {Point} the clone
13966
+ */
13967
+ clone: function () {
13968
+ return new Point(this.x, this.y);
13969
+ },
13970
+ /**
13971
+ * Add this point's x & y coordinates to another point,
13972
+ * yielding a new point.
13973
+ * @param {Point} p the other point
13974
+ * @return {Point} output point
13975
+ */
13976
+ add: function (p) {
13977
+ return this.clone()._add(p);
13978
+ },
13979
+ /**
13980
+ * Subtract this point's x & y coordinates to from point,
13981
+ * yielding a new point.
13982
+ * @param {Point} p the other point
13983
+ * @return {Point} output point
13984
+ */
13985
+ sub: function (p) {
13986
+ return this.clone()._sub(p);
13987
+ },
13988
+ /**
13989
+ * Multiply this point's x & y coordinates by point,
13990
+ * yielding a new point.
13991
+ * @param {Point} p the other point
13992
+ * @return {Point} output point
13993
+ */
13994
+ multByPoint: function (p) {
13995
+ return this.clone()._multByPoint(p);
13996
+ },
13997
+ /**
13998
+ * Divide this point's x & y coordinates by point,
13999
+ * yielding a new point.
14000
+ * @param {Point} p the other point
14001
+ * @return {Point} output point
14002
+ */
14003
+ divByPoint: function (p) {
14004
+ return this.clone()._divByPoint(p);
14005
+ },
14006
+ /**
14007
+ * Multiply this point's x & y coordinates by a factor,
14008
+ * yielding a new point.
14009
+ * @param {Point} k factor
14010
+ * @return {Point} output point
14011
+ */
14012
+ mult: function (k) {
14013
+ return this.clone()._mult(k);
14014
+ },
14015
+ /**
14016
+ * Divide this point's x & y coordinates by a factor,
14017
+ * yielding a new point.
14018
+ * @param {Point} k factor
14019
+ * @return {Point} output point
14020
+ */
14021
+ div: function (k) {
14022
+ return this.clone()._div(k);
14023
+ },
14024
+ /**
14025
+ * Rotate this point around the 0, 0 origin by an angle a,
14026
+ * given in radians
14027
+ * @param {Number} a angle to rotate around, in radians
14028
+ * @return {Point} output point
14029
+ */
14030
+ rotate: function (a) {
14031
+ return this.clone()._rotate(a);
14032
+ },
14033
+ /**
14034
+ * Rotate this point around p point by an angle a,
14035
+ * given in radians
14036
+ * @param {Number} a angle to rotate around, in radians
14037
+ * @param {Point} p Point to rotate around
14038
+ * @return {Point} output point
14039
+ */
14040
+ rotateAround: function (a, p) {
14041
+ return this.clone()._rotateAround(a, p);
14042
+ },
14043
+ /**
14044
+ * Multiply this point by a 4x1 transformation matrix
14045
+ * @param {Array<Number>} m transformation matrix
14046
+ * @return {Point} output point
14047
+ */
14048
+ matMult: function (m) {
14049
+ return this.clone()._matMult(m);
14050
+ },
14051
+ /**
14052
+ * Calculate this point but as a unit vector from 0, 0, meaning
14053
+ * that the distance from the resulting point to the 0, 0
14054
+ * coordinate will be equal to 1 and the angle from the resulting
14055
+ * point to the 0, 0 coordinate will be the same as before.
14056
+ * @return {Point} unit vector point
14057
+ */
14058
+ unit: function () {
14059
+ return this.clone()._unit();
14060
+ },
14061
+ /**
14062
+ * Compute a perpendicular point, where the new y coordinate
14063
+ * is the old x coordinate and the new x coordinate is the old y
14064
+ * coordinate multiplied by -1
14065
+ * @return {Point} perpendicular point
14066
+ */
14067
+ perp: function () {
14068
+ return this.clone()._perp();
14069
+ },
14070
+ /**
14071
+ * Return a version of this point with the x & y coordinates
14072
+ * rounded to integers.
14073
+ * @return {Point} rounded point
14074
+ */
14075
+ round: function () {
14076
+ return this.clone()._round();
14077
+ },
14078
+ /**
14079
+ * Return the magitude of this point: this is the Euclidean
14080
+ * distance from the 0, 0 coordinate to this point's x and y
14081
+ * coordinates.
14082
+ * @return {Number} magnitude
14083
+ */
14084
+ mag: function () {
14085
+ return Math.sqrt(this.x * this.x + this.y * this.y);
14086
+ },
14087
+ /**
14088
+ * Judge whether this point is equal to another point, returning
14089
+ * true or false.
14090
+ * @param {Point} other the other point
14091
+ * @return {boolean} whether the points are equal
14092
+ */
14093
+ equals: function (other) {
14094
+ return this.x === other.x && this.y === other.y;
14095
+ },
14096
+ /**
14097
+ * Calculate the distance from this point to another point
14098
+ * @param {Point} p the other point
14099
+ * @return {Number} distance
14100
+ */
14101
+ dist: function (p) {
14102
+ return Math.sqrt(this.distSqr(p));
14103
+ },
14104
+ /**
14105
+ * Calculate the distance from this point to another point,
14106
+ * without the square root step. Useful if you're comparing
14107
+ * relative distances.
14108
+ * @param {Point} p the other point
14109
+ * @return {Number} distance
14110
+ */
14111
+ distSqr: function (p) {
14112
+ var dx = p.x - this.x, dy = p.y - this.y;
14113
+ return dx * dx + dy * dy;
14114
+ },
14115
+ /**
14116
+ * Get the angle from the 0, 0 coordinate to this point, in radians
14117
+ * coordinates.
14118
+ * @return {Number} angle
14119
+ */
14120
+ angle: function () {
14121
+ return Math.atan2(this.y, this.x);
14122
+ },
14123
+ /**
14124
+ * Get the angle from this point to another point, in radians
14125
+ * @param {Point} b the other point
14126
+ * @return {Number} angle
14127
+ */
14128
+ angleTo: function (b) {
14129
+ return Math.atan2(this.y - b.y, this.x - b.x);
14130
+ },
14131
+ /**
14132
+ * Get the angle between this point and another point, in radians
14133
+ * @param {Point} b the other point
14134
+ * @return {Number} angle
14135
+ */
14136
+ angleWith: function (b) {
14137
+ return this.angleWithSep(b.x, b.y);
14138
+ },
14139
+ /*
14140
+ * Find the angle of the two vectors, solving the formula for
14141
+ * the cross product a x b = |a||b|sin(θ) for θ.
14142
+ * @param {Number} x the x-coordinate
14143
+ * @param {Number} y the y-coordinate
14144
+ * @return {Number} the angle in radians
14145
+ */
14146
+ angleWithSep: function (x, y) {
14147
+ return Math.atan2(this.x * y - this.y * x, this.x * x + this.y * y);
14148
+ },
14149
+ _matMult: function (m) {
14150
+ var x = m[0] * this.x + m[1] * this.y, y = m[2] * this.x + m[3] * this.y;
14151
+ this.x = x;
14152
+ this.y = y;
14153
+ return this;
14154
+ },
14155
+ _add: function (p) {
14156
+ this.x += p.x;
14157
+ this.y += p.y;
14158
+ return this;
14159
+ },
14160
+ _sub: function (p) {
14161
+ this.x -= p.x;
14162
+ this.y -= p.y;
14163
+ return this;
14164
+ },
14165
+ _mult: function (k) {
14166
+ this.x *= k;
14167
+ this.y *= k;
14168
+ return this;
14169
+ },
14170
+ _div: function (k) {
14171
+ this.x /= k;
14172
+ this.y /= k;
14173
+ return this;
14174
+ },
14175
+ _multByPoint: function (p) {
14176
+ this.x *= p.x;
14177
+ this.y *= p.y;
14178
+ return this;
14179
+ },
14180
+ _divByPoint: function (p) {
14181
+ this.x /= p.x;
14182
+ this.y /= p.y;
14183
+ return this;
14184
+ },
14185
+ _unit: function () {
14186
+ this._div(this.mag());
14187
+ return this;
14188
+ },
14189
+ _perp: function () {
14190
+ var y = this.y;
14191
+ this.y = this.x;
14192
+ this.x = -y;
14193
+ return this;
14194
+ },
14195
+ _rotate: function (angle) {
14196
+ var cos = Math.cos(angle), sin = Math.sin(angle), x = cos * this.x - sin * this.y, y = sin * this.x + cos * this.y;
14197
+ this.x = x;
14198
+ this.y = y;
14199
+ return this;
14200
+ },
14201
+ _rotateAround: function (angle, p) {
14202
+ var cos = Math.cos(angle), sin = Math.sin(angle), x = p.x + cos * (this.x - p.x) - sin * (this.y - p.y), y = p.y + sin * (this.x - p.x) + cos * (this.y - p.y);
14203
+ this.x = x;
14204
+ this.y = y;
14205
+ return this;
14206
+ },
14207
+ _round: function () {
14208
+ this.x = Math.round(this.x);
14209
+ this.y = Math.round(this.y);
14210
+ return this;
14211
+ }
14212
+ };
14213
+ /**
14214
+ * Construct a point from an array if necessary, otherwise if the input
14215
+ * is already a Point, or an unknown type, return it unchanged
14216
+ * @param {Array<Number>|Point|*} a any kind of input value
14217
+ * @return {Point} constructed point, or passed-through value.
14218
+ * @example
14219
+ * // this
14220
+ * var point = Point.convert([0, 1]);
14221
+ * // is equivalent to
14222
+ * var point = new Point(0, 1);
14223
+ */
14224
+ Point.convert = function (a) {
14225
+ if (a instanceof Point) {
14226
+ return a;
14227
+ }
14228
+ if (Array.isArray(a)) {
14229
+ return new Point(a[0], a[1]);
14230
+ }
14231
+ return a;
14232
+ };
14233
+ return pointGeometry;
14234
+ }
14235
+
14236
+ requirePointGeometry();
14237
+
13633
14238
  function calculateSignedArea(ring) {
13634
14239
  let sum = 0;
13635
14240
  for (let i = 0, len = ring.length, j = len - 1, p1, p2; i < len; j = i++) {
@@ -19050,7 +19655,15 @@ const operations = {
19050
19655
  /**
19051
19656
  * { command: 'updateImport', args: [importId, importSpecification | styleUrl] }
19052
19657
  */
19053
- updateImport: 'updateImport'
19658
+ updateImport: 'updateImport',
19659
+ /*
19660
+ * { command: 'addIconset', args: [iconsetId, IconsetSpecification] }
19661
+ */
19662
+ addIconset: 'addIconset',
19663
+ /*
19664
+ * { command: 'removeIconset', args: [iconsetId] }
19665
+ */
19666
+ removeIconset: 'removeIconset'
19054
19667
  };
19055
19668
  function addSource(sourceId, after, commands) {
19056
19669
  commands.push({
@@ -19357,6 +19970,47 @@ function diffImports(before = [], after = [], commands) {
19357
19970
  });
19358
19971
  }
19359
19972
  }
19973
+ function diffIconsets(before, after, commands) {
19974
+ before = before || {};
19975
+ after = after || {};
19976
+ let iconsetId;
19977
+ for (iconsetId in before) {
19978
+ if (!before.hasOwnProperty(iconsetId))
19979
+ continue;
19980
+ if (!after.hasOwnProperty(iconsetId)) {
19981
+ commands.push({
19982
+ command: operations.removeIconset,
19983
+ args: [iconsetId]
19984
+ });
19985
+ }
19986
+ }
19987
+ for (iconsetId in after) {
19988
+ if (!after.hasOwnProperty(iconsetId))
19989
+ continue;
19990
+ const iconset = after[iconsetId];
19991
+ if (!before.hasOwnProperty(iconsetId)) {
19992
+ commands.push({
19993
+ command: operations.addIconset,
19994
+ args: [
19995
+ iconsetId,
19996
+ iconset
19997
+ ]
19998
+ });
19999
+ } else if (!deepEqual(before[iconsetId], iconset)) {
20000
+ commands.push({
20001
+ command: operations.removeIconset,
20002
+ args: [iconsetId]
20003
+ });
20004
+ commands.push({
20005
+ command: operations.addIconset,
20006
+ args: [
20007
+ iconsetId,
20008
+ iconset
20009
+ ]
20010
+ });
20011
+ }
20012
+ }
20013
+ }
19360
20014
  function diffStyles(before, after) {
19361
20015
  if (!before)
19362
20016
  return [{
@@ -19458,6 +20112,9 @@ function diffStyles(before, after) {
19458
20112
  args: [after.camera]
19459
20113
  });
19460
20114
  }
20115
+ if (!deepEqual(before.iconsets, after.iconsets)) {
20116
+ diffIconsets(before.iconsets, after.iconsets, commands);
20117
+ }
19461
20118
  if (!deepEqual(before['color-theme'], after['color-theme'])) {
19462
20119
  return [{
19463
20120
  command: operations.setStyle,
@@ -20211,8 +20868,8 @@ function validateLayer(options) {
20211
20868
  'raster-particle'
20212
20869
  ].includes(type)) {
20213
20870
  errors.push(new ValidationError(key, layer.source, `raster-array source can only be used with layer type 'raster'.`));
20214
- } else if (type === 'line' && layer.paint && (layer.paint['line-gradient'] || layer.paint['line-trim-offset']) && (sourceType !== 'geojson' || !source.lineMetrics)) {
20215
- errors.push(new ValidationError(key, layer, `layer "${ layer.id }" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`));
20871
+ } else if (type === 'line' && layer.paint && (layer.paint['line-gradient'] || layer.paint['line-trim-offset']) && (sourceType === 'geojson' && !source.lineMetrics)) {
20872
+ errors.push(new ValidationError(key, layer, `layer "${ layer.id }" specifies a line-gradient, which requires the GeoJSON source to have \`lineMetrics\` enabled.`));
20216
20873
  } else if (type === 'raster-particle' && sourceType !== 'raster-array') {
20217
20874
  errors.push(new ValidationError(key, layer.source, `layer "${ layer.id }" requires a 'raster-array' source.`));
20218
20875
  }