@mapbox/mapbox-gl-style-spec 14.13.0 → 14.14.0-alpha.a4a566d51
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/dist/index.cjs +487 -305
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +26 -2
- package/dist/index.es.js +487 -305
- package/dist/index.es.js.map +1 -1
- package/expression/definitions/index.ts +3 -1
- package/expression/definitions/split.ts +56 -0
- package/package.json +2 -2
- package/reference/v8.json +136 -6
- package/types.ts +24 -3
package/dist/index.es.js
CHANGED
|
@@ -1939,6 +1939,79 @@ var layout_building = {
|
|
|
1939
1939
|
},
|
|
1940
1940
|
"property-type": "constant"
|
|
1941
1941
|
},
|
|
1942
|
+
"building-facade": {
|
|
1943
|
+
type: "boolean",
|
|
1944
|
+
"default": false,
|
|
1945
|
+
doc: "Whether to render facade details on the buildings.",
|
|
1946
|
+
experimental: true,
|
|
1947
|
+
"private": true,
|
|
1948
|
+
"sdk-support": {
|
|
1949
|
+
"basic functionality": {
|
|
1950
|
+
},
|
|
1951
|
+
"data-driven styling": {
|
|
1952
|
+
}
|
|
1953
|
+
},
|
|
1954
|
+
expression: {
|
|
1955
|
+
interpolated: false,
|
|
1956
|
+
parameters: [
|
|
1957
|
+
"feature"
|
|
1958
|
+
]
|
|
1959
|
+
},
|
|
1960
|
+
"property-type": "data-driven"
|
|
1961
|
+
},
|
|
1962
|
+
"building-facade-floors": {
|
|
1963
|
+
type: "number",
|
|
1964
|
+
minimum: 1,
|
|
1965
|
+
maximum: 200,
|
|
1966
|
+
"default": 3,
|
|
1967
|
+
doc: "Number of floors created when building-facade is enabled.",
|
|
1968
|
+
experimental: true,
|
|
1969
|
+
"property-type": "data-driven",
|
|
1970
|
+
"sdk-support": {
|
|
1971
|
+
"basic functionality": {
|
|
1972
|
+
},
|
|
1973
|
+
"data-driven styling": {
|
|
1974
|
+
}
|
|
1975
|
+
},
|
|
1976
|
+
expression: {
|
|
1977
|
+
interpolated: false,
|
|
1978
|
+
parameters: [
|
|
1979
|
+
"feature"
|
|
1980
|
+
]
|
|
1981
|
+
},
|
|
1982
|
+
requires: [
|
|
1983
|
+
"building-facade"
|
|
1984
|
+
]
|
|
1985
|
+
},
|
|
1986
|
+
"building-facade-window": {
|
|
1987
|
+
type: "array",
|
|
1988
|
+
length: 2,
|
|
1989
|
+
value: "number",
|
|
1990
|
+
minimum: 0.1,
|
|
1991
|
+
maximum: 1,
|
|
1992
|
+
"default": [
|
|
1993
|
+
0.9,
|
|
1994
|
+
0.9
|
|
1995
|
+
],
|
|
1996
|
+
doc: "Given as fractions, specifies the percentage of floor area covered by windows when building-facade is enabled",
|
|
1997
|
+
experimental: true,
|
|
1998
|
+
"property-type": "data-driven",
|
|
1999
|
+
"sdk-support": {
|
|
2000
|
+
"basic functionality": {
|
|
2001
|
+
},
|
|
2002
|
+
"data-driven styling": {
|
|
2003
|
+
}
|
|
2004
|
+
},
|
|
2005
|
+
expression: {
|
|
2006
|
+
interpolated: false,
|
|
2007
|
+
parameters: [
|
|
2008
|
+
"feature"
|
|
2009
|
+
]
|
|
2010
|
+
},
|
|
2011
|
+
requires: [
|
|
2012
|
+
"building-facade"
|
|
2013
|
+
]
|
|
2014
|
+
},
|
|
1942
2015
|
"building-roof-shape": {
|
|
1943
2016
|
type: "enum",
|
|
1944
2017
|
values: {
|
|
@@ -4186,6 +4259,17 @@ var expression_name = {
|
|
|
4186
4259
|
}
|
|
4187
4260
|
}
|
|
4188
4261
|
},
|
|
4262
|
+
split: {
|
|
4263
|
+
doc: "Returns an array of substrings from a string, split by a delimiter parameter.",
|
|
4264
|
+
group: "Lookup",
|
|
4265
|
+
"sdk-support": {
|
|
4266
|
+
"basic functionality": {
|
|
4267
|
+
js: "3.14.0",
|
|
4268
|
+
android: "11.14.0",
|
|
4269
|
+
ios: "11.14.0"
|
|
4270
|
+
}
|
|
4271
|
+
}
|
|
4272
|
+
},
|
|
4189
4273
|
"case": {
|
|
4190
4274
|
doc: "Selects the first output whose corresponding test condition evaluates to true, or the fallback value otherwise.",
|
|
4191
4275
|
group: "Decision",
|
|
@@ -6674,7 +6758,7 @@ var paint_building = {
|
|
|
6674
6758
|
},
|
|
6675
6759
|
"property-type": "data-constant"
|
|
6676
6760
|
},
|
|
6677
|
-
"building-ambient-occlusion-
|
|
6761
|
+
"building-ambient-occlusion-intensity": {
|
|
6678
6762
|
"property-type": "data-constant",
|
|
6679
6763
|
type: "number",
|
|
6680
6764
|
"default": 0,
|
|
@@ -6683,13 +6767,12 @@ var paint_building = {
|
|
|
6683
6767
|
experimental: true,
|
|
6684
6768
|
"private": true,
|
|
6685
6769
|
expression: {
|
|
6686
|
-
interpolated:
|
|
6770
|
+
interpolated: false,
|
|
6687
6771
|
parameters: [
|
|
6688
|
-
"zoom"
|
|
6689
6772
|
]
|
|
6690
6773
|
},
|
|
6691
6774
|
transition: true,
|
|
6692
|
-
doc: "Controls the intensity of shading concave angles between walls and
|
|
6775
|
+
doc: "Controls the intensity of ambinet occlusion when shading concave angles between walls and roof crevices.",
|
|
6693
6776
|
"sdk-support": {
|
|
6694
6777
|
"basic functionality": {
|
|
6695
6778
|
}
|
|
@@ -6808,7 +6891,8 @@ var paint_building = {
|
|
|
6808
6891
|
interpolated: true,
|
|
6809
6892
|
parameters: [
|
|
6810
6893
|
"feature",
|
|
6811
|
-
"feature-state"
|
|
6894
|
+
"feature-state",
|
|
6895
|
+
"measure-light"
|
|
6812
6896
|
]
|
|
6813
6897
|
},
|
|
6814
6898
|
"property-type": "data-driven"
|
|
@@ -6817,7 +6901,9 @@ var paint_building = {
|
|
|
6817
6901
|
type: "number",
|
|
6818
6902
|
"default": 0,
|
|
6819
6903
|
minimum: 0,
|
|
6820
|
-
|
|
6904
|
+
maximum: 5,
|
|
6905
|
+
units: "intensity",
|
|
6906
|
+
doc: "Controls the intensity of light emitted on the source features. There is no emission for value 0. For value 1.0, only emissive component (no shading) is displayed and values above 1.0 produce light contribution to surrounding area, for some of the parts (e.g. doors).",
|
|
6821
6907
|
experimental: true,
|
|
6822
6908
|
"private": true,
|
|
6823
6909
|
"sdk-support": {
|
|
@@ -6835,6 +6921,60 @@ var paint_building = {
|
|
|
6835
6921
|
]
|
|
6836
6922
|
},
|
|
6837
6923
|
"property-type": "data-driven"
|
|
6924
|
+
},
|
|
6925
|
+
"building-facade-emissive-chance": {
|
|
6926
|
+
type: "number",
|
|
6927
|
+
"default": 0.35,
|
|
6928
|
+
minimum: 0,
|
|
6929
|
+
maximum: 1,
|
|
6930
|
+
doc: "Given as a fraction specifies the likelihood for the facades to be emissive when building-facade is enabled. A value of 0.0 means the window will never be emissive, while a value of 1.0 means the window will always be emissive. This can be used to create variations on a building where some windows are lit and some are not.",
|
|
6931
|
+
experimental: true,
|
|
6932
|
+
"property-type": "data-constant",
|
|
6933
|
+
"sdk-support": {
|
|
6934
|
+
"basic functionality": {
|
|
6935
|
+
}
|
|
6936
|
+
},
|
|
6937
|
+
expression: {
|
|
6938
|
+
interpolated: true,
|
|
6939
|
+
parameters: [
|
|
6940
|
+
"measure-light",
|
|
6941
|
+
"zoom"
|
|
6942
|
+
]
|
|
6943
|
+
}
|
|
6944
|
+
},
|
|
6945
|
+
"building-ambient-occlusion-window-intensity": {
|
|
6946
|
+
type: "number",
|
|
6947
|
+
"default": 0,
|
|
6948
|
+
minimum: 0,
|
|
6949
|
+
maximum: 1,
|
|
6950
|
+
doc: "Controls the intensity of ambient occlusion applied to the windows of the buildings. A value of 0.0 means no ambient occlusion is applied, while a value of 1.0 means full ambient occlusion is applied.",
|
|
6951
|
+
experimental: true,
|
|
6952
|
+
"property-type": "data-constant",
|
|
6953
|
+
"sdk-support": {
|
|
6954
|
+
"basic functionality": {
|
|
6955
|
+
}
|
|
6956
|
+
},
|
|
6957
|
+
expression: {
|
|
6958
|
+
interpolated: false,
|
|
6959
|
+
parameters: [
|
|
6960
|
+
]
|
|
6961
|
+
}
|
|
6962
|
+
},
|
|
6963
|
+
"building-cutoff-fade-range": {
|
|
6964
|
+
type: "number",
|
|
6965
|
+
"default": 0,
|
|
6966
|
+
minimum: 0,
|
|
6967
|
+
maximum: 1,
|
|
6968
|
+
doc: "This parameter defines the range for the fade-out effect before an automatic content cutoff on pitched map views. Fade out is implemented by scaling down and removing buildings in the fade range in a staggered fashion. Opacity is not changed. The fade range is expressed in relation to the height of the map view. A value of 1.0 indicates that the content is faded to the same extent as the map's height in pixels, while a value close to zero represents a sharp cutoff. When the value is set to 0.0, the cutoff is completely disabled. Note: The property has no effect on the map if terrain is enabled.",
|
|
6969
|
+
transition: false,
|
|
6970
|
+
expression: {
|
|
6971
|
+
interpolated: false
|
|
6972
|
+
},
|
|
6973
|
+
"sdk-support": {
|
|
6974
|
+
"basic functionality": {
|
|
6975
|
+
}
|
|
6976
|
+
},
|
|
6977
|
+
"property-type": "data-constant"
|
|
6838
6978
|
}
|
|
6839
6979
|
};
|
|
6840
6980
|
var paint_line = {
|
|
@@ -14105,305 +14245,309 @@ class CollatorExpression {
|
|
|
14105
14245
|
}
|
|
14106
14246
|
}
|
|
14107
14247
|
|
|
14108
|
-
|
|
14109
|
-
|
|
14110
|
-
|
|
14111
|
-
|
|
14112
|
-
|
|
14113
|
-
|
|
14114
|
-
|
|
14115
|
-
|
|
14116
|
-
|
|
14117
|
-
|
|
14118
|
-
|
|
14119
|
-
|
|
14120
|
-
|
|
14121
|
-
|
|
14122
|
-
* @param {Number} y the y-coordinate. this could be latitude or screen
|
|
14123
|
-
* pixels, or any other sort of unit.
|
|
14124
|
-
* @example
|
|
14125
|
-
* var point = new Point(-77, 38);
|
|
14126
|
-
*/
|
|
14127
|
-
function Point(x, y) {
|
|
14128
|
-
this.x = x;
|
|
14129
|
-
this.y = y;
|
|
14130
|
-
}
|
|
14131
|
-
Point.prototype = {
|
|
14132
|
-
/**
|
|
14133
|
-
* Clone this point, returning a new point that can be modified
|
|
14134
|
-
* without affecting the old one.
|
|
14135
|
-
* @return {Point} the clone
|
|
14136
|
-
*/
|
|
14137
|
-
clone: function () {
|
|
14138
|
-
return new Point(this.x, this.y);
|
|
14139
|
-
},
|
|
14140
|
-
/**
|
|
14141
|
-
* Add this point's x & y coordinates to another point,
|
|
14142
|
-
* yielding a new point.
|
|
14143
|
-
* @param {Point} p the other point
|
|
14144
|
-
* @return {Point} output point
|
|
14145
|
-
*/
|
|
14146
|
-
add: function (p) {
|
|
14147
|
-
return this.clone()._add(p);
|
|
14148
|
-
},
|
|
14149
|
-
/**
|
|
14150
|
-
* Subtract this point's x & y coordinates to from point,
|
|
14151
|
-
* yielding a new point.
|
|
14152
|
-
* @param {Point} p the other point
|
|
14153
|
-
* @return {Point} output point
|
|
14154
|
-
*/
|
|
14155
|
-
sub: function (p) {
|
|
14156
|
-
return this.clone()._sub(p);
|
|
14157
|
-
},
|
|
14158
|
-
/**
|
|
14159
|
-
* Multiply this point's x & y coordinates by point,
|
|
14160
|
-
* yielding a new point.
|
|
14161
|
-
* @param {Point} p the other point
|
|
14162
|
-
* @return {Point} output point
|
|
14163
|
-
*/
|
|
14164
|
-
multByPoint: function (p) {
|
|
14165
|
-
return this.clone()._multByPoint(p);
|
|
14166
|
-
},
|
|
14167
|
-
/**
|
|
14168
|
-
* Divide this point's x & y coordinates by point,
|
|
14169
|
-
* yielding a new point.
|
|
14170
|
-
* @param {Point} p the other point
|
|
14171
|
-
* @return {Point} output point
|
|
14172
|
-
*/
|
|
14173
|
-
divByPoint: function (p) {
|
|
14174
|
-
return this.clone()._divByPoint(p);
|
|
14175
|
-
},
|
|
14176
|
-
/**
|
|
14177
|
-
* Multiply this point's x & y coordinates by a factor,
|
|
14178
|
-
* yielding a new point.
|
|
14179
|
-
* @param {Point} k factor
|
|
14180
|
-
* @return {Point} output point
|
|
14181
|
-
*/
|
|
14182
|
-
mult: function (k) {
|
|
14183
|
-
return this.clone()._mult(k);
|
|
14184
|
-
},
|
|
14185
|
-
/**
|
|
14186
|
-
* Divide this point's x & y coordinates by a factor,
|
|
14187
|
-
* yielding a new point.
|
|
14188
|
-
* @param {Point} k factor
|
|
14189
|
-
* @return {Point} output point
|
|
14190
|
-
*/
|
|
14191
|
-
div: function (k) {
|
|
14192
|
-
return this.clone()._div(k);
|
|
14193
|
-
},
|
|
14194
|
-
/**
|
|
14195
|
-
* Rotate this point around the 0, 0 origin by an angle a,
|
|
14196
|
-
* given in radians
|
|
14197
|
-
* @param {Number} a angle to rotate around, in radians
|
|
14198
|
-
* @return {Point} output point
|
|
14199
|
-
*/
|
|
14200
|
-
rotate: function (a) {
|
|
14201
|
-
return this.clone()._rotate(a);
|
|
14202
|
-
},
|
|
14203
|
-
/**
|
|
14204
|
-
* Rotate this point around p point by an angle a,
|
|
14205
|
-
* given in radians
|
|
14206
|
-
* @param {Number} a angle to rotate around, in radians
|
|
14207
|
-
* @param {Point} p Point to rotate around
|
|
14208
|
-
* @return {Point} output point
|
|
14209
|
-
*/
|
|
14210
|
-
rotateAround: function (a, p) {
|
|
14211
|
-
return this.clone()._rotateAround(a, p);
|
|
14212
|
-
},
|
|
14213
|
-
/**
|
|
14214
|
-
* Multiply this point by a 4x1 transformation matrix
|
|
14215
|
-
* @param {Array<Number>} m transformation matrix
|
|
14216
|
-
* @return {Point} output point
|
|
14217
|
-
*/
|
|
14218
|
-
matMult: function (m) {
|
|
14219
|
-
return this.clone()._matMult(m);
|
|
14220
|
-
},
|
|
14221
|
-
/**
|
|
14222
|
-
* Calculate this point but as a unit vector from 0, 0, meaning
|
|
14223
|
-
* that the distance from the resulting point to the 0, 0
|
|
14224
|
-
* coordinate will be equal to 1 and the angle from the resulting
|
|
14225
|
-
* point to the 0, 0 coordinate will be the same as before.
|
|
14226
|
-
* @return {Point} unit vector point
|
|
14227
|
-
*/
|
|
14228
|
-
unit: function () {
|
|
14229
|
-
return this.clone()._unit();
|
|
14230
|
-
},
|
|
14231
|
-
/**
|
|
14232
|
-
* Compute a perpendicular point, where the new y coordinate
|
|
14233
|
-
* is the old x coordinate and the new x coordinate is the old y
|
|
14234
|
-
* coordinate multiplied by -1
|
|
14235
|
-
* @return {Point} perpendicular point
|
|
14236
|
-
*/
|
|
14237
|
-
perp: function () {
|
|
14238
|
-
return this.clone()._perp();
|
|
14239
|
-
},
|
|
14240
|
-
/**
|
|
14241
|
-
* Return a version of this point with the x & y coordinates
|
|
14242
|
-
* rounded to integers.
|
|
14243
|
-
* @return {Point} rounded point
|
|
14244
|
-
*/
|
|
14245
|
-
round: function () {
|
|
14246
|
-
return this.clone()._round();
|
|
14247
|
-
},
|
|
14248
|
-
/**
|
|
14249
|
-
* Return the magitude of this point: this is the Euclidean
|
|
14250
|
-
* distance from the 0, 0 coordinate to this point's x and y
|
|
14251
|
-
* coordinates.
|
|
14252
|
-
* @return {Number} magnitude
|
|
14253
|
-
*/
|
|
14254
|
-
mag: function () {
|
|
14255
|
-
return Math.sqrt(this.x * this.x + this.y * this.y);
|
|
14256
|
-
},
|
|
14257
|
-
/**
|
|
14258
|
-
* Judge whether this point is equal to another point, returning
|
|
14259
|
-
* true or false.
|
|
14260
|
-
* @param {Point} other the other point
|
|
14261
|
-
* @return {boolean} whether the points are equal
|
|
14262
|
-
*/
|
|
14263
|
-
equals: function (other) {
|
|
14264
|
-
return this.x === other.x && this.y === other.y;
|
|
14265
|
-
},
|
|
14266
|
-
/**
|
|
14267
|
-
* Calculate the distance from this point to another point
|
|
14268
|
-
* @param {Point} p the other point
|
|
14269
|
-
* @return {Number} distance
|
|
14270
|
-
*/
|
|
14271
|
-
dist: function (p) {
|
|
14272
|
-
return Math.sqrt(this.distSqr(p));
|
|
14273
|
-
},
|
|
14274
|
-
/**
|
|
14275
|
-
* Calculate the distance from this point to another point,
|
|
14276
|
-
* without the square root step. Useful if you're comparing
|
|
14277
|
-
* relative distances.
|
|
14278
|
-
* @param {Point} p the other point
|
|
14279
|
-
* @return {Number} distance
|
|
14280
|
-
*/
|
|
14281
|
-
distSqr: function (p) {
|
|
14282
|
-
var dx = p.x - this.x, dy = p.y - this.y;
|
|
14283
|
-
return dx * dx + dy * dy;
|
|
14284
|
-
},
|
|
14285
|
-
/**
|
|
14286
|
-
* Get the angle from the 0, 0 coordinate to this point, in radians
|
|
14287
|
-
* coordinates.
|
|
14288
|
-
* @return {Number} angle
|
|
14289
|
-
*/
|
|
14290
|
-
angle: function () {
|
|
14291
|
-
return Math.atan2(this.y, this.x);
|
|
14292
|
-
},
|
|
14293
|
-
/**
|
|
14294
|
-
* Get the angle from this point to another point, in radians
|
|
14295
|
-
* @param {Point} b the other point
|
|
14296
|
-
* @return {Number} angle
|
|
14297
|
-
*/
|
|
14298
|
-
angleTo: function (b) {
|
|
14299
|
-
return Math.atan2(this.y - b.y, this.x - b.x);
|
|
14300
|
-
},
|
|
14301
|
-
/**
|
|
14302
|
-
* Get the angle between this point and another point, in radians
|
|
14303
|
-
* @param {Point} b the other point
|
|
14304
|
-
* @return {Number} angle
|
|
14305
|
-
*/
|
|
14306
|
-
angleWith: function (b) {
|
|
14307
|
-
return this.angleWithSep(b.x, b.y);
|
|
14308
|
-
},
|
|
14309
|
-
/*
|
|
14310
|
-
* Find the angle of the two vectors, solving the formula for
|
|
14311
|
-
* the cross product a x b = |a||b|sin(θ) for θ.
|
|
14312
|
-
* @param {Number} x the x-coordinate
|
|
14313
|
-
* @param {Number} y the y-coordinate
|
|
14314
|
-
* @return {Number} the angle in radians
|
|
14315
|
-
*/
|
|
14316
|
-
angleWithSep: function (x, y) {
|
|
14317
|
-
return Math.atan2(this.x * y - this.y * x, this.x * x + this.y * y);
|
|
14318
|
-
},
|
|
14319
|
-
_matMult: function (m) {
|
|
14320
|
-
var x = m[0] * this.x + m[1] * this.y, y = m[2] * this.x + m[3] * this.y;
|
|
14321
|
-
this.x = x;
|
|
14322
|
-
this.y = y;
|
|
14323
|
-
return this;
|
|
14324
|
-
},
|
|
14325
|
-
_add: function (p) {
|
|
14326
|
-
this.x += p.x;
|
|
14327
|
-
this.y += p.y;
|
|
14328
|
-
return this;
|
|
14329
|
-
},
|
|
14330
|
-
_sub: function (p) {
|
|
14331
|
-
this.x -= p.x;
|
|
14332
|
-
this.y -= p.y;
|
|
14333
|
-
return this;
|
|
14334
|
-
},
|
|
14335
|
-
_mult: function (k) {
|
|
14336
|
-
this.x *= k;
|
|
14337
|
-
this.y *= k;
|
|
14338
|
-
return this;
|
|
14339
|
-
},
|
|
14340
|
-
_div: function (k) {
|
|
14341
|
-
this.x /= k;
|
|
14342
|
-
this.y /= k;
|
|
14343
|
-
return this;
|
|
14344
|
-
},
|
|
14345
|
-
_multByPoint: function (p) {
|
|
14346
|
-
this.x *= p.x;
|
|
14347
|
-
this.y *= p.y;
|
|
14348
|
-
return this;
|
|
14349
|
-
},
|
|
14350
|
-
_divByPoint: function (p) {
|
|
14351
|
-
this.x /= p.x;
|
|
14352
|
-
this.y /= p.y;
|
|
14353
|
-
return this;
|
|
14354
|
-
},
|
|
14355
|
-
_unit: function () {
|
|
14356
|
-
this._div(this.mag());
|
|
14357
|
-
return this;
|
|
14358
|
-
},
|
|
14359
|
-
_perp: function () {
|
|
14360
|
-
var y = this.y;
|
|
14361
|
-
this.y = this.x;
|
|
14362
|
-
this.x = -y;
|
|
14363
|
-
return this;
|
|
14364
|
-
},
|
|
14365
|
-
_rotate: function (angle) {
|
|
14366
|
-
var cos = Math.cos(angle), sin = Math.sin(angle), x = cos * this.x - sin * this.y, y = sin * this.x + cos * this.y;
|
|
14367
|
-
this.x = x;
|
|
14368
|
-
this.y = y;
|
|
14369
|
-
return this;
|
|
14370
|
-
},
|
|
14371
|
-
_rotateAround: function (angle, p) {
|
|
14372
|
-
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);
|
|
14373
|
-
this.x = x;
|
|
14374
|
-
this.y = y;
|
|
14375
|
-
return this;
|
|
14376
|
-
},
|
|
14377
|
-
_round: function () {
|
|
14378
|
-
this.x = Math.round(this.x);
|
|
14379
|
-
this.y = Math.round(this.y);
|
|
14380
|
-
return this;
|
|
14381
|
-
}
|
|
14382
|
-
};
|
|
14383
|
-
/**
|
|
14384
|
-
* Construct a point from an array if necessary, otherwise if the input
|
|
14385
|
-
* is already a Point, or an unknown type, return it unchanged
|
|
14386
|
-
* @param {Array<Number>|Point|*} a any kind of input value
|
|
14387
|
-
* @return {Point} constructed point, or passed-through value.
|
|
14388
|
-
* @example
|
|
14389
|
-
* // this
|
|
14390
|
-
* var point = Point.convert([0, 1]);
|
|
14391
|
-
* // is equivalent to
|
|
14392
|
-
* var point = new Point(0, 1);
|
|
14393
|
-
*/
|
|
14394
|
-
Point.convert = function (a) {
|
|
14395
|
-
if (a instanceof Point) {
|
|
14396
|
-
return a;
|
|
14397
|
-
}
|
|
14398
|
-
if (Array.isArray(a)) {
|
|
14399
|
-
return new Point(a[0], a[1]);
|
|
14400
|
-
}
|
|
14401
|
-
return a;
|
|
14402
|
-
};
|
|
14403
|
-
return pointGeometry;
|
|
14248
|
+
/**
|
|
14249
|
+
* A standalone point geometry with useful accessor, comparison, and
|
|
14250
|
+
* modification methods.
|
|
14251
|
+
*
|
|
14252
|
+
* @class
|
|
14253
|
+
* @param {number} x the x-coordinate. This could be longitude or screen pixels, or any other sort of unit.
|
|
14254
|
+
* @param {number} y the y-coordinate. This could be latitude or screen pixels, or any other sort of unit.
|
|
14255
|
+
*
|
|
14256
|
+
* @example
|
|
14257
|
+
* const point = new Point(-77, 38);
|
|
14258
|
+
*/
|
|
14259
|
+
function Point(x, y) {
|
|
14260
|
+
this.x = x;
|
|
14261
|
+
this.y = y;
|
|
14404
14262
|
}
|
|
14405
|
-
|
|
14406
|
-
|
|
14263
|
+
Point.prototype = {
|
|
14264
|
+
/**
|
|
14265
|
+
* Clone this point, returning a new point that can be modified
|
|
14266
|
+
* without affecting the old one.
|
|
14267
|
+
* @return {Point} the clone
|
|
14268
|
+
*/
|
|
14269
|
+
clone() {
|
|
14270
|
+
return new Point(this.x, this.y);
|
|
14271
|
+
},
|
|
14272
|
+
/**
|
|
14273
|
+
* Add this point's x & y coordinates to another point,
|
|
14274
|
+
* yielding a new point.
|
|
14275
|
+
* @param {Point} p the other point
|
|
14276
|
+
* @return {Point} output point
|
|
14277
|
+
*/
|
|
14278
|
+
add(p) {
|
|
14279
|
+
return this.clone()._add(p);
|
|
14280
|
+
},
|
|
14281
|
+
/**
|
|
14282
|
+
* Subtract this point's x & y coordinates to from point,
|
|
14283
|
+
* yielding a new point.
|
|
14284
|
+
* @param {Point} p the other point
|
|
14285
|
+
* @return {Point} output point
|
|
14286
|
+
*/
|
|
14287
|
+
sub(p) {
|
|
14288
|
+
return this.clone()._sub(p);
|
|
14289
|
+
},
|
|
14290
|
+
/**
|
|
14291
|
+
* Multiply this point's x & y coordinates by point,
|
|
14292
|
+
* yielding a new point.
|
|
14293
|
+
* @param {Point} p the other point
|
|
14294
|
+
* @return {Point} output point
|
|
14295
|
+
*/
|
|
14296
|
+
multByPoint(p) {
|
|
14297
|
+
return this.clone()._multByPoint(p);
|
|
14298
|
+
},
|
|
14299
|
+
/**
|
|
14300
|
+
* Divide this point's x & y coordinates by point,
|
|
14301
|
+
* yielding a new point.
|
|
14302
|
+
* @param {Point} p the other point
|
|
14303
|
+
* @return {Point} output point
|
|
14304
|
+
*/
|
|
14305
|
+
divByPoint(p) {
|
|
14306
|
+
return this.clone()._divByPoint(p);
|
|
14307
|
+
},
|
|
14308
|
+
/**
|
|
14309
|
+
* Multiply this point's x & y coordinates by a factor,
|
|
14310
|
+
* yielding a new point.
|
|
14311
|
+
* @param {number} k factor
|
|
14312
|
+
* @return {Point} output point
|
|
14313
|
+
*/
|
|
14314
|
+
mult(k) {
|
|
14315
|
+
return this.clone()._mult(k);
|
|
14316
|
+
},
|
|
14317
|
+
/**
|
|
14318
|
+
* Divide this point's x & y coordinates by a factor,
|
|
14319
|
+
* yielding a new point.
|
|
14320
|
+
* @param {number} k factor
|
|
14321
|
+
* @return {Point} output point
|
|
14322
|
+
*/
|
|
14323
|
+
div(k) {
|
|
14324
|
+
return this.clone()._div(k);
|
|
14325
|
+
},
|
|
14326
|
+
/**
|
|
14327
|
+
* Rotate this point around the 0, 0 origin by an angle a,
|
|
14328
|
+
* given in radians
|
|
14329
|
+
* @param {number} a angle to rotate around, in radians
|
|
14330
|
+
* @return {Point} output point
|
|
14331
|
+
*/
|
|
14332
|
+
rotate(a) {
|
|
14333
|
+
return this.clone()._rotate(a);
|
|
14334
|
+
},
|
|
14335
|
+
/**
|
|
14336
|
+
* Rotate this point around p point by an angle a,
|
|
14337
|
+
* given in radians
|
|
14338
|
+
* @param {number} a angle to rotate around, in radians
|
|
14339
|
+
* @param {Point} p Point to rotate around
|
|
14340
|
+
* @return {Point} output point
|
|
14341
|
+
*/
|
|
14342
|
+
rotateAround(a, p) {
|
|
14343
|
+
return this.clone()._rotateAround(a, p);
|
|
14344
|
+
},
|
|
14345
|
+
/**
|
|
14346
|
+
* Multiply this point by a 4x1 transformation matrix
|
|
14347
|
+
* @param {[number, number, number, number]} m transformation matrix
|
|
14348
|
+
* @return {Point} output point
|
|
14349
|
+
*/
|
|
14350
|
+
matMult(m) {
|
|
14351
|
+
return this.clone()._matMult(m);
|
|
14352
|
+
},
|
|
14353
|
+
/**
|
|
14354
|
+
* Calculate this point but as a unit vector from 0, 0, meaning
|
|
14355
|
+
* that the distance from the resulting point to the 0, 0
|
|
14356
|
+
* coordinate will be equal to 1 and the angle from the resulting
|
|
14357
|
+
* point to the 0, 0 coordinate will be the same as before.
|
|
14358
|
+
* @return {Point} unit vector point
|
|
14359
|
+
*/
|
|
14360
|
+
unit() {
|
|
14361
|
+
return this.clone()._unit();
|
|
14362
|
+
},
|
|
14363
|
+
/**
|
|
14364
|
+
* Compute a perpendicular point, where the new y coordinate
|
|
14365
|
+
* is the old x coordinate and the new x coordinate is the old y
|
|
14366
|
+
* coordinate multiplied by -1
|
|
14367
|
+
* @return {Point} perpendicular point
|
|
14368
|
+
*/
|
|
14369
|
+
perp() {
|
|
14370
|
+
return this.clone()._perp();
|
|
14371
|
+
},
|
|
14372
|
+
/**
|
|
14373
|
+
* Return a version of this point with the x & y coordinates
|
|
14374
|
+
* rounded to integers.
|
|
14375
|
+
* @return {Point} rounded point
|
|
14376
|
+
*/
|
|
14377
|
+
round() {
|
|
14378
|
+
return this.clone()._round();
|
|
14379
|
+
},
|
|
14380
|
+
/**
|
|
14381
|
+
* Return the magnitude of this point: this is the Euclidean
|
|
14382
|
+
* distance from the 0, 0 coordinate to this point's x and y
|
|
14383
|
+
* coordinates.
|
|
14384
|
+
* @return {number} magnitude
|
|
14385
|
+
*/
|
|
14386
|
+
mag() {
|
|
14387
|
+
return Math.sqrt(this.x * this.x + this.y * this.y);
|
|
14388
|
+
},
|
|
14389
|
+
/**
|
|
14390
|
+
* Judge whether this point is equal to another point, returning
|
|
14391
|
+
* true or false.
|
|
14392
|
+
* @param {Point} other the other point
|
|
14393
|
+
* @return {boolean} whether the points are equal
|
|
14394
|
+
*/
|
|
14395
|
+
equals(other) {
|
|
14396
|
+
return this.x === other.x && this.y === other.y;
|
|
14397
|
+
},
|
|
14398
|
+
/**
|
|
14399
|
+
* Calculate the distance from this point to another point
|
|
14400
|
+
* @param {Point} p the other point
|
|
14401
|
+
* @return {number} distance
|
|
14402
|
+
*/
|
|
14403
|
+
dist(p) {
|
|
14404
|
+
return Math.sqrt(this.distSqr(p));
|
|
14405
|
+
},
|
|
14406
|
+
/**
|
|
14407
|
+
* Calculate the distance from this point to another point,
|
|
14408
|
+
* without the square root step. Useful if you're comparing
|
|
14409
|
+
* relative distances.
|
|
14410
|
+
* @param {Point} p the other point
|
|
14411
|
+
* @return {number} distance
|
|
14412
|
+
*/
|
|
14413
|
+
distSqr(p) {
|
|
14414
|
+
const dx = p.x - this.x, dy = p.y - this.y;
|
|
14415
|
+
return dx * dx + dy * dy;
|
|
14416
|
+
},
|
|
14417
|
+
/**
|
|
14418
|
+
* Get the angle from the 0, 0 coordinate to this point, in radians
|
|
14419
|
+
* coordinates.
|
|
14420
|
+
* @return {number} angle
|
|
14421
|
+
*/
|
|
14422
|
+
angle() {
|
|
14423
|
+
return Math.atan2(this.y, this.x);
|
|
14424
|
+
},
|
|
14425
|
+
/**
|
|
14426
|
+
* Get the angle from this point to another point, in radians
|
|
14427
|
+
* @param {Point} b the other point
|
|
14428
|
+
* @return {number} angle
|
|
14429
|
+
*/
|
|
14430
|
+
angleTo(b) {
|
|
14431
|
+
return Math.atan2(this.y - b.y, this.x - b.x);
|
|
14432
|
+
},
|
|
14433
|
+
/**
|
|
14434
|
+
* Get the angle between this point and another point, in radians
|
|
14435
|
+
* @param {Point} b the other point
|
|
14436
|
+
* @return {number} angle
|
|
14437
|
+
*/
|
|
14438
|
+
angleWith(b) {
|
|
14439
|
+
return this.angleWithSep(b.x, b.y);
|
|
14440
|
+
},
|
|
14441
|
+
/**
|
|
14442
|
+
* Find the angle of the two vectors, solving the formula for
|
|
14443
|
+
* the cross product a x b = |a||b|sin(θ) for θ.
|
|
14444
|
+
* @param {number} x the x-coordinate
|
|
14445
|
+
* @param {number} y the y-coordinate
|
|
14446
|
+
* @return {number} the angle in radians
|
|
14447
|
+
*/
|
|
14448
|
+
angleWithSep(x, y) {
|
|
14449
|
+
return Math.atan2(this.x * y - this.y * x, this.x * x + this.y * y);
|
|
14450
|
+
},
|
|
14451
|
+
/** @param {[number, number, number, number]} m */
|
|
14452
|
+
_matMult(m) {
|
|
14453
|
+
const x = m[0] * this.x + m[1] * this.y, y = m[2] * this.x + m[3] * this.y;
|
|
14454
|
+
this.x = x;
|
|
14455
|
+
this.y = y;
|
|
14456
|
+
return this;
|
|
14457
|
+
},
|
|
14458
|
+
/** @param {Point} p */
|
|
14459
|
+
_add(p) {
|
|
14460
|
+
this.x += p.x;
|
|
14461
|
+
this.y += p.y;
|
|
14462
|
+
return this;
|
|
14463
|
+
},
|
|
14464
|
+
/** @param {Point} p */
|
|
14465
|
+
_sub(p) {
|
|
14466
|
+
this.x -= p.x;
|
|
14467
|
+
this.y -= p.y;
|
|
14468
|
+
return this;
|
|
14469
|
+
},
|
|
14470
|
+
/** @param {number} k */
|
|
14471
|
+
_mult(k) {
|
|
14472
|
+
this.x *= k;
|
|
14473
|
+
this.y *= k;
|
|
14474
|
+
return this;
|
|
14475
|
+
},
|
|
14476
|
+
/** @param {number} k */
|
|
14477
|
+
_div(k) {
|
|
14478
|
+
this.x /= k;
|
|
14479
|
+
this.y /= k;
|
|
14480
|
+
return this;
|
|
14481
|
+
},
|
|
14482
|
+
/** @param {Point} p */
|
|
14483
|
+
_multByPoint(p) {
|
|
14484
|
+
this.x *= p.x;
|
|
14485
|
+
this.y *= p.y;
|
|
14486
|
+
return this;
|
|
14487
|
+
},
|
|
14488
|
+
/** @param {Point} p */
|
|
14489
|
+
_divByPoint(p) {
|
|
14490
|
+
this.x /= p.x;
|
|
14491
|
+
this.y /= p.y;
|
|
14492
|
+
return this;
|
|
14493
|
+
},
|
|
14494
|
+
_unit() {
|
|
14495
|
+
this._div(this.mag());
|
|
14496
|
+
return this;
|
|
14497
|
+
},
|
|
14498
|
+
_perp() {
|
|
14499
|
+
const y = this.y;
|
|
14500
|
+
this.y = this.x;
|
|
14501
|
+
this.x = -y;
|
|
14502
|
+
return this;
|
|
14503
|
+
},
|
|
14504
|
+
/** @param {number} angle */
|
|
14505
|
+
_rotate(angle) {
|
|
14506
|
+
const cos = Math.cos(angle), sin = Math.sin(angle), x = cos * this.x - sin * this.y, y = sin * this.x + cos * this.y;
|
|
14507
|
+
this.x = x;
|
|
14508
|
+
this.y = y;
|
|
14509
|
+
return this;
|
|
14510
|
+
},
|
|
14511
|
+
/**
|
|
14512
|
+
* @param {number} angle
|
|
14513
|
+
* @param {Point} p
|
|
14514
|
+
*/
|
|
14515
|
+
_rotateAround(angle, p) {
|
|
14516
|
+
const 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);
|
|
14517
|
+
this.x = x;
|
|
14518
|
+
this.y = y;
|
|
14519
|
+
return this;
|
|
14520
|
+
},
|
|
14521
|
+
_round() {
|
|
14522
|
+
this.x = Math.round(this.x);
|
|
14523
|
+
this.y = Math.round(this.y);
|
|
14524
|
+
return this;
|
|
14525
|
+
},
|
|
14526
|
+
constructor: Point
|
|
14527
|
+
};
|
|
14528
|
+
/**
|
|
14529
|
+
* Construct a point from an array if necessary, otherwise if the input
|
|
14530
|
+
* is already a Point, return it unchanged.
|
|
14531
|
+
* @param {Point | [number, number] | {x: number, y: number}} p input value
|
|
14532
|
+
* @return {Point} constructed point.
|
|
14533
|
+
* @example
|
|
14534
|
+
* // this
|
|
14535
|
+
* var point = Point.convert([0, 1]);
|
|
14536
|
+
* // is equivalent to
|
|
14537
|
+
* var point = new Point(0, 1);
|
|
14538
|
+
*/
|
|
14539
|
+
Point.convert = function (p) {
|
|
14540
|
+
if (p instanceof Point) {
|
|
14541
|
+
return p;
|
|
14542
|
+
}
|
|
14543
|
+
if (Array.isArray(p)) {
|
|
14544
|
+
return new Point(+p[0], +p[1]);
|
|
14545
|
+
}
|
|
14546
|
+
if (p.x !== undefined && p.y !== undefined) {
|
|
14547
|
+
return new Point(+p.x, +p.y);
|
|
14548
|
+
}
|
|
14549
|
+
throw new Error('Expected [x, y] or {x, y} point format');
|
|
14550
|
+
};
|
|
14407
14551
|
|
|
14408
14552
|
function calculateSignedArea(ring) {
|
|
14409
14553
|
let sum = 0;
|
|
@@ -17359,6 +17503,43 @@ class Slice {
|
|
|
17359
17503
|
}
|
|
17360
17504
|
}
|
|
17361
17505
|
|
|
17506
|
+
class Split {
|
|
17507
|
+
constructor(str, delimiter) {
|
|
17508
|
+
this.type = array$1(StringType);
|
|
17509
|
+
this.str = str;
|
|
17510
|
+
this.delimiter = delimiter;
|
|
17511
|
+
}
|
|
17512
|
+
static parse(args, context) {
|
|
17513
|
+
if (args.length !== 3) {
|
|
17514
|
+
return context.error(`Expected 2 arguments, but found ${ args.length - 1 } instead.`);
|
|
17515
|
+
}
|
|
17516
|
+
const str = context.parse(args[1], 1, StringType);
|
|
17517
|
+
const delimiter = context.parse(args[2], 2, StringType);
|
|
17518
|
+
if (!str || !delimiter)
|
|
17519
|
+
return;
|
|
17520
|
+
return new Split(str, delimiter);
|
|
17521
|
+
}
|
|
17522
|
+
evaluate(ctx) {
|
|
17523
|
+
const str = this.str.evaluate(ctx);
|
|
17524
|
+
const delimiter = this.delimiter.evaluate(ctx);
|
|
17525
|
+
return str.split(delimiter);
|
|
17526
|
+
}
|
|
17527
|
+
eachChild(fn) {
|
|
17528
|
+
fn(this.str);
|
|
17529
|
+
fn(this.delimiter);
|
|
17530
|
+
}
|
|
17531
|
+
outputDefined() {
|
|
17532
|
+
return false;
|
|
17533
|
+
}
|
|
17534
|
+
serialize() {
|
|
17535
|
+
return [
|
|
17536
|
+
'split',
|
|
17537
|
+
this.str.serialize(),
|
|
17538
|
+
this.delimiter.serialize()
|
|
17539
|
+
];
|
|
17540
|
+
}
|
|
17541
|
+
}
|
|
17542
|
+
|
|
17362
17543
|
function isComparableType(op, type) {
|
|
17363
17544
|
if (op === '==' || op === '!=') {
|
|
17364
17545
|
return type.kind === 'boolean' || type.kind === 'string' || type.kind === 'number' || type.kind === 'null' || type.kind === 'value';
|
|
@@ -17690,7 +17871,8 @@ const expressions = {
|
|
|
17690
17871
|
'var': Var,
|
|
17691
17872
|
'within': Within,
|
|
17692
17873
|
'distance': Distance,
|
|
17693
|
-
'config': Config
|
|
17874
|
+
'config': Config,
|
|
17875
|
+
'split': Split
|
|
17694
17876
|
};
|
|
17695
17877
|
function rgba(ctx, [r, g, b, a]) {
|
|
17696
17878
|
r = r.evaluate(ctx);
|