@sswroom/sswr 1.6.3 → 1.6.4
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/data.d.ts +25 -0
- package/data.js +33 -0
- package/geometry.d.ts +7 -1
- package/geometry.js +21 -4
- package/leaflet.js +48 -4
- package/math.d.ts +1 -1
- package/math.js +1 -0
- package/package.json +1 -1
- package/parser.js +11 -0
package/Changelog
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
1.6.4
|
|
2
|
+
-Support geometry.Polyline
|
|
3
|
+
-Fixed geometry.Polygon.insideOrTouch
|
|
4
|
+
-Fixed geometry.MultiGeometry.insideOrTouch
|
|
5
|
+
-leaflet.createFromKML support group in group
|
|
6
|
+
-parser.parseKMLContainer hide Schema message
|
|
7
|
+
-Added data.Timestamp.toDate()
|
|
8
|
+
-Added data.Weekday enum
|
|
9
|
+
-Added data.DateTimeUtil.ticks2Weekday()
|
|
10
|
+
-Added data.LocalDate.getWeekday()
|
|
11
|
+
-Added data.StringMap and data.NumberMap interface type
|
|
12
|
+
-Fixed math.GeoJSON.parseGeometry
|
|
13
|
+
|
|
1
14
|
1.6.3
|
|
2
15
|
-Added hash.MD5
|
|
3
16
|
-Support web.Dialog in frameset
|
package/data.d.ts
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
export enum Weekday
|
|
2
|
+
{
|
|
3
|
+
Sunday,
|
|
4
|
+
Monday,
|
|
5
|
+
Tuesday,
|
|
6
|
+
Wednesday,
|
|
7
|
+
Thursday,
|
|
8
|
+
Friday,
|
|
9
|
+
Saturday
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
interface StringMap<Type> {
|
|
13
|
+
[key: string]: Type;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface NumberMap<Type> {
|
|
17
|
+
[key: number]: Type;
|
|
18
|
+
}
|
|
19
|
+
|
|
1
20
|
export function isArray(o: any): boolean;
|
|
2
21
|
export function isObject(o: any): boolean;
|
|
3
22
|
export function toObjectString(o: any, lev: number): string;
|
|
@@ -53,6 +72,7 @@ export class DateTimeUtil
|
|
|
53
72
|
static secs2TimeValue(secs: bigint, tzQhr?: number): TimeValue;
|
|
54
73
|
static totalDays2DateValue(totalDays: number, d: DateValue): void;
|
|
55
74
|
static instant2TimeValue(secs: bigint, nanosec: number, tzQhr?: number): TimeValue;
|
|
75
|
+
static ticks2Weekday(ticks: number, tzQhr: number): Weekday;
|
|
56
76
|
static toString(tval: TimeValue, pattern: string): string;
|
|
57
77
|
static string2TimeValue(dateStr: string, tzQhr?: number): TimeValue;
|
|
58
78
|
static isYearLeap(year: number): boolean;
|
|
@@ -98,6 +118,7 @@ export class LocalDate
|
|
|
98
118
|
toString(pattern: string | null): string;
|
|
99
119
|
compareTo(obj: Date): number;
|
|
100
120
|
isNull(): boolean;
|
|
121
|
+
getWeekday(): Weekday;
|
|
101
122
|
static today(): LocalDate;
|
|
102
123
|
static fromStr(s: string): LocalDate | null;
|
|
103
124
|
}
|
|
@@ -134,6 +155,9 @@ export class TimeInstant
|
|
|
134
155
|
}
|
|
135
156
|
|
|
136
157
|
export class Timestamp {
|
|
158
|
+
inst: TimeInstant;
|
|
159
|
+
tzQhr: number;
|
|
160
|
+
|
|
137
161
|
constructor(inst: TimeInstant, tzQhr?: number);
|
|
138
162
|
static fromTicks(ticks: number | number, tzQhr?: number): Timestamp;
|
|
139
163
|
static fromStr(str: string, defTzQhr?: number): Timestamp | null;
|
|
@@ -167,6 +191,7 @@ export class Timestamp {
|
|
|
167
191
|
diffMS(ts: Timestamp): number;
|
|
168
192
|
diffSecDbl(ts: Timestamp): number;
|
|
169
193
|
diff(ts: Timestamp): number;
|
|
194
|
+
toDate(): LocalDate;
|
|
170
195
|
toTicks(): number;
|
|
171
196
|
toDotNetTicks(): number;
|
|
172
197
|
toUnixTimestamp(): number;
|
package/data.js
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import * as text from "./text.js";
|
|
2
2
|
|
|
3
|
+
export const Weekday = {
|
|
4
|
+
Sunday: 0,
|
|
5
|
+
Monday: 1,
|
|
6
|
+
Tuesday: 2,
|
|
7
|
+
Wednesday: 3,
|
|
8
|
+
Thursday: 4,
|
|
9
|
+
Friday: 5,
|
|
10
|
+
Saturday: 6
|
|
11
|
+
}
|
|
12
|
+
|
|
3
13
|
export function isArray(o)
|
|
4
14
|
{
|
|
5
15
|
return o != null && o.constructor === Array;
|
|
@@ -824,6 +834,19 @@ export class DateTimeUtil
|
|
|
824
834
|
return t;
|
|
825
835
|
}
|
|
826
836
|
|
|
837
|
+
static ticks2Weekday(ticks, tzQhr)
|
|
838
|
+
{
|
|
839
|
+
let days = ((ticks + tzQhr * 900000) / 86400000 + 4);
|
|
840
|
+
if (days >= 0)
|
|
841
|
+
{
|
|
842
|
+
return (days % 7);
|
|
843
|
+
}
|
|
844
|
+
else
|
|
845
|
+
{
|
|
846
|
+
return ((days % 7) + 7);
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
|
|
827
850
|
static toString(tval, pattern)
|
|
828
851
|
{
|
|
829
852
|
let output = new Array();
|
|
@@ -1798,6 +1821,11 @@ export class LocalDate
|
|
|
1798
1821
|
return this.dateVal == LocalDate.DATE_NULL;
|
|
1799
1822
|
}
|
|
1800
1823
|
|
|
1824
|
+
getWeekday()
|
|
1825
|
+
{
|
|
1826
|
+
return DateTimeUtil.ticks2Weekday(this.dateVal * 86400000, 0);
|
|
1827
|
+
}
|
|
1828
|
+
|
|
1801
1829
|
static today()
|
|
1802
1830
|
{
|
|
1803
1831
|
let d = new Date();
|
|
@@ -2220,6 +2248,11 @@ export class Timestamp
|
|
|
2220
2248
|
return this.inst.diff(ts.inst);
|
|
2221
2249
|
}
|
|
2222
2250
|
|
|
2251
|
+
toDate()
|
|
2252
|
+
{
|
|
2253
|
+
return new LocalDate(Math.floor(Number((this.inst.sec + BigInt(this.tzQhr * 900)) / 86400n)));
|
|
2254
|
+
}
|
|
2255
|
+
|
|
2223
2256
|
toTicks()
|
|
2224
2257
|
{
|
|
2225
2258
|
return this.inst.toTicks();
|
package/geometry.d.ts
CHANGED
|
@@ -85,11 +85,17 @@ export class MultiGeometry<VecType> extends Vector2D
|
|
|
85
85
|
export class Polygon extends MultiGeometry<LinearRing>
|
|
86
86
|
{
|
|
87
87
|
constructor(srid: number, coordinates: number[][][]);
|
|
88
|
+
insideOrTouch(coord: math.Coord2D): boolean;
|
|
88
89
|
}
|
|
89
90
|
|
|
90
91
|
export class MultiPolygon extends MultiGeometry<Polygon>
|
|
91
92
|
{
|
|
92
|
-
constructor(srid: number, coordinates
|
|
93
|
+
constructor(srid: number, coordinates?: number[][][][]);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export class Polyline extends MultiGeometry<LineString>
|
|
97
|
+
{
|
|
98
|
+
constructor(srid: number, coordinates?: number[][][]);
|
|
93
99
|
}
|
|
94
100
|
|
|
95
101
|
export class GeometryCollection extends MultiGeometry<Vector2D>
|
package/geometry.js
CHANGED
|
@@ -370,10 +370,10 @@ export class MultiGeometry extends Vector2D
|
|
|
370
370
|
|
|
371
371
|
insideOrTouch(coord)
|
|
372
372
|
{
|
|
373
|
-
let i = this.
|
|
373
|
+
let i = this.geometries.length;
|
|
374
374
|
while (i-- > 0)
|
|
375
375
|
{
|
|
376
|
-
if (this.
|
|
376
|
+
if (this.geometries[i].insideOrTouch(coord))
|
|
377
377
|
{
|
|
378
378
|
return true;
|
|
379
379
|
}
|
|
@@ -420,11 +420,11 @@ export class Polygon extends MultiGeometry
|
|
|
420
420
|
|
|
421
421
|
insideOrTouch(coord)
|
|
422
422
|
{
|
|
423
|
-
let i = this.
|
|
423
|
+
let i = this.geometries.length;
|
|
424
424
|
let inside = false;
|
|
425
425
|
while (i-- > 0)
|
|
426
426
|
{
|
|
427
|
-
if (this.
|
|
427
|
+
if (this.geometries[i].insideOrTouch(coord))
|
|
428
428
|
{
|
|
429
429
|
inside = !inside;
|
|
430
430
|
}
|
|
@@ -450,6 +450,23 @@ export class MultiPolygon extends MultiGeometry
|
|
|
450
450
|
}
|
|
451
451
|
}
|
|
452
452
|
|
|
453
|
+
export class Polyline extends MultiGeometry
|
|
454
|
+
{
|
|
455
|
+
constructor(srid, coordinates)
|
|
456
|
+
{
|
|
457
|
+
super(srid);
|
|
458
|
+
this.type = VectorType.Polyline;
|
|
459
|
+
let i;
|
|
460
|
+
if (coordinates)
|
|
461
|
+
{
|
|
462
|
+
for (i in coordinates)
|
|
463
|
+
{
|
|
464
|
+
this.geometries.push(new LineString(srid, coordinates[i]));
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
|
|
453
470
|
export class GeometryCollection extends MultiGeometry
|
|
454
471
|
{
|
|
455
472
|
constructor(srid)
|
package/leaflet.js
CHANGED
|
@@ -69,12 +69,27 @@ export function createFromKML(feature, options)
|
|
|
69
69
|
if (feature instanceof kml.Container)
|
|
70
70
|
{
|
|
71
71
|
let i;
|
|
72
|
-
let layers =
|
|
72
|
+
let layers = [];
|
|
73
|
+
let lyr;
|
|
74
|
+
let hasGroup = false;
|
|
75
|
+
let hasFeature = false;
|
|
73
76
|
for (i in feature.features)
|
|
74
77
|
{
|
|
75
|
-
createFromKML(feature.features[i], options)
|
|
78
|
+
lyr = createFromKML(feature.features[i], options);
|
|
79
|
+
layers.push(lyr);
|
|
80
|
+
if ((lyr instanceof L.FeatureGroup) || (lyr instanceof L.LayerGroup))
|
|
81
|
+
hasGroup = true;
|
|
82
|
+
else
|
|
83
|
+
hasFeature = true;
|
|
84
|
+
}
|
|
85
|
+
if (hasGroup)
|
|
86
|
+
{
|
|
87
|
+
return L.layerGroup(layers);
|
|
88
|
+
}
|
|
89
|
+
else
|
|
90
|
+
{
|
|
91
|
+
return L.featureGroup(layers);
|
|
76
92
|
}
|
|
77
|
-
return layers;
|
|
78
93
|
}
|
|
79
94
|
else if (feature instanceof kml.Placemark)
|
|
80
95
|
{
|
|
@@ -162,7 +177,7 @@ export function createFromGeometry(geom, options)
|
|
|
162
177
|
{
|
|
163
178
|
if (options.name)
|
|
164
179
|
opt.title = options.name;
|
|
165
|
-
if (options.icon)
|
|
180
|
+
if (options.icon && options.icon.iconUrl)
|
|
166
181
|
opt.icon = options.icon;
|
|
167
182
|
}
|
|
168
183
|
return L.marker(L.latLng(geom.coordinates[1], geom.coordinates[0]), opt);
|
|
@@ -190,6 +205,35 @@ export function createFromGeometry(geom, options)
|
|
|
190
205
|
}
|
|
191
206
|
return L.polyline(pts, opt);
|
|
192
207
|
}
|
|
208
|
+
else if (geom instanceof geometry.Polyline)
|
|
209
|
+
{
|
|
210
|
+
let opt = {};
|
|
211
|
+
let i;
|
|
212
|
+
let j;
|
|
213
|
+
let ptsArr = [];
|
|
214
|
+
if (options.lineColor)
|
|
215
|
+
opt.color = options.lineColor;
|
|
216
|
+
if (options.lineWidth)
|
|
217
|
+
opt.weight = options.lineWidth;
|
|
218
|
+
for (i in geom.geometries)
|
|
219
|
+
{
|
|
220
|
+
let pts = [];
|
|
221
|
+
for (j in geom.geometries[i].coordinates)
|
|
222
|
+
{
|
|
223
|
+
let latLng = L.latLng(geom.geometries[i].coordinates[j][1], geom.geometries[i].coordinates[j][0]);
|
|
224
|
+
if (latLng)
|
|
225
|
+
{
|
|
226
|
+
pts.push(latLng);
|
|
227
|
+
}
|
|
228
|
+
else
|
|
229
|
+
{
|
|
230
|
+
console.log("Error in Polyline", geom.geometries[i].coordinates[j]);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
ptsArr.push(pts);
|
|
234
|
+
}
|
|
235
|
+
return L.polyline(ptsArr, opt);
|
|
236
|
+
}
|
|
193
237
|
else if (geom instanceof geometry.LinearRing)
|
|
194
238
|
{
|
|
195
239
|
let opt = {};
|
package/math.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export function roundToFloat(n: number, decimalPoints: number): number;
|
|
|
5
5
|
export function roundToStr(n: number, decimalPoints: number): string;
|
|
6
6
|
export class GeoJSON
|
|
7
7
|
{
|
|
8
|
-
static parseGeometry(srid:
|
|
8
|
+
static parseGeometry(srid: number, geom: object): geometry.Vector2D | null;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export class Coord2D
|
package/math.js
CHANGED
package/package.json
CHANGED
package/parser.js
CHANGED
|
@@ -342,6 +342,8 @@ function parseKMLContainer(container, kmlNode, doc)
|
|
|
342
342
|
break;
|
|
343
343
|
case "#text":
|
|
344
344
|
break;
|
|
345
|
+
case "Schema":
|
|
346
|
+
break;
|
|
345
347
|
default:
|
|
346
348
|
console.log("Unknown node in kml container: "+node.nodeName, node);
|
|
347
349
|
break;
|
|
@@ -605,6 +607,15 @@ function parseKMLGeometry(kmlNode)
|
|
|
605
607
|
}
|
|
606
608
|
return geom;
|
|
607
609
|
}
|
|
610
|
+
else if (geomList[0] instanceof geometry.LineString && (geomList.length == 1 || geomList[1] instanceof geometry.LineString))
|
|
611
|
+
{
|
|
612
|
+
geom = new geometry.Polyline(4326);
|
|
613
|
+
for (i in geomList)
|
|
614
|
+
{
|
|
615
|
+
geom.geometries.push(geomList[i]);
|
|
616
|
+
}
|
|
617
|
+
return geom;
|
|
618
|
+
}
|
|
608
619
|
else
|
|
609
620
|
{
|
|
610
621
|
geom = new geometry.GeometryCollection(4326);
|