@sswroom/sswr 1.6.22 → 1.6.23

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 CHANGED
@@ -1,3 +1,8 @@
1
+ 1.6.23
2
+ -Enhance cesium types
3
+ -Fixed time shift on Android after monitor off
4
+ -Added geometry.LineString.calcLength
5
+
1
6
  1.6.22
2
7
  -Enhance map.MapControl Marker
3
8
  -Added map.MapControl.layerMoveMarker
package/cesium.d.ts CHANGED
@@ -7,7 +7,7 @@ import * as web from "./web";
7
7
 
8
8
  declare class KMLFeatureOptions
9
9
  {
10
- noPopup: boolean;
10
+ noPopup?: boolean;
11
11
  }
12
12
 
13
13
  export function screenToLatLon(viewer: Viewer, x: number, y: number, ellipsoid: Ellipsoid) : math.Coord2D;
@@ -17,7 +17,7 @@ export function newObjFromGeoJSON(geoJSON: object) : object;
17
17
  export function addGeoJSON(viewer: Viewer, geoJSON: object, color: Color, extSize: number): void;
18
18
  export function fromCartesian3Array(viewer: Viewer, arr: Cartesian3[]): object[];
19
19
  export function fromPolygonGraphics(viewer: Viewer, pg: PolygonGraphics): geometry.Polygon;
20
- export function createFromKML(feature: kml.Feature | kml.KMLFile, options: KMLFeatureOptions): any;
20
+ export function createFromKML(feature: kml.Feature | kml.KMLFile, options?: KMLFeatureOptions): any;
21
21
  export function createFromGeometry(geom: geometry.Vector2D, options: map.GeometryOptions)
22
22
  export function parseColor(c: string): web.Color;
23
23
  export class CesiumMap extends map.MapControl
package/data.js CHANGED
@@ -2276,7 +2276,15 @@ export class TimeInstant
2276
2276
  let ns = (t1 / 1000) - Math.floor(t1 / 1000) + (t2 / 1000) - Math.floor(t2 / 1000);
2277
2277
  if (ns >= 1)
2278
2278
  ns -= 1;
2279
- return new TimeInstant(secs, Math.round(ns * 1000000000));
2279
+ let n = Date.now();
2280
+ if (secs == Math.floor(n))
2281
+ {
2282
+ return new TimeInstant(secs, Math.round(ns * 1000000000));
2283
+ }
2284
+ else
2285
+ {
2286
+ return TimeInstant.fromTicks(n);
2287
+ }
2280
2288
  }
2281
2289
  else
2282
2290
  {
package/geometry.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import * as math from "./math";
2
+ import * as unit from "./unit";
2
3
 
3
4
  declare class BoundaryPointResult
4
5
  {
@@ -70,6 +71,7 @@ export class LineString extends Vector2D
70
71
  hasArea(): boolean;
71
72
  calcHIntersacts(y: double): number[];
72
73
  getDisplayCenter(): math.Coord2D;
74
+ calcLength(distUnit: unit.Distance.Unit): number | null;
73
75
  }
74
76
 
75
77
  export class LinearRing extends LineString
package/geometry.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import * as math from "./math.js";
2
+ import * as unit from "./unit.js";
2
3
 
3
4
  export const VectorType = {
4
5
  Unknown: "Unknown",
@@ -397,6 +398,28 @@ export class LineString extends Vector2D
397
398
  }
398
399
  return new math.Coord2D(xList[xList.length >> 1], pt.y);
399
400
  }
401
+
402
+ /**
403
+ * @param {unit.Distance.Unit} distUnit
404
+ */
405
+ calcLength(distUnit)
406
+ {
407
+ let csys = math.CoordinateSystemManager.srCreateCsys(this.srid);
408
+ if (!csys)
409
+ return null;
410
+ let totalLength = 0;
411
+ let i = 1;
412
+ let lastPt = this.coordinates[0];
413
+ let thisPt;
414
+ while (i < this.coordinates.length)
415
+ {
416
+ thisPt = this.coordinates[i];
417
+ totalLength += csys.calcSurfaceDistance(lastPt[0], lastPt[1], thisPt[0], thisPt[1], distUnit);
418
+ lastPt = thisPt;
419
+ i++;
420
+ }
421
+ return totalLength;
422
+ }
400
423
  }
401
424
 
402
425
  export class LinearRing extends LineString
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sswroom/sswr",
3
- "version": "1.6.22",
3
+ "version": "1.6.23",
4
4
  "description": "Libraries made by sswroom",
5
5
  "main": "sswr.js",
6
6
  "scripts": {