@sswroom/sswr 1.5.0 → 1.5.2

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/math.js CHANGED
@@ -6,7 +6,7 @@ export function roundToFloat(n, decimalPoints)
6
6
  decimalPoints = 0;
7
7
  }
8
8
 
9
- var multiplicator = Math.pow(10, decimalPoints);
9
+ let multiplicator = Math.pow(10, decimalPoints);
10
10
  n = parseFloat((n * multiplicator).toFixed(11));
11
11
  return Math.round(n) / multiplicator;
12
12
  }
@@ -17,9 +17,9 @@ export function roundToStr(n, decimalPoints)
17
17
  decimalPoints = 0;
18
18
  }
19
19
 
20
- var multiplicator = Math.pow(10, decimalPoints);
20
+ let multiplicator = Math.pow(10, decimalPoints);
21
21
  n = parseFloat((n * multiplicator).toFixed(11));
22
- var s = "" + Math.round(n);
22
+ let s = "" + Math.round(n);
23
23
  if (decimalPoints == 0)
24
24
  {
25
25
  return s;
@@ -81,8 +81,8 @@ export class RectArea
81
81
  {
82
82
  constructor(x1, y1, x2, y2)
83
83
  {
84
- var minX;
85
- var maxX;
84
+ let minX;
85
+ let maxX;
86
86
  if (x1 > x2)
87
87
  {
88
88
  maxX = x1;
@@ -224,17 +224,17 @@ export class EarthEllipsoid
224
224
  this.inverseFlattening = inverseFlattening;
225
225
  }
226
226
  this.semiMinorAxis = this.semiMajorAxis * (1.0 - 1.0 / this.inverseFlattening);
227
- var f = 1 - this.getSemiMinorAxis() / this.semiMajorAxis;
227
+ let f = 1 - this.getSemiMinorAxis() / this.semiMajorAxis;
228
228
  this.eccentricity = Math.sqrt(2 * f - f * f);
229
229
  };
230
230
 
231
231
  calSurfaceDistance(dLat1, dLon1, dLat2, dLon2, distUnit)
232
232
  {
233
- var r;
234
- var rLat1;
235
- var rLon1;
236
- var rLat2;
237
- var rLon2;
233
+ let r;
234
+ let rLat1;
235
+ let rLon1;
236
+ let rLat2;
237
+ let rLon2;
238
238
  if (dLat1 == dLat2 && dLon1 == dLon2)
239
239
  return 0;
240
240
 
@@ -242,12 +242,12 @@ export class EarthEllipsoid
242
242
  rLon1 = dLon1 * Math.PI / 180.0;
243
243
  rLat2 = dLat2 * Math.PI / 180.0;
244
244
  rLon2 = dLon2 * Math.PI / 180.0;
245
- var y = (rLat1 + rLat2) * 0.5;
246
- var tmpV = this.eccentricity * Math.sin(y);
245
+ let y = (rLat1 + rLat2) * 0.5;
246
+ let tmpV = this.eccentricity * Math.sin(y);
247
247
  r = this.semiMajorAxis * (1 - this.eccentricity * this.eccentricity) / Math.pow(1 - tmpV * tmpV, 1.5);
248
- var cLat1 = Math.cos(rLat1);
249
- var cLat2 = Math.cos(rLat2);
250
- var d = Math.acos(cLat1 * Math.cos(rLon1) * cLat2 * Math.cos(rLon2) + cLat1 * Math.sin(rLon1) * cLat2 * Math.sin(rLon2) + Math.sin(rLat1) * Math.sin(rLat2)) * r;
248
+ let cLat1 = Math.cos(rLat1);
249
+ let cLat2 = Math.cos(rLat2);
250
+ let d = Math.acos(cLat1 * Math.cos(rLon1) * cLat2 * Math.cos(rLon2) + cLat1 * Math.sin(rLon1) * cLat2 * Math.sin(rLon2) + Math.sin(rLat1) * Math.sin(rLat2)) * r;
251
251
  if (d > 0 || d < 0)
252
252
  {
253
253
  if (distUnit != null && distUnit != unit.Distance.Unit.METER)
@@ -399,12 +399,12 @@ export class EarthEllipsoid
399
399
  }
400
400
  toCartesianCoordRad(lonLatH)
401
401
  {
402
- var cLat = Math.cos(lonLatH.lat);
403
- var sLat = Math.sin(lonLatH.lat);
404
- var cLon = Math.cos(lonLatH.lon);
405
- var sLon = Math.sin(lonLatH.lon);
406
- var e2 = this.eccentricity * this.eccentricity;
407
- var v = this.semiMajorAxis / Math.sqrt(1 - e2 * sLat * sLat);
402
+ let cLat = Math.cos(lonLatH.lat);
403
+ let sLat = Math.sin(lonLatH.lat);
404
+ let cLon = Math.cos(lonLatH.lon);
405
+ let sLon = Math.sin(lonLatH.lon);
406
+ let e2 = this.eccentricity * this.eccentricity;
407
+ let v = this.semiMajorAxis / Math.sqrt(1 - e2 * sLat * sLat);
408
408
  return new Vector3(
409
409
  (v + lonLatH.z) * cLat * cLon,
410
410
  (v + lonLatH.z) * cLat * sLon,
@@ -413,14 +413,14 @@ export class EarthEllipsoid
413
413
 
414
414
  fromCartesianCoordRad(coord)
415
415
  {
416
- var e2 = this.eccentricity * this.eccentricity;
417
- var rLon = Math.atan2(coord.y, coord.x);
418
- var p = Math.sqrt(coord.x * coord.x + coord.y * coord.y);
419
- var rLat = Math.atan2(coord.z, p * (1 - e2));
420
- var sLat;
421
- var thisLat;
422
- var v = 0;
423
- var i = 10;
416
+ let e2 = this.eccentricity * this.eccentricity;
417
+ let rLon = Math.atan2(coord.y, coord.x);
418
+ let p = Math.sqrt(coord.x * coord.x + coord.y * coord.y);
419
+ let rLat = Math.atan2(coord.z, p * (1 - e2));
420
+ let sLat;
421
+ let thisLat;
422
+ let v = 0;
423
+ let i = 10;
424
424
  while (i-- > 0)
425
425
  {
426
426
  sLat = Math.sin(rLat);
@@ -467,12 +467,12 @@ export class DatumData
467
467
  this.cX = cX;
468
468
  this.cY = cY;
469
469
  this.cZ = cZ;
470
- var aratio = unit.Angle.getUnitRatio(aunit);
470
+ let aratio = unit.Angle.getUnitRatio(aunit);
471
471
  this.xAngle = xAngle * aratio;
472
472
  this.yAngle = yAngle * aratio;
473
473
  this.zAngle = zAngle * aratio;
474
474
  this.scale = scale;
475
- this.aunit = unit.AngleUnit.RADIAN;
475
+ this.aunit = unit.Angle.Unit.RADIAN;
476
476
  }
477
477
  }
478
478
 
@@ -496,8 +496,8 @@ export class CoordinateSystem
496
496
  {
497
497
  if (this == csys)
498
498
  return true;
499
- var thisType = this.getCoordSysType();
500
- var csysType = csys.getCoordSysType();
499
+ let thisType = this.getCoordSysType();
500
+ let csysType = csys.getCoordSysType();
501
501
  if (thisType != csysType)
502
502
  return false;
503
503
  if (csysType == CoordinateSystemType.Geographic)
@@ -534,7 +534,7 @@ export class CoordinateSystem
534
534
 
535
535
  if (destCoord.isProjected())
536
536
  {
537
- var gcs = destCoord.getGeographicCoordinateSystem();
537
+ let gcs = destCoord.getGeographicCoordinateSystem();
538
538
  srcPos = gcs.fromCartesianCoordRad(srcPos);
539
539
  return Vector3.fromCoord2D(destCoord.fromGeographicCoordinateRad(srcPos), srcPos.z);
540
540
  }
@@ -546,9 +546,9 @@ export class CoordinateSystem
546
546
 
547
547
  static convertArray(srcCoord, destCoord, srcArr)
548
548
  {
549
- var i;
550
- var srcRad = false;
551
- var destArr = [];
549
+ let i;
550
+ let srcRad = false;
551
+ let destArr = [];
552
552
  if (srcCoord.isProjected())
553
553
  {
554
554
  for (i in srcArr)
@@ -577,10 +577,10 @@ export class CoordinateSystem
577
577
  }
578
578
  return destArr;
579
579
  }
580
- var tmpPos;
580
+ let tmpPos;
581
581
  if (destCoord.isProjected())
582
582
  {
583
- var gcs = destCoord.getGeographicCoordinateSystem();
583
+ let gcs = destCoord.getGeographicCoordinateSystem();
584
584
  if (srcRad)
585
585
  {
586
586
  for (i in srcArr)
@@ -664,7 +664,7 @@ export class GeographicCoordinateSystem extends CoordinateSystem
664
664
 
665
665
  toCartesianCoordRad(lonLatH)
666
666
  {
667
- var tmpPos = this.datum.spheroid.ellipsoid.toCartesianCoordRad(lonLatH);
667
+ let tmpPos = this.datum.spheroid.ellipsoid.toCartesianCoordRad(lonLatH);
668
668
  if (this.datum.scale == 0 && this.datum.xAngle == 0 && this.datum.yAngle == 0 && this.datum.zAngle == 0)
669
669
  {
670
670
  return new Vector3(
@@ -677,7 +677,7 @@ export class GeographicCoordinateSystem extends CoordinateSystem
677
677
  tmpPos.x -= this.datum.x0;
678
678
  tmpPos.y -= this.datum.y0;
679
679
  tmpPos.z -= this.datum.z0;
680
- var s = 1 + this.datum.scale * 0.000001;
680
+ let s = 1 + this.datum.scale * 0.000001;
681
681
  return new Vector3(
682
682
  s * ( tmpPos.x - this.datum.zAngle * tmpPos.y + this.datum.yAngle * tmpPos.z) + this.datum.cX + this.datum.x0,
683
683
  s * ( this.datum.zAngle * tmpPos.x + tmpPos.y - this.datum.xAngle * tmpPos.z) + this.datum.cY + this.datum.y0,
@@ -687,7 +687,7 @@ export class GeographicCoordinateSystem extends CoordinateSystem
687
687
 
688
688
  fromCartesianCoordRad(coord)
689
689
  {
690
- var tmpPos;
690
+ let tmpPos;
691
691
  if (this.datum.scale == 0 && this.datum.xAngle == 0 && this.datum.yAngle == 0 && this.datum.zAngle == 0)
692
692
  {
693
693
  tmpPos = new Vector3(
@@ -700,7 +700,7 @@ export class GeographicCoordinateSystem extends CoordinateSystem
700
700
  coord.x = coord.x - this.datum.x0 - this.datum.cX;
701
701
  coord.y = coord.y - this.datum.y0 - this.datum.cY;
702
702
  coord.z = coord.z - this.datum.z0 - this.datum.cZ;
703
- var s = 1 / (1 + this.datum.scale * 0.000001);
703
+ let s = 1 / (1 + this.datum.scale * 0.000001);
704
704
  tmpPos = new Vector3(
705
705
  s * ( coord.x + this.datum.zAngle * coord.y - this.datum.yAngle * coord.z) + this.datum.x0,
706
706
  s * (-this.datum.zAngle * coord.x + coord.y + this.datum.xAngle * coord.z) + this.datum.y0,
@@ -735,11 +735,11 @@ export class ProjectedCoordinateSystem extends CoordinateSystem
735
735
 
736
736
  calcSurfaceDistance(x1, y1, x2, y2, distUnit)
737
737
  {
738
- var diffX = x2 - x1;
739
- var diffY = y2 - y1;
738
+ let diffX = x2 - x1;
739
+ let diffY = y2 - y1;
740
740
  diffX = diffX * diffX;
741
741
  diffY = diffY * diffY;
742
- var d = Math.sqrt(diffX + diffY);
742
+ let d = Math.sqrt(diffX + diffY);
743
743
  if (distUnit != unit.Distance.Unit.METER)
744
744
  {
745
745
  d = unit.Distance.convert(unit.Distance.Unit.METER, distUnit, d);
@@ -797,14 +797,14 @@ export class MercatorProjectedCoordinateSystem extends ProjectedCoordinateSystem
797
797
 
798
798
  toGeographicCoordinateRad(projPos)
799
799
  {
800
- var ellipsoid = this.gcs.getEllipsoid();
801
- var aF = ellipsoid.getSemiMajorAxis() * this.scaleFactor;
802
- var rLatL = (projPos.y - this.falseNorthing) / aF + this.rlatitudeOfOrigin;
803
- var rLastLat;
804
- var e = ellipsoid.getEccentricity();
805
- var e2 = e * e;
806
- var tmpV;
807
- var i = 20;
800
+ let ellipsoid = this.gcs.getEllipsoid();
801
+ let aF = ellipsoid.getSemiMajorAxis() * this.scaleFactor;
802
+ let rLatL = (projPos.y - this.falseNorthing) / aF + this.rlatitudeOfOrigin;
803
+ let rLastLat;
804
+ let e = ellipsoid.getEccentricity();
805
+ let e2 = e * e;
806
+ let tmpV;
807
+ let i = 20;
808
808
  while (i-- > 0)
809
809
  {
810
810
  tmpV = projPos.y - this.falseNorthing - this.calcM(rLatL);
@@ -813,69 +813,69 @@ export class MercatorProjectedCoordinateSystem extends ProjectedCoordinateSystem
813
813
  if (rLastLat == rLatL || (tmpV < 0.000000001 && tmpV > -0.000000001))
814
814
  break;
815
815
  }
816
- var sLat = Math.sin(rLatL);
817
- var cLat = Math.cos(rLatL);
818
- var secLat = 1 / cLat;
819
- var tLat = sLat * secLat; //Math_Tan(rLatL);
820
- var tLat2 = tLat * tLat;
821
- var tLat4 = tLat2 * tLat2;
822
- var tmp = 1 - e2 * sLat * sLat;
823
- var v = aF / Math.sqrt(tmp);
824
- var v2 = v * v;
825
- var v3 = v * v2;
826
- var v5 = v3 * v2;
827
- var v7 = v5 * v2;
828
- var p = v * (1 - e2) / tmp;
829
- var nb2 = v / p - 1;
816
+ let sLat = Math.sin(rLatL);
817
+ let cLat = Math.cos(rLatL);
818
+ let secLat = 1 / cLat;
819
+ let tLat = sLat * secLat; //Math_Tan(rLatL);
820
+ let tLat2 = tLat * tLat;
821
+ let tLat4 = tLat2 * tLat2;
822
+ let tmp = 1 - e2 * sLat * sLat;
823
+ let v = aF / Math.sqrt(tmp);
824
+ let v2 = v * v;
825
+ let v3 = v * v2;
826
+ let v5 = v3 * v2;
827
+ let v7 = v5 * v2;
828
+ let p = v * (1 - e2) / tmp;
829
+ let nb2 = v / p - 1;
830
830
 
831
- var ser7 = tLat / (2 * p * v);
832
- var ser8 = tLat / (24 * p * v3) * (5 + 3 * tLat2 + nb2 - 9 * tLat2 * nb2);
833
- var ser9 = tLat / (720 * p * v5) * (61 + 90 * tLat2 + 45 * tLat4);
834
- var ser10 = secLat / v;
835
- var ser11 = secLat / (6 * v3) * (v / p + 2 * tLat2);
836
- var ser12 = secLat / (120 * v5) * (5 + 28 * tLat2 + 24 * tLat4);
837
- var ser12a = secLat / (5040 * v7) * (61 + 662 * tLat2 + 1320 * tLat4 + 720 * tLat4 * tLat2);
831
+ let ser7 = tLat / (2 * p * v);
832
+ let ser8 = tLat / (24 * p * v3) * (5 + 3 * tLat2 + nb2 - 9 * tLat2 * nb2);
833
+ let ser9 = tLat / (720 * p * v5) * (61 + 90 * tLat2 + 45 * tLat4);
834
+ let ser10 = secLat / v;
835
+ let ser11 = secLat / (6 * v3) * (v / p + 2 * tLat2);
836
+ let ser12 = secLat / (120 * v5) * (5 + 28 * tLat2 + 24 * tLat4);
837
+ let ser12a = secLat / (5040 * v7) * (61 + 662 * tLat2 + 1320 * tLat4 + 720 * tLat4 * tLat2);
838
838
 
839
- var eDiff = projPos.x - this.falseEasting;
840
- var eDiff2 = eDiff * eDiff;
841
- var eDiff4 = eDiff2 * eDiff2;
842
- var eDiff6 = eDiff4 * eDiff2;
839
+ let eDiff = projPos.x - this.falseEasting;
840
+ let eDiff2 = eDiff * eDiff;
841
+ let eDiff4 = eDiff2 * eDiff2;
842
+ let eDiff6 = eDiff4 * eDiff2;
843
843
  return new Coord2D(this.rcentralMeridian + ser10 * eDiff - ser11 * (eDiff2 * eDiff) + ser12 * (eDiff4 * eDiff) - ser12a * (eDiff6 * eDiff),
844
844
  rLatL - ser7 * eDiff2 + ser8 * eDiff4 - ser9 * eDiff6);
845
845
  }
846
846
 
847
847
  fromGeographicCoordinateRad(geoPos)
848
848
  {
849
- var ellipsoid = this.gcs.getEllipsoid();
850
- var rLat = geoPos.lat;
851
- var rLon = geoPos.lon;
852
- var rLon0 = this.rcentralMeridian;
853
- var sLat = Math.sin(rLat);
854
- var cLat = Math.cos(rLat);
855
- var tLat = sLat / cLat; //Math_Tan(rLat);
856
- var a = ellipsoid.getSemiMajorAxis();
857
- var e = ellipsoid.getEccentricity();
858
- var e2 = e * e;
859
- var tmp = 1 - e2 * sLat * sLat;
860
- var v = a * this.scaleFactor / Math.sqrt(tmp);
861
- var p = v * (1 - e2) / tmp;
862
- var nb2 = v / p - 1;
863
- var m = this.calcM(rLat);
864
- var tLat2 = tLat * tLat;
865
- var tLat4 = tLat2 * tLat2;
866
- var cLat3 = cLat * cLat * cLat;
867
- var cLat5 = cLat3 * cLat * cLat;
849
+ let ellipsoid = this.gcs.getEllipsoid();
850
+ let rLat = geoPos.lat;
851
+ let rLon = geoPos.lon;
852
+ let rLon0 = this.rcentralMeridian;
853
+ let sLat = Math.sin(rLat);
854
+ let cLat = Math.cos(rLat);
855
+ let tLat = sLat / cLat; //Math_Tan(rLat);
856
+ let a = ellipsoid.getSemiMajorAxis();
857
+ let e = ellipsoid.getEccentricity();
858
+ let e2 = e * e;
859
+ let tmp = 1 - e2 * sLat * sLat;
860
+ let v = a * this.scaleFactor / Math.sqrt(tmp);
861
+ let p = v * (1 - e2) / tmp;
862
+ let nb2 = v / p - 1;
863
+ let m = this.calcM(rLat);
864
+ let tLat2 = tLat * tLat;
865
+ let tLat4 = tLat2 * tLat2;
866
+ let cLat3 = cLat * cLat * cLat;
867
+ let cLat5 = cLat3 * cLat * cLat;
868
868
 
869
- var ser1 = m + this.falseNorthing;
870
- var ser2 = v * 0.5 * cLat * sLat;
871
- var ser3 = v / 24 * sLat * cLat3 * (5 - tLat2 + 9 * nb2);
872
- var ser3a = v / 720 * sLat * cLat5 * (61 - 58 * tLat2 + tLat4);
873
- var ser4 = v * cLat;
874
- var ser5 = v / 6 * cLat3 * (v / p - tLat2);
875
- var ser6 = v / 120 * cLat5 * (5 - 18 * tLat2 + tLat4 + 14 * nb2 - 58 * tLat2 * nb2);
876
- var dlon = rLon - rLon0;
877
- var dlon2 = dlon * dlon;
878
- var dlon4 = dlon2 * dlon2;
869
+ let ser1 = m + this.falseNorthing;
870
+ let ser2 = v * 0.5 * cLat * sLat;
871
+ let ser3 = v / 24 * sLat * cLat3 * (5 - tLat2 + 9 * nb2);
872
+ let ser3a = v / 720 * sLat * cLat5 * (61 - 58 * tLat2 + tLat4);
873
+ let ser4 = v * cLat;
874
+ let ser5 = v / 6 * cLat3 * (v / p - tLat2);
875
+ let ser6 = v / 120 * cLat5 * (5 - 18 * tLat2 + tLat4 + 14 * nb2 - 58 * tLat2 * nb2);
876
+ let dlon = rLon - rLon0;
877
+ let dlon2 = dlon * dlon;
878
+ let dlon4 = dlon2 * dlon2;
879
879
 
880
880
  return new Coord2D(this.falseEasting + ser4 * dlon + ser5 * dlon * dlon2 + ser6 * dlon * dlon4,
881
881
  ser1 + ser2 * dlon2 + ser3 * dlon4 + ser3a * dlon4 * dlon2);
@@ -883,14 +883,14 @@ export class MercatorProjectedCoordinateSystem extends ProjectedCoordinateSystem
883
883
 
884
884
  calcM(rLat)
885
885
  {
886
- var ellipsoid = this.gcs.getEllipsoid();
887
- var a = ellipsoid.getSemiMajorAxis();
888
- var b = ellipsoid.getSemiMinorAxis();
889
- var n = (a - b) / (a + b);
890
- var n2 = n * n;
891
- var n3 = n2 * n;
892
- var rLat0 = this.rlatitudeOfOrigin;
893
- var m;
886
+ let ellipsoid = this.gcs.getEllipsoid();
887
+ let a = ellipsoid.getSemiMajorAxis();
888
+ let b = ellipsoid.getSemiMinorAxis();
889
+ let n = (a - b) / (a + b);
890
+ let n2 = n * n;
891
+ let n3 = n2 * n;
892
+ let rLat0 = this.rlatitudeOfOrigin;
893
+ let m;
894
894
  m = (1 + n + 1.25 * n2 + 1.25 * n3) * (rLat - rLat0);
895
895
  m = m - (3 * n + 3 * n2 + 2.625 * n3) * Math.sin(rLat - rLat0) * Math.cos(rLat + rLat0);
896
896
  m = m + (1.875 * n2 + 1.875 * n3) * Math.sin(2 * (rLat - rLat0)) * Math.cos(2 * (rLat + rLat0));
@@ -914,21 +914,21 @@ export class Mercator1SPProjectedCoordinateSystem extends ProjectedCoordinateSys
914
914
 
915
915
  toGeographicCoordinateRad(projPos)
916
916
  {
917
- var ellipsoid = this.gcs.getEllipsoid();
918
- var rLon0 = this.rcentralMeridian;
919
- var a = ellipsoid.getSemiMajorAxis();
917
+ let ellipsoid = this.gcs.getEllipsoid();
918
+ let rLon0 = this.rcentralMeridian;
919
+ let a = ellipsoid.getSemiMajorAxis();
920
920
  return new Coord2D(((projPos.x - this.falseEasting) / a + rLon0),
921
921
  (Math.atan(Math.exp((projPos.y - this.falseNorthing) / a)) - Math.PI * 0.25) * 2);
922
922
  }
923
923
 
924
924
  fromGeographicCoordinateRad(geoPos)
925
925
  {
926
- var ellipsoid = this.gcs.getEllipsoid();
927
- var rLat = geoPos.lat;
928
- var rLon = geoPos.lon;
929
- var rLon0 = this.rcentralMeridian;
930
- var a = ellipsoid.getSemiMajorAxis();
931
- var dlon = rLon - rLon0;
926
+ let ellipsoid = this.gcs.getEllipsoid();
927
+ let rLat = geoPos.lat;
928
+ let rLon = geoPos.lon;
929
+ let rLon0 = this.rcentralMeridian;
930
+ let a = ellipsoid.getSemiMajorAxis();
931
+ let dlon = rLon - rLon0;
932
932
  return new Coord2D(this.falseEasting + dlon * a,
933
933
  this.falseNorthing + a * Math.log(Math.tan(Math.PI * 0.25 + rLat * 0.5)));
934
934
  }
@@ -938,7 +938,7 @@ export class CoordinateSystemManager
938
938
  {
939
939
  static srCreateGeogCSysData(srid, datumSrid, name)
940
940
  {
941
- var data = this.srGetDatumData(datumSrid);
941
+ let data = this.srGetDatumData(datumSrid);
942
942
  if (data == null)
943
943
  {
944
944
  return null;
@@ -948,7 +948,7 @@ export class CoordinateSystemManager
948
948
 
949
949
  static srCreateProjCSysData(srid, geogcsSrid, csysType, projName, falseEasting, falseNorthing, centralMeridian, latitudeOfOrigin, scaleFactor)
950
950
  {
951
- var gcsys = this.srCreateGeogCSys(geogcsSrid);
951
+ let gcsys = this.srCreateGeogCSys(geogcsSrid);
952
952
  if (gcsys == null)
953
953
  return null;
954
954
  if (csysType == CoordinateSystemType.MercatorProjected || csysType == CoordinateSystemType.GausskrugerProjected)
@@ -1014,17 +1014,17 @@ export class CoordinateSystemManager
1014
1014
  switch (srid)
1015
1015
  {
1016
1016
  case 6326:
1017
- return new DatumData(6326, this.srGetSpheroid(7030), "WGS_1984", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, unit.AngleUnit.RADIAN);
1017
+ return new DatumData(6326, this.srGetSpheroid(7030), "WGS_1984", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, unit.Angle.Unit.RADIAN);
1018
1018
  case 6600:
1019
- return new DatumData(6600, this.srGetSpheroid(7012), "Anguilla_1957", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, unit.AngleUnit.RADIAN);
1019
+ return new DatumData(6600, this.srGetSpheroid(7012), "Anguilla_1957", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, unit.Angle.Unit.RADIAN);
1020
1020
  case 6601:
1021
- return new DatumData(6601, this.srGetSpheroid(7012), "Antigua_1943", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, unit.AngleUnit.RADIAN);
1021
+ return new DatumData(6601, this.srGetSpheroid(7012), "Antigua_1943", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, unit.Angle.Unit.RADIAN);
1022
1022
  case 6602:
1023
- return new DatumData(6602, this.srGetSpheroid(7012), "Dominica_1945", 0, 0, 0, 725, 685, 536, 0, 0, 0, 0, unit.AngleUnit.ARCSECOND);
1023
+ return new DatumData(6602, this.srGetSpheroid(7012), "Dominica_1945", 0, 0, 0, 725, 685, 536, 0, 0, 0, 0, unit.Angle.Unit.ARCSECOND);
1024
1024
  case 6603:
1025
- return new DatumData(6603, this.srGetSpheroid(7012), "Grenada_1953", 0, 0, 0, 72, 213.7, 93, 0, 0, 0, 0, unit.AngleUnit.ARCSECOND);
1025
+ return new DatumData(6603, this.srGetSpheroid(7012), "Grenada_1953", 0, 0, 0, 72, 213.7, 93, 0, 0, 0, 0, unit.Angle.Unit.ARCSECOND);
1026
1026
  case 6611:
1027
- return new DatumData(6611, this.srGetSpheroid(7022), "Hong_Kong_1980", 0, 0, 0, -162.619, -276.959, -161.764, 0.067753, -2.24365, -1.15883, -1.09425, unit.AngleUnit.ARCSECOND);
1027
+ return new DatumData(6611, this.srGetSpheroid(7022), "Hong_Kong_1980", 0, 0, 0, -162.619, -276.959, -161.764, 0.067753, -2.24365, -1.15883, -1.09425, unit.Angle.Unit.ARCSECOND);
1028
1028
  }
1029
1029
  return null;
1030
1030
  }
package/net.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export function oidText2PDU(txt: string): Uint8Array;
2
+ export function oidToString(oid: ArrayBuffer): string;
package/net.js ADDED
@@ -0,0 +1,76 @@
1
+ export function oidText2PDU(txt)
2
+ {
3
+ var sarr = txt.split(".");
4
+ var ret = [];
5
+ var i = 2;
6
+ var j = sarr.length;
7
+ var v;
8
+ if (j == 1)
9
+ {
10
+ ret.push(sarr[0] * 40);
11
+ }
12
+ else
13
+ {
14
+ ret.push(sarr[0] * 40 + Number.parseInt(sarr[1]));
15
+ }
16
+ while (i < j)
17
+ {
18
+ v = sarr[i];
19
+
20
+ if (v < 128)
21
+ {
22
+ ret.push(Number.parseInt(v));
23
+ }
24
+ else if (v < 0x4000)
25
+ {
26
+ ret.push(0x80 | (v >> 7));
27
+ ret.push(v & 0x7f);
28
+ }
29
+ else if (v < 0x200000)
30
+ {
31
+ ret.push(0x80 | (v >> 14));
32
+ ret.push(0x80 | ((v >> 7) & 0x7f));
33
+ ret.push(v & 0x7f);
34
+ }
35
+ else if (v < 0x10000000)
36
+ {
37
+ ret.push(0x80 | (v >> 21));
38
+ ret.push(0x80 | ((v >> 14) & 0x7f));
39
+ ret.push(0x80 | ((v >> 7) & 0x7f));
40
+ ret.push(v & 0x7f);
41
+ }
42
+ else
43
+ {
44
+ ret.push(0x80 | (v >> 28));
45
+ ret.push(0x80 | ((v >> 21) & 0x7f));
46
+ ret.push(0x80 | ((v >> 14) & 0x7f));
47
+ ret.push(0x80 | ((v >> 7) & 0x7f));
48
+ ret.push(v & 0x7f);
49
+ }
50
+
51
+ i++;
52
+ }
53
+ return new Uint8Array(ret);
54
+ }
55
+
56
+ export function oidToString(oid)
57
+ {
58
+ let arr = new Uint8Array(oid);
59
+ let i = 1;
60
+ let j = arr.length;
61
+ let v = 0;
62
+ let ret = [];
63
+ ret.push(Math.floor(arr[0] / 40));
64
+ ret.push(arr[0] % 40);
65
+ while (i < j)
66
+ {
67
+ v = (v << 7) | (arr[i] & 0x7f);
68
+ if ((arr[i] & 0x80) == 0)
69
+ {
70
+ ret.push(v);
71
+ v = 0;
72
+ }
73
+ i++;
74
+ }
75
+ return ret.join(".");
76
+ }
package/olayer2.d.ts CHANGED
@@ -3,6 +3,17 @@ import * as kml from "./kml";
3
3
  import * as map from "./map";
4
4
  import * as math from "./math";
5
5
 
6
+ declare class Olayer2Options
7
+ {
8
+ objProjection: OpenLayers.Projection;
9
+ mapProjection: OpenLayers.Projection;
10
+ map: OpenLayers.Map;
11
+ };
12
+
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>;
15
+ export function createFromGeometry(geom: geometry, options: Olayer2Options): Promise<OpenLayers.Marker | OpenLayers.Geometry | null>;
16
+
6
17
  export class Olayer2Map extends map.MapControl
7
18
  {
8
19
  inited: boolean;