@sswroom/sswr 1.6.13 → 1.6.15
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/Changelog +14 -0
- package/certutil.d.ts +1 -1
- package/certutil.js +645 -23
- package/data.d.ts +30 -2
- package/data.js +673 -72
- package/exporter/GPXExporter.d.ts +12 -0
- package/exporter/GPXExporter.js +89 -0
- package/exporter/XLSXExporter.d.ts +40 -0
- package/exporter/XLSXExporter.js +1976 -0
- package/hash.d.ts +25 -0
- package/hash.js +257 -2
- package/map.d.ts +14 -10
- package/map.js +57 -10
- package/osm.js +41 -2
- package/package.json +4 -1
- package/parser.js +46 -0
- package/spreadsheet.d.ts +786 -0
- package/spreadsheet.js +3294 -0
- package/text.d.ts +19 -0
- package/text.js +17 -0
- package/web.d.ts +2 -0
- package/web.js +28 -0
- package/zip.d.ts +57 -0
- package/zip.js +474 -0
package/hash.d.ts
CHANGED
|
@@ -72,4 +72,29 @@ export class MD5 extends Hash
|
|
|
72
72
|
getBlockSize(): number;
|
|
73
73
|
|
|
74
74
|
static calcBlock(hVals: number[], block: DataView): void;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export class CRC32
|
|
78
|
+
{
|
|
79
|
+
static getPolynormialIEEE(): number;
|
|
80
|
+
static getPolynormialCastagnoli(): number;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export class CRC32R extends Hash
|
|
84
|
+
{
|
|
85
|
+
crctab: number[];
|
|
86
|
+
currVal: number;
|
|
87
|
+
|
|
88
|
+
initTable(polynomial: number): void;
|
|
89
|
+
|
|
90
|
+
constructor(param: CRC32R|number|null|undefined);
|
|
91
|
+
|
|
92
|
+
getName(): string;
|
|
93
|
+
clone(): Hash;
|
|
94
|
+
clear(): void;
|
|
95
|
+
calc(buff: ArrayBuffer): void;
|
|
96
|
+
getValue(): ArrayBuffer;
|
|
97
|
+
getBlockSize(): number;
|
|
98
|
+
|
|
99
|
+
calcDirect(buff: ArrayBuffer): number;
|
|
75
100
|
}
|
package/hash.js
CHANGED
|
@@ -80,6 +80,9 @@ export class SHA1 extends Hash
|
|
|
80
80
|
this.messageBlock = new Array(64);
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
+
/**
|
|
84
|
+
* @param {ArrayBuffer | ArrayLike<number>} buff
|
|
85
|
+
*/
|
|
83
86
|
calc(buff)
|
|
84
87
|
{
|
|
85
88
|
if (!(buff instanceof ArrayBuffer))
|
|
@@ -167,7 +170,7 @@ export class SHA1 extends Hash
|
|
|
167
170
|
calBuff[i] = 0;
|
|
168
171
|
i++;
|
|
169
172
|
}
|
|
170
|
-
SHA1.calcBlock(intHash, calBuff);
|
|
173
|
+
SHA1.calcBlock(intHash, new Uint8Array(calBuff));
|
|
171
174
|
i = 0;
|
|
172
175
|
while (i < 56)
|
|
173
176
|
{
|
|
@@ -193,6 +196,10 @@ export class SHA1 extends Hash
|
|
|
193
196
|
return 64;
|
|
194
197
|
}
|
|
195
198
|
|
|
199
|
+
/**
|
|
200
|
+
* @param {number[]} intermediateHash
|
|
201
|
+
* @param {ArrayBuffer} messageBlock
|
|
202
|
+
*/
|
|
196
203
|
static calcBlock(intermediateHash, messageBlock)
|
|
197
204
|
{
|
|
198
205
|
let w = new Array(80);
|
|
@@ -306,6 +313,9 @@ export class MD5 extends Hash
|
|
|
306
313
|
this.buffSize = 0;
|
|
307
314
|
}
|
|
308
315
|
|
|
316
|
+
/**
|
|
317
|
+
* @param {ArrayBuffer | ArrayLike<number>} buff
|
|
318
|
+
*/
|
|
309
319
|
calc(buff)
|
|
310
320
|
{
|
|
311
321
|
if (!(buff instanceof ArrayBuffer))
|
|
@@ -356,6 +366,7 @@ export class MD5 extends Hash
|
|
|
356
366
|
|
|
357
367
|
getValue()
|
|
358
368
|
{
|
|
369
|
+
/** @type {number[]} */
|
|
359
370
|
let calBuff = new Array(64);
|
|
360
371
|
let intHash = [
|
|
361
372
|
this.h[0],
|
|
@@ -389,7 +400,7 @@ export class MD5 extends Hash
|
|
|
389
400
|
calBuff[i] = 0;
|
|
390
401
|
i++;
|
|
391
402
|
}
|
|
392
|
-
MD5.calcBlock(intHash, calBuff);
|
|
403
|
+
MD5.calcBlock(intHash, new Uint8Array(calBuff));
|
|
393
404
|
i = 0;
|
|
394
405
|
while (i < 56)
|
|
395
406
|
{
|
|
@@ -415,6 +426,15 @@ export class MD5 extends Hash
|
|
|
415
426
|
return 64;
|
|
416
427
|
}
|
|
417
428
|
|
|
429
|
+
/**
|
|
430
|
+
* @param {number[]} vals
|
|
431
|
+
* @param {number} w
|
|
432
|
+
* @param {number} x
|
|
433
|
+
* @param {number} y
|
|
434
|
+
* @param {number} z
|
|
435
|
+
* @param {number} dataNum
|
|
436
|
+
* @param {number} s
|
|
437
|
+
*/
|
|
418
438
|
static step1(vals, w, x, y, z, dataNum, s)
|
|
419
439
|
{
|
|
420
440
|
vals[w] += vals[z] ^ (vals[x] & (vals[y] ^ vals[z]));
|
|
@@ -423,6 +443,15 @@ export class MD5 extends Hash
|
|
|
423
443
|
vals[w] += vals[x];
|
|
424
444
|
}
|
|
425
445
|
|
|
446
|
+
/**
|
|
447
|
+
* @param {number[]} vals
|
|
448
|
+
* @param {number} w
|
|
449
|
+
* @param {number} x
|
|
450
|
+
* @param {number} y
|
|
451
|
+
* @param {number} z
|
|
452
|
+
* @param {number} dataNum
|
|
453
|
+
* @param {number} s
|
|
454
|
+
*/
|
|
426
455
|
static step2(vals, w, x, y, z, dataNum, s)
|
|
427
456
|
{
|
|
428
457
|
vals[w] += vals[y] ^ (vals[z] & (vals[x] ^ vals[y]));
|
|
@@ -431,6 +460,15 @@ export class MD5 extends Hash
|
|
|
431
460
|
vals[w] += vals[x];
|
|
432
461
|
}
|
|
433
462
|
|
|
463
|
+
/**
|
|
464
|
+
* @param {number[]} vals
|
|
465
|
+
* @param {number} w
|
|
466
|
+
* @param {number} x
|
|
467
|
+
* @param {number} y
|
|
468
|
+
* @param {number} z
|
|
469
|
+
* @param {number} dataNum
|
|
470
|
+
* @param {number} s
|
|
471
|
+
*/
|
|
434
472
|
static step3(vals, w, x, y, z, dataNum, s)
|
|
435
473
|
{
|
|
436
474
|
vals[w] += vals[z] ^ vals[y] ^ vals[x];
|
|
@@ -439,6 +477,15 @@ export class MD5 extends Hash
|
|
|
439
477
|
vals[w] += vals[x];
|
|
440
478
|
}
|
|
441
479
|
|
|
480
|
+
/**
|
|
481
|
+
* @param {number[]} vals
|
|
482
|
+
* @param {number} w
|
|
483
|
+
* @param {number} x
|
|
484
|
+
* @param {number} y
|
|
485
|
+
* @param {number} z
|
|
486
|
+
* @param {number} dataNum
|
|
487
|
+
* @param {number} s
|
|
488
|
+
*/
|
|
442
489
|
static step4(vals, w, x, y, z, dataNum, s)
|
|
443
490
|
{
|
|
444
491
|
vals[w] += vals[y] ^ (vals[x] | ~vals[z]);
|
|
@@ -447,6 +494,10 @@ export class MD5 extends Hash
|
|
|
447
494
|
vals[w] += vals[x];
|
|
448
495
|
}
|
|
449
496
|
|
|
497
|
+
/**
|
|
498
|
+
* @param {number[]} hVals
|
|
499
|
+
* @param {ArrayBuffer} block
|
|
500
|
+
*/
|
|
450
501
|
static calcBlock(hVals, block)
|
|
451
502
|
{
|
|
452
503
|
let view = new DataView(block);
|
|
@@ -550,3 +601,207 @@ export class MD5 extends Hash
|
|
|
550
601
|
hVals[3] = vals[d];
|
|
551
602
|
}
|
|
552
603
|
}
|
|
604
|
+
|
|
605
|
+
/**
|
|
606
|
+
* @param {number} polynomial
|
|
607
|
+
*/
|
|
608
|
+
function crc32rReverse(polynomial)
|
|
609
|
+
{
|
|
610
|
+
let v = polynomial;
|
|
611
|
+
let v2 = 0;
|
|
612
|
+
let i = 32;
|
|
613
|
+
while (i-- > 0)
|
|
614
|
+
{
|
|
615
|
+
v2 = (v2 >>> 1) | (v & 0x80000000);
|
|
616
|
+
v <<= 1;
|
|
617
|
+
}
|
|
618
|
+
return v2;
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
/**
|
|
622
|
+
* @param {number[]} tab
|
|
623
|
+
* @param {number} rpn
|
|
624
|
+
*/
|
|
625
|
+
function crc32rInitTable(tab, rpn)
|
|
626
|
+
{
|
|
627
|
+
let i = 256;
|
|
628
|
+
let j;
|
|
629
|
+
let v;
|
|
630
|
+
while (i-- > 0)
|
|
631
|
+
{
|
|
632
|
+
v = i;
|
|
633
|
+
j = 8;
|
|
634
|
+
while (j-- > 0)
|
|
635
|
+
{
|
|
636
|
+
if (v & 1)
|
|
637
|
+
{
|
|
638
|
+
v = (v >>> 1) ^ rpn;
|
|
639
|
+
}
|
|
640
|
+
else
|
|
641
|
+
{
|
|
642
|
+
v = (v >>> 1);
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
tab[i] = v;
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
i = 256;
|
|
649
|
+
while (i-- > 0)
|
|
650
|
+
{
|
|
651
|
+
tab[256 + i] = (tab[0 + i] >>> 8) ^ tab[tab[0 + i] & 0xff];
|
|
652
|
+
tab[512 + i] = (tab[256 + i] >>> 8) ^ tab[tab[256 + i] & 0xff];
|
|
653
|
+
tab[768 + i] = (tab[512 + i] >>> 8) ^ tab[tab[512 + i] & 0xff];
|
|
654
|
+
tab[1024 + i] = (tab[768 + i] >>> 8) ^ tab[tab[768 + i] & 0xff];
|
|
655
|
+
tab[1280 + i] = (tab[1024 + i] >>> 8) ^ tab[tab[1024 + i] & 0xff];
|
|
656
|
+
tab[1536 + i] = (tab[1280 + i] >>> 8) ^ tab[tab[1280 + i] & 0xff];
|
|
657
|
+
tab[1792 + i] = (tab[1536 + i] >>> 8) ^ tab[tab[1536 + i] & 0xff];
|
|
658
|
+
tab[2048 + i] = (tab[1792 + i] >>> 8) ^ tab[tab[1792 + i] & 0xff];
|
|
659
|
+
tab[2304 + i] = (tab[2048 + i] >>> 8) ^ tab[tab[2048 + i] & 0xff];
|
|
660
|
+
tab[2560 + i] = (tab[2304 + i] >>> 8) ^ tab[tab[2304 + i] & 0xff];
|
|
661
|
+
tab[2816 + i] = (tab[2560 + i] >>> 8) ^ tab[tab[2560 + i] & 0xff];
|
|
662
|
+
tab[3072 + i] = (tab[2816 + i] >>> 8) ^ tab[tab[2816 + i] & 0xff];
|
|
663
|
+
tab[3328 + i] = (tab[3072 + i] >>> 8) ^ tab[tab[3072 + i] & 0xff];
|
|
664
|
+
tab[3584 + i] = (tab[3328 + i] >>> 8) ^ tab[tab[3328 + i] & 0xff];
|
|
665
|
+
tab[3840 + i] = (tab[3584 + i] >>> 8) ^ tab[tab[3584 + i] & 0xff];
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
/**
|
|
670
|
+
* @param {ArrayBuffer} buff
|
|
671
|
+
* @param {number[]} tab
|
|
672
|
+
* @param {number} currVal
|
|
673
|
+
*/
|
|
674
|
+
function crc32rCalc(buff, tab, currVal)
|
|
675
|
+
{
|
|
676
|
+
let reader = new data.ByteReader(buff);
|
|
677
|
+
let i = 0;
|
|
678
|
+
let length = reader.getLength();
|
|
679
|
+
while ((length - i) >= 16)
|
|
680
|
+
{
|
|
681
|
+
let currVal1 = reader.readUInt32(i, true) ^ currVal;
|
|
682
|
+
let currVal2 = reader.readUInt32(i + 4, true);
|
|
683
|
+
let currVal3 = reader.readUInt32(i + 8, true);
|
|
684
|
+
let currVal4 = reader.readUInt32(i + 12, true);
|
|
685
|
+
i += 16;
|
|
686
|
+
currVal = tab[0 + (currVal4 >>> 24)];
|
|
687
|
+
currVal ^= tab[256 + ((currVal4 >>> 16) & 0xff)];
|
|
688
|
+
currVal ^= tab[512 + ((currVal4 >>> 8) & 0xff)];
|
|
689
|
+
currVal ^= tab[768 + (currVal4 & 0xff)];
|
|
690
|
+
currVal ^= tab[1024 + (currVal3 >>> 24)];
|
|
691
|
+
currVal ^= tab[1280 + ((currVal3 >>> 16) & 0xff)];
|
|
692
|
+
currVal ^= tab[1536 + ((currVal3 >>> 8) & 0xff)];
|
|
693
|
+
currVal ^= tab[1792 + (currVal3 & 0xff)];
|
|
694
|
+
currVal ^= tab[2048 + (currVal2 >>> 24)];
|
|
695
|
+
currVal ^= tab[2304 + ((currVal2 >>> 16) & 0xff)];
|
|
696
|
+
currVal ^= tab[2560 + ((currVal2 >>> 8) & 0xff)];
|
|
697
|
+
currVal ^= tab[2816 + (currVal2 & 0xff)];
|
|
698
|
+
currVal ^= tab[3072 + (currVal1 >>> 24)];
|
|
699
|
+
currVal ^= tab[3328 + ((currVal1 >>> 16) & 0xff)];
|
|
700
|
+
currVal ^= tab[3584 + ((currVal1 >>> 8) & 0xff)];
|
|
701
|
+
currVal ^= tab[3840 + (currVal1 & 0xff)];
|
|
702
|
+
}
|
|
703
|
+
while ((length - i) >= 4)
|
|
704
|
+
{
|
|
705
|
+
currVal ^= reader.readUInt32(i, true);
|
|
706
|
+
i += 4;
|
|
707
|
+
currVal = tab[768 + (currVal & 0xff)] ^ tab[512 + ((currVal >>> 8) & 0xff)] ^ tab[256 + ((currVal >>> 16) & 0xff)] ^ tab[0 + (currVal >>> 24)];
|
|
708
|
+
}
|
|
709
|
+
while ((length - i) > 0)
|
|
710
|
+
{
|
|
711
|
+
currVal = tab[(currVal & 0xff) ^ reader.readUInt8(i)] ^ (currVal >>> 8);
|
|
712
|
+
i++;
|
|
713
|
+
}
|
|
714
|
+
return currVal;
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
export class CRC32
|
|
718
|
+
{
|
|
719
|
+
static getPolynormialIEEE()
|
|
720
|
+
{
|
|
721
|
+
return 0x04C11DB7;
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
static getPolynormialCastagnoli()
|
|
725
|
+
{
|
|
726
|
+
return 0x1EDC6F41;
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
export class CRC32R extends Hash
|
|
731
|
+
{
|
|
732
|
+
/**
|
|
733
|
+
* @param {number} polynomial
|
|
734
|
+
*/
|
|
735
|
+
initTable(polynomial)
|
|
736
|
+
{
|
|
737
|
+
this.currVal = 0xffffffff;
|
|
738
|
+
let rpn = crc32rReverse(polynomial);
|
|
739
|
+
this.crctab = new Array(256 * 16);
|
|
740
|
+
crc32rInitTable(this.crctab, rpn);
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
/**
|
|
744
|
+
* @param {{ crctab: any; currVal: any; }} param
|
|
745
|
+
*/
|
|
746
|
+
constructor(param)
|
|
747
|
+
{
|
|
748
|
+
super();
|
|
749
|
+
if (param instanceof CRC32R)
|
|
750
|
+
{
|
|
751
|
+
this.crctab = param.crctab;
|
|
752
|
+
this.currVal = param.currVal;
|
|
753
|
+
}
|
|
754
|
+
else if (typeof param == "number")
|
|
755
|
+
{
|
|
756
|
+
|
|
757
|
+
this.initTable(param);
|
|
758
|
+
}
|
|
759
|
+
else
|
|
760
|
+
{
|
|
761
|
+
this.initTable(CRC32.getPolynormialIEEE());
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
getName()
|
|
766
|
+
{
|
|
767
|
+
return "CRC (32-bit Reversed)";
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
clone()
|
|
771
|
+
{
|
|
772
|
+
return new CRC32R(this);
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
clear()
|
|
776
|
+
{
|
|
777
|
+
this.currVal = 0xffffffff;
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
/**
|
|
781
|
+
* @param {ArrayBuffer} buff
|
|
782
|
+
*/
|
|
783
|
+
calc(buff)
|
|
784
|
+
{
|
|
785
|
+
this.currVal = crc32rCalc(buff, this.crctab, this.currVal);
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
getValue()
|
|
789
|
+
{
|
|
790
|
+
let builder = new data.ByteBuilder();
|
|
791
|
+
builder.writeInt32(0, ~this.currVal, false);
|
|
792
|
+
return builder.build();
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
getBlockSize()
|
|
796
|
+
{
|
|
797
|
+
return 1;
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
/**
|
|
801
|
+
* @param {ArrayBuffer} buff
|
|
802
|
+
*/
|
|
803
|
+
calcDirect(buff)
|
|
804
|
+
{
|
|
805
|
+
return ~crc32rCalc(buff, this.crctab, 0xffffffff);
|
|
806
|
+
}
|
|
807
|
+
}
|
package/map.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as data from "./data";
|
|
2
2
|
import * as geometry from "./geometry";
|
|
3
3
|
import * as kml from "./kml";
|
|
4
4
|
import * as map from "./map";
|
|
@@ -82,22 +82,26 @@ export function getLayerData(svcUrl: string, onResultFunc: Function, layerName:
|
|
|
82
82
|
|
|
83
83
|
declare class GPSRecord
|
|
84
84
|
{
|
|
85
|
-
|
|
85
|
+
recTime: number;
|
|
86
86
|
lat: number;
|
|
87
87
|
lon: number;
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
88
|
+
altitude: number;
|
|
89
|
+
speed: number;
|
|
90
|
+
heading: number;
|
|
91
|
+
valid: boolean;
|
|
92
|
+
sateUsed: number;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
export class GPSTrack
|
|
95
|
+
export class GPSTrack extends data.ParsedObject
|
|
96
96
|
{
|
|
97
97
|
recs: GPSRecord[];
|
|
98
|
-
|
|
98
|
+
|
|
99
|
+
constructor(recs: GPSRecord[], sourceName?: string);
|
|
100
|
+
addPosition(pos: GeolocationPosition);
|
|
101
|
+
getTrackCnt(): number;
|
|
102
|
+
getTrack(index: number): GPSRecord[]|null;
|
|
99
103
|
createLineString(): geometry.LineString;
|
|
100
|
-
getPosByTime(ts: Timestamp): math.Vector3;
|
|
104
|
+
getPosByTime(ts: data.Timestamp): math.Vector3;
|
|
101
105
|
getPosByTicks(ticks: number): math.Vector3;
|
|
102
106
|
}
|
|
103
107
|
|
package/map.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as data from "./data.js";
|
|
1
2
|
import * as geometry from "./geometry.js";
|
|
2
3
|
import * as math from "./math.js";
|
|
3
4
|
import * as web from "./web.js";
|
|
@@ -46,6 +47,9 @@ export function calcDistance(srid, geom, x, y)
|
|
|
46
47
|
return csys.calcSurfaceDistance(x, y, pt.x, pt.y, unit.Distance.Unit.METER);
|
|
47
48
|
}
|
|
48
49
|
|
|
50
|
+
/**
|
|
51
|
+
* @param {string} svcUrl
|
|
52
|
+
*/
|
|
49
53
|
export function getLayers(svcUrl, onResultFunc)
|
|
50
54
|
{
|
|
51
55
|
web.loadJSON(svcUrl + '/getlayers', onResultFunc);
|
|
@@ -56,13 +60,49 @@ export function getLayerData(svcUrl, onResultFunc, layerName, dataFormat)
|
|
|
56
60
|
web.loadJSON(svcUrl + '/getlayerdata?name='+encodeURIComponent(layerName)+"&fmt="+encodeURIComponent(dataFormat), onResultFunc);
|
|
57
61
|
}
|
|
58
62
|
|
|
59
|
-
export class GPSTrack
|
|
63
|
+
export class GPSTrack extends data.ParsedObject
|
|
60
64
|
{
|
|
61
|
-
|
|
65
|
+
/**
|
|
66
|
+
* @param {{recTime: number;lat: number;lon: number;altitude: number;speed: number;heading: number;valid: boolean;sateUsed: number;}[]} recs
|
|
67
|
+
* @param {string|undefined} sourceName
|
|
68
|
+
*/
|
|
69
|
+
constructor(recs, sourceName)
|
|
62
70
|
{
|
|
71
|
+
super(sourceName||"Untitled.gpx", "GPSTrack");
|
|
63
72
|
this.recs = recs;
|
|
64
73
|
}
|
|
65
74
|
|
|
75
|
+
/**
|
|
76
|
+
* @param {GeolocationPosition} pos
|
|
77
|
+
*/
|
|
78
|
+
addPosition(pos)
|
|
79
|
+
{
|
|
80
|
+
this.recs.push({
|
|
81
|
+
recTime: pos.timestamp,
|
|
82
|
+
lat: pos.coords.latitude,
|
|
83
|
+
lon: pos.coords.longitude,
|
|
84
|
+
altitude: pos.coords.altitude || 0,
|
|
85
|
+
heading: pos.coords.heading||0,
|
|
86
|
+
speed: (pos.coords.speed || 0) * 3.6 / 1.852,
|
|
87
|
+
valid: true,
|
|
88
|
+
sateUsed: -1});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
getTrackCnt()
|
|
92
|
+
{
|
|
93
|
+
return 1;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* @param {number} index
|
|
98
|
+
*/
|
|
99
|
+
getTrack(index)
|
|
100
|
+
{
|
|
101
|
+
if (index == 0)
|
|
102
|
+
return this.recs;
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
|
|
66
106
|
createLineString()
|
|
67
107
|
{
|
|
68
108
|
let coordinates = new Array();
|
|
@@ -70,20 +110,26 @@ export class GPSTrack
|
|
|
70
110
|
let j = this.recs.length;
|
|
71
111
|
while (i < j)
|
|
72
112
|
{
|
|
73
|
-
coordinates.push([this.recs[i].lon, this.recs[i].lat, this.recs[i].
|
|
113
|
+
coordinates.push([this.recs[i].lon, this.recs[i].lat, this.recs[i].altitude]);
|
|
74
114
|
i++;
|
|
75
115
|
}
|
|
76
116
|
return new geometry.LineString(4326, coordinates);
|
|
77
117
|
}
|
|
78
118
|
|
|
119
|
+
/**
|
|
120
|
+
* @param {data.Timestamp} ts
|
|
121
|
+
*/
|
|
79
122
|
getPosByTime(ts)
|
|
80
123
|
{
|
|
81
124
|
return this.getPosByTicks(ts.toTicks());
|
|
82
125
|
}
|
|
83
126
|
|
|
127
|
+
/**
|
|
128
|
+
* @param {number} ticks
|
|
129
|
+
*/
|
|
84
130
|
getPosByTicks(ticks)
|
|
85
131
|
{
|
|
86
|
-
if (ticks >= this.recs[0].
|
|
132
|
+
if (ticks >= this.recs[0].recTime && ticks <= this.recs[this.recs.length - 1].recTime)
|
|
87
133
|
{
|
|
88
134
|
let i = 0;
|
|
89
135
|
let j = this.recs.length - 1;
|
|
@@ -92,7 +138,7 @@ export class GPSTrack
|
|
|
92
138
|
while (i <= j)
|
|
93
139
|
{
|
|
94
140
|
k = (i + j) >> 1;
|
|
95
|
-
l = this.recs[k].
|
|
141
|
+
l = this.recs[k].recTime;
|
|
96
142
|
if (ticks > l)
|
|
97
143
|
{
|
|
98
144
|
i = k + 1;
|
|
@@ -103,17 +149,17 @@ export class GPSTrack
|
|
|
103
149
|
}
|
|
104
150
|
else
|
|
105
151
|
{
|
|
106
|
-
return new math.Vector3(this.recs[k].lon, this.recs[k].lat, this.recs[k].
|
|
152
|
+
return new math.Vector3(this.recs[k].lon, this.recs[k].lat, this.recs[k].altitude);
|
|
107
153
|
}
|
|
108
154
|
}
|
|
109
155
|
let tDiff;
|
|
110
156
|
let rec1 = this.recs[i - 1];
|
|
111
157
|
let rec2 = this.recs[i];
|
|
112
|
-
tDiff = rec2.
|
|
158
|
+
tDiff = rec2.recTime - rec1.recTime;
|
|
113
159
|
return new math.Vector3(
|
|
114
|
-
(rec1.lon * (rec2.
|
|
115
|
-
(rec1.lat * (rec2.
|
|
116
|
-
(rec1.
|
|
160
|
+
(rec1.lon * (rec2.recTime - ticks) + rec2.lon * (ticks - rec1.recTime)) / tDiff,
|
|
161
|
+
(rec1.lat * (rec2.recTime - ticks) + rec2.lat * (ticks - rec1.recTime)) / tDiff,
|
|
162
|
+
(rec1.altitude * (rec2.recTime - ticks) + rec2.altitude * (ticks - rec1.recTime)) / tDiff);
|
|
117
163
|
}
|
|
118
164
|
return new math.Vector3(0, 0, 0);
|
|
119
165
|
}
|
|
@@ -181,6 +227,7 @@ export class WMS
|
|
|
181
227
|
let node = doc.childNodes[0];
|
|
182
228
|
if (node.nodeName == "WMS_Capabilities" || node.nodeName == "WMT_MS_Capabilities")
|
|
183
229
|
{
|
|
230
|
+
// @ts-ignore
|
|
184
231
|
let attr = node.attributes.getNamedItem("version");
|
|
185
232
|
if (attr)
|
|
186
233
|
{
|
package/osm.js
CHANGED
|
@@ -1,24 +1,53 @@
|
|
|
1
|
+
import * as math from "./math.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @param {number} lon
|
|
5
|
+
* @param {number} level
|
|
6
|
+
* @param {number} tileSize
|
|
7
|
+
*/
|
|
1
8
|
export function lon2PixelX(lon, level, tileSize)
|
|
2
9
|
{
|
|
3
10
|
return ((lon + 180.0) / 360.0 * (1 << level)) * tileSize;
|
|
4
11
|
}
|
|
5
12
|
|
|
13
|
+
/**
|
|
14
|
+
* @param {number} lat
|
|
15
|
+
* @param {number} level
|
|
16
|
+
* @param {number} tileSize
|
|
17
|
+
*/
|
|
6
18
|
export function lat2PixelY(lat, level, tileSize)
|
|
7
19
|
{
|
|
8
20
|
return ((1.0 - Math.log(Math.tan(lat * Math.PI / 180.0) + 1.0 / Math.cos(lat * Math.PI / 180.0)) / Math.PI) / 2.0 * (1 << level)) * tileSize;
|
|
9
21
|
}
|
|
10
22
|
|
|
23
|
+
/**
|
|
24
|
+
* @param {number} x
|
|
25
|
+
* @param {number} level
|
|
26
|
+
* @param {number} tileSize
|
|
27
|
+
*/
|
|
11
28
|
export function pixelX2Lon(x, level, tileSize)
|
|
12
29
|
{
|
|
13
30
|
return x / tileSize * 360.0 / (1 << level) - 180;
|
|
14
31
|
}
|
|
15
32
|
|
|
33
|
+
/**
|
|
34
|
+
* @param {number} y
|
|
35
|
+
* @param {number} level
|
|
36
|
+
* @param {number} tileSize
|
|
37
|
+
*/
|
|
16
38
|
export function pixelY2Lat(y, level, tileSize)
|
|
17
39
|
{
|
|
18
40
|
let n = Math.PI - 2.0 * Math.PI * y / tileSize / (1 << level);
|
|
19
41
|
return 180.0 / Math.PI * Math.atan(0.5 * (Math.exp(n) - Math.exp(-n)));
|
|
20
42
|
}
|
|
21
43
|
|
|
44
|
+
/**
|
|
45
|
+
* @param {string} osmUrl
|
|
46
|
+
* @param {math.Coord2D} minCoord
|
|
47
|
+
* @param {math.Coord2D} maxCoord
|
|
48
|
+
* @param {number} minLev
|
|
49
|
+
* @param {number} maxLev
|
|
50
|
+
*/
|
|
22
51
|
export function tileUrls(osmUrl, minCoord, maxCoord, minLev, maxLev)
|
|
23
52
|
{
|
|
24
53
|
let tileSize = 256;
|
|
@@ -42,7 +71,7 @@ export function tileUrls(osmUrl, minCoord, maxCoord, minLev, maxLev)
|
|
|
42
71
|
i = minX;
|
|
43
72
|
while (i <= maxX)
|
|
44
73
|
{
|
|
45
|
-
url = osmUrl.replace("{x}", i).replace("{y}", j).replace("{z}", minLev);
|
|
74
|
+
url = osmUrl.replace("{x}", ""+i).replace("{y}", ""+j).replace("{z}", ""+minLev);
|
|
46
75
|
ret.push(url);
|
|
47
76
|
i++;
|
|
48
77
|
}
|
|
@@ -53,6 +82,13 @@ export function tileUrls(osmUrl, minCoord, maxCoord, minLev, maxLev)
|
|
|
53
82
|
return ret;
|
|
54
83
|
}
|
|
55
84
|
|
|
85
|
+
/**
|
|
86
|
+
* @param {string[]} urls
|
|
87
|
+
* @param {string} osmUrl
|
|
88
|
+
* @param {number} minLev
|
|
89
|
+
* @param {number} maxLev
|
|
90
|
+
* @param {math.RectArea[]| null} areaList
|
|
91
|
+
*/
|
|
56
92
|
export function removeTileUrls(urls, osmUrl, minLev, maxLev, areaList)
|
|
57
93
|
{
|
|
58
94
|
if (areaList == null || areaList.length == 0)
|
|
@@ -88,7 +124,7 @@ export function removeTileUrls(urls, osmUrl, minLev, maxLev, areaList)
|
|
|
88
124
|
i = minX;
|
|
89
125
|
while (i <= maxX)
|
|
90
126
|
{
|
|
91
|
-
url = osmUrl.replace("{x}", i).replace("{y}", j).replace("{z}", minLev);
|
|
127
|
+
url = osmUrl.replace("{x}", ""+i).replace("{y}", ""+j).replace("{z}", ""+minLev);
|
|
92
128
|
delete urlMap[url];
|
|
93
129
|
i++;
|
|
94
130
|
}
|
|
@@ -104,6 +140,9 @@ export function removeTileUrls(urls, osmUrl, minLev, maxLev, areaList)
|
|
|
104
140
|
}
|
|
105
141
|
}
|
|
106
142
|
|
|
143
|
+
/**
|
|
144
|
+
* @param {number} scale
|
|
145
|
+
*/
|
|
107
146
|
export function scale2Level(scale)
|
|
108
147
|
{
|
|
109
148
|
return Math.round(Math.log10(204094080000.0 / scale / 256) / Math.log10(2));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sswroom/sswr",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.15",
|
|
4
4
|
"description": "Libraries made by sswroom",
|
|
5
5
|
"main": "sswr.js",
|
|
6
6
|
"scripts": {
|
|
@@ -11,5 +11,8 @@
|
|
|
11
11
|
"devDependencies": {
|
|
12
12
|
"cesium": "^1.113.0",
|
|
13
13
|
"leaflet": "^1.9.4"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"pako": "^2.1.0"
|
|
14
17
|
}
|
|
15
18
|
}
|