@sswroom/sswr 1.6.4 → 1.6.6
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 +13 -0
- package/cert.d.ts +55 -53
- package/cert.js +733 -134
- package/certutil.d.ts +11 -11
- package/certutil.js +11 -6
- package/data.d.ts +4 -1
- package/data.js +119 -24
- package/geometry.d.ts +4 -2
- package/geometry.js +89 -13
- package/hash.js +7 -2
- package/kml.d.ts +1 -1
- package/kml.js +46 -4
- package/leaflet.d.ts +2 -2
- package/leaflet.js +2 -0
- package/map.d.ts +5 -1
- package/map.js +11 -0
- package/math.js +368 -29
- package/media.d.ts +1 -1
- package/media.js +20 -9
- package/package.json +1 -1
- package/parser.js +20 -10
- package/text.d.ts +1 -1
- package/text.js +9 -2
- package/unit.js +746 -663
- package/web.d.ts +3 -0
- package/web.js +138 -15
package/media.d.ts
CHANGED
|
@@ -98,7 +98,7 @@ export class EXIFData
|
|
|
98
98
|
parseMakerNote(buff: ArrayBuffer): EXIFData | null;
|
|
99
99
|
|
|
100
100
|
static getEXIFName(exifMaker: EXIFMaker, id: number, subId: number): string;
|
|
101
|
-
static parseIFD(reader: data.ByteReader, ofst: number, lsb: boolean, nextOfst: object, readBase: number, maker?: EXIFMaker): EXIFData | null;
|
|
101
|
+
static parseIFD(reader: data.ByteReader, ofst: number, lsb: boolean, nextOfst: object | null, readBase: number | null, maker?: EXIFMaker): EXIFData | null;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
export class StaticImage extends data.ParsedObject
|
package/media.js
CHANGED
|
@@ -1359,7 +1359,7 @@ export class EXIFData
|
|
|
1359
1359
|
getPhotoDate()
|
|
1360
1360
|
{
|
|
1361
1361
|
let item;
|
|
1362
|
-
if (this.exifMaker ==
|
|
1362
|
+
if (this.exifMaker == EXIFMaker.Standard)
|
|
1363
1363
|
{
|
|
1364
1364
|
if ((item = this.exifMap[36867]))
|
|
1365
1365
|
{
|
|
@@ -1386,7 +1386,7 @@ export class EXIFData
|
|
|
1386
1386
|
}
|
|
1387
1387
|
if ((item = this.exifMap[306]))
|
|
1388
1388
|
{
|
|
1389
|
-
if (item.type ==
|
|
1389
|
+
if (item.type == EXIFType.STRING)
|
|
1390
1390
|
{
|
|
1391
1391
|
return data.Timestamp.fromStr(item.data, data.DateTimeUtil.getLocalTzQhr());
|
|
1392
1392
|
}
|
|
@@ -1605,7 +1605,7 @@ export class EXIFData
|
|
|
1605
1605
|
{
|
|
1606
1606
|
return null;
|
|
1607
1607
|
}
|
|
1608
|
-
ret.lat =
|
|
1608
|
+
ret.lat = val;
|
|
1609
1609
|
}
|
|
1610
1610
|
else
|
|
1611
1611
|
{
|
|
@@ -1715,7 +1715,7 @@ export class EXIFData
|
|
|
1715
1715
|
{
|
|
1716
1716
|
hh = item1.data[0];
|
|
1717
1717
|
mm = item1.data[2];
|
|
1718
|
-
val = item1.data[4] /
|
|
1718
|
+
val = item1.data[4] / item1.data[5];
|
|
1719
1719
|
ss = Math.floor(val);
|
|
1720
1720
|
ms = (val - ss);
|
|
1721
1721
|
}
|
|
@@ -1933,6 +1933,14 @@ export class EXIFData
|
|
|
1933
1933
|
return name || ("Tag "+subId);
|
|
1934
1934
|
}
|
|
1935
1935
|
|
|
1936
|
+
/**
|
|
1937
|
+
* @param {data.ByteReader} reader
|
|
1938
|
+
* @param {number} ofst
|
|
1939
|
+
* @param {boolean} lsb
|
|
1940
|
+
* @param {object | null} nextOfst
|
|
1941
|
+
* @param {number | null} readBase
|
|
1942
|
+
* @param {string | null | undefined} [maker]
|
|
1943
|
+
*/
|
|
1936
1944
|
static parseIFD(reader, ofst, lsb, nextOfst, readBase, maker)
|
|
1937
1945
|
{
|
|
1938
1946
|
if (!(reader instanceof data.ByteReader))
|
|
@@ -2165,7 +2173,7 @@ export class EXIFData
|
|
|
2165
2173
|
case 8:
|
|
2166
2174
|
if (fcnt <= 2)
|
|
2167
2175
|
{
|
|
2168
|
-
exif.addInt16(tag, reader.readInt16Arr(ifdOfst + 8, fcnt));
|
|
2176
|
+
exif.addInt16(tag, reader.readInt16Arr(ifdOfst + 8, lsb, fcnt));
|
|
2169
2177
|
}
|
|
2170
2178
|
else
|
|
2171
2179
|
{
|
|
@@ -2175,7 +2183,7 @@ export class EXIFData
|
|
|
2175
2183
|
case 9:
|
|
2176
2184
|
if (fcnt == 1)
|
|
2177
2185
|
{
|
|
2178
|
-
exif.addInt32(tag, reader.readInt32Arr(ifdOfst + 8, fcnt));
|
|
2186
|
+
exif.addInt32(tag, reader.readInt32Arr(ifdOfst + 8, lsb, fcnt));
|
|
2179
2187
|
}
|
|
2180
2188
|
else
|
|
2181
2189
|
{
|
|
@@ -2190,7 +2198,6 @@ export class EXIFData
|
|
|
2190
2198
|
break;
|
|
2191
2199
|
default:
|
|
2192
2200
|
console.log("EXIFData.parseIFD: Unsupported field type: "+ftype+", tag = "+tag);
|
|
2193
|
-
j = 0;
|
|
2194
2201
|
break;
|
|
2195
2202
|
}
|
|
2196
2203
|
|
|
@@ -2243,8 +2250,12 @@ export class StaticImage extends data.ParsedObject
|
|
|
2243
2250
|
canvas.width = this.img.naturalWidth;
|
|
2244
2251
|
canvas.height = this.img.naturalHeight;
|
|
2245
2252
|
let ctx = canvas.getContext("2d");
|
|
2246
|
-
ctx
|
|
2247
|
-
|
|
2253
|
+
if (ctx)
|
|
2254
|
+
{
|
|
2255
|
+
ctx.drawImage(this.img, 0, 0, this.img.naturalWidth, this.img.naturalHeight);
|
|
2256
|
+
return canvas;
|
|
2257
|
+
}
|
|
2258
|
+
throw new Error("Error in creating canvas");
|
|
2248
2259
|
}
|
|
2249
2260
|
|
|
2250
2261
|
exportJPG(quality)
|
package/package.json
CHANGED
package/parser.js
CHANGED
|
@@ -149,7 +149,7 @@ function parseKMLStyle(node)
|
|
|
149
149
|
break;
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
|
-
style.
|
|
152
|
+
style.setLabelStyle(innerStyle);
|
|
153
153
|
break;
|
|
154
154
|
case "PolyStyle":
|
|
155
155
|
innerStyle = new kml.PolyStyle();
|
|
@@ -551,7 +551,7 @@ function parseKMLGeometry(kmlNode)
|
|
|
551
551
|
break;
|
|
552
552
|
case "LinearRing":
|
|
553
553
|
geom = parseKMLGeometry(subNode2);
|
|
554
|
-
if (geom)
|
|
554
|
+
if (geom && (geom instanceof geometry.LinearRing))
|
|
555
555
|
geomList.push(geom);
|
|
556
556
|
break;
|
|
557
557
|
default:
|
|
@@ -603,7 +603,11 @@ function parseKMLGeometry(kmlNode)
|
|
|
603
603
|
geom = new geometry.MultiPolygon(4326);
|
|
604
604
|
for (i in geomList)
|
|
605
605
|
{
|
|
606
|
-
|
|
606
|
+
let g = geomList[i];
|
|
607
|
+
if (g instanceof geometry.Polygon)
|
|
608
|
+
{
|
|
609
|
+
geom.geometries.push(g);
|
|
610
|
+
}
|
|
607
611
|
}
|
|
608
612
|
return geom;
|
|
609
613
|
}
|
|
@@ -612,7 +616,9 @@ function parseKMLGeometry(kmlNode)
|
|
|
612
616
|
geom = new geometry.Polyline(4326);
|
|
613
617
|
for (i in geomList)
|
|
614
618
|
{
|
|
615
|
-
|
|
619
|
+
let g = geomList[i];
|
|
620
|
+
if (g instanceof geometry.LineString)
|
|
621
|
+
geom.geometries.push(g);
|
|
616
622
|
}
|
|
617
623
|
return geom;
|
|
618
624
|
}
|
|
@@ -1151,14 +1157,18 @@ function parseX509(reader, fileName, mime)
|
|
|
1151
1157
|
}
|
|
1152
1158
|
else if (files.length > 1)
|
|
1153
1159
|
{
|
|
1154
|
-
let
|
|
1155
|
-
|
|
1156
|
-
while (i < files.length)
|
|
1160
|
+
let f = files[0];
|
|
1161
|
+
if (f instanceof cert.X509Cert)
|
|
1157
1162
|
{
|
|
1158
|
-
fileList.
|
|
1159
|
-
i
|
|
1163
|
+
let fileList = new cert.X509FileList(fileName, f);
|
|
1164
|
+
let i = 1;
|
|
1165
|
+
while (i < files.length)
|
|
1166
|
+
{
|
|
1167
|
+
fileList.addFile(files[i]);
|
|
1168
|
+
i++;
|
|
1169
|
+
}
|
|
1170
|
+
return fileList;
|
|
1160
1171
|
}
|
|
1161
|
-
return fileList;
|
|
1162
1172
|
}
|
|
1163
1173
|
console.log("Unsupported file", fileName, mime);
|
|
1164
1174
|
}
|
package/text.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ export function arrayToNumbers(arr: string[]): number[];
|
|
|
24
24
|
export function toHex8(v: number): string;
|
|
25
25
|
export function toHex16(v: number): string;
|
|
26
26
|
export function toHex32(v: number): string;
|
|
27
|
-
export function u8Arr2Hex(buff: Uint8Array, byteSep: string, rowSep: string): string;
|
|
27
|
+
export function u8Arr2Hex(buff: Uint8Array, byteSep: string | null, rowSep: string | null): string;
|
|
28
28
|
export function splitLines(txt: string): string[];
|
|
29
29
|
export function isEmailAddress(s: string): boolean;
|
|
30
30
|
export function toUTF32Length(s: string): number;
|
package/text.js
CHANGED
|
@@ -320,6 +320,13 @@ export function isEmailAddress(s)
|
|
|
320
320
|
if (charIsAlphaNumeric(s, i) || c == '-')
|
|
321
321
|
{
|
|
322
322
|
|
|
323
|
+
}
|
|
324
|
+
if (c == '_')
|
|
325
|
+
{
|
|
326
|
+
if (atPos != -1)
|
|
327
|
+
{
|
|
328
|
+
return false;
|
|
329
|
+
}
|
|
323
330
|
}
|
|
324
331
|
else if (c == '.')
|
|
325
332
|
{
|
|
@@ -916,7 +923,7 @@ export class Base64Enc extends TextBinEnc
|
|
|
916
923
|
let i = 0;
|
|
917
924
|
let j = str.length;
|
|
918
925
|
let b = 0;
|
|
919
|
-
let b2;
|
|
926
|
+
let b2 = 0;
|
|
920
927
|
let c;
|
|
921
928
|
let code;
|
|
922
929
|
while (i < j)
|
|
@@ -1182,7 +1189,7 @@ export class CPPTextBinEnc extends TextBinEnc
|
|
|
1182
1189
|
}
|
|
1183
1190
|
else if ((b & 0xfe) == 0xfc)
|
|
1184
1191
|
{
|
|
1185
|
-
code = (
|
|
1192
|
+
code = (((b & 0x1) << 30) | ((arr[i + 1] & 0x3f) << 24) | ((arr[i + 2] & 0x3f) << 18) | ((arr[i + 3] & 0x3f) << 12) | ((arr[i + 4] & 0x3f) << 6) | (arr[i + 5] & 0x3f));
|
|
1186
1193
|
if (code >= 0x10000)
|
|
1187
1194
|
{
|
|
1188
1195
|
ret.push(String.fromCharCode(((code - 0x10000) >> 10) + 0xd800, (code & 0x3ff) + 0xdc00));
|