@sswroom/sswr 1.5.5 → 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/leaflet.js CHANGED
@@ -59,8 +59,12 @@ export function createLayer(layer, options)
59
59
  return null;
60
60
  }
61
61
 
62
- export function createFromKMLFeature(feature, options)
62
+ export function createFromKML(feature, options)
63
63
  {
64
+ if (feature instanceof kml.KMLFile)
65
+ {
66
+ return createFromKML(feature.root, options);
67
+ }
64
68
  options = data.mergeOptions(options, {noPopup: false});
65
69
  if (feature instanceof kml.Container)
66
70
  {
@@ -68,7 +72,7 @@ export function createFromKMLFeature(feature, options)
68
72
  let layers = L.featureGroup();
69
73
  for (i in feature.features)
70
74
  {
71
- createFromKMLFeature(feature.features[i], options).addTo(layers);
75
+ createFromKML(feature.features[i], options).addTo(layers);
72
76
  }
73
77
  return layers;
74
78
  }
@@ -473,7 +477,7 @@ export class KMLNetworkLink
473
477
  if (val instanceof kml.Feature)
474
478
  {
475
479
  this.container.clearLayers();
476
- let layer = createFromKMLFeature(val);
480
+ let layer = createFromKML(val);
477
481
  if (layer)
478
482
  layer.addTo(this.container);
479
483
  }
@@ -509,9 +513,9 @@ export class LeafletMap extends map.MapControl
509
513
  layer.addTo(this.mapObj);
510
514
  }
511
515
 
512
- addKMLFeature(feature)
516
+ addKML(feature)
513
517
  {
514
- createFromKMLFeature(feature).addTo(this.mapObj);
518
+ createFromKML(feature).addTo(this.mapObj);
515
519
  }
516
520
 
517
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/math.d.ts CHANGED
@@ -6,7 +6,7 @@ export function roundToStr(n: number, decimalPoints: number): string;
6
6
  export class GeoJSON
7
7
  {
8
8
  static parseGeometry(srid: null, geom: object): geometry.Vector2D | null;
9
- };
9
+ }
10
10
 
11
11
  export class Coord2D
12
12
  {
@@ -17,7 +17,7 @@ export class Coord2D
17
17
  get lon(): number;
18
18
 
19
19
  mul(val: number): Coord2D;
20
- };
20
+ }
21
21
 
22
22
  export class RectArea
23
23
  {
@@ -36,7 +36,7 @@ export class RectArea
36
36
  getArea(): number;
37
37
  unionInPlace(rect: RectArea): RectArea;
38
38
  unionPointInPlace(x: number, y: number): RectArea;
39
- };
39
+ }
40
40
 
41
41
  export class Vector3 extends Coord2D
42
42
  {
@@ -77,7 +77,7 @@ export enum EarthEllipsoidType
77
77
  WGS84_OGC,
78
78
  IERS1989,
79
79
  IERS2003
80
- };
80
+ }
81
81
 
82
82
  export class EarthEllipsoid
83
83
  {
@@ -86,7 +86,7 @@ export class EarthEllipsoid
86
86
  eet: EarthEllipsoidType;
87
87
  eccentricity: number;
88
88
  constructor(semiMajorAxis: number, inverseFlattening: number, eet: EarthEllipsoidType);
89
- calSurfaceDistance(dLat1: number, dLon1: number, dLat2: number, dLon2: number, distUnit: unit.DistanceUnit): number;
89
+ calSurfaceDistance(dLat1: number, dLon1: number, dLat2: number, dLon2: number, distUnit: unit.Distance.Unit): number;
90
90
  getSemiMajorAxis(): number;
91
91
  getSemiMinorAxis(): number;
92
92
  getInverseFlattening(): number;
@@ -123,9 +123,9 @@ export class DatumData
123
123
  yAngle: number;
124
124
  zAngle: number;
125
125
  scale: number;
126
- aunit: unit.AngleUnit;
126
+ aunit: unit.Angle.Unit;
127
127
 
128
- constructor(srid: number, spheroid: Spheroid, name: string, x0: number, y0: number, z0: number, cX: number, cY: number, cZ: number, xAngle: number, yAngle: number, zAngle: number, scale: number, aunit: unit.AngleUnit);
128
+ constructor(srid: number, spheroid: Spheroid, name: string, x0: number, y0: number, z0: number, cX: number, cY: number, cZ: number, xAngle: number, yAngle: number, zAngle: number, scale: number, aunit: unit.Angle.Unit);
129
129
  }
130
130
 
131
131
  export enum CoordinateSystemType
@@ -135,7 +135,7 @@ export enum CoordinateSystemType
135
135
  Mercator1SPProjected,
136
136
  PointMapping,
137
137
  GausskrugerProjected
138
- };
138
+ }
139
139
 
140
140
  export abstract class CoordinateSystem
141
141
  {
@@ -143,7 +143,7 @@ export abstract class CoordinateSystem
143
143
  csysName: string;
144
144
 
145
145
  constructor(srid: number, csysName: string);
146
- abstract calcSurfaceDistance(x1: number, y1: number, x2: number, y2: number, distUnit: unit.DistanceUnit) : number;
146
+ abstract calcSurfaceDistance(x1: number, y1: number, x2: number, y2: number, distUnit: unit.Distance.Unit) : number;
147
147
  abstract getCoordSysType(): CoordinateSystemType;
148
148
  abstract isProjected(): boolean;
149
149
 
@@ -160,7 +160,7 @@ export class GeographicCoordinateSystem extends CoordinateSystem
160
160
  datum: DatumData;
161
161
 
162
162
  constructor(srid: number, csysName: string, datumData: DatumData);
163
- calcSurfaceDistance(x1: number, y1: number, x2: number, y2: number, unit: unit.DistanceUnit): number;
163
+ calcSurfaceDistance(x1: number, y1: number, x2: number, y2: number, unit: unit.Distance.Unit): number;
164
164
  getCoordSysType(): CoordinateSystemType;
165
165
  isProjected(): boolean;
166
166
 
@@ -172,7 +172,7 @@ export class GeographicCoordinateSystem extends CoordinateSystem
172
172
  fromCartesianCoordDeg(coord: Vector3): Vector3;
173
173
  }
174
174
 
175
- export class ProjectedCoordinateSystem extends CoordinateSystem
175
+ export abstract class ProjectedCoordinateSystem extends CoordinateSystem
176
176
  {
177
177
  falseEasting: number;
178
178
  falseNorthing: number;
@@ -181,7 +181,7 @@ export class ProjectedCoordinateSystem extends CoordinateSystem
181
181
  scaleFactor: number;
182
182
  gcs: GeographicCoordinateSystem;
183
183
  constructor(srid: number, csysName: string, falseEasting: number, falseNorthing: number, dcentralMeridian: number, dlatitudeOfOrigin: number, scaleFactor: number, gcs: GeographicCoordinateSystem);
184
- calcSurfaceDistance(x1: number, y1: number, x2: number, y2: number, distUnit: unit.DistanceUnit): number;
184
+ calcSurfaceDistance(x1: number, y1: number, x2: number, y2: number, distUnit: unit.Distance.Unit): number;
185
185
  isProjected(): boolean;
186
186
 
187
187
  getGeographicCoordinateSystem(): GeographicCoordinateSystem;
@@ -220,4 +220,4 @@ export class CoordinateSystemManager
220
220
  static srCreateCsys(srid: number) : CoordinateSystem | null;
221
221
  static srGetDatumData(srid: number) : DatumData | null;
222
222
  static srGetSpheroid(srid: number) : Spheroid | null;
223
- };
223
+ }
package/media.d.ts CHANGED
@@ -12,7 +12,7 @@ export enum EXIFMaker
12
12
  Nikon3,
13
13
  Sanyo,
14
14
  Apple
15
- };
15
+ }
16
16
 
17
17
  export enum EXIFType
18
18
  {
@@ -30,7 +30,7 @@ export enum EXIFType
30
30
  Double,
31
31
  UINT64,
32
32
  INT64
33
- };
33
+ }
34
34
 
35
35
  declare class GPSInfo
36
36
  {
@@ -40,7 +40,7 @@ declare class GPSInfo
40
40
  gpsTime: data.Timestamp;
41
41
  }
42
42
 
43
- export function loadImageFromBlob(blob: Blob): Promise<Image>;
43
+ export function loadImageFromBlob(blob: Blob): Promise<HTMLImageElement>;
44
44
 
45
45
  export class EXIFItem
46
46
  {
@@ -50,7 +50,7 @@ export class EXIFItem
50
50
 
51
51
  constructor(id: number, type: EXIFType, data: any);
52
52
  clone(): EXIFItem;
53
- };
53
+ }
54
54
 
55
55
  export class EXIFData
56
56
  {
@@ -98,16 +98,16 @@ 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);
102
- };
101
+ static parseIFD(reader: data.ByteReader, ofst: number, lsb: boolean, nextOfst: object, readBase: number, maker?: EXIFMaker): EXIFData | null;
102
+ }
103
103
 
104
- export class StaticImage
104
+ export class StaticImage extends data.ParsedObject
105
105
  {
106
106
  img: HTMLImageElement;
107
- exif: any;
107
+ exif: EXIFData;
108
108
 
109
- constructor(img: HTMLImageElement);
110
- setExif(exif: any): void;
109
+ constructor(img: HTMLImageElement, sourceName: string, objType: string);
110
+ setExif(exif: EXIFData): void;
111
111
  getWidth(): number;
112
112
  getHeight(): number;
113
113
  getProperties(): object;
package/media.js CHANGED
@@ -2206,10 +2206,11 @@ export class EXIFData
2206
2206
  }
2207
2207
  }
2208
2208
 
2209
- export class StaticImage
2209
+ export class StaticImage extends data.ParsedObject
2210
2210
  {
2211
- constructor(img)
2211
+ constructor(img, sourceName, objType)
2212
2212
  {
2213
+ super(sourceName, objType);
2213
2214
  this.img = img;
2214
2215
  }
2215
2216
 
package/net.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export function oidText2PDU(txt: string): Uint8Array;
2
2
  export function oidToString(oid: ArrayBuffer): string;
3
+ export function getIPv4Name(ip: number): string;
package/net.js CHANGED
@@ -74,3 +74,8 @@ export function oidToString(oid)
74
74
  }
75
75
  return ret.join(".");
76
76
  }
77
+
78
+ export function getIPv4Name(ip)
79
+ {
80
+ return ((ip >> 24) & 0xff).toString() + "." + ((ip >> 16) & 0xff).toString() + "." + ((ip >> 8) & 0xff).toString() + "." + (ip & 0xff).toString()
81
+ }
package/olayer2.d.ts CHANGED
@@ -11,7 +11,7 @@ declare class Olayer2Options
11
11
  };
12
12
 
13
13
  export function toPointArray(numArr: number[][], options: Olayer2Options): OpenLayers.Geometry.Point[];
14
- export function createFromKMLFeature(feature: kml.Feature, options: Olayer2Options): Promise<OpenLayers.Feature.Vector | OpenLayers.Marker | any[] | null>;
14
+ export function createFromKML(feature: kml.Feature | kml.KMLFile, options: Olayer2Options): Promise<OpenLayers.Feature.Vector | OpenLayers.Marker | any[] | null>;
15
15
  export function createFromGeometry(geom: geometry, options: Olayer2Options): Promise<OpenLayers.Marker | OpenLayers.Geometry | null>;
16
16
 
17
17
  export class Olayer2Map extends map.MapControl
@@ -33,7 +33,7 @@ export class Olayer2Map extends map.MapControl
33
33
  createMarkerLayer(name: string, options?: LayerOptions): any;
34
34
  createGeometryLayer(name: string, options?: LayerOptions): any;
35
35
  addLayer(layer: any): void;
36
- addKMLFeature(feature: kml.Feature): void;
36
+ addKML(feature: kml.Feature | kml.KMLFile): void;
37
37
  uninit(): void;
38
38
  zoomIn(): void;
39
39
  zoomOut(): void;
package/olayer2.js CHANGED
@@ -19,8 +19,12 @@ export function toPointArray(numArr, options)
19
19
  return ret;
20
20
  }
21
21
 
22
- export async function createFromKMLFeature(feature, options)
22
+ export async function createFromKML(feature, options)
23
23
  {
24
+ if (feature instanceof kml.KMLFile)
25
+ {
26
+ return await createFromKML(feature.root, options);
27
+ }
24
28
  options = data.mergeOptions(options, {noPopup: false});
25
29
  if (feature instanceof kml.Container)
26
30
  {
@@ -29,7 +33,7 @@ export async function createFromKMLFeature(feature, options)
29
33
  let layer;
30
34
  for (i in feature.features)
31
35
  {
32
- layer = await createFromKMLFeature(feature.features[i], options);
36
+ layer = await createFromKML(feature.features[i], options);
33
37
  if (layer instanceof OpenLayers.Marker)
34
38
  {
35
39
  layers.push(layer);
@@ -348,9 +352,9 @@ export class Olayer2Map extends map.MapControl
348
352
  }
349
353
  }
350
354
 
351
- addKMLFeature(feature)
355
+ addKML(feature)
352
356
  {
353
- createFromKMLFeature(feature, {map: this.map, objProjection: this.mapProjection, mapProjection: this.map.getProjectionObject()}).then((layer)=>{this.addLayer(layer);});
357
+ createFromKML(feature, {map: this.map, objProjection: this.mapProjection, mapProjection: this.map.getProjectionObject()}).then((layer)=>{this.addLayer(layer);});
354
358
  }
355
359
 
356
360
  uninit()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sswroom/sswr",
3
- "version": "1.5.5",
3
+ "version": "1.6.0",
4
4
  "description": "Libraries made by sswroom",
5
5
  "main": "sswr.js",
6
6
  "scripts": {
package/parser.d.ts CHANGED
@@ -1,5 +1,10 @@
1
+ import * as data from "./data";
1
2
  import * as kml from "./kml";
2
- import * as media from "./media";
3
3
 
4
- export function parseXML(txt: string): kml.Feature | kml.NetworkLinkControl | null;
5
- export function parseFile(file: File | Response): Promise<kml.Feature | kml.NetworkLinkControl | media.StaticImage | null>;
4
+ export function parseXML(txt: string): kml.KMLFile | null;
5
+ /**
6
+ * Parse file into data.ParsedObject
7
+ * @param file file to be parsed
8
+ * @returns can be kml.KMLFile, media.StaticImage, cert.ASN1Data, null if failed
9
+ */
10
+ export function parseFile(file: File | Response): Promise<data.ParsedObject | null>;