@sswroom/sswr 1.5.4 → 1.6.0
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 +30 -0
- package/cert.d.ts +411 -0
- package/cert.js +4616 -0
- package/certutil.d.ts +376 -0
- package/certutil.js +2692 -0
- package/cesium.d.ts +13 -13
- package/cesium.js +8 -4
- package/data.d.ts +76 -30
- package/data.js +342 -75
- package/geometry.d.ts +2 -2
- package/hash.d.ts +57 -0
- package/hash.js +269 -0
- package/hkoapi.d.ts +26 -26
- package/kml.d.ts +53 -16
- package/kml.js +115 -2
- package/leaflet.d.ts +17 -7
- package/leaflet.js +55 -4
- package/map.d.ts +17 -16
- package/map.js +1 -1
- package/math.d.ts +13 -13
- package/media.d.ts +119 -0
- package/media.js +2272 -0
- package/net.d.ts +1 -0
- package/net.js +5 -0
- package/olayer2.d.ts +2 -2
- package/olayer2.js +8 -4
- package/package.json +1 -1
- package/parser.d.ts +8 -2
- package/parser.js +539 -3
- package/text.d.ts +3 -1
- package/text.js +70 -2
- package/unit.d.ts +2 -0
- package/unit.js +110 -0
- package/web.d.ts +3 -1
- package/web.js +54 -4
package/kml.d.ts
CHANGED
|
@@ -8,13 +8,13 @@ export enum AltitudeMode
|
|
|
8
8
|
ClampToGround,
|
|
9
9
|
RelativeToGround,
|
|
10
10
|
Absolute
|
|
11
|
-
}
|
|
11
|
+
}
|
|
12
12
|
|
|
13
13
|
export enum DisplayMode
|
|
14
14
|
{
|
|
15
15
|
Default,
|
|
16
16
|
Hide
|
|
17
|
-
}
|
|
17
|
+
}
|
|
18
18
|
|
|
19
19
|
export enum ListItemType
|
|
20
20
|
{
|
|
@@ -22,7 +22,7 @@ export enum ListItemType
|
|
|
22
22
|
RadioFolder,
|
|
23
23
|
CheckOffOnly,
|
|
24
24
|
CheckHideChildren
|
|
25
|
-
}
|
|
25
|
+
}
|
|
26
26
|
|
|
27
27
|
export enum ItemIconMode
|
|
28
28
|
{
|
|
@@ -32,14 +32,29 @@ export enum ItemIconMode
|
|
|
32
32
|
Fetching0,
|
|
33
33
|
Fetching1,
|
|
34
34
|
Fetching2
|
|
35
|
-
}
|
|
35
|
+
}
|
|
36
36
|
|
|
37
37
|
export enum HotSpotUnit
|
|
38
38
|
{
|
|
39
39
|
Fraction,
|
|
40
40
|
Pixels,
|
|
41
41
|
InsetPixels
|
|
42
|
-
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export enum RefreshMode
|
|
45
|
+
{
|
|
46
|
+
OnChange,
|
|
47
|
+
OnInterval,
|
|
48
|
+
OnExpire
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export enum ViewRefreshMode
|
|
52
|
+
{
|
|
53
|
+
Never,
|
|
54
|
+
OnStop,
|
|
55
|
+
OnRequest,
|
|
56
|
+
OnRegion
|
|
57
|
+
}
|
|
43
58
|
|
|
44
59
|
export class Element
|
|
45
60
|
{
|
|
@@ -60,7 +75,7 @@ export class NetworkLinkControl extends Element
|
|
|
60
75
|
|
|
61
76
|
getUsedNS(ns: object): void;
|
|
62
77
|
appendOuterXML(strs: string[], level: number): void;
|
|
63
|
-
}
|
|
78
|
+
}
|
|
64
79
|
|
|
65
80
|
export class LookAt extends Element
|
|
66
81
|
{
|
|
@@ -79,7 +94,7 @@ export class LookAt extends Element
|
|
|
79
94
|
|
|
80
95
|
getUsedNS(ns: object): void;
|
|
81
96
|
appendOuterXML(strs: string[], level: number): void;
|
|
82
|
-
}
|
|
97
|
+
}
|
|
83
98
|
|
|
84
99
|
export class ColorStyle extends Element
|
|
85
100
|
{
|
|
@@ -94,7 +109,7 @@ export class ColorStyle extends Element
|
|
|
94
109
|
|
|
95
110
|
sameColor(c: ColorStyle): boolean;
|
|
96
111
|
appendInnerXML(strs: string[], level: number): void;
|
|
97
|
-
}
|
|
112
|
+
}
|
|
98
113
|
|
|
99
114
|
export class IconStyle extends ColorStyle
|
|
100
115
|
{
|
|
@@ -115,7 +130,7 @@ export class IconStyle extends ColorStyle
|
|
|
115
130
|
getUsedNS(ns: object): void;
|
|
116
131
|
appendOuterXML(strs: string[], level: number): void;
|
|
117
132
|
equals(o: IconStyle): boolean;
|
|
118
|
-
}
|
|
133
|
+
}
|
|
119
134
|
|
|
120
135
|
export class LabelStyle extends ColorStyle
|
|
121
136
|
{
|
|
@@ -125,7 +140,7 @@ export class LabelStyle extends ColorStyle
|
|
|
125
140
|
getUsedNS(ns: object): void;
|
|
126
141
|
appendOuterXML(strs: string[], level: number): void;
|
|
127
142
|
equals(o: LabelStyle): boolean;
|
|
128
|
-
}
|
|
143
|
+
}
|
|
129
144
|
|
|
130
145
|
export class LineStyle extends ColorStyle
|
|
131
146
|
{
|
|
@@ -137,7 +152,7 @@ export class LineStyle extends ColorStyle
|
|
|
137
152
|
getUsedNS(ns: object): void;
|
|
138
153
|
appendOuterXML(strs: string[], level: number): void;
|
|
139
154
|
equals(o: LineStyle): boolean;
|
|
140
|
-
}
|
|
155
|
+
}
|
|
141
156
|
|
|
142
157
|
export class PolyStyle extends ColorStyle
|
|
143
158
|
{
|
|
@@ -147,7 +162,7 @@ export class PolyStyle extends ColorStyle
|
|
|
147
162
|
getUsedNS(ns: object): void;
|
|
148
163
|
appendOuterXML(strs: string[], level: number): void;
|
|
149
164
|
equals(o: PolyStyle): boolean;
|
|
150
|
-
}
|
|
165
|
+
}
|
|
151
166
|
|
|
152
167
|
export class BalloonStyle extends Element
|
|
153
168
|
{
|
|
@@ -160,7 +175,7 @@ export class BalloonStyle extends Element
|
|
|
160
175
|
getUsedNS(ns: object): void;
|
|
161
176
|
appendOuterXML(strs: string[], level: number): void;
|
|
162
177
|
equals(o: BalloonStyle): boolean;
|
|
163
|
-
}
|
|
178
|
+
}
|
|
164
179
|
|
|
165
180
|
export class ListStyle extends Element
|
|
166
181
|
{
|
|
@@ -171,13 +186,14 @@ export class ListStyle extends Element
|
|
|
171
186
|
getUsedNS(ns: object): void;
|
|
172
187
|
appendOuterXML(strs: string[], level: number): void;
|
|
173
188
|
equals(o: ListStyle): boolean;
|
|
174
|
-
}
|
|
189
|
+
}
|
|
175
190
|
|
|
176
191
|
export class StyleSelector extends Element
|
|
177
192
|
{
|
|
178
193
|
id: string;
|
|
179
194
|
constructor(id: string);
|
|
180
195
|
}
|
|
196
|
+
|
|
181
197
|
export class Style extends StyleSelector
|
|
182
198
|
{
|
|
183
199
|
iconStyle: IconStyle;
|
|
@@ -197,7 +213,7 @@ export class Style extends StyleSelector
|
|
|
197
213
|
isStyle(iconStyle: IconStyle, labelStyle: LabelStyle, lineStyle: LineStyle, polyStyle: PolyStyle, balloonStyle: BalloonStyle, listStyle: ListStyle): boolean;
|
|
198
214
|
getUsedNS(ns: object): void;
|
|
199
215
|
appendOuterXML(strs: string[], level: number): void;
|
|
200
|
-
}
|
|
216
|
+
}
|
|
201
217
|
|
|
202
218
|
export class StyleMap extends StyleSelector
|
|
203
219
|
{
|
|
@@ -215,6 +231,7 @@ export class Feature extends Element
|
|
|
215
231
|
visibility: boolean;
|
|
216
232
|
open: boolean;
|
|
217
233
|
author: string;
|
|
234
|
+
authorName: string;
|
|
218
235
|
link: string;
|
|
219
236
|
address: string;
|
|
220
237
|
//AddressDetails: ?;
|
|
@@ -229,6 +246,7 @@ export class Feature extends Element
|
|
|
229
246
|
setVisibility(visibility: boolean): void;
|
|
230
247
|
setOpen(open: boolean): void;
|
|
231
248
|
setAuthor(author: string): void;
|
|
249
|
+
setAuthorName(authorName: string): void;
|
|
232
250
|
setLink(link: string): void;
|
|
233
251
|
setAddress(address: string): void;
|
|
234
252
|
setPhoneNumber(phoneNumber: string): void;
|
|
@@ -271,7 +289,19 @@ export class Folder extends Container
|
|
|
271
289
|
|
|
272
290
|
export class NetworkLink extends Feature
|
|
273
291
|
{
|
|
274
|
-
|
|
292
|
+
networkLink: string;
|
|
293
|
+
refreshVisibility: boolean;
|
|
294
|
+
flyToView: boolean;
|
|
295
|
+
refreshMode: RefreshMode;
|
|
296
|
+
refreshInterval: number;
|
|
297
|
+
viewRefreshMode: ViewRefreshMode;
|
|
298
|
+
|
|
299
|
+
constructor(networkLink: string);
|
|
300
|
+
setRefreshVisibility(refreshVisibility: boolean): void;
|
|
301
|
+
setFlyToView(flyToView: boolean): void;
|
|
302
|
+
setRefreshMode(refreshMode: RefreshMode): void;
|
|
303
|
+
setRefreshInterval(refreshInterval: number): void;
|
|
304
|
+
setViewRefreshMode(viewRefreshMode: ViewRefreshMode): void;
|
|
275
305
|
|
|
276
306
|
getBounds(): math.RectArea | null;
|
|
277
307
|
getUsedNS(ns: object): void;
|
|
@@ -313,6 +343,13 @@ export class ScreenOverlay extends Feature
|
|
|
313
343
|
appendOuterXML(strs: string[], level: number): void;
|
|
314
344
|
}
|
|
315
345
|
|
|
346
|
+
export class KMLFile extends data.ParsedObject
|
|
347
|
+
{
|
|
348
|
+
root: Feature | NetworkLinkControl;
|
|
349
|
+
constructor(root: Feature | NetworkLinkControl, sourceName: string);
|
|
350
|
+
toString():string;
|
|
351
|
+
}
|
|
352
|
+
|
|
316
353
|
export function toString(item: Feature | NetworkLinkControl): string;
|
|
317
354
|
export function toColor(color: string): web.Color;
|
|
318
355
|
export function toCSSColor(color: string): string;
|
package/kml.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 text from "./text.js";
|
|
3
4
|
import * as web from "./web.js";
|
|
@@ -35,6 +36,19 @@ export const HotSpotUnit = {
|
|
|
35
36
|
InsetPixels: "insetPixels"
|
|
36
37
|
}
|
|
37
38
|
|
|
39
|
+
export const RefreshMode = {
|
|
40
|
+
OnChange: "onChange",
|
|
41
|
+
OnInterval: "onInterval",
|
|
42
|
+
OnExpire: "onExpire"
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export const ViewRefreshMode = {
|
|
46
|
+
Never: "never",
|
|
47
|
+
OnStop: "onStop",
|
|
48
|
+
OnRequest: "onRequest",
|
|
49
|
+
OnRegion: "onRegion"
|
|
50
|
+
};
|
|
51
|
+
|
|
38
52
|
export class Element
|
|
39
53
|
{
|
|
40
54
|
}
|
|
@@ -655,6 +669,11 @@ export class Feature extends Element
|
|
|
655
669
|
this.author = author;
|
|
656
670
|
}
|
|
657
671
|
|
|
672
|
+
setAuthorName(authorName)
|
|
673
|
+
{
|
|
674
|
+
this.authorName = authorName;
|
|
675
|
+
}
|
|
676
|
+
|
|
658
677
|
setLink(link)
|
|
659
678
|
{
|
|
660
679
|
this.link = link;
|
|
@@ -698,8 +717,12 @@ export class Feature extends Element
|
|
|
698
717
|
strs.push("\t".repeat(level)+"<visibility>"+(this.visibility?"1":"0")+"</visibility>");
|
|
699
718
|
if (this.open != null)
|
|
700
719
|
strs.push("\t".repeat(level)+"<open>"+(this.open?"1":"0")+"</open>");
|
|
701
|
-
if (this.author)
|
|
720
|
+
if (this.author && this.authorName)
|
|
721
|
+
strs.push("\t".repeat(level)+"<atom:author>"+text.toXMLText(this.author)+"<atom:name>"+text.toXMLText(this.authorName)+"</atom:name></atom:author>");
|
|
722
|
+
else if (this.author)
|
|
702
723
|
strs.push("\t".repeat(level)+"<atom:author>"+text.toXMLText(this.author)+"</atom:author>");
|
|
724
|
+
else if (this.authorName)
|
|
725
|
+
strs.push("\t".repeat(level)+"<atom:author><atom:name>"+text.toXMLText(this.authorName)+"</atom:name></atom:author>");
|
|
703
726
|
if (this.link)
|
|
704
727
|
strs.push("\t".repeat(level)+"<atom:link href="+text.toAttrText(this.link)+"/>");
|
|
705
728
|
if (this.address)
|
|
@@ -868,6 +891,70 @@ export class Folder extends Container
|
|
|
868
891
|
}
|
|
869
892
|
}
|
|
870
893
|
|
|
894
|
+
export class NetworkLink extends Feature
|
|
895
|
+
{
|
|
896
|
+
constructor(networkLink)
|
|
897
|
+
{
|
|
898
|
+
super();
|
|
899
|
+
this.networkLink = networkLink;
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
setRefreshVisibility(refreshVisibility)
|
|
903
|
+
{
|
|
904
|
+
this.refreshVisibility = refreshVisibility;
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
setFlyToView(flyToView)
|
|
908
|
+
{
|
|
909
|
+
this.flyToView = flyToView;
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
setRefreshMode(refreshMode)
|
|
913
|
+
{
|
|
914
|
+
this.refreshMode = refreshMode;
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
setRefreshInterval(refreshInterval)
|
|
918
|
+
{
|
|
919
|
+
this.refreshInterval = refreshInterval;
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
setViewRefreshMode(viewRefreshMode)
|
|
923
|
+
{
|
|
924
|
+
this.viewRefreshMode = viewRefreshMode;
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
getBounds()
|
|
928
|
+
{
|
|
929
|
+
return null;
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
getUsedNS(ns)
|
|
933
|
+
{
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
appendOuterXML(strs, level)
|
|
937
|
+
{
|
|
938
|
+
strs.push("\t".repeat(level)+"<NetworkLink>");
|
|
939
|
+
this.appendInnerXML(strs, level + 1);
|
|
940
|
+
if (this.refreshVisibility != null)
|
|
941
|
+
strs.push("\t".repeat(level + 1)+"<refreshVisibility>"+(this.refreshVisibility?"1":"0")+"</refreshVisibility>");
|
|
942
|
+
if (this.flyToView != null)
|
|
943
|
+
strs.push("\t".repeat(level + 1)+"<flyToView>"+(this.flyToView?"1":"0")+"</flyToView>");
|
|
944
|
+
|
|
945
|
+
strs.push("\t".repeat(level + 1)+"<Link>");
|
|
946
|
+
strs.push("\t".repeat(level + 2)+"<href>"+text.toXMLText(this.networkLink)+"</href>");
|
|
947
|
+
if (this.refreshMode)
|
|
948
|
+
strs.push("\t".repeat(level + 2)+"<refreshMode>"+text.toXMLText(this.refreshMode)+"</refreshMode>");
|
|
949
|
+
if (this.refreshInterval)
|
|
950
|
+
strs.push("\t".repeat(level + 2)+"<refreshInterval>"+this.refreshInterval+"</refreshInterval>");
|
|
951
|
+
if (this.viewRefreshMode)
|
|
952
|
+
strs.push("\t".repeat(level + 2)+"<viewRefreshMode>"+text.toXMLText(this.viewRefreshMode)+"</viewRefreshMode>");
|
|
953
|
+
strs.push("\t".repeat(level + 1)+"</Link>");
|
|
954
|
+
strs.push("\t".repeat(level)+"</NetworkLink>");
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
|
|
871
958
|
export class Placemark extends Feature
|
|
872
959
|
{
|
|
873
960
|
constructor(vec)
|
|
@@ -1011,6 +1098,10 @@ export class Placemark extends Feature
|
|
|
1011
1098
|
|
|
1012
1099
|
getUsedNS(ns)
|
|
1013
1100
|
{
|
|
1101
|
+
if (this.author || this.link || this.authorName)
|
|
1102
|
+
{
|
|
1103
|
+
ns.atom = "http://www.w3.org/2005/Atom";
|
|
1104
|
+
}
|
|
1014
1105
|
}
|
|
1015
1106
|
|
|
1016
1107
|
appendOuterXML(strs, level)
|
|
@@ -1025,13 +1116,35 @@ export class Placemark extends Feature
|
|
|
1025
1116
|
}
|
|
1026
1117
|
}
|
|
1027
1118
|
|
|
1119
|
+
export class KMLFile extends data.ParsedObject
|
|
1120
|
+
{
|
|
1121
|
+
constructor(root, sourceName)
|
|
1122
|
+
{
|
|
1123
|
+
super(sourceName, "application/vnd.google-earth.kml+xml");
|
|
1124
|
+
this.root = root;
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1127
|
+
toString()
|
|
1128
|
+
{
|
|
1129
|
+
toString(this.root);
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1028
1133
|
export function toString(item)
|
|
1029
1134
|
{
|
|
1030
1135
|
let strs = [];
|
|
1031
1136
|
strs.push("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>");
|
|
1032
1137
|
let namespaces = {};
|
|
1033
1138
|
item.getUsedNS(namespaces);
|
|
1034
|
-
|
|
1139
|
+
let ns;
|
|
1140
|
+
let rootEle = [];
|
|
1141
|
+
rootEle.push("<kml xmlns=\"http://www.opengis.net/kml/2.2\"");
|
|
1142
|
+
for (ns in namespaces)
|
|
1143
|
+
{
|
|
1144
|
+
rootEle.push(" xmlns:"+ns+"="+text.toAttrText(namespaces[ns]));
|
|
1145
|
+
}
|
|
1146
|
+
rootEle.push(">");
|
|
1147
|
+
strs.push(rootEle.join(""));
|
|
1035
1148
|
item.appendOuterXML(strs, 1);
|
|
1036
1149
|
strs.push("</kml>");
|
|
1037
1150
|
return strs.join("\r\n");
|
package/leaflet.d.ts
CHANGED
|
@@ -21,20 +21,30 @@ export function fromLatLngBounds(b: L.LatLngBounds): math.RectArea;
|
|
|
21
21
|
export function toLatLngBounds(rect: math.RectArea): L.LatLngBounds;
|
|
22
22
|
|
|
23
23
|
export function createLayer(layer: map.LayerInfo, options: object): L.Layer;
|
|
24
|
-
export function
|
|
24
|
+
export function createFromKML(feature: kml.Feature | kml.KMLFile, options: KMLFeatureOptions): L.Layer;
|
|
25
25
|
export function createFromGeometry(geom: geometry.Vector2D, options: GeometryOptions): L.Layer;
|
|
26
26
|
export function createKMLLookAt(map: L.Map): kml.LookAt;
|
|
27
27
|
export function toKMLFeature(layer: L.Layer, doc?: kml.Document): kml.Feature | null;
|
|
28
28
|
export function toKMLString(layer: L.Layer): string | null;
|
|
29
29
|
|
|
30
|
+
export class KMLNetworkLink
|
|
31
|
+
{
|
|
32
|
+
feature: kml.NetworkLink;
|
|
33
|
+
container: L.FeatureGroup;
|
|
34
|
+
|
|
35
|
+
constructor(feature: kml.NetworkLink);
|
|
36
|
+
reload(): void;
|
|
37
|
+
addTo(container: L.FeatureGroup): KMLNetworkLink;
|
|
38
|
+
}
|
|
39
|
+
|
|
30
40
|
export class LeafletMap extends map.MapControl
|
|
31
41
|
{
|
|
32
42
|
constructor(divId: string);
|
|
33
|
-
createLayer(layer: map.LayerInfo, options?: LayerOptions): any;
|
|
34
|
-
createMarkerLayer(name: string, options?: LayerOptions): any;
|
|
35
|
-
createGeometryLayer(name: string, options?: LayerOptions): any;
|
|
43
|
+
createLayer(layer: map.LayerInfo, options?: map.LayerOptions): any;
|
|
44
|
+
createMarkerLayer(name: string, options?: map.LayerOptions): any;
|
|
45
|
+
createGeometryLayer(name: string, options?: map.LayerOptions): any;
|
|
36
46
|
addLayer(layer: any): void;
|
|
37
|
-
|
|
47
|
+
addKML(feature: kml.Feature | kml.KMLFile): void;
|
|
38
48
|
uninit(): void;
|
|
39
49
|
zoomIn(): void;
|
|
40
50
|
zoomOut(): void;
|
|
@@ -48,13 +58,13 @@ export class LeafletMap extends map.MapControl
|
|
|
48
58
|
map2ScnPos(mapPos: math.Coord2D): math.Coord2D;
|
|
49
59
|
scn2MapPos(scnPos: math.Coord2D): math.Coord2D;
|
|
50
60
|
|
|
51
|
-
createMarker(mapPos: math.Coord2D, imgURL: string, imgWidth: number, imgHeight: number, options?: MarkerOptions): any;
|
|
61
|
+
createMarker(mapPos: math.Coord2D, imgURL: string, imgWidth: number, imgHeight: number, options?: map.MarkerOptions): any;
|
|
52
62
|
layerAddMarker(markerLayer: any, marker: any): void;
|
|
53
63
|
layerRemoveMarker(markerLayer: any, marker: any): void;
|
|
54
64
|
layerClearMarkers(markerLayer: any): void;
|
|
55
65
|
markerIsOver(marker: any, scnPos: math.Coord2D): boolean;
|
|
56
66
|
|
|
57
|
-
createGeometry(geom: geometry.Vector2D, options: GeometryOptions): any;
|
|
67
|
+
createGeometry(geom: geometry.Vector2D, options: map.GeometryOptions): any;
|
|
58
68
|
layerAddGeometry(geometryLayer: any, geom: any): void;
|
|
59
69
|
layerRemoveGeometry(geometryLayer: any, geom: any): void;
|
|
60
70
|
layerClearGeometries(geometryLayer: any): void;
|
package/leaflet.js
CHANGED
|
@@ -4,6 +4,7 @@ import * as kml from "./kml.js";
|
|
|
4
4
|
import * as math from "./math.js";
|
|
5
5
|
import * as map from "./map.js";
|
|
6
6
|
import * as osm from "./osm.js";
|
|
7
|
+
import * as parser from "./parser.js";
|
|
7
8
|
import * as text from "./text.js";
|
|
8
9
|
import * as web from "./web.js";
|
|
9
10
|
|
|
@@ -58,8 +59,12 @@ export function createLayer(layer, options)
|
|
|
58
59
|
return null;
|
|
59
60
|
}
|
|
60
61
|
|
|
61
|
-
export function
|
|
62
|
+
export function createFromKML(feature, options)
|
|
62
63
|
{
|
|
64
|
+
if (feature instanceof kml.KMLFile)
|
|
65
|
+
{
|
|
66
|
+
return createFromKML(feature.root, options);
|
|
67
|
+
}
|
|
63
68
|
options = data.mergeOptions(options, {noPopup: false});
|
|
64
69
|
if (feature instanceof kml.Container)
|
|
65
70
|
{
|
|
@@ -67,7 +72,7 @@ export function createFromKMLFeature(feature, options)
|
|
|
67
72
|
let layers = L.featureGroup();
|
|
68
73
|
for (i in feature.features)
|
|
69
74
|
{
|
|
70
|
-
|
|
75
|
+
createFromKML(feature.features[i], options).addTo(layers);
|
|
71
76
|
}
|
|
72
77
|
return layers;
|
|
73
78
|
}
|
|
@@ -137,6 +142,10 @@ export function createFromKMLFeature(feature, options)
|
|
|
137
142
|
}
|
|
138
143
|
return layer;
|
|
139
144
|
}
|
|
145
|
+
else if (feature instanceof kml.NetworkLink)
|
|
146
|
+
{
|
|
147
|
+
return new KMLNetworkLink(feature);
|
|
148
|
+
}
|
|
140
149
|
else
|
|
141
150
|
{
|
|
142
151
|
console.log("Unknown KML feature type", feature);
|
|
@@ -441,6 +450,48 @@ export function toKMLString(layer)
|
|
|
441
450
|
return null;
|
|
442
451
|
}
|
|
443
452
|
|
|
453
|
+
export class KMLNetworkLink
|
|
454
|
+
{
|
|
455
|
+
constructor(feature)
|
|
456
|
+
{
|
|
457
|
+
if (feature instanceof kml.NetworkLink)
|
|
458
|
+
{
|
|
459
|
+
this.feature = feature;
|
|
460
|
+
this.container = L.featureGroup();
|
|
461
|
+
this.reload();
|
|
462
|
+
}
|
|
463
|
+
else
|
|
464
|
+
{
|
|
465
|
+
throw new Error("Feature is not NetworkLink");
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
reload()
|
|
470
|
+
{
|
|
471
|
+
fetch(this.feature.networkLink).then((resp)=>{
|
|
472
|
+
console.log(resp);
|
|
473
|
+
if (resp.ok)
|
|
474
|
+
{
|
|
475
|
+
parser.parseFile(resp).then((val)=>{
|
|
476
|
+
console.log(val);
|
|
477
|
+
if (val instanceof kml.Feature)
|
|
478
|
+
{
|
|
479
|
+
this.container.clearLayers();
|
|
480
|
+
let layer = createFromKML(val);
|
|
481
|
+
if (layer)
|
|
482
|
+
layer.addTo(this.container);
|
|
483
|
+
}
|
|
484
|
+
})
|
|
485
|
+
}
|
|
486
|
+
})
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
addTo(container)
|
|
490
|
+
{
|
|
491
|
+
this.container.addTo(container);
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
|
|
444
495
|
export class LeafletMap extends map.MapControl
|
|
445
496
|
{
|
|
446
497
|
constructor(divId)
|
|
@@ -462,9 +513,9 @@ export class LeafletMap extends map.MapControl
|
|
|
462
513
|
layer.addTo(this.mapObj);
|
|
463
514
|
}
|
|
464
515
|
|
|
465
|
-
|
|
516
|
+
addKML(feature)
|
|
466
517
|
{
|
|
467
|
-
|
|
518
|
+
createFromKML(feature).addTo(this.mapObj);
|
|
468
519
|
}
|
|
469
520
|
|
|
470
521
|
// uninit(): void;
|
package/map.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Timestamp } from "./data";
|
|
2
2
|
import * as geometry from "./geometry";
|
|
3
|
+
import * as kml from "./kml";
|
|
3
4
|
import * as map from "./map";
|
|
4
5
|
import * as math from "./math";
|
|
5
6
|
|
|
@@ -8,7 +9,7 @@ export enum DataFormat
|
|
|
8
9
|
Cesium,
|
|
9
10
|
WKT,
|
|
10
11
|
GeoJSON
|
|
11
|
-
}
|
|
12
|
+
}
|
|
12
13
|
|
|
13
14
|
export enum WebMapType
|
|
14
15
|
{
|
|
@@ -16,13 +17,13 @@ export enum WebMapType
|
|
|
16
17
|
WFS,
|
|
17
18
|
ArcGIS,
|
|
18
19
|
OSMTile
|
|
19
|
-
}
|
|
20
|
+
}
|
|
20
21
|
|
|
21
22
|
export enum GeoJSONType
|
|
22
23
|
{
|
|
23
24
|
Feature,
|
|
24
25
|
FeatureCollection
|
|
25
|
-
}
|
|
26
|
+
}
|
|
26
27
|
|
|
27
28
|
export enum GeometryType
|
|
28
29
|
{
|
|
@@ -33,7 +34,7 @@ export enum GeometryType
|
|
|
33
34
|
Polygon,
|
|
34
35
|
MultiPolygon,
|
|
35
36
|
GeometryCollection
|
|
36
|
-
}
|
|
37
|
+
}
|
|
37
38
|
|
|
38
39
|
declare class LayerInfo
|
|
39
40
|
{
|
|
@@ -44,32 +45,32 @@ declare class LayerInfo
|
|
|
44
45
|
format?: string;
|
|
45
46
|
minZoom?: number;
|
|
46
47
|
maxZoom?: number;
|
|
47
|
-
}
|
|
48
|
+
}
|
|
48
49
|
|
|
49
50
|
declare class GeoJSON
|
|
50
51
|
{
|
|
51
52
|
type: GeoJSONType;
|
|
52
53
|
bbox?: number[];
|
|
53
|
-
}
|
|
54
|
+
}
|
|
54
55
|
|
|
55
56
|
declare class Geometry
|
|
56
57
|
{
|
|
57
58
|
type: GeometryType;
|
|
58
59
|
coordinates?: any[];
|
|
59
60
|
geometries?: Geometry[];
|
|
60
|
-
}
|
|
61
|
+
}
|
|
61
62
|
|
|
62
63
|
declare class GeoJSONFeature<PropType> extends GeoJSON
|
|
63
64
|
{
|
|
64
65
|
id?: string | number;
|
|
65
66
|
geometry: Geometry;
|
|
66
67
|
properties?: PropType;
|
|
67
|
-
}
|
|
68
|
+
}
|
|
68
69
|
|
|
69
|
-
declare class GeoJSONFeatureCollection extends GeoJSON
|
|
70
|
+
declare class GeoJSONFeatureCollection<PropType> extends GeoJSON
|
|
70
71
|
{
|
|
71
|
-
features: GeoJSONFeature[];
|
|
72
|
-
}
|
|
72
|
+
features: GeoJSONFeature<PropType>[];
|
|
73
|
+
}
|
|
73
74
|
|
|
74
75
|
export function calcDistance(srid: number, geom: geometry.Vector2D, x: number, y: number): number;
|
|
75
76
|
export function getLayers(svcUrl: string, onResultFunc: Function): void;
|
|
@@ -85,7 +86,7 @@ declare class GPSRecord
|
|
|
85
86
|
d: number;
|
|
86
87
|
v: boolean;
|
|
87
88
|
sate: number;
|
|
88
|
-
}
|
|
89
|
+
}
|
|
89
90
|
|
|
90
91
|
export class GPSTrack
|
|
91
92
|
{
|
|
@@ -94,7 +95,7 @@ export class GPSTrack
|
|
|
94
95
|
createLineString(): geometry.LineString;
|
|
95
96
|
getPosByTime(ts: Timestamp): math.Vector3;
|
|
96
97
|
getPosByTicks(ticks: number): math.Vector3;
|
|
97
|
-
}
|
|
98
|
+
}
|
|
98
99
|
|
|
99
100
|
export class GeolocationFilter
|
|
100
101
|
{
|
|
@@ -105,12 +106,12 @@ export class GeolocationFilter
|
|
|
105
106
|
|
|
106
107
|
constructor(minSecs: number, minDistMeter: number);
|
|
107
108
|
isValid(pos: GeolocationPosition): boolean;
|
|
108
|
-
}
|
|
109
|
+
}
|
|
109
110
|
|
|
110
111
|
|
|
111
112
|
declare class LayerOptions
|
|
112
113
|
{
|
|
113
|
-
}
|
|
114
|
+
}
|
|
114
115
|
|
|
115
116
|
declare class MarkerOptions
|
|
116
117
|
{
|
|
@@ -156,7 +157,7 @@ export class MapControl
|
|
|
156
157
|
layerAddGeometry(geometryLayer: any, geom: any): void;
|
|
157
158
|
layerRemoveGeometry(geometryLayer: any, geom: any): void;
|
|
158
159
|
layerClearGeometries(geometryLayer: any): void;
|
|
159
|
-
}
|
|
160
|
+
}
|
|
160
161
|
|
|
161
162
|
declare class OWSSpatialReference
|
|
162
163
|
{
|
package/map.js
CHANGED
|
@@ -134,7 +134,7 @@ export class GeolocationFilter
|
|
|
134
134
|
}
|
|
135
135
|
if (this.minDistMeter)
|
|
136
136
|
{
|
|
137
|
-
if (this.csys.calcSurfaceDistance(pos.coords.longitude, pos.coords.latitude, this.lastPos.longitude, this.lastPos.latitude, unit.Distance.Unit.METER) < this.minDistMeter)
|
|
137
|
+
if (this.csys.calcSurfaceDistance(pos.coords.longitude, pos.coords.latitude, this.lastPos.coords.longitude, this.lastPos.coords.latitude, unit.Distance.Unit.METER) < this.minDistMeter)
|
|
138
138
|
return false;
|
|
139
139
|
}
|
|
140
140
|
|