@mapbox/mapbox-gl-style-spec 14.11.0 → 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.
- package/diff.ts +47 -11
- package/dist/index.cjs +673 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +184 -10
- package/dist/index.es.js +673 -3
- package/dist/index.es.js.map +1 -1
- package/expression/compound_expression.ts +1 -1
- package/expression/definitions/coalesce.ts +2 -2
- package/expression/definitions/config.ts +1 -1
- package/expression/definitions/index.ts +3 -2
- package/expression/definitions/interpolate.ts +2 -2
- package/expression/definitions/match.ts +1 -1
- package/expression/definitions/step.ts +1 -1
- package/expression/evaluation_context.ts +3 -5
- package/expression/index.ts +4 -8
- package/expression/parsing_context.ts +1 -1
- package/expression/values.ts +1 -3
- package/feature_filter/index.ts +1 -1
- package/migrate/expressions.ts +1 -1
- package/migrate/v8.ts +1 -1
- package/migrate/v9.ts +1 -1
- package/migrate.ts +1 -1
- package/package.json +1 -1
- package/reference/v8.json +312 -0
- package/test.js +2 -4
- package/types.ts +195 -0
- package/util/extend.ts +1 -1
- package/util/geometry_util.ts +19 -2
- package/util/interpolate.ts +1 -1
- package/validate/validate_fog.ts +1 -1
- package/validate/validate_glyphs_url.ts +1 -1
- package/validate/validate_layer.ts +2 -2
- package/validate/validate_light.ts +1 -1
- package/validate/validate_lights.ts +1 -1
- package/validate/validate_property.ts +1 -1
- package/validate/validate_source.ts +2 -4
- package/validate/validate_terrain.ts +1 -1
- package/validate_mapbox_api_supported.ts +1 -1
- package/visit.ts +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1327,6 +1327,13 @@
|
|
|
1327
1327
|
}
|
|
1328
1328
|
}
|
|
1329
1329
|
},
|
|
1330
|
+
building: {
|
|
1331
|
+
doc: "A procedural 3D building.",
|
|
1332
|
+
"sdk-support": {
|
|
1333
|
+
},
|
|
1334
|
+
experimental: true,
|
|
1335
|
+
"private": true
|
|
1336
|
+
},
|
|
1330
1337
|
raster: {
|
|
1331
1338
|
doc: "Raster map textures such as satellite imagery.",
|
|
1332
1339
|
"sdk-support": {
|
|
@@ -1468,6 +1475,7 @@
|
|
|
1468
1475
|
"layout_circle",
|
|
1469
1476
|
"layout_heatmap",
|
|
1470
1477
|
"layout_fill-extrusion",
|
|
1478
|
+
"layout_building",
|
|
1471
1479
|
"layout_symbol",
|
|
1472
1480
|
"layout_raster",
|
|
1473
1481
|
"layout_raster-particle",
|
|
@@ -1865,6 +1873,115 @@
|
|
|
1865
1873
|
"property-type": "constant"
|
|
1866
1874
|
}
|
|
1867
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
|
+
};
|
|
1868
1985
|
var layout_line = {
|
|
1869
1986
|
"line-cap": {
|
|
1870
1987
|
type: "enum",
|
|
@@ -3806,6 +3923,20 @@
|
|
|
3806
3923
|
]
|
|
3807
3924
|
}
|
|
3808
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
|
+
};
|
|
3809
3940
|
var filter_heatmap = {
|
|
3810
3941
|
type: "boolean",
|
|
3811
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.",
|
|
@@ -6111,6 +6242,7 @@
|
|
|
6111
6242
|
"paint_circle",
|
|
6112
6243
|
"paint_heatmap",
|
|
6113
6244
|
"paint_fill-extrusion",
|
|
6245
|
+
"paint_building",
|
|
6114
6246
|
"paint_symbol",
|
|
6115
6247
|
"paint_raster",
|
|
6116
6248
|
"paint_raster-particle",
|
|
@@ -6423,6 +6555,189 @@
|
|
|
6423
6555
|
"property-type": "data-driven"
|
|
6424
6556
|
}
|
|
6425
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
|
+
};
|
|
6426
6741
|
var paint_line = {
|
|
6427
6742
|
"line-opacity": {
|
|
6428
6743
|
type: "number",
|
|
@@ -9653,6 +9968,7 @@
|
|
|
9653
9968
|
"property-type": "constant"
|
|
9654
9969
|
}
|
|
9655
9970
|
},
|
|
9971
|
+
layout_building: layout_building,
|
|
9656
9972
|
layout_line: layout_line,
|
|
9657
9973
|
layout_symbol: layout_symbol,
|
|
9658
9974
|
layout_raster: layout_raster,
|
|
@@ -9725,6 +10041,7 @@
|
|
|
9725
10041
|
]
|
|
9726
10042
|
}
|
|
9727
10043
|
},
|
|
10044
|
+
filter_building: filter_building,
|
|
9728
10045
|
filter_heatmap: filter_heatmap,
|
|
9729
10046
|
filter_operator: filter_operator,
|
|
9730
10047
|
geometry_type: geometry_type,
|
|
@@ -10479,6 +10796,7 @@
|
|
|
10479
10796
|
"property-type": "data-constant"
|
|
10480
10797
|
}
|
|
10481
10798
|
},
|
|
10799
|
+
paint_building: paint_building,
|
|
10482
10800
|
paint_line: paint_line,
|
|
10483
10801
|
paint_circle: paint_circle,
|
|
10484
10802
|
paint_heatmap: paint_heatmap,
|
|
@@ -13623,6 +13941,306 @@
|
|
|
13623
13941
|
}
|
|
13624
13942
|
}
|
|
13625
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
|
+
|
|
13626
14244
|
function calculateSignedArea(ring) {
|
|
13627
14245
|
let sum = 0;
|
|
13628
14246
|
for (let i = 0, len = ring.length, j = len - 1, p1, p2; i < len; j = i++) {
|
|
@@ -19043,7 +19661,15 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
19043
19661
|
/**
|
|
19044
19662
|
* { command: 'updateImport', args: [importId, importSpecification | styleUrl] }
|
|
19045
19663
|
*/
|
|
19046
|
-
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'
|
|
19047
19673
|
};
|
|
19048
19674
|
function addSource(sourceId, after, commands) {
|
|
19049
19675
|
commands.push({
|
|
@@ -19350,6 +19976,47 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
19350
19976
|
});
|
|
19351
19977
|
}
|
|
19352
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
|
+
}
|
|
19353
20020
|
function diffStyles(before, after) {
|
|
19354
20021
|
if (!before)
|
|
19355
20022
|
return [{
|
|
@@ -19451,6 +20118,9 @@ ${ JSON.stringify(filterExp, null, 2) }
|
|
|
19451
20118
|
args: [after.camera]
|
|
19452
20119
|
});
|
|
19453
20120
|
}
|
|
20121
|
+
if (!deepEqual(before.iconsets, after.iconsets)) {
|
|
20122
|
+
diffIconsets(before.iconsets, after.iconsets, commands);
|
|
20123
|
+
}
|
|
19454
20124
|
if (!deepEqual(before['color-theme'], after['color-theme'])) {
|
|
19455
20125
|
return [{
|
|
19456
20126
|
command: operations.setStyle,
|
|
@@ -20204,8 +20874,8 @@ Use an identity property function instead: ${ example }.`)];
|
|
|
20204
20874
|
'raster-particle'
|
|
20205
20875
|
].includes(type)) {
|
|
20206
20876
|
errors.push(new ValidationError(key, layer.source, `raster-array source can only be used with layer type 'raster'.`));
|
|
20207
|
-
} else if (type === 'line' && layer.paint && (layer.paint['line-gradient'] || layer.paint['line-trim-offset']) && (sourceType
|
|
20208
|
-
errors.push(new ValidationError(key, layer, `layer "${ layer.id }" specifies a line-gradient, which requires
|
|
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.`));
|
|
20209
20879
|
} else if (type === 'raster-particle' && sourceType !== 'raster-array') {
|
|
20210
20880
|
errors.push(new ValidationError(key, layer.source, `layer "${ layer.id }" requires a 'raster-array' source.`));
|
|
20211
20881
|
}
|