@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.cjs CHANGED
@@ -154,6 +154,7 @@
154
154
  doc: "A collection of icon sets",
155
155
  "sdk-support": {
156
156
  "basic functionality": {
157
+ js: "3.11.0",
157
158
  android: "11.11.0",
158
159
  ios: "11.11.0"
159
160
  }
@@ -1326,6 +1327,13 @@
1326
1327
  }
1327
1328
  }
1328
1329
  },
1330
+ building: {
1331
+ doc: "A procedural 3D building.",
1332
+ "sdk-support": {
1333
+ },
1334
+ experimental: true,
1335
+ "private": true
1336
+ },
1329
1337
  raster: {
1330
1338
  doc: "Raster map textures such as satellite imagery.",
1331
1339
  "sdk-support": {
@@ -1467,6 +1475,7 @@
1467
1475
  "layout_circle",
1468
1476
  "layout_heatmap",
1469
1477
  "layout_fill-extrusion",
1478
+ "layout_building",
1470
1479
  "layout_symbol",
1471
1480
  "layout_raster",
1472
1481
  "layout_raster-particle",
@@ -1864,6 +1873,115 @@
1864
1873
  "property-type": "constant"
1865
1874
  }
1866
1875
  };
1876
+ var layout_building = {
1877
+ visibility: {
1878
+ type: "enum",
1879
+ values: {
1880
+ visible: {
1881
+ doc: "The layer is shown."
1882
+ },
1883
+ none: {
1884
+ doc: "The layer is not shown."
1885
+ }
1886
+ },
1887
+ "default": "visible",
1888
+ doc: "Whether this layer is displayed.",
1889
+ "sdk-support": {
1890
+ "basic functionality": {
1891
+ }
1892
+ },
1893
+ expression: {
1894
+ interpolated: false
1895
+ },
1896
+ "property-type": "constant"
1897
+ },
1898
+ "building-roof-shape": {
1899
+ type: "enum",
1900
+ values: {
1901
+ flat: {
1902
+ doc: "Use regular extruded buildings with flat roofs."
1903
+ },
1904
+ hipped: {
1905
+ doc: "Use hipped roof for the procedurally generated buildings."
1906
+ },
1907
+ gabled: {
1908
+ doc: "Use gabled roof for the procedurally generated buildings."
1909
+ },
1910
+ parapet: {
1911
+ doc: "Use parapet roof for the procedurally generated buildings."
1912
+ },
1913
+ mansard: {
1914
+ doc: "Use mansard roof for the procedurally generated buildings."
1915
+ },
1916
+ skillion: {
1917
+ doc: "Use skillion roof for the procedurally generated buildings."
1918
+ },
1919
+ pyramidal: {
1920
+ doc: "Use pyramidal roof for the procedurally generated buildings."
1921
+ }
1922
+ },
1923
+ "default": "flat",
1924
+ doc: "Roof type to use for the procedural buildings.",
1925
+ experimental: true,
1926
+ "private": true,
1927
+ "sdk-support": {
1928
+ "basic functionality": {
1929
+ },
1930
+ "data-driven styling": {
1931
+ }
1932
+ },
1933
+ expression: {
1934
+ interpolated: false,
1935
+ parameters: [
1936
+ "feature"
1937
+ ]
1938
+ },
1939
+ "property-type": "data-driven"
1940
+ },
1941
+ "building-height": {
1942
+ type: "number",
1943
+ "default": 0,
1944
+ minimum: 0,
1945
+ units: "meters",
1946
+ doc: "The height of the procedural buildings.",
1947
+ transition: true,
1948
+ experimental: true,
1949
+ "private": true,
1950
+ "sdk-support": {
1951
+ "basic functionality": {
1952
+ },
1953
+ "data-driven styling": {
1954
+ }
1955
+ },
1956
+ expression: {
1957
+ interpolated: false
1958
+ },
1959
+ "property-type": "data-driven"
1960
+ },
1961
+ "building-base": {
1962
+ type: "number",
1963
+ "default": 0,
1964
+ minimum: 0,
1965
+ units: "meters",
1966
+ doc: "The height with which to extrude the base of this layer. Must be less than or equal to `building-height`.",
1967
+ transition: true,
1968
+ requires: [
1969
+ "building-height"
1970
+ ],
1971
+ experimental: true,
1972
+ "private": true,
1973
+ "sdk-support": {
1974
+ "basic functionality": {
1975
+ },
1976
+ "data-driven styling": {
1977
+ }
1978
+ },
1979
+ expression: {
1980
+ interpolated: false
1981
+ },
1982
+ "property-type": "data-driven"
1983
+ }
1984
+ };
1867
1985
  var layout_line = {
1868
1986
  "line-cap": {
1869
1987
  type: "enum",
@@ -3805,6 +3923,20 @@
3805
3923
  ]
3806
3924
  }
3807
3925
  };
3926
+ var filter_building = {
3927
+ type: "boolean",
3928
+ 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.",
3929
+ "default": false,
3930
+ transition: false,
3931
+ "property-type": "data-driven",
3932
+ expression: {
3933
+ interpolated: false,
3934
+ parameters: [
3935
+ "zoom",
3936
+ "feature"
3937
+ ]
3938
+ }
3939
+ };
3808
3940
  var filter_heatmap = {
3809
3941
  type: "boolean",
3810
3942
  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.",
@@ -6110,6 +6242,7 @@
6110
6242
  "paint_circle",
6111
6243
  "paint_heatmap",
6112
6244
  "paint_fill-extrusion",
6245
+ "paint_building",
6113
6246
  "paint_symbol",
6114
6247
  "paint_raster",
6115
6248
  "paint_raster-particle",
@@ -6422,6 +6555,189 @@
6422
6555
  "property-type": "data-driven"
6423
6556
  }
6424
6557
  };
6558
+ var paint_building = {
6559
+ "building-opacity": {
6560
+ type: "number",
6561
+ "default": 1,
6562
+ minimum: 0,
6563
+ maximum: 1,
6564
+ 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.",
6565
+ transition: true,
6566
+ experimental: true,
6567
+ "private": true,
6568
+ "sdk-support": {
6569
+ "basic functionality": {
6570
+ }
6571
+ },
6572
+ expression: {
6573
+ interpolated: true,
6574
+ parameters: [
6575
+ "zoom"
6576
+ ]
6577
+ },
6578
+ "property-type": "data-constant"
6579
+ },
6580
+ "building-ambient-occlusion-wall-intensity": {
6581
+ "property-type": "data-constant",
6582
+ type: "number",
6583
+ "default": 0,
6584
+ minimum: 0,
6585
+ maximum: 1,
6586
+ experimental: true,
6587
+ "private": true,
6588
+ expression: {
6589
+ interpolated: true,
6590
+ parameters: [
6591
+ "zoom"
6592
+ ]
6593
+ },
6594
+ transition: true,
6595
+ doc: "Controls the intensity of shading concave angles between walls and building elements, such as facades and rooftop.",
6596
+ "sdk-support": {
6597
+ "basic functionality": {
6598
+ }
6599
+ }
6600
+ },
6601
+ "building-ambient-occlusion-ground-intensity": {
6602
+ "property-type": "data-constant",
6603
+ type: "number",
6604
+ "default": 0,
6605
+ minimum: 0,
6606
+ maximum: 1,
6607
+ experimental: true,
6608
+ "private": true,
6609
+ expression: {
6610
+ interpolated: true,
6611
+ parameters: [
6612
+ "zoom"
6613
+ ]
6614
+ },
6615
+ transition: true,
6616
+ doc: "Controls the intensity of shading near ground",
6617
+ "sdk-support": {
6618
+ "basic functionality": {
6619
+ }
6620
+ }
6621
+ },
6622
+ "building-ambient-occlusion-ground-radius": {
6623
+ "property-type": "data-constant",
6624
+ type: "number",
6625
+ experimental: true,
6626
+ "private": true,
6627
+ "default": 3,
6628
+ minimum: 0,
6629
+ expression: {
6630
+ interpolated: true,
6631
+ parameters: [
6632
+ "zoom"
6633
+ ]
6634
+ },
6635
+ transition: true,
6636
+ doc: "The extent of the ambient occlusion effect on the ground beneath the procedural buildings in meters.",
6637
+ "sdk-support": {
6638
+ "basic functionality": {
6639
+ }
6640
+ }
6641
+ },
6642
+ "building-ambient-occlusion-ground-attenuation": {
6643
+ "property-type": "data-constant",
6644
+ type: "number",
6645
+ experimental: true,
6646
+ "private": true,
6647
+ "default": 0.69,
6648
+ minimum: 0,
6649
+ maximum: 1,
6650
+ 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.",
6651
+ transition: true,
6652
+ expression: {
6653
+ interpolated: true,
6654
+ parameters: [
6655
+ "zoom"
6656
+ ]
6657
+ },
6658
+ "sdk-support": {
6659
+ "basic functionality": {
6660
+ }
6661
+ }
6662
+ },
6663
+ "building-vertical-scale": {
6664
+ "property-type": "data-constant",
6665
+ type: "number",
6666
+ experimental: true,
6667
+ "private": true,
6668
+ "default": 1,
6669
+ minimum: 0,
6670
+ doc: "A global multiplier that can be used to scale base and height of the procedural buildings.",
6671
+ transition: true,
6672
+ expression: {
6673
+ interpolated: true,
6674
+ parameters: [
6675
+ "zoom"
6676
+ ]
6677
+ },
6678
+ "sdk-support": {
6679
+ "basic functionality": {
6680
+ }
6681
+ }
6682
+ },
6683
+ "building-cast-shadows": {
6684
+ type: "boolean",
6685
+ "default": true,
6686
+ doc: "Enable/Disable shadow casting for this layer",
6687
+ transition: false,
6688
+ experimental: true,
6689
+ "private": true,
6690
+ "sdk-support": {
6691
+ "basic functionality": {
6692
+ }
6693
+ },
6694
+ "property-type": "data-constant"
6695
+ },
6696
+ "building-color": {
6697
+ type: "color",
6698
+ "default": "rgba(193, 154, 127, 1)",
6699
+ 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`.",
6700
+ experimental: true,
6701
+ "private": true,
6702
+ "sdk-support": {
6703
+ "basic functionality": {
6704
+ },
6705
+ "data-driven styling": {
6706
+ }
6707
+ },
6708
+ expression: {
6709
+ interpolated: true,
6710
+ parameters: [
6711
+ "feature",
6712
+ "feature-state"
6713
+ ]
6714
+ },
6715
+ "property-type": "data-driven"
6716
+ },
6717
+ "building-emissive-strength": {
6718
+ type: "number",
6719
+ "default": 0,
6720
+ minimum: 0,
6721
+ doc: "Controls the intensity of light emitted on the source features.",
6722
+ experimental: true,
6723
+ "private": true,
6724
+ "sdk-support": {
6725
+ "basic functionality": {
6726
+ },
6727
+ "data-driven styling": {
6728
+ }
6729
+ },
6730
+ expression: {
6731
+ interpolated: true,
6732
+ parameters: [
6733
+ "feature",
6734
+ "feature-state",
6735
+ "measure-light"
6736
+ ]
6737
+ },
6738
+ "property-type": "data-driven"
6739
+ }
6740
+ };
6425
6741
  var paint_line = {
6426
6742
  "line-opacity": {
6427
6743
  type: "number",
@@ -9652,6 +9968,7 @@
9652
9968
  "property-type": "constant"
9653
9969
  }
9654
9970
  },
9971
+ layout_building: layout_building,
9655
9972
  layout_line: layout_line,
9656
9973
  layout_symbol: layout_symbol,
9657
9974
  layout_raster: layout_raster,
@@ -9724,6 +10041,7 @@
9724
10041
  ]
9725
10042
  }
9726
10043
  },
10044
+ filter_building: filter_building,
9727
10045
  filter_heatmap: filter_heatmap,
9728
10046
  filter_operator: filter_operator,
9729
10047
  geometry_type: geometry_type,
@@ -10478,6 +10796,7 @@
10478
10796
  "property-type": "data-constant"
10479
10797
  }
10480
10798
  },
10799
+ paint_building: paint_building,
10481
10800
  paint_line: paint_line,
10482
10801
  paint_circle: paint_circle,
10483
10802
  paint_heatmap: paint_heatmap,
@@ -12148,11 +12467,15 @@
12148
12467
  return number(d, to[i], t);
12149
12468
  });
12150
12469
  }
12470
+ function easeIn(x) {
12471
+ return x * x * x * x * x;
12472
+ }
12151
12473
 
12152
12474
  var interpolate$1 = /*#__PURE__*/Object.freeze({
12153
12475
  __proto__: null,
12154
12476
  array: array,
12155
12477
  color: color,
12478
+ easeIn: easeIn,
12156
12479
  number: number
12157
12480
  });
12158
12481
 
@@ -12498,6 +12821,7 @@
12498
12821
  }
12499
12822
  }
12500
12823
 
12824
+ const separator = '\x1F';
12501
12825
  class ImageId {
12502
12826
  constructor(id) {
12503
12827
  if (typeof id === 'string') {
@@ -12511,30 +12835,20 @@
12511
12835
  return new ImageId(id);
12512
12836
  }
12513
12837
  static toString(id) {
12514
- return JSON.stringify({
12515
- name: id.name,
12516
- iconsetId: id.iconsetId
12517
- });
12838
+ return id.iconsetId ? `${ id.name }${ separator }${ id.iconsetId }` : id.name;
12518
12839
  }
12519
12840
  static parse(str) {
12520
- try {
12521
- const {name, iconsetId} = JSON.parse(str);
12522
- return new ImageId({
12523
- name,
12524
- iconsetId
12525
- });
12526
- } catch (e) {
12527
- return null;
12528
- }
12841
+ const [name, iconsetId] = str.split(separator);
12842
+ return new ImageId({
12843
+ name,
12844
+ iconsetId
12845
+ });
12529
12846
  }
12530
12847
  static isEqual(a, b) {
12531
12848
  return a.name === b.name && a.iconsetId === b.iconsetId;
12532
12849
  }
12533
12850
  toString() {
12534
- return JSON.stringify({
12535
- name: this.name,
12536
- iconsetId: this.iconsetId
12537
- });
12851
+ return ImageId.toString(this);
12538
12852
  }
12539
12853
  serialize() {
12540
12854
  return {
@@ -13149,16 +13463,7 @@
13149
13463
  for (const key in params) {
13150
13464
  if (params[key]) {
13151
13465
  try {
13152
- const color = params[key].evaluate(ctx);
13153
- const msg = `Ignoring image parameter "${ key }" with semi-transparent color ${ color.toString() }`;
13154
- if (color.a !== 1) {
13155
- if (!this._imageWarnHistory[msg]) {
13156
- console.warn(msg);
13157
- this._imageWarnHistory[msg] = true;
13158
- }
13159
- continue;
13160
- }
13161
- result[key] = color;
13466
+ result[key] = params[key].evaluate(ctx);
13162
13467
  } catch (err) {
13163
13468
  continue;
13164
13469
  }
@@ -13636,6 +13941,306 @@
13636
13941
  }
13637
13942
  }
13638
13943
 
13944
+ var pointGeometry;
13945
+ var hasRequiredPointGeometry;
13946
+
13947
+ function requirePointGeometry () {
13948
+ if (hasRequiredPointGeometry) return pointGeometry;
13949
+ hasRequiredPointGeometry = 1;
13950
+ pointGeometry = Point;
13951
+ /**
13952
+ * A standalone point geometry with useful accessor, comparison, and
13953
+ * modification methods.
13954
+ *
13955
+ * @class Point
13956
+ * @param {Number} x the x-coordinate. this could be longitude or screen
13957
+ * pixels, or any other sort of unit.
13958
+ * @param {Number} y the y-coordinate. this could be latitude or screen
13959
+ * pixels, or any other sort of unit.
13960
+ * @example
13961
+ * var point = new Point(-77, 38);
13962
+ */
13963
+ function Point(x, y) {
13964
+ this.x = x;
13965
+ this.y = y;
13966
+ }
13967
+ Point.prototype = {
13968
+ /**
13969
+ * Clone this point, returning a new point that can be modified
13970
+ * without affecting the old one.
13971
+ * @return {Point} the clone
13972
+ */
13973
+ clone: function () {
13974
+ return new Point(this.x, this.y);
13975
+ },
13976
+ /**
13977
+ * Add this point's x & y coordinates to another point,
13978
+ * yielding a new point.
13979
+ * @param {Point} p the other point
13980
+ * @return {Point} output point
13981
+ */
13982
+ add: function (p) {
13983
+ return this.clone()._add(p);
13984
+ },
13985
+ /**
13986
+ * Subtract this point's x & y coordinates to from point,
13987
+ * yielding a new point.
13988
+ * @param {Point} p the other point
13989
+ * @return {Point} output point
13990
+ */
13991
+ sub: function (p) {
13992
+ return this.clone()._sub(p);
13993
+ },
13994
+ /**
13995
+ * Multiply this point's x & y coordinates by point,
13996
+ * yielding a new point.
13997
+ * @param {Point} p the other point
13998
+ * @return {Point} output point
13999
+ */
14000
+ multByPoint: function (p) {
14001
+ return this.clone()._multByPoint(p);
14002
+ },
14003
+ /**
14004
+ * Divide this point's x & y coordinates by point,
14005
+ * yielding a new point.
14006
+ * @param {Point} p the other point
14007
+ * @return {Point} output point
14008
+ */
14009
+ divByPoint: function (p) {
14010
+ return this.clone()._divByPoint(p);
14011
+ },
14012
+ /**
14013
+ * Multiply this point's x & y coordinates by a factor,
14014
+ * yielding a new point.
14015
+ * @param {Point} k factor
14016
+ * @return {Point} output point
14017
+ */
14018
+ mult: function (k) {
14019
+ return this.clone()._mult(k);
14020
+ },
14021
+ /**
14022
+ * Divide this point's x & y coordinates by a factor,
14023
+ * yielding a new point.
14024
+ * @param {Point} k factor
14025
+ * @return {Point} output point
14026
+ */
14027
+ div: function (k) {
14028
+ return this.clone()._div(k);
14029
+ },
14030
+ /**
14031
+ * Rotate this point around the 0, 0 origin by an angle a,
14032
+ * given in radians
14033
+ * @param {Number} a angle to rotate around, in radians
14034
+ * @return {Point} output point
14035
+ */
14036
+ rotate: function (a) {
14037
+ return this.clone()._rotate(a);
14038
+ },
14039
+ /**
14040
+ * Rotate this point around p point by an angle a,
14041
+ * given in radians
14042
+ * @param {Number} a angle to rotate around, in radians
14043
+ * @param {Point} p Point to rotate around
14044
+ * @return {Point} output point
14045
+ */
14046
+ rotateAround: function (a, p) {
14047
+ return this.clone()._rotateAround(a, p);
14048
+ },
14049
+ /**
14050
+ * Multiply this point by a 4x1 transformation matrix
14051
+ * @param {Array<Number>} m transformation matrix
14052
+ * @return {Point} output point
14053
+ */
14054
+ matMult: function (m) {
14055
+ return this.clone()._matMult(m);
14056
+ },
14057
+ /**
14058
+ * Calculate this point but as a unit vector from 0, 0, meaning
14059
+ * that the distance from the resulting point to the 0, 0
14060
+ * coordinate will be equal to 1 and the angle from the resulting
14061
+ * point to the 0, 0 coordinate will be the same as before.
14062
+ * @return {Point} unit vector point
14063
+ */
14064
+ unit: function () {
14065
+ return this.clone()._unit();
14066
+ },
14067
+ /**
14068
+ * Compute a perpendicular point, where the new y coordinate
14069
+ * is the old x coordinate and the new x coordinate is the old y
14070
+ * coordinate multiplied by -1
14071
+ * @return {Point} perpendicular point
14072
+ */
14073
+ perp: function () {
14074
+ return this.clone()._perp();
14075
+ },
14076
+ /**
14077
+ * Return a version of this point with the x & y coordinates
14078
+ * rounded to integers.
14079
+ * @return {Point} rounded point
14080
+ */
14081
+ round: function () {
14082
+ return this.clone()._round();
14083
+ },
14084
+ /**
14085
+ * Return the magitude of this point: this is the Euclidean
14086
+ * distance from the 0, 0 coordinate to this point's x and y
14087
+ * coordinates.
14088
+ * @return {Number} magnitude
14089
+ */
14090
+ mag: function () {
14091
+ return Math.sqrt(this.x * this.x + this.y * this.y);
14092
+ },
14093
+ /**
14094
+ * Judge whether this point is equal to another point, returning
14095
+ * true or false.
14096
+ * @param {Point} other the other point
14097
+ * @return {boolean} whether the points are equal
14098
+ */
14099
+ equals: function (other) {
14100
+ return this.x === other.x && this.y === other.y;
14101
+ },
14102
+ /**
14103
+ * Calculate the distance from this point to another point
14104
+ * @param {Point} p the other point
14105
+ * @return {Number} distance
14106
+ */
14107
+ dist: function (p) {
14108
+ return Math.sqrt(this.distSqr(p));
14109
+ },
14110
+ /**
14111
+ * Calculate the distance from this point to another point,
14112
+ * without the square root step. Useful if you're comparing
14113
+ * relative distances.
14114
+ * @param {Point} p the other point
14115
+ * @return {Number} distance
14116
+ */
14117
+ distSqr: function (p) {
14118
+ var dx = p.x - this.x, dy = p.y - this.y;
14119
+ return dx * dx + dy * dy;
14120
+ },
14121
+ /**
14122
+ * Get the angle from the 0, 0 coordinate to this point, in radians
14123
+ * coordinates.
14124
+ * @return {Number} angle
14125
+ */
14126
+ angle: function () {
14127
+ return Math.atan2(this.y, this.x);
14128
+ },
14129
+ /**
14130
+ * Get the angle from this point to another point, in radians
14131
+ * @param {Point} b the other point
14132
+ * @return {Number} angle
14133
+ */
14134
+ angleTo: function (b) {
14135
+ return Math.atan2(this.y - b.y, this.x - b.x);
14136
+ },
14137
+ /**
14138
+ * Get the angle between this point and another point, in radians
14139
+ * @param {Point} b the other point
14140
+ * @return {Number} angle
14141
+ */
14142
+ angleWith: function (b) {
14143
+ return this.angleWithSep(b.x, b.y);
14144
+ },
14145
+ /*
14146
+ * Find the angle of the two vectors, solving the formula for
14147
+ * the cross product a x b = |a||b|sin(θ) for θ.
14148
+ * @param {Number} x the x-coordinate
14149
+ * @param {Number} y the y-coordinate
14150
+ * @return {Number} the angle in radians
14151
+ */
14152
+ angleWithSep: function (x, y) {
14153
+ return Math.atan2(this.x * y - this.y * x, this.x * x + this.y * y);
14154
+ },
14155
+ _matMult: function (m) {
14156
+ var x = m[0] * this.x + m[1] * this.y, y = m[2] * this.x + m[3] * this.y;
14157
+ this.x = x;
14158
+ this.y = y;
14159
+ return this;
14160
+ },
14161
+ _add: function (p) {
14162
+ this.x += p.x;
14163
+ this.y += p.y;
14164
+ return this;
14165
+ },
14166
+ _sub: function (p) {
14167
+ this.x -= p.x;
14168
+ this.y -= p.y;
14169
+ return this;
14170
+ },
14171
+ _mult: function (k) {
14172
+ this.x *= k;
14173
+ this.y *= k;
14174
+ return this;
14175
+ },
14176
+ _div: function (k) {
14177
+ this.x /= k;
14178
+ this.y /= k;
14179
+ return this;
14180
+ },
14181
+ _multByPoint: function (p) {
14182
+ this.x *= p.x;
14183
+ this.y *= p.y;
14184
+ return this;
14185
+ },
14186
+ _divByPoint: function (p) {
14187
+ this.x /= p.x;
14188
+ this.y /= p.y;
14189
+ return this;
14190
+ },
14191
+ _unit: function () {
14192
+ this._div(this.mag());
14193
+ return this;
14194
+ },
14195
+ _perp: function () {
14196
+ var y = this.y;
14197
+ this.y = this.x;
14198
+ this.x = -y;
14199
+ return this;
14200
+ },
14201
+ _rotate: function (angle) {
14202
+ var cos = Math.cos(angle), sin = Math.sin(angle), x = cos * this.x - sin * this.y, y = sin * this.x + cos * this.y;
14203
+ this.x = x;
14204
+ this.y = y;
14205
+ return this;
14206
+ },
14207
+ _rotateAround: function (angle, p) {
14208
+ 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);
14209
+ this.x = x;
14210
+ this.y = y;
14211
+ return this;
14212
+ },
14213
+ _round: function () {
14214
+ this.x = Math.round(this.x);
14215
+ this.y = Math.round(this.y);
14216
+ return this;
14217
+ }
14218
+ };
14219
+ /**
14220
+ * Construct a point from an array if necessary, otherwise if the input
14221
+ * is already a Point, or an unknown type, return it unchanged
14222
+ * @param {Array<Number>|Point|*} a any kind of input value
14223
+ * @return {Point} constructed point, or passed-through value.
14224
+ * @example
14225
+ * // this
14226
+ * var point = Point.convert([0, 1]);
14227
+ * // is equivalent to
14228
+ * var point = new Point(0, 1);
14229
+ */
14230
+ Point.convert = function (a) {
14231
+ if (a instanceof Point) {
14232
+ return a;
14233
+ }
14234
+ if (Array.isArray(a)) {
14235
+ return new Point(a[0], a[1]);
14236
+ }
14237
+ return a;
14238
+ };
14239
+ return pointGeometry;
14240
+ }
14241
+
14242
+ requirePointGeometry();
14243
+
13639
14244
  function calculateSignedArea(ring) {
13640
14245
  let sum = 0;
13641
14246
  for (let i = 0, len = ring.length, j = len - 1, p1, p2; i < len; j = i++) {
@@ -19056,7 +19661,15 @@ ${ JSON.stringify(filterExp, null, 2) }
19056
19661
  /**
19057
19662
  * { command: 'updateImport', args: [importId, importSpecification | styleUrl] }
19058
19663
  */
19059
- updateImport: 'updateImport'
19664
+ updateImport: 'updateImport',
19665
+ /*
19666
+ * { command: 'addIconset', args: [iconsetId, IconsetSpecification] }
19667
+ */
19668
+ addIconset: 'addIconset',
19669
+ /*
19670
+ * { command: 'removeIconset', args: [iconsetId] }
19671
+ */
19672
+ removeIconset: 'removeIconset'
19060
19673
  };
19061
19674
  function addSource(sourceId, after, commands) {
19062
19675
  commands.push({
@@ -19363,6 +19976,47 @@ ${ JSON.stringify(filterExp, null, 2) }
19363
19976
  });
19364
19977
  }
19365
19978
  }
19979
+ function diffIconsets(before, after, commands) {
19980
+ before = before || {};
19981
+ after = after || {};
19982
+ let iconsetId;
19983
+ for (iconsetId in before) {
19984
+ if (!before.hasOwnProperty(iconsetId))
19985
+ continue;
19986
+ if (!after.hasOwnProperty(iconsetId)) {
19987
+ commands.push({
19988
+ command: operations.removeIconset,
19989
+ args: [iconsetId]
19990
+ });
19991
+ }
19992
+ }
19993
+ for (iconsetId in after) {
19994
+ if (!after.hasOwnProperty(iconsetId))
19995
+ continue;
19996
+ const iconset = after[iconsetId];
19997
+ if (!before.hasOwnProperty(iconsetId)) {
19998
+ commands.push({
19999
+ command: operations.addIconset,
20000
+ args: [
20001
+ iconsetId,
20002
+ iconset
20003
+ ]
20004
+ });
20005
+ } else if (!deepEqual(before[iconsetId], iconset)) {
20006
+ commands.push({
20007
+ command: operations.removeIconset,
20008
+ args: [iconsetId]
20009
+ });
20010
+ commands.push({
20011
+ command: operations.addIconset,
20012
+ args: [
20013
+ iconsetId,
20014
+ iconset
20015
+ ]
20016
+ });
20017
+ }
20018
+ }
20019
+ }
19366
20020
  function diffStyles(before, after) {
19367
20021
  if (!before)
19368
20022
  return [{
@@ -19464,6 +20118,9 @@ ${ JSON.stringify(filterExp, null, 2) }
19464
20118
  args: [after.camera]
19465
20119
  });
19466
20120
  }
20121
+ if (!deepEqual(before.iconsets, after.iconsets)) {
20122
+ diffIconsets(before.iconsets, after.iconsets, commands);
20123
+ }
19467
20124
  if (!deepEqual(before['color-theme'], after['color-theme'])) {
19468
20125
  return [{
19469
20126
  command: operations.setStyle,
@@ -20217,8 +20874,8 @@ Use an identity property function instead: ${ example }.`)];
20217
20874
  'raster-particle'
20218
20875
  ].includes(type)) {
20219
20876
  errors.push(new ValidationError(key, layer.source, `raster-array source can only be used with layer type 'raster'.`));
20220
- } else if (type === 'line' && layer.paint && (layer.paint['line-gradient'] || layer.paint['line-trim-offset']) && (sourceType !== 'geojson' || !source.lineMetrics)) {
20221
- errors.push(new ValidationError(key, layer, `layer "${ layer.id }" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`));
20877
+ } else if (type === 'line' && layer.paint && (layer.paint['line-gradient'] || layer.paint['line-trim-offset']) && (sourceType === 'geojson' && !source.lineMetrics)) {
20878
+ errors.push(new ValidationError(key, layer, `layer "${ layer.id }" specifies a line-gradient, which requires the GeoJSON source to have \`lineMetrics\` enabled.`));
20222
20879
  } else if (type === 'raster-particle' && sourceType !== 'raster-array') {
20223
20880
  errors.push(new ValidationError(key, layer.source, `layer "${ layer.id }" requires a 'raster-array' source.`));
20224
20881
  }