@nextgis/ngw-leaflet 1.17.0 → 1.18.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/lib/ngw-leaflet.esm-browser.js +635 -33
- package/lib/ngw-leaflet.esm-browser.js.map +1 -1
- package/lib/ngw-leaflet.esm-browser.prod.js +2 -2
- package/lib/ngw-leaflet.esm-browser.prod.js.map +1 -1
- package/lib/ngw-leaflet.esm-bundler.js +1 -1
- package/lib/ngw-leaflet.global.js +657 -33
- package/lib/ngw-leaflet.global.js.map +1 -1
- package/lib/ngw-leaflet.global.prod.js +2 -2
- package/lib/ngw-leaflet.global.prod.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Bundle of @nextgis/ngw-leaflet; version: 1.
|
|
1
|
+
/** Bundle of @nextgis/ngw-leaflet; version: 1.18.1; author: NextGIS */
|
|
2
2
|
var NgwLeaflet = (function () {
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
@@ -15430,12 +15430,6 @@ var NgwLeaflet = (function () {
|
|
|
15430
15430
|
return url.replace(/([^:]\/)\/+/g, '$1');
|
|
15431
15431
|
}
|
|
15432
15432
|
|
|
15433
|
-
function isExpression(value) {
|
|
15434
|
-
if (Array.isArray(value)) {
|
|
15435
|
-
return true;
|
|
15436
|
-
}
|
|
15437
|
-
return false;
|
|
15438
|
-
}
|
|
15439
15433
|
function isPropertiesPaint(paint) {
|
|
15440
15434
|
if (Array.isArray(paint)) {
|
|
15441
15435
|
return true;
|
|
@@ -15455,41 +15449,641 @@ var NgwLeaflet = (function () {
|
|
|
15455
15449
|
return false;
|
|
15456
15450
|
}
|
|
15457
15451
|
|
|
15458
|
-
function
|
|
15459
|
-
|
|
15460
|
-
|
|
15452
|
+
var tryConvert = function (converter, arg, data) {
|
|
15453
|
+
try {
|
|
15454
|
+
var result = converter(arg, data);
|
|
15455
|
+
if (result !== undefined) {
|
|
15456
|
+
return result;
|
|
15457
|
+
}
|
|
15458
|
+
}
|
|
15459
|
+
catch (_a) {
|
|
15460
|
+
// ignore errors
|
|
15461
|
+
}
|
|
15462
|
+
return undefined;
|
|
15463
|
+
};
|
|
15464
|
+
|
|
15465
|
+
function fallback(cb) {
|
|
15466
|
+
return function (args, data) {
|
|
15467
|
+
for (var _i = 0, args_1 = args; _i < args_1.length; _i++) {
|
|
15468
|
+
var arg = args_1[_i];
|
|
15469
|
+
var result = tryConvert(cb, arg, data);
|
|
15470
|
+
if (result !== undefined) {
|
|
15471
|
+
return result;
|
|
15472
|
+
}
|
|
15473
|
+
}
|
|
15474
|
+
throw new Error("Received a mismatched type");
|
|
15475
|
+
};
|
|
15461
15476
|
}
|
|
15462
|
-
|
|
15463
|
-
|
|
15464
|
-
var
|
|
15465
|
-
|
|
15466
|
-
|
|
15477
|
+
|
|
15478
|
+
var array = function (args) {
|
|
15479
|
+
var firstArg = args[0], secondArg = args[1], thirdArg = args[2];
|
|
15480
|
+
var requiredType = undefined;
|
|
15481
|
+
var requiredLength = undefined;
|
|
15482
|
+
var value;
|
|
15483
|
+
if (typeof firstArg === 'string' &&
|
|
15484
|
+
['string', 'number', 'boolean'].includes(firstArg)) {
|
|
15485
|
+
requiredType = firstArg;
|
|
15486
|
+
if (typeof secondArg === 'number') {
|
|
15487
|
+
requiredLength = secondArg;
|
|
15488
|
+
value = thirdArg;
|
|
15489
|
+
}
|
|
15490
|
+
else {
|
|
15491
|
+
value = secondArg;
|
|
15492
|
+
}
|
|
15493
|
+
}
|
|
15494
|
+
else if (Array.isArray(firstArg)) {
|
|
15495
|
+
value = firstArg;
|
|
15496
|
+
}
|
|
15497
|
+
if (!Array.isArray(value)) {
|
|
15498
|
+
throw new Error('Expected an array');
|
|
15499
|
+
}
|
|
15500
|
+
if (requiredType && !value.every(function (item) { return typeof item === requiredType; })) {
|
|
15501
|
+
throw new Error("Expected all items in array to be of type ".concat(requiredType));
|
|
15502
|
+
}
|
|
15503
|
+
if (requiredLength && value.length !== requiredLength) {
|
|
15504
|
+
throw new Error("Expected array of length ".concat(requiredLength));
|
|
15505
|
+
}
|
|
15506
|
+
return value;
|
|
15507
|
+
};
|
|
15508
|
+
var typeExpressions = {
|
|
15509
|
+
array: array,
|
|
15510
|
+
boolean: fallback(function (arg) { return (typeof arg === 'boolean' ? arg : undefined); }),
|
|
15511
|
+
literal: function (_a) {
|
|
15512
|
+
var arg = _a[0];
|
|
15513
|
+
return arg;
|
|
15514
|
+
},
|
|
15515
|
+
number: fallback(function (arg) { return (typeof arg === 'number' ? arg : undefined); }),
|
|
15516
|
+
object: fallback(function (arg) {
|
|
15517
|
+
return arg !== null && typeof arg === 'object' && !Array.isArray(arg)
|
|
15518
|
+
? arg
|
|
15519
|
+
: undefined;
|
|
15520
|
+
}),
|
|
15521
|
+
string: fallback(function (arg) { return (typeof arg === 'string' ? arg : undefined); }),
|
|
15522
|
+
'to-boolean': fallback(Boolean),
|
|
15523
|
+
'to-number': fallback(Number),
|
|
15524
|
+
'to-string': fallback(String),
|
|
15525
|
+
typeof: function (_a) {
|
|
15526
|
+
var arg = _a[0];
|
|
15527
|
+
return typeof arg;
|
|
15528
|
+
},
|
|
15529
|
+
};
|
|
15530
|
+
|
|
15531
|
+
var mathExpressions = {
|
|
15532
|
+
'+': function (args) { return args.reduce(function (a, b) { return a + b; }, 0); },
|
|
15533
|
+
'-': function (args) { return args.reduce(function (a, b) { return a - b; }); },
|
|
15534
|
+
'*': function (args) { return args.reduce(function (a, b) { return a * b; }, 1); },
|
|
15535
|
+
'/': function (args) { return args.reduce(function (a, b) { return a / b; }); },
|
|
15536
|
+
'%': function (args) { return args[0] % args[1]; },
|
|
15537
|
+
'^': function (args) { return Math.pow(args[0], args[1]); },
|
|
15538
|
+
abs: function (args) { return Math.abs(args[0]); },
|
|
15539
|
+
acos: function (args) { return Math.acos(args[0]); },
|
|
15540
|
+
asin: function (args) { return Math.asin(args[0]); },
|
|
15541
|
+
atan: function (args) { return Math.atan(args[0]); },
|
|
15542
|
+
ceil: function (args) { return Math.ceil(args[0]); },
|
|
15543
|
+
cos: function (args) { return Math.cos(args[0]); },
|
|
15544
|
+
e: function () { return Math.E; },
|
|
15545
|
+
floor: function (args) { return Math.floor(args[0]); },
|
|
15546
|
+
ln: function (args) { return Math.log(args[0]); },
|
|
15547
|
+
ln2: function () { return Math.LN2; },
|
|
15548
|
+
log10: function (args) { return Math.log10(args[0]); },
|
|
15549
|
+
log2: function (args) { return Math.log2(args[0]); },
|
|
15550
|
+
max: function (args) { return Math.max.apply(Math, args); },
|
|
15551
|
+
min: function (args) { return Math.min.apply(Math, args); },
|
|
15552
|
+
pi: function () { return Math.PI; },
|
|
15553
|
+
round: function (args) { return Math.round(args[0]); },
|
|
15554
|
+
sin: function (args) { return Math.sin(args[0]); },
|
|
15555
|
+
sqrt: function (args) { return Math.sqrt(args[0]); },
|
|
15556
|
+
tan: function (args) { return Math.tan(args[0]); },
|
|
15557
|
+
};
|
|
15558
|
+
|
|
15559
|
+
function get(_a, data) {
|
|
15560
|
+
var key = _a[0], objExp = _a[1];
|
|
15561
|
+
var target = objExp || data;
|
|
15562
|
+
if (target && typeof target === 'object' && key in target) {
|
|
15563
|
+
return target[key];
|
|
15564
|
+
}
|
|
15565
|
+
return null;
|
|
15566
|
+
}
|
|
15567
|
+
function has(_a, data) {
|
|
15568
|
+
var key = _a[0], objExp = _a[1];
|
|
15569
|
+
var target = objExp || data;
|
|
15570
|
+
return !!(target && typeof target === 'object' && key in target);
|
|
15571
|
+
}
|
|
15572
|
+
function at(_a) {
|
|
15573
|
+
var index = _a[0], array = _a[1];
|
|
15574
|
+
return array[index];
|
|
15575
|
+
}
|
|
15576
|
+
function inFunc(_a) {
|
|
15577
|
+
var keyword = _a[0], input = _a[1];
|
|
15578
|
+
if (typeof input === 'string') {
|
|
15579
|
+
return input.includes(String(keyword));
|
|
15580
|
+
}
|
|
15581
|
+
else if (Array.isArray(input)) {
|
|
15582
|
+
return input.includes(keyword);
|
|
15467
15583
|
}
|
|
15584
|
+
throw new Error("Invalid input type for 'in'. Expected string or array, got ".concat(typeof input, "."));
|
|
15585
|
+
}
|
|
15586
|
+
var length = function (_a) {
|
|
15587
|
+
var item = _a[0];
|
|
15588
|
+
if (typeof item === 'string' || Array.isArray(item)) {
|
|
15589
|
+
return item.length;
|
|
15590
|
+
}
|
|
15591
|
+
return undefined;
|
|
15592
|
+
};
|
|
15593
|
+
function indexOf(_a) {
|
|
15594
|
+
var keyword = _a[0], input = _a[1], startIndex = _a[2];
|
|
15595
|
+
if (typeof input === 'string') {
|
|
15596
|
+
return input.indexOf(String(keyword), startIndex);
|
|
15597
|
+
}
|
|
15598
|
+
else if (Array.isArray(input)) {
|
|
15599
|
+
return input.indexOf(keyword, startIndex);
|
|
15600
|
+
}
|
|
15601
|
+
throw new Error("Invalid input type for 'index-of'. Expected string or array, got ".concat(typeof input, "."));
|
|
15602
|
+
}
|
|
15603
|
+
function slice(args) {
|
|
15604
|
+
var input = args[0], startIndex = args[1], endIndex = args[2];
|
|
15605
|
+
if (typeof input === 'string') {
|
|
15606
|
+
return input.slice(startIndex, endIndex);
|
|
15607
|
+
}
|
|
15608
|
+
else if (Array.isArray(input)) {
|
|
15609
|
+
return input.slice(startIndex, endIndex);
|
|
15610
|
+
}
|
|
15611
|
+
throw new Error("Invalid input type for 'slice'. Expected string or array, got ".concat(typeof input, "."));
|
|
15612
|
+
}
|
|
15613
|
+
var lookupExpressions = {
|
|
15614
|
+
get: get,
|
|
15615
|
+
length: length,
|
|
15616
|
+
at: at,
|
|
15617
|
+
has: has,
|
|
15618
|
+
in: inFunc,
|
|
15619
|
+
'index-of': indexOf,
|
|
15620
|
+
slice: slice,
|
|
15621
|
+
};
|
|
15622
|
+
|
|
15623
|
+
var stringExpressions = {
|
|
15624
|
+
concat: function (args) { return args.reduce(function (a, b) { return String(a) + String(b); }, ''); },
|
|
15625
|
+
downcase: function (args) { return String(args[0]).toLowerCase(); },
|
|
15626
|
+
upcase: function (args) { return String(args[0]).toUpperCase(); },
|
|
15627
|
+
};
|
|
15628
|
+
|
|
15629
|
+
function not(_a) {
|
|
15630
|
+
var expr = _a[0];
|
|
15631
|
+
return !expr;
|
|
15632
|
+
}
|
|
15633
|
+
var checkCompareValues = function (_a) {
|
|
15634
|
+
var a = _a[0], b = _a[1];
|
|
15635
|
+
if (typeof a !== typeof b) {
|
|
15636
|
+
throw new Error('Values have different types.');
|
|
15637
|
+
}
|
|
15638
|
+
};
|
|
15639
|
+
function notEqual(_a) {
|
|
15640
|
+
var a = _a[0], b = _a[1];
|
|
15641
|
+
checkCompareValues([a, b]);
|
|
15642
|
+
return a !== b;
|
|
15643
|
+
}
|
|
15644
|
+
function lessThan(_a) {
|
|
15645
|
+
var left = _a[0], right = _a[1];
|
|
15646
|
+
checkCompareValues([left, right]);
|
|
15647
|
+
return left < right;
|
|
15648
|
+
}
|
|
15649
|
+
function lessThanOrEqual(_a) {
|
|
15650
|
+
var left = _a[0], right = _a[1];
|
|
15651
|
+
checkCompareValues([left, right]);
|
|
15652
|
+
return left <= right;
|
|
15653
|
+
}
|
|
15654
|
+
function equal(_a) {
|
|
15655
|
+
var left = _a[0], right = _a[1];
|
|
15656
|
+
checkCompareValues([left, right]);
|
|
15657
|
+
return left === right;
|
|
15658
|
+
}
|
|
15659
|
+
function greaterThan(_a) {
|
|
15660
|
+
var left = _a[0], right = _a[1];
|
|
15661
|
+
checkCompareValues([left, right]);
|
|
15662
|
+
return left > right;
|
|
15663
|
+
}
|
|
15664
|
+
function greaterThanOrEqual(_a) {
|
|
15665
|
+
var left = _a[0], right = _a[1];
|
|
15666
|
+
checkCompareValues([left, right]);
|
|
15667
|
+
return left >= right;
|
|
15668
|
+
}
|
|
15669
|
+
function all(args) {
|
|
15670
|
+
for (var i = 0; i < args.length; i++) {
|
|
15671
|
+
var arg = args[i];
|
|
15672
|
+
if (!arg) {
|
|
15673
|
+
return false;
|
|
15674
|
+
}
|
|
15675
|
+
}
|
|
15676
|
+
return true;
|
|
15677
|
+
}
|
|
15678
|
+
function any(args) {
|
|
15679
|
+
for (var i = 0; i < args.length; i++) {
|
|
15680
|
+
var arg = args[i];
|
|
15681
|
+
if (arg) {
|
|
15682
|
+
return true;
|
|
15683
|
+
}
|
|
15684
|
+
}
|
|
15685
|
+
return false;
|
|
15686
|
+
}
|
|
15687
|
+
function match(args) {
|
|
15688
|
+
var lookup = args[0], cases = args.slice(1);
|
|
15468
15689
|
// remove last odd item from cases array
|
|
15469
15690
|
var defValue = cases.splice(-1, cases.length % 2)[0];
|
|
15470
15691
|
for (var fry = 0; fry < cases.length - 1; fry += 2) {
|
|
15471
15692
|
var key = cases[fry];
|
|
15472
|
-
if (key ===
|
|
15693
|
+
if (key === lookup) {
|
|
15473
15694
|
return cases[fry + 1];
|
|
15474
15695
|
}
|
|
15475
15696
|
}
|
|
15476
15697
|
return defValue;
|
|
15477
15698
|
}
|
|
15478
|
-
|
|
15479
|
-
|
|
15699
|
+
function caseFunc(args) {
|
|
15700
|
+
if (args.length < 2) {
|
|
15701
|
+
throw new Error('The "case" function requires at least a condition and a corresponding output.');
|
|
15702
|
+
}
|
|
15703
|
+
var fallback = args[args.length - 1];
|
|
15704
|
+
if (args.length % 2 === 0) {
|
|
15705
|
+
throw new Error('Missing a fallback value or unmatched condition-output pair.');
|
|
15706
|
+
}
|
|
15707
|
+
for (var i = 0; i < args.length - 1; i += 2) {
|
|
15708
|
+
var condition = args[i];
|
|
15709
|
+
var value = args[i + 1];
|
|
15710
|
+
if (condition) {
|
|
15711
|
+
return value;
|
|
15712
|
+
}
|
|
15713
|
+
}
|
|
15714
|
+
return fallback;
|
|
15715
|
+
}
|
|
15716
|
+
var decisionExpressions = {
|
|
15717
|
+
'!': not,
|
|
15718
|
+
'!=': notEqual,
|
|
15719
|
+
'<': lessThan,
|
|
15720
|
+
'<=': lessThanOrEqual,
|
|
15721
|
+
'==': equal,
|
|
15722
|
+
'>': greaterThan,
|
|
15723
|
+
'>=': greaterThanOrEqual,
|
|
15724
|
+
all: all,
|
|
15725
|
+
any: any,
|
|
15726
|
+
case: caseFunc,
|
|
15480
15727
|
match: match,
|
|
15481
15728
|
};
|
|
15482
|
-
|
|
15729
|
+
|
|
15730
|
+
function step(args) {
|
|
15731
|
+
var input = args[0], defaultValue = args[1], stops = args.slice(2);
|
|
15732
|
+
if (typeof input !== 'number') {
|
|
15733
|
+
return defaultValue;
|
|
15734
|
+
}
|
|
15735
|
+
for (var i = 0; i < stops.length - 2; i += 2) {
|
|
15736
|
+
var stopInput = stops[i];
|
|
15737
|
+
var stopOutput = stops[i + 1];
|
|
15738
|
+
var nextStopInput = stops[i + 2];
|
|
15739
|
+
if (input >= stopInput && input < nextStopInput) {
|
|
15740
|
+
return stopOutput;
|
|
15741
|
+
}
|
|
15742
|
+
}
|
|
15743
|
+
if (input >= stops[stops.length - 2]) {
|
|
15744
|
+
return stops[stops.length - 1];
|
|
15745
|
+
}
|
|
15746
|
+
return defaultValue;
|
|
15747
|
+
}
|
|
15748
|
+
|
|
15749
|
+
var COLORS = {
|
|
15750
|
+
aliceblue: '#f0f8ff',
|
|
15751
|
+
antiquewhite: '#faebd7',
|
|
15752
|
+
aqua: '#00ffff',
|
|
15753
|
+
aquamarine: '#7fffd4',
|
|
15754
|
+
azure: '#f0ffff',
|
|
15755
|
+
beige: '#f5f5dc',
|
|
15756
|
+
bisque: '#ffe4c4',
|
|
15757
|
+
black: '#000000',
|
|
15758
|
+
blanchedalmond: '#ffebcd',
|
|
15759
|
+
blue: '#0000ff',
|
|
15760
|
+
blueviolet: '#8a2be2',
|
|
15761
|
+
brown: '#a52a2a',
|
|
15762
|
+
burlywood: '#deb887',
|
|
15763
|
+
cadetblue: '#5f9ea0',
|
|
15764
|
+
chartreuse: '#7fff00',
|
|
15765
|
+
chocolate: '#d2691e',
|
|
15766
|
+
coral: '#ff7f50',
|
|
15767
|
+
cornflowerblue: '#6495ed',
|
|
15768
|
+
cornsilk: '#fff8dc',
|
|
15769
|
+
crimson: '#dc143c',
|
|
15770
|
+
cyan: '#00ffff',
|
|
15771
|
+
darkblue: '#00008b',
|
|
15772
|
+
darkcyan: '#008b8b',
|
|
15773
|
+
darkgoldenrod: '#b8860b',
|
|
15774
|
+
darkgray: '#a9a9a9',
|
|
15775
|
+
darkgreen: '#006400',
|
|
15776
|
+
darkkhaki: '#bdb76b',
|
|
15777
|
+
darkmagenta: '#8b008b',
|
|
15778
|
+
darkolivegreen: '#556b2f',
|
|
15779
|
+
darkorange: '#ff8c00',
|
|
15780
|
+
darkorchid: '#9932cc',
|
|
15781
|
+
darkred: '#8b0000',
|
|
15782
|
+
darksalmon: '#e9967a',
|
|
15783
|
+
darkseagreen: '#8fbc8f',
|
|
15784
|
+
darkslateblue: '#483d8b',
|
|
15785
|
+
darkslategray: '#2f4f4f',
|
|
15786
|
+
darkturquoise: '#00ced1',
|
|
15787
|
+
darkviolet: '#9400d3',
|
|
15788
|
+
deeppink: '#ff1493',
|
|
15789
|
+
deepskyblue: '#00bfff',
|
|
15790
|
+
dimgray: '#696969',
|
|
15791
|
+
dodgerblue: '#1e90ff',
|
|
15792
|
+
firebrick: '#b22222',
|
|
15793
|
+
floralwhite: '#fffaf0',
|
|
15794
|
+
forestgreen: '#228b22',
|
|
15795
|
+
fuchsia: '#ff00ff',
|
|
15796
|
+
gainsboro: '#dcdcdc',
|
|
15797
|
+
ghostwhite: '#f8f8ff',
|
|
15798
|
+
gold: '#ffd700',
|
|
15799
|
+
goldenrod: '#daa520',
|
|
15800
|
+
gray: '#808080',
|
|
15801
|
+
green: '#008000',
|
|
15802
|
+
greenyellow: '#adff2f',
|
|
15803
|
+
honeydew: '#f0fff0',
|
|
15804
|
+
hotpink: '#ff69b4',
|
|
15805
|
+
'indianred ': '#cd5c5c',
|
|
15806
|
+
indigo: '#4b0082',
|
|
15807
|
+
ivory: '#fffff0',
|
|
15808
|
+
khaki: '#f0e68c',
|
|
15809
|
+
lavender: '#e6e6fa',
|
|
15810
|
+
lavenderblush: '#fff0f5',
|
|
15811
|
+
lawngreen: '#7cfc00',
|
|
15812
|
+
lemonchiffon: '#fffacd',
|
|
15813
|
+
lightblue: '#add8e6',
|
|
15814
|
+
lightcoral: '#f08080',
|
|
15815
|
+
lightcyan: '#e0ffff',
|
|
15816
|
+
lightgoldenrodyellow: '#fafad2',
|
|
15817
|
+
lightgrey: '#d3d3d3',
|
|
15818
|
+
lightgreen: '#90ee90',
|
|
15819
|
+
lightpink: '#ffb6c1',
|
|
15820
|
+
lightsalmon: '#ffa07a',
|
|
15821
|
+
lightseagreen: '#20b2aa',
|
|
15822
|
+
lightskyblue: '#87cefa',
|
|
15823
|
+
lightslategray: '#778899',
|
|
15824
|
+
lightsteelblue: '#b0c4de',
|
|
15825
|
+
lightyellow: '#ffffe0',
|
|
15826
|
+
lime: '#00ff00',
|
|
15827
|
+
limegreen: '#32cd32',
|
|
15828
|
+
linen: '#faf0e6',
|
|
15829
|
+
magenta: '#ff00ff',
|
|
15830
|
+
maroon: '#800000',
|
|
15831
|
+
mediumaquamarine: '#66cdaa',
|
|
15832
|
+
mediumblue: '#0000cd',
|
|
15833
|
+
mediumorchid: '#ba55d3',
|
|
15834
|
+
mediumpurple: '#9370d8',
|
|
15835
|
+
mediumseagreen: '#3cb371',
|
|
15836
|
+
mediumslateblue: '#7b68ee',
|
|
15837
|
+
mediumspringgreen: '#00fa9a',
|
|
15838
|
+
mediumturquoise: '#48d1cc',
|
|
15839
|
+
mediumvioletred: '#c71585',
|
|
15840
|
+
midnightblue: '#191970',
|
|
15841
|
+
mintcream: '#f5fffa',
|
|
15842
|
+
mistyrose: '#ffe4e1',
|
|
15843
|
+
moccasin: '#ffe4b5',
|
|
15844
|
+
navajowhite: '#ffdead',
|
|
15845
|
+
navy: '#000080',
|
|
15846
|
+
oldlace: '#fdf5e6',
|
|
15847
|
+
olive: '#808000',
|
|
15848
|
+
olivedrab: '#6b8e23',
|
|
15849
|
+
orange: '#ffa500',
|
|
15850
|
+
orangered: '#ff4500',
|
|
15851
|
+
orchid: '#da70d6',
|
|
15852
|
+
palegoldenrod: '#eee8aa',
|
|
15853
|
+
palegreen: '#98fb98',
|
|
15854
|
+
paleturquoise: '#afeeee',
|
|
15855
|
+
palevioletred: '#d87093',
|
|
15856
|
+
papayawhip: '#ffefd5',
|
|
15857
|
+
peachpuff: '#ffdab9',
|
|
15858
|
+
peru: '#cd853f',
|
|
15859
|
+
pink: '#ffc0cb',
|
|
15860
|
+
plum: '#dda0dd',
|
|
15861
|
+
powderblue: '#b0e0e6',
|
|
15862
|
+
purple: '#800080',
|
|
15863
|
+
rebeccapurple: '#663399',
|
|
15864
|
+
red: '#ff0000',
|
|
15865
|
+
rosybrown: '#bc8f8f',
|
|
15866
|
+
royalblue: '#4169e1',
|
|
15867
|
+
saddlebrown: '#8b4513',
|
|
15868
|
+
salmon: '#fa8072',
|
|
15869
|
+
sandybrown: '#f4a460',
|
|
15870
|
+
seagreen: '#2e8b57',
|
|
15871
|
+
seashell: '#fff5ee',
|
|
15872
|
+
sienna: '#a0522d',
|
|
15873
|
+
silver: '#c0c0c0',
|
|
15874
|
+
skyblue: '#87ceeb',
|
|
15875
|
+
slateblue: '#6a5acd',
|
|
15876
|
+
slategray: '#708090',
|
|
15877
|
+
snow: '#fffafa',
|
|
15878
|
+
springgreen: '#00ff7f',
|
|
15879
|
+
steelblue: '#4682b4',
|
|
15880
|
+
tan: '#d2b48c',
|
|
15881
|
+
teal: '#008080',
|
|
15882
|
+
thistle: '#d8bfd8',
|
|
15883
|
+
tomato: '#ff6347',
|
|
15884
|
+
turquoise: '#40e0d0',
|
|
15885
|
+
violet: '#ee82ee',
|
|
15886
|
+
wheat: '#f5deb3',
|
|
15887
|
+
white: '#ffffff',
|
|
15888
|
+
whitesmoke: '#f5f5f5',
|
|
15889
|
+
yellow: '#ffff00',
|
|
15890
|
+
yellowgreen: '#9acd32',
|
|
15891
|
+
};
|
|
15892
|
+
|
|
15893
|
+
function isHex(hex) {
|
|
15894
|
+
return typeof hex === 'string' && /^#([A-Fa-f0-9]{3}){1,2}$/.test(hex);
|
|
15895
|
+
}
|
|
15896
|
+
function isRgb(hex) {
|
|
15897
|
+
var r =
|
|
15898
|
+
// eslint-disable-next-line max-len
|
|
15899
|
+
/^rgb(a?)\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)(?:\s*,\s*([01](?:\.\d+)?))?\s*\)$/;
|
|
15900
|
+
return typeof hex === 'string' && r.test(hex);
|
|
15901
|
+
}
|
|
15902
|
+
function isColorObj(obj) {
|
|
15903
|
+
if (typeof obj === 'object' && obj !== null) {
|
|
15904
|
+
var hasRgb = 'r' in obj && 'g' in obj && 'b' in obj;
|
|
15905
|
+
var hasValidAlpha = !('a' in obj) || (typeof obj.a === 'number' && obj.a >= 0 && obj.a <= 1);
|
|
15906
|
+
return hasRgb && hasValidAlpha;
|
|
15907
|
+
}
|
|
15908
|
+
return false;
|
|
15909
|
+
}
|
|
15910
|
+
function isColorName(name) {
|
|
15911
|
+
if (typeof name === 'string' && name in COLORS) {
|
|
15912
|
+
return true;
|
|
15913
|
+
}
|
|
15914
|
+
return false;
|
|
15915
|
+
}
|
|
15916
|
+
function toColor(value) {
|
|
15917
|
+
if (isHex(value)) {
|
|
15918
|
+
return hexToColor(value);
|
|
15919
|
+
}
|
|
15920
|
+
else if (isColorName(value)) {
|
|
15921
|
+
return colorNameToColor(value);
|
|
15922
|
+
}
|
|
15923
|
+
else if (isRgb(value)) {
|
|
15924
|
+
return rgbToColor(value);
|
|
15925
|
+
}
|
|
15926
|
+
else if (isColorObj(value)) {
|
|
15927
|
+
return colorObjectToColor(value);
|
|
15928
|
+
}
|
|
15929
|
+
throw new Error("The '".concat(value, "' cannot be converted to color"));
|
|
15930
|
+
}
|
|
15931
|
+
function colorNameToColor(name) {
|
|
15932
|
+
return hexToColor(COLORS[name]);
|
|
15933
|
+
}
|
|
15934
|
+
function hexToColor(hex) {
|
|
15935
|
+
var shortRGB = /^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])$/;
|
|
15936
|
+
var shortRGBA = /^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])$/;
|
|
15937
|
+
var longRGB = /^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/;
|
|
15938
|
+
var longRGBA = /^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/;
|
|
15939
|
+
var result;
|
|
15940
|
+
if ((result = shortRGB.exec(hex))) {
|
|
15941
|
+
return [
|
|
15942
|
+
parseInt(result[1] + result[1], 16),
|
|
15943
|
+
parseInt(result[2] + result[2], 16),
|
|
15944
|
+
parseInt(result[3] + result[3], 16),
|
|
15945
|
+
];
|
|
15946
|
+
}
|
|
15947
|
+
else if ((result = shortRGBA.exec(hex))) {
|
|
15948
|
+
return [
|
|
15949
|
+
parseInt(result[1] + result[1], 16),
|
|
15950
|
+
parseInt(result[2] + result[2], 16),
|
|
15951
|
+
parseInt(result[3] + result[3], 16),
|
|
15952
|
+
parseInt(result[4] + result[4], 16) / 255,
|
|
15953
|
+
];
|
|
15954
|
+
}
|
|
15955
|
+
else if ((result = longRGB.exec(hex))) {
|
|
15956
|
+
return [
|
|
15957
|
+
parseInt(result[1], 16),
|
|
15958
|
+
parseInt(result[2], 16),
|
|
15959
|
+
parseInt(result[3], 16),
|
|
15960
|
+
];
|
|
15961
|
+
}
|
|
15962
|
+
else if ((result = longRGBA.exec(hex))) {
|
|
15963
|
+
return [
|
|
15964
|
+
parseInt(result[1], 16),
|
|
15965
|
+
parseInt(result[2], 16),
|
|
15966
|
+
parseInt(result[3], 16),
|
|
15967
|
+
parseInt(result[4], 16) / 255,
|
|
15968
|
+
];
|
|
15969
|
+
}
|
|
15970
|
+
throw new Error("The '".concat(hex, "' Is not valid hex"));
|
|
15971
|
+
}
|
|
15972
|
+
function rgbToColor(rgb) {
|
|
15973
|
+
var rgbPattern = /^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/;
|
|
15974
|
+
var rgbaPattern = /^rgba\((\d+),\s*(\d+),\s*(\d+),\s*([\d.]+)\)$/;
|
|
15975
|
+
var matches;
|
|
15976
|
+
if ((matches = rgb.match(rgbPattern))) {
|
|
15977
|
+
return [
|
|
15978
|
+
parseInt(matches[1], 10),
|
|
15979
|
+
parseInt(matches[2], 10),
|
|
15980
|
+
parseInt(matches[3], 10),
|
|
15981
|
+
];
|
|
15982
|
+
}
|
|
15983
|
+
else if ((matches = rgb.match(rgbaPattern))) {
|
|
15984
|
+
return [
|
|
15985
|
+
parseInt(matches[1], 10),
|
|
15986
|
+
parseInt(matches[2], 10),
|
|
15987
|
+
parseInt(matches[3], 10),
|
|
15988
|
+
parseFloat(matches[4]),
|
|
15989
|
+
];
|
|
15990
|
+
}
|
|
15991
|
+
throw new Error("The '".concat(rgb, "' Is not valid rgb"));
|
|
15992
|
+
}
|
|
15993
|
+
function colorObjectToColor(_a) {
|
|
15994
|
+
var r = _a.r, g = _a.g, b = _a.b, a = _a.a;
|
|
15995
|
+
return __spreadArray([r, g, b], (a !== undefined ? [a] : []), true);
|
|
15996
|
+
}
|
|
15997
|
+
function colorToRGB(array) {
|
|
15998
|
+
return "rgb(".concat(array.join(','), ")");
|
|
15999
|
+
}
|
|
16000
|
+
|
|
16001
|
+
function linearInterpolation(input, input1, output1, input2, output2) {
|
|
16002
|
+
if (typeof output1 === 'number' && typeof output2 === 'number') {
|
|
16003
|
+
return (output1 + ((input - input1) / (input2 - input1)) * (output2 - output1));
|
|
16004
|
+
}
|
|
16005
|
+
try {
|
|
16006
|
+
var outputColor1 = toColor(output1);
|
|
16007
|
+
var outputColor2_1 = toColor(output2);
|
|
16008
|
+
return colorToRGB(outputColor1.map(function (val, index) {
|
|
16009
|
+
return Math.ceil(linearInterpolation(input, input1, val, input2, outputColor2_1[index]));
|
|
16010
|
+
}));
|
|
16011
|
+
}
|
|
16012
|
+
catch (er) {
|
|
16013
|
+
console.log(er);
|
|
16014
|
+
}
|
|
16015
|
+
throw new Error('Unsupported output type for linear interpolation.');
|
|
16016
|
+
}
|
|
16017
|
+
function interpolate(_a) {
|
|
16018
|
+
var interpolation = _a[0], input = _a[1], stops = _a.slice(2);
|
|
16019
|
+
if (stops.length < 2) {
|
|
16020
|
+
throw new Error('At least two stops are required');
|
|
16021
|
+
}
|
|
16022
|
+
if (typeof input !== 'number') {
|
|
16023
|
+
throw new Error('Input must be a number.');
|
|
16024
|
+
}
|
|
16025
|
+
if (stops.length < 2 || stops.length % 2 !== 0) {
|
|
16026
|
+
throw new Error('Invalid stops provided.');
|
|
16027
|
+
}
|
|
16028
|
+
for (var i = 0; i < stops.length - 2; i += 2) {
|
|
16029
|
+
var stopInput1 = stops[i];
|
|
16030
|
+
var stopOutput1 = stops[i + 1];
|
|
16031
|
+
var stopInput2 = stops[i + 2];
|
|
16032
|
+
var stopOutput2 = stops[i + 3];
|
|
16033
|
+
if (input >= stopInput1 && input <= stopInput2) {
|
|
16034
|
+
if (interpolation[0] === 'linear') {
|
|
16035
|
+
return linearInterpolation(input, stopInput1, stopOutput1, stopInput2, stopOutput2);
|
|
16036
|
+
}
|
|
16037
|
+
// else if (interpolation[0] === 'exponential') {
|
|
16038
|
+
// const base = interpolation[1];
|
|
16039
|
+
// return exponentialInterpolation(
|
|
16040
|
+
// input,
|
|
16041
|
+
// base,
|
|
16042
|
+
// stopInput1,
|
|
16043
|
+
// stopOutput1,
|
|
16044
|
+
// stopInput2,
|
|
16045
|
+
// stopOutput2,
|
|
16046
|
+
// );
|
|
16047
|
+
// }
|
|
16048
|
+
}
|
|
16049
|
+
}
|
|
16050
|
+
throw new Error('Invalid interpolation type.');
|
|
16051
|
+
}
|
|
16052
|
+
|
|
16053
|
+
var interpolationExpressions = {
|
|
16054
|
+
step: step,
|
|
16055
|
+
interpolate: interpolate,
|
|
16056
|
+
};
|
|
16057
|
+
|
|
16058
|
+
function isExpression(value) {
|
|
16059
|
+
if (Array.isArray(value)) {
|
|
16060
|
+
var lookup = value[0], cases = value.slice(1);
|
|
16061
|
+
var l = lookup;
|
|
16062
|
+
return (typeof l === 'string' &&
|
|
16063
|
+
l !== 'literal' &&
|
|
16064
|
+
l in expressions &&
|
|
16065
|
+
cases.length > 0);
|
|
16066
|
+
}
|
|
16067
|
+
return false;
|
|
16068
|
+
}
|
|
16069
|
+
var expressions = __assign(__assign(__assign(__assign(__assign(__assign({}, mathExpressions), typeExpressions), stringExpressions), lookupExpressions), decisionExpressions), interpolationExpressions);
|
|
16070
|
+
function evaluate(expression, data) {
|
|
16071
|
+
if (data === void 0) { data = {}; }
|
|
15483
16072
|
var name = expression[0], args = expression.slice(1);
|
|
15484
16073
|
var expressionFun = expressions[name];
|
|
15485
16074
|
if (expressionFun) {
|
|
15486
|
-
return expressionFun(
|
|
16075
|
+
return expressionFun(args.map(function (arg) { return (isExpression(arg) ? evaluate(arg, data) : arg); }), data);
|
|
15487
16076
|
}
|
|
15488
|
-
|
|
16077
|
+
throw new Error("Expression \"".concat(name, "\" is not supported."));
|
|
15489
16078
|
}
|
|
16079
|
+
|
|
15490
16080
|
function createPropertyExpressionCb(expression) {
|
|
15491
16081
|
return function (feature) {
|
|
15492
|
-
|
|
16082
|
+
var properties = feature.properties;
|
|
16083
|
+
if (properties) {
|
|
16084
|
+
return evaluate(expression, properties);
|
|
16085
|
+
}
|
|
16086
|
+
return false;
|
|
15493
16087
|
};
|
|
15494
16088
|
}
|
|
15495
16089
|
var excludeExpressionList = ['iconSize', 'iconAnchor'];
|
|
@@ -15637,32 +16231,46 @@ var NgwLeaflet = (function () {
|
|
|
15637
16231
|
return mask;
|
|
15638
16232
|
};
|
|
15639
16233
|
}
|
|
15640
|
-
function expressionCallback(
|
|
16234
|
+
function expressionCallback(_a) {
|
|
16235
|
+
var paint = _a.paint, defaultPaint = _a.defaultPaint;
|
|
15641
16236
|
var expressionCallback = createExpressionCallback(paint);
|
|
15642
16237
|
if (expressionCallback) {
|
|
15643
16238
|
var expressionPaintCb = function (feature) {
|
|
15644
|
-
return preparePaint(
|
|
16239
|
+
return preparePaint({
|
|
16240
|
+
paint: expressionCallback(feature),
|
|
16241
|
+
defaultPaint: defaultPaint,
|
|
16242
|
+
});
|
|
15645
16243
|
};
|
|
15646
|
-
expressionPaintCb.paint = paint;
|
|
16244
|
+
expressionPaintCb.paint = finalizePaint({ paint: paint, defaultPaint: defaultPaint });
|
|
15647
16245
|
return expressionPaintCb;
|
|
15648
16246
|
}
|
|
16247
|
+
return finalizePaint({ paint: paint, defaultPaint: defaultPaint });
|
|
16248
|
+
}
|
|
16249
|
+
function finalizePaint(_a) {
|
|
16250
|
+
var _b;
|
|
16251
|
+
var paint = _a.paint, defaultPaint = _a.defaultPaint;
|
|
15649
16252
|
var newPaint = __assign({}, defaultPaint);
|
|
15650
16253
|
newPaint = __assign(__assign({}, newPaint), paint);
|
|
15651
|
-
newPaint.fill = newPaint.fill !==
|
|
16254
|
+
newPaint.fill = (_b = newPaint.fill) !== null && _b !== void 0 ? _b : true;
|
|
15652
16255
|
newPaint.stroke =
|
|
15653
16256
|
newPaint.stroke !== undefined
|
|
15654
16257
|
? newPaint.stroke
|
|
15655
16258
|
: !newPaint.fill || !!(newPaint.strokeColor || newPaint.strokeOpacity);
|
|
15656
16259
|
return newPaint;
|
|
15657
16260
|
}
|
|
15658
|
-
function preparePaint(
|
|
16261
|
+
function preparePaint(_a) {
|
|
16262
|
+
var paint = _a.paint, defaultPaint = _a.defaultPaint, getPaintFunctions = _a.getPaintFunctions;
|
|
15659
16263
|
if (!paint) {
|
|
15660
16264
|
throw new Error('paint is empty');
|
|
15661
16265
|
}
|
|
15662
16266
|
var newPaint = __assign({}, defaultPaint);
|
|
15663
16267
|
if (isPaintCallback(paint)) {
|
|
15664
16268
|
var getPaintFunction = function (feature) {
|
|
15665
|
-
var getPaint = preparePaint(
|
|
16269
|
+
var getPaint = preparePaint({
|
|
16270
|
+
paint: paint(feature),
|
|
16271
|
+
defaultPaint: defaultPaint,
|
|
16272
|
+
getPaintFunctions: getPaintFunctions,
|
|
16273
|
+
});
|
|
15666
16274
|
getPaint.type = paint.type;
|
|
15667
16275
|
return getPaint;
|
|
15668
16276
|
};
|
|
@@ -15671,20 +16279,28 @@ var NgwLeaflet = (function () {
|
|
|
15671
16279
|
}
|
|
15672
16280
|
else if (isPropertiesPaint(paint)) {
|
|
15673
16281
|
return function (feature) {
|
|
15674
|
-
return preparePaint(
|
|
16282
|
+
return preparePaint({
|
|
16283
|
+
paint: createPropertiesPaint(paint)(feature),
|
|
16284
|
+
defaultPaint: defaultPaint,
|
|
16285
|
+
getPaintFunctions: getPaintFunctions,
|
|
16286
|
+
});
|
|
15675
16287
|
};
|
|
15676
16288
|
}
|
|
15677
16289
|
else if (paint.type === 'get-paint') {
|
|
15678
16290
|
var getPaint = updatePaintOptionFromCallback(paint, getPaintFunctions);
|
|
15679
16291
|
if (getPaint) {
|
|
15680
|
-
newPaint = preparePaint(
|
|
16292
|
+
newPaint = preparePaint({
|
|
16293
|
+
paint: getPaint,
|
|
16294
|
+
defaultPaint: defaultPaint,
|
|
16295
|
+
getPaintFunctions: getPaintFunctions,
|
|
16296
|
+
});
|
|
15681
16297
|
}
|
|
15682
16298
|
}
|
|
15683
16299
|
else if (paint.type === 'icon') {
|
|
15684
16300
|
return paint;
|
|
15685
16301
|
}
|
|
15686
16302
|
else {
|
|
15687
|
-
newPaint = expressionCallback(paint, defaultPaint
|
|
16303
|
+
newPaint = expressionCallback({ paint: paint, defaultPaint: defaultPaint });
|
|
15688
16304
|
}
|
|
15689
16305
|
if (isPaintCallback(newPaint)) {
|
|
15690
16306
|
return newPaint;
|
|
@@ -17440,10 +18056,18 @@ var NgwLeaflet = (function () {
|
|
|
17440
18056
|
};
|
|
17441
18057
|
if (!options.nativePaint) {
|
|
17442
18058
|
if (this.options.paint) {
|
|
17443
|
-
options.paint = preparePaint(
|
|
18059
|
+
options.paint = preparePaint({
|
|
18060
|
+
paint: options.paint || {},
|
|
18061
|
+
defaultPaint: this.options.paint,
|
|
18062
|
+
getPaintFunctions: this.getPaintFunctions,
|
|
18063
|
+
});
|
|
17444
18064
|
}
|
|
17445
18065
|
if (options.selectedPaint && this.options.selectedPaint) {
|
|
17446
|
-
options.selectedPaint = preparePaint(
|
|
18066
|
+
options.selectedPaint = preparePaint({
|
|
18067
|
+
paint: options.selectedPaint,
|
|
18068
|
+
defaultPaint: this.options.selectedPaint,
|
|
18069
|
+
getPaintFunctions: this.getPaintFunctions,
|
|
18070
|
+
});
|
|
17447
18071
|
}
|
|
17448
18072
|
}
|
|
17449
18073
|
};
|