@sswroom/sswr 1.6.4 → 1.6.5

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
@@ -1,6 +1,10 @@
1
1
  import * as geometry from "./geometry.js";
2
2
  import * as unit from "./unit.js";
3
3
 
4
+ /**
5
+ * @param {number} n
6
+ * @param {number | undefined} decimalPoints
7
+ */
4
8
  export function roundToFloat(n, decimalPoints)
5
9
  {
6
10
  if (decimalPoints === undefined) {
@@ -12,6 +16,10 @@ export function roundToFloat(n, decimalPoints)
12
16
  return Math.round(n) / multiplicator;
13
17
  }
14
18
 
19
+ /**
20
+ * @param {number} n
21
+ * @param {number | undefined} decimalPoints
22
+ */
15
23
  export function roundToStr(n, decimalPoints)
16
24
  {
17
25
  if (decimalPoints === undefined) {
@@ -36,14 +44,20 @@ export function roundToStr(n, decimalPoints)
36
44
  }
37
45
 
38
46
  export class GeoJSON {
47
+ /**
48
+ * @param {number} srid
49
+ * @param {{ type: string; coordinates: number[][][] | number[][][][] | undefined; }} geom
50
+ */
39
51
  static parseGeometry(srid, geom)
40
52
  {
41
53
  if (geom.type == "Polygon")
42
54
  {
55
+ // @ts-ignore
43
56
  return new geometry.Polygon(srid, geom.coordinates);
44
57
  }
45
58
  else if (geom.type == "MultiPolygon")
46
59
  {
60
+ // @ts-ignore
47
61
  return new geometry.MultiPolygon(srid, geom.coordinates);
48
62
  }
49
63
  else
@@ -56,6 +70,10 @@ export class GeoJSON {
56
70
 
57
71
  export class Coord2D
58
72
  {
73
+ /**
74
+ * @param {number} x
75
+ * @param {number} y
76
+ */
59
77
  constructor(x, y)
60
78
  {
61
79
  this.x = x;
@@ -72,6 +90,9 @@ export class Coord2D
72
90
  return this.x;
73
91
  }
74
92
 
93
+ /**
94
+ * @param {number} val
95
+ */
75
96
  mul(val)
76
97
  {
77
98
  return new Coord2D(this.x * val, this.y * val);
@@ -80,6 +101,12 @@ export class Coord2D
80
101
 
81
102
  export class RectArea
82
103
  {
104
+ /**
105
+ * @param {number} x1
106
+ * @param {number} y1
107
+ * @param {number} x2
108
+ * @param {number} y2
109
+ */
83
110
  constructor(x1, y1, x2, y2)
84
111
  {
85
112
  let minX;
@@ -126,6 +153,10 @@ export class RectArea
126
153
  return this.max.y;
127
154
  }
128
155
 
156
+ /**
157
+ * @param {number} x
158
+ * @param {number} y
159
+ */
129
160
  containPt(x, y)
130
161
  {
131
162
  return (x >= this.min.x && x <= this.max.x && y >= this.min.y && y <= this.max.y);
@@ -151,6 +182,9 @@ export class RectArea
151
182
  return this.getWidth() * this.getHeight();
152
183
  }
153
184
 
185
+ /**
186
+ * @param {RectArea} rect
187
+ */
154
188
  unionInPlace(rect)
155
189
  {
156
190
  if (this.min.x > rect.min.x)
@@ -164,6 +198,10 @@ export class RectArea
164
198
  return this;
165
199
  }
166
200
 
201
+ /**
202
+ * @param {number} x
203
+ * @param {number} y
204
+ */
167
205
  unionPointInPlace(x, y)
168
206
  {
169
207
  if (this.min.x > x)
@@ -180,6 +218,11 @@ export class RectArea
180
218
 
181
219
  export class Vector3 extends Coord2D
182
220
  {
221
+ /**
222
+ * @param {number} x
223
+ * @param {number} y
224
+ * @param {number} z
225
+ */
183
226
  constructor(x, y, z)
184
227
  {
185
228
  super(x, y);
@@ -191,16 +234,26 @@ export class Vector3 extends Coord2D
191
234
  return this.z;
192
235
  }
193
236
 
237
+ /**
238
+ * @param {number} val
239
+ */
194
240
  mulXY(val)
195
241
  {
196
242
  return new Vector3(this.x * val, this.y * val, this.z);
197
243
  }
198
244
 
245
+ /**
246
+ * @param {number} val
247
+ */
199
248
  mul(val)
200
249
  {
201
250
  return new Vector3(this.x * val, this.y * val, this.z * val);
202
251
  }
203
252
 
253
+ /**
254
+ * @param {{ x: any; y: any; }} coord
255
+ * @param {number} z
256
+ */
204
257
  static fromCoord2D(coord, z)
205
258
  {
206
259
  return new Vector3(coord.x, coord.y, z);
@@ -238,11 +291,18 @@ export const EarthEllipsoidType = {
238
291
 
239
292
  export class EarthEllipsoid
240
293
  {
294
+ /**
295
+ * @param {number | null} semiMajorAxis
296
+ * @param {number | null} inverseFlattening
297
+ * @param {number} eet
298
+ */
241
299
  constructor(semiMajorAxis, inverseFlattening, eet)
242
300
  {
243
301
  this.eet = eet;
244
302
  if (semiMajorAxis == null || inverseFlattening == null)
245
303
  {
304
+ this.semiMajorAxis = 0;
305
+ this.inverseFlattening = 99999999.0;
246
306
  this.initEarthInfo(eet);
247
307
  }
248
308
  else
@@ -255,6 +315,13 @@ export class EarthEllipsoid
255
315
  this.eccentricity = Math.sqrt(2 * f - f * f);
256
316
  };
257
317
 
318
+ /**
319
+ * @param {number} dLat1
320
+ * @param {number} dLon1
321
+ * @param {number} dLat2
322
+ * @param {number} dLon2
323
+ * @param {unit.Distance.Unit | null} distUnit
324
+ */
258
325
  calSurfaceDistance(dLat1, dLon1, dLat2, dLon2, distUnit)
259
326
  {
260
327
  let r;
@@ -308,11 +375,17 @@ export class EarthEllipsoid
308
375
  return this.eccentricity;
309
376
  }
310
377
 
378
+ /**
379
+ * @param {{ semiMajorAxis: any; inverseFlattening: any; }} ellipsoid
380
+ */
311
381
  equals(ellipsoid)
312
382
  {
313
383
  return ellipsoid.semiMajorAxis == this.semiMajorAxis && ellipsoid.inverseFlattening == this.inverseFlattening;
314
384
  }
315
385
 
386
+ /**
387
+ * @param {number} eet
388
+ */
316
389
  initEarthInfo(eet)
317
390
  {
318
391
  switch (eet)
@@ -424,6 +497,9 @@ export class EarthEllipsoid
424
497
  return;
425
498
  }
426
499
  }
500
+ /**
501
+ * @param {{ lat: number; lon: number; z: number; }} lonLatH
502
+ */
427
503
  toCartesianCoordRad(lonLatH)
428
504
  {
429
505
  let cLat = Math.cos(lonLatH.lat);
@@ -438,6 +514,9 @@ export class EarthEllipsoid
438
514
  ((1 - e2) * v + lonLatH.z) * sLat);
439
515
  }
440
516
 
517
+ /**
518
+ * @param {{ y: number; x: number; z: number; }} coord
519
+ */
441
520
  fromCartesianCoordRad(coord)
442
521
  {
443
522
  let e2 = this.eccentricity * this.eccentricity;
@@ -460,11 +539,17 @@ export class EarthEllipsoid
460
539
  return new Vector3(rLon, rLat, p / Math.cos(rLat) - v);
461
540
  }
462
541
 
542
+ /**
543
+ * @param {{ mulXY: (arg0: number) => any; }} lonLatH
544
+ */
463
545
  toCartesianCoordDeg(lonLatH)
464
546
  {
465
547
  return this.toCartesianCoordRad(lonLatH.mulXY(Math.PI / 180.0));
466
548
  }
467
549
 
550
+ /**
551
+ * @param {any} coord
552
+ */
468
553
  fromCartesianCoordDeg(coord)
469
554
  {
470
555
  return this.fromCartesianCoordRad(coord).mulXY(180.0 / Math.PI);
@@ -473,6 +558,11 @@ export class EarthEllipsoid
473
558
 
474
559
  export class Spheroid
475
560
  {
561
+ /**
562
+ * @param {number} srid
563
+ * @param {EarthEllipsoid} ellipsoid
564
+ * @param {string} name
565
+ */
476
566
  constructor(srid, ellipsoid, name)
477
567
  {
478
568
  this.srid = srid;
@@ -483,6 +573,22 @@ export class Spheroid
483
573
 
484
574
  export class DatumData
485
575
  {
576
+ /**
577
+ * @param {number} srid
578
+ * @param {Spheroid} spheroid
579
+ * @param {string} name
580
+ * @param {number} x0
581
+ * @param {number} y0
582
+ * @param {number} z0
583
+ * @param {number} cX
584
+ * @param {number} cY
585
+ * @param {number} cZ
586
+ * @param {number} xAngle
587
+ * @param {number} yAngle
588
+ * @param {number} zAngle
589
+ * @param {number} scale
590
+ * @param {unit.Angle.Unit} aunit
591
+ */
486
592
  constructor(srid, spheroid, name, x0, y0, z0, cX, cY, cZ, xAngle, yAngle, zAngle, scale, aunit)
487
593
  {
488
594
  this.srid = srid;
@@ -513,12 +619,55 @@ export const CoordinateSystemType = {
513
619
 
514
620
  export class CoordinateSystem
515
621
  {
622
+ /**
623
+ * @param {number} srid
624
+ * @param {string} csysName
625
+ */
516
626
  constructor(srid, csysName)
517
627
  {
628
+ if(this.constructor == CoordinateSystem) {
629
+ throw new Error("Class is of abstract type and can't be instantiated");
630
+ };
631
+
632
+ if(this.getCoordSysType == undefined) {
633
+ throw new Error("getCoordSysType method must be implemented");
634
+ };
518
635
  this.srid = srid;
519
636
  this.csysName = csysName;
520
637
  }
521
638
 
639
+ /**
640
+ * @param {number} x1
641
+ * @param {number} y1
642
+ * @param {number} x2
643
+ * @param {number} y2
644
+ * @param {unit.Distance.Unit} distUnit
645
+ * @returns {number}
646
+ */
647
+ calcSurfaceDistance(x1, y1, x2, y2, distUnit)
648
+ {
649
+ throw new Error("Calling abstract method CoordinateSystem.calcSurfaceDistance");
650
+ }
651
+
652
+ /**
653
+ * @returns {number}
654
+ */
655
+ getCoordSysType()
656
+ {
657
+ throw new Error("Calling abstract method CoordinateSystem.getCoordSysType");
658
+ }
659
+
660
+ /**
661
+ * @returns {boolean}
662
+ */
663
+ isProjected()
664
+ {
665
+ throw new Error("Calling abstract method CoordinateSystem.isProjected");
666
+ }
667
+
668
+ /**
669
+ * @param {CoordinateSystem} csys
670
+ */
522
671
  equals(csys)
523
672
  {
524
673
  if (this == csys)
@@ -527,66 +676,107 @@ export class CoordinateSystem
527
676
  let csysType = csys.getCoordSysType();
528
677
  if (thisType != csysType)
529
678
  return false;
530
- if (csysType == CoordinateSystemType.Geographic)
679
+ if (csysType == CoordinateSystemType.Geographic && (this instanceof GeographicCoordinateSystem) && (csys instanceof GeographicCoordinateSystem))
531
680
  {
532
681
  return this.getEllipsoid().equals(csys.getEllipsoid());
533
682
  }
534
- else if (cst == CoordinateSystemType.PointMapping)
683
+ else if (csysType == CoordinateSystemType.PointMapping)
535
684
  {
536
685
  return false;
537
686
  }
538
- else
687
+ else if ((this instanceof ProjectedCoordinateSystem) && (csys instanceof ProjectedCoordinateSystem))
539
688
  {
540
689
  return this.sameProjection(csys);
541
690
  }
691
+ else
692
+ {
693
+ return false;
694
+ }
542
695
  }
543
696
 
697
+ /**
698
+ * @param {CoordinateSystem} srcCoord
699
+ * @param {CoordinateSystem} destCoord
700
+ * @param {Coord2D} coord
701
+ */
544
702
  static convert(srcCoord, destCoord, coord)
545
703
  {
546
704
  return CoordinateSystem.convert3D(srcCoord, destCoord, Vector3.fromCoord2D(coord, 0));
547
705
  }
548
706
 
707
+ /**
708
+ * @param {CoordinateSystem} srcCoord
709
+ * @param {CoordinateSystem} destCoord
710
+ * @param {Vector3} srcPos
711
+ */
549
712
  static convert3D(srcCoord, destCoord, srcPos)
550
713
  {
551
- if (srcCoord.isProjected())
714
+ let srcGCsys;
715
+ if (srcCoord instanceof ProjectedCoordinateSystem)
552
716
  {
553
717
  srcPos = Vector3.fromCoord2D(srcCoord.toGeographicCoordinateDeg(srcPos), srcPos.z);
554
- srcCoord = srcCoord.getGeographicCoordinateSystem();
718
+ srcGCsys = srcCoord.getGeographicCoordinateSystem();
719
+ }
720
+ else if (srcCoord instanceof GeographicCoordinateSystem)
721
+ {
722
+ srcGCsys = srcCoord;
723
+ }
724
+ else
725
+ {
726
+ throw new Error("Unsupported coordinate system in srcCoord");
555
727
  }
556
- if (srcCoord.equals(destCoord))
728
+ if (srcGCsys.equals(destCoord))
557
729
  {
558
730
  return srcPos;
559
731
  }
560
- srcPos = srcCoord.toCartesianCoordDeg(srcPos);
732
+ srcPos = srcGCsys.toCartesianCoordDeg(srcPos);
561
733
 
562
- if (destCoord.isProjected())
734
+ if (destCoord instanceof ProjectedCoordinateSystem)
563
735
  {
564
736
  let gcs = destCoord.getGeographicCoordinateSystem();
565
737
  srcPos = gcs.fromCartesianCoordRad(srcPos);
566
738
  return Vector3.fromCoord2D(destCoord.fromGeographicCoordinateRad(srcPos), srcPos.z);
567
739
  }
568
- else
740
+ else if (destCoord instanceof GeographicCoordinateSystem)
569
741
  {
570
742
  return destCoord.fromCartesianCoordDeg(srcPos);
571
743
  }
744
+ else
745
+ {
746
+ throw new Error("Unsupported coordinate system in destCoord");
747
+ }
572
748
  }
573
749
 
750
+ /**
751
+ * @param {CoordinateSystem} srcCoord
752
+ * @param {CoordinateSystem} destCoord
753
+ * @param {Coord2D[]} srcArr
754
+ */
574
755
  static convertArray(srcCoord, destCoord, srcArr)
575
756
  {
576
757
  let i;
577
758
  let srcRad = false;
578
759
  let destArr = [];
579
- if (srcCoord.isProjected())
760
+ let srcGCsys;
761
+ if (srcCoord instanceof ProjectedCoordinateSystem)
580
762
  {
581
763
  for (i in srcArr)
582
764
  {
583
765
  destArr[i] = srcCoord.toGeographicCoordinateRad(srcArr[i]);
584
766
  }
585
- srcCoord = srcCoord.getGeographicCoordinateSystem();
767
+ srcGCsys = srcCoord.getGeographicCoordinateSystem();
586
768
  srcArr = destArr;
587
769
  srcRad = true;
588
770
  }
589
- if (srcCoord.equals(destCoord))
771
+ else if (srcCoord instanceof GeographicCoordinateSystem)
772
+ {
773
+ srcGCsys = srcCoord;
774
+ }
775
+ else
776
+ {
777
+ throw new Error("Unsupported coordinate system in srcCoord");
778
+ }
779
+ if (srcGCsys.equals(destCoord))
590
780
  {
591
781
  if (srcRad)
592
782
  {
@@ -605,14 +795,14 @@ export class CoordinateSystem
605
795
  return destArr;
606
796
  }
607
797
  let tmpPos;
608
- if (destCoord.isProjected())
798
+ if (destCoord instanceof ProjectedCoordinateSystem)
609
799
  {
610
800
  let gcs = destCoord.getGeographicCoordinateSystem();
611
801
  if (srcRad)
612
802
  {
613
803
  for (i in srcArr)
614
804
  {
615
- tmpPos = srcCoord.toCartesianCoordRad(Vector3.fromCoord2D(srcArr[i], 0));
805
+ tmpPos = srcGCsys.toCartesianCoordRad(Vector3.fromCoord2D(srcArr[i], 0));
616
806
  tmpPos = gcs.fromCartesianCoordRad(tmpPos);
617
807
  destArr[i] = destCoord.fromGeographicCoordinateRad(tmpPos);
618
808
  }
@@ -621,35 +811,42 @@ export class CoordinateSystem
621
811
  {
622
812
  for (i in srcArr)
623
813
  {
624
- tmpPos = srcCoord.toCartesianCoordDeg(Vector3.fromCoord2D(srcArr[i], 0));
814
+ tmpPos = srcGCsys.toCartesianCoordDeg(Vector3.fromCoord2D(srcArr[i], 0));
625
815
  tmpPos = gcs.fromCartesianCoordRad(tmpPos);
626
- destArr[i] = destCoord.FromGeographicCoordinateRad(tmpPos);
816
+ destArr[i] = destCoord.fromGeographicCoordinateRad(tmpPos);
627
817
  }
628
818
  }
629
819
  }
630
- else
820
+ else if (destCoord instanceof GeographicCoordinateSystem)
631
821
  {
632
822
  if (srcRad)
633
823
  {
634
824
  for (i in srcArr)
635
825
  {
636
- tmpPos = srcCoord.toCartesianCoordRad(Vector3.fromCoord2D(srcArr[i], 0));
826
+ tmpPos = srcGCsys.toCartesianCoordRad(Vector3.fromCoord2D(srcArr[i], 0));
637
827
  destArr[i] = destCoord.fromCartesianCoordDeg(tmpPos);
638
828
  }
639
829
  }
640
830
  else
641
831
  {
642
- i = nPoints;
643
- while (i-- > 0)
832
+ for (i in srcArr)
644
833
  {
645
- tmpPos = srcCoord.toCartesianCoordDeg(Vector3.fromCoord2D(srcArr[i], 0));
834
+ tmpPos = srcGCsys.toCartesianCoordDeg(Vector3.fromCoord2D(srcArr[i], 0));
646
835
  destArr[i] = destCoord.fromCartesianCoordDeg(tmpPos);
647
836
  }
648
837
  }
649
838
  }
839
+ else
840
+ {
841
+ throw new Error("Unsupported coordinate system in destCoord");
842
+ }
650
843
  return destArr;
651
844
  }
652
845
 
846
+ /**
847
+ * @param {{ isProjected: () => any; toGeographicCoordinateDeg: (arg0: any) => any; getGeographicCoordinateSystem: () => any; toCartesianCoordDeg: (arg0: any) => any; }} srcCoord
848
+ * @param {Vector3} srcPos
849
+ */
653
850
  static convertToCartesianCoord(srcCoord, srcPos)
654
851
  {
655
852
  if (srcCoord.isProjected())
@@ -663,12 +860,24 @@ export class CoordinateSystem
663
860
 
664
861
  export class GeographicCoordinateSystem extends CoordinateSystem
665
862
  {
863
+ /**
864
+ * @param {number} srid
865
+ * @param {string} csysName
866
+ * @param {DatumData} datumData
867
+ */
666
868
  constructor(srid, csysName, datumData)
667
869
  {
668
870
  super(srid, csysName);
669
871
  this.datum = datumData;
670
872
  }
671
873
 
874
+ /**
875
+ * @param {number} x1
876
+ * @param {number} y1
877
+ * @param {number} x2
878
+ * @param {number} y2
879
+ * @param {unit.Distance.Unit} unit
880
+ */
672
881
  calcSurfaceDistance(x1, y1, x2, y2, unit)
673
882
  {
674
883
  return this.datum.spheroid.ellipsoid.calSurfaceDistance(y1, x1, y2, x2, unit);
@@ -689,6 +898,9 @@ export class GeographicCoordinateSystem extends CoordinateSystem
689
898
  return this.datum.spheroid.ellipsoid;
690
899
  }
691
900
 
901
+ /**
902
+ * @param {Vector3} lonLatH
903
+ */
692
904
  toCartesianCoordRad(lonLatH)
693
905
  {
694
906
  let tmpPos = this.datum.spheroid.ellipsoid.toCartesianCoordRad(lonLatH);
@@ -712,6 +924,9 @@ export class GeographicCoordinateSystem extends CoordinateSystem
712
924
  }
713
925
  }
714
926
 
927
+ /**
928
+ * @param {{ x: number; y: number; z: number; }} coord
929
+ */
715
930
  fromCartesianCoordRad(coord)
716
931
  {
717
932
  let tmpPos;
@@ -736,11 +951,17 @@ export class GeographicCoordinateSystem extends CoordinateSystem
736
951
  return this.datum.spheroid.ellipsoid.fromCartesianCoordRad(tmpPos);
737
952
  }
738
953
 
954
+ /**
955
+ * @param {{ mulXY: (arg0: number) => any; }} lonLatH
956
+ */
739
957
  toCartesianCoordDeg(lonLatH)
740
958
  {
741
959
  return this.toCartesianCoordRad(lonLatH.mulXY(Math.PI / 180.0));
742
960
  }
743
961
 
962
+ /**
963
+ * @param {any} coord
964
+ */
744
965
  fromCartesianCoordDeg(coord)
745
966
  {
746
967
  return this.fromCartesianCoordRad(coord).mulXY(180.0 / Math.PI);
@@ -749,6 +970,16 @@ export class GeographicCoordinateSystem extends CoordinateSystem
749
970
 
750
971
  export class ProjectedCoordinateSystem extends CoordinateSystem
751
972
  {
973
+ /**
974
+ * @param {number} srid
975
+ * @param {string} csysName
976
+ * @param {number} falseEasting
977
+ * @param {number} falseNorthing
978
+ * @param {number} dcentralMeridian
979
+ * @param {number} dlatitudeOfOrigin
980
+ * @param {number} scaleFactor
981
+ * @param {GeographicCoordinateSystem} gcs
982
+ */
752
983
  constructor(srid, csysName, falseEasting, falseNorthing, dcentralMeridian, dlatitudeOfOrigin, scaleFactor, gcs)
753
984
  {
754
985
  super(srid, csysName);
@@ -760,6 +991,31 @@ export class ProjectedCoordinateSystem extends CoordinateSystem
760
991
  this.gcs = gcs;
761
992
  }
762
993
 
994
+ /**
995
+ * @param {Coord2D} projPos
996
+ * @returns {Coord2D}
997
+ */
998
+ toGeographicCoordinateRad(projPos)
999
+ {
1000
+ throw new Error("abstract function ProjectedCoordinateSystem.toGeographicCoordinateRad is called");
1001
+ }
1002
+
1003
+ /**
1004
+ * @param {Coord2D} geogPos
1005
+ * @returns {Coord2D}
1006
+ */
1007
+ fromGeographicCoordinateRad(geogPos)
1008
+ {
1009
+ throw new Error("abstract function ProjectedCoordinateSystem.fromGeographicCoordinateRad is called");
1010
+ }
1011
+
1012
+ /**
1013
+ * @param {number} x1
1014
+ * @param {number} y1
1015
+ * @param {number} x2
1016
+ * @param {number} y2
1017
+ * @param {unit.Distance.Unit} distUnit
1018
+ */
763
1019
  calcSurfaceDistance(x1, y1, x2, y2, distUnit)
764
1020
  {
765
1021
  let diffX = x2 - x1;
@@ -784,16 +1040,25 @@ export class ProjectedCoordinateSystem extends CoordinateSystem
784
1040
  return this.gcs;
785
1041
  }
786
1042
 
1043
+ /**
1044
+ * @param {Coord2D} projPos
1045
+ */
787
1046
  toGeographicCoordinateDeg(projPos)
788
1047
  {
789
1048
  return this.toGeographicCoordinateRad(projPos).mul(180 / Math.PI);
790
1049
  }
791
1050
 
1051
+ /**
1052
+ * @param {Coord2D} geoPos
1053
+ */
792
1054
  fromGeographicCoordinateDeg(geoPos)
793
1055
  {
794
1056
  return this.fromGeographicCoordinateRad(geoPos.mul(Math.PI / 180.0));
795
1057
  }
796
1058
 
1059
+ /**
1060
+ * @param {ProjectedCoordinateSystem} csys
1061
+ */
797
1062
  sameProjection(csys)
798
1063
  {
799
1064
  if (this.falseEasting != csys.falseEasting)
@@ -812,6 +1077,16 @@ export class ProjectedCoordinateSystem extends CoordinateSystem
812
1077
 
813
1078
  export class MercatorProjectedCoordinateSystem extends ProjectedCoordinateSystem
814
1079
  {
1080
+ /**
1081
+ * @param {number} srid
1082
+ * @param {string} csysName
1083
+ * @param {number} falseEasting
1084
+ * @param {number} falseNorthing
1085
+ * @param {number} dcentralMeridian
1086
+ * @param {number} dlatitudeOfOrigin
1087
+ * @param {number} scaleFactor
1088
+ * @param {GeographicCoordinateSystem} gcs
1089
+ */
815
1090
  constructor(srid, csysName, falseEasting, falseNorthing, dcentralMeridian, dlatitudeOfOrigin, scaleFactor, gcs)
816
1091
  {
817
1092
  super(srid, csysName, falseEasting, falseNorthing, dcentralMeridian, dlatitudeOfOrigin, scaleFactor, gcs);
@@ -822,6 +1097,9 @@ export class MercatorProjectedCoordinateSystem extends ProjectedCoordinateSystem
822
1097
  return CoordinateSystemType.MercatorProjected;
823
1098
  }
824
1099
 
1100
+ /**
1101
+ * @param {Coord2D} projPos
1102
+ */
825
1103
  toGeographicCoordinateRad(projPos)
826
1104
  {
827
1105
  let ellipsoid = this.gcs.getEllipsoid();
@@ -871,6 +1149,9 @@ export class MercatorProjectedCoordinateSystem extends ProjectedCoordinateSystem
871
1149
  rLatL - ser7 * eDiff2 + ser8 * eDiff4 - ser9 * eDiff6);
872
1150
  }
873
1151
 
1152
+ /**
1153
+ * @param {Coord2D} geoPos
1154
+ */
874
1155
  fromGeographicCoordinateRad(geoPos)
875
1156
  {
876
1157
  let ellipsoid = this.gcs.getEllipsoid();
@@ -908,6 +1189,9 @@ export class MercatorProjectedCoordinateSystem extends ProjectedCoordinateSystem
908
1189
  ser1 + ser2 * dlon2 + ser3 * dlon4 + ser3a * dlon4 * dlon2);
909
1190
  }
910
1191
 
1192
+ /**
1193
+ * @param {number} rLat
1194
+ */
911
1195
  calcM(rLat)
912
1196
  {
913
1197
  let ellipsoid = this.gcs.getEllipsoid();
@@ -929,6 +1213,16 @@ export class MercatorProjectedCoordinateSystem extends ProjectedCoordinateSystem
929
1213
 
930
1214
  export class Mercator1SPProjectedCoordinateSystem extends ProjectedCoordinateSystem
931
1215
  {
1216
+ /**
1217
+ * @param {number} srid
1218
+ * @param {string} csysName
1219
+ * @param {number} falseEasting
1220
+ * @param {number} falseNorthing
1221
+ * @param {number} dcentralMeridian
1222
+ * @param {number} dlatitudeOfOrigin
1223
+ * @param {number} scaleFactor
1224
+ * @param {GeographicCoordinateSystem} gcs
1225
+ */
932
1226
  constructor(srid, csysName, falseEasting, falseNorthing, dcentralMeridian, dlatitudeOfOrigin, scaleFactor, gcs)
933
1227
  {
934
1228
  super(srid, csysName, falseEasting, falseNorthing, dcentralMeridian, dlatitudeOfOrigin, scaleFactor, gcs);
@@ -939,6 +1233,9 @@ export class Mercator1SPProjectedCoordinateSystem extends ProjectedCoordinateSys
939
1233
  return CoordinateSystemType.Mercator1SPProjected;
940
1234
  }
941
1235
 
1236
+ /**
1237
+ * @param {Coord2D} projPos
1238
+ */
942
1239
  toGeographicCoordinateRad(projPos)
943
1240
  {
944
1241
  let ellipsoid = this.gcs.getEllipsoid();
@@ -948,6 +1245,9 @@ export class Mercator1SPProjectedCoordinateSystem extends ProjectedCoordinateSys
948
1245
  (Math.atan(Math.exp((projPos.y - this.falseNorthing) / a)) - Math.PI * 0.25) * 2);
949
1246
  }
950
1247
 
1248
+ /**
1249
+ * @param {Coord2D} geoPos
1250
+ */
951
1251
  fromGeographicCoordinateRad(geoPos)
952
1252
  {
953
1253
  let ellipsoid = this.gcs.getEllipsoid();
@@ -963,6 +1263,11 @@ export class Mercator1SPProjectedCoordinateSystem extends ProjectedCoordinateSys
963
1263
 
964
1264
  export class CoordinateSystemManager
965
1265
  {
1266
+ /**
1267
+ * @param {number} srid
1268
+ * @param {number} datumSrid
1269
+ * @param {string} name
1270
+ */
966
1271
  static srCreateGeogCSysData(srid, datumSrid, name)
967
1272
  {
968
1273
  let data = this.srGetDatumData(datumSrid);
@@ -973,9 +1278,20 @@ export class CoordinateSystemManager
973
1278
  return new GeographicCoordinateSystem(srid, name, data);
974
1279
  }
975
1280
 
1281
+ /**
1282
+ * @param {number} srid
1283
+ * @param {number} geogcsSrid
1284
+ * @param {number} csysType
1285
+ * @param {string} projName
1286
+ * @param {number} falseEasting
1287
+ * @param {number} falseNorthing
1288
+ * @param {number} centralMeridian
1289
+ * @param {number} latitudeOfOrigin
1290
+ * @param {number} scaleFactor
1291
+ */
976
1292
  static srCreateProjCSysData(srid, geogcsSrid, csysType, projName, falseEasting, falseNorthing, centralMeridian, latitudeOfOrigin, scaleFactor)
977
1293
  {
978
- let gcsys = this.srCreateGeogCSys(geogcsSrid);
1294
+ let gcsys = CoordinateSystemManager.srCreateGeogCSys(geogcsSrid);
979
1295
  if (gcsys == null)
980
1296
  return null;
981
1297
  if (csysType == CoordinateSystemType.MercatorProjected || csysType == CoordinateSystemType.GausskrugerProjected)
@@ -989,6 +1305,9 @@ export class CoordinateSystemManager
989
1305
  return null;
990
1306
  }
991
1307
 
1308
+ /**
1309
+ * @param {number} srid
1310
+ */
992
1311
  static srCreateGeogCSys(srid)
993
1312
  {
994
1313
  switch (srid)
@@ -1003,6 +1322,9 @@ export class CoordinateSystemManager
1003
1322
  }
1004
1323
  }
1005
1324
 
1325
+ /**
1326
+ * @param {number} srid
1327
+ */
1006
1328
  static srCreateProjCSys(srid)
1007
1329
  {
1008
1330
  switch (srid)
@@ -1018,6 +1340,9 @@ export class CoordinateSystemManager
1018
1340
  return null;
1019
1341
  }
1020
1342
  }
1343
+ /**
1344
+ * @param {number} srid
1345
+ */
1021
1346
  static srCreateCsys(srid)
1022
1347
  {
1023
1348
  switch (srid)
@@ -1036,26 +1361,32 @@ export class CoordinateSystemManager
1036
1361
  }
1037
1362
  }
1038
1363
 
1364
+ /**
1365
+ * @param {number} srid
1366
+ */
1039
1367
  static srGetDatumData(srid)
1040
1368
  {
1041
1369
  switch (srid)
1042
1370
  {
1043
1371
  case 6326:
1044
- return new DatumData(6326, this.srGetSpheroid(7030), "WGS_1984", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, unit.Angle.Unit.RADIAN);
1372
+ return new DatumData(6326, CoordinateSystemManager.srGetSpheroid(7030), "WGS_1984", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, unit.Angle.Unit.RADIAN);
1045
1373
  case 6600:
1046
- return new DatumData(6600, this.srGetSpheroid(7012), "Anguilla_1957", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, unit.Angle.Unit.RADIAN);
1374
+ return new DatumData(6600, CoordinateSystemManager.srGetSpheroid(7012), "Anguilla_1957", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, unit.Angle.Unit.RADIAN);
1047
1375
  case 6601:
1048
- return new DatumData(6601, this.srGetSpheroid(7012), "Antigua_1943", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, unit.Angle.Unit.RADIAN);
1376
+ return new DatumData(6601, CoordinateSystemManager.srGetSpheroid(7012), "Antigua_1943", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, unit.Angle.Unit.RADIAN);
1049
1377
  case 6602:
1050
- return new DatumData(6602, this.srGetSpheroid(7012), "Dominica_1945", 0, 0, 0, 725, 685, 536, 0, 0, 0, 0, unit.Angle.Unit.ARCSECOND);
1378
+ return new DatumData(6602, CoordinateSystemManager.srGetSpheroid(7012), "Dominica_1945", 0, 0, 0, 725, 685, 536, 0, 0, 0, 0, unit.Angle.Unit.ARCSECOND);
1051
1379
  case 6603:
1052
- return new DatumData(6603, this.srGetSpheroid(7012), "Grenada_1953", 0, 0, 0, 72, 213.7, 93, 0, 0, 0, 0, unit.Angle.Unit.ARCSECOND);
1380
+ return new DatumData(6603, CoordinateSystemManager.srGetSpheroid(7012), "Grenada_1953", 0, 0, 0, 72, 213.7, 93, 0, 0, 0, 0, unit.Angle.Unit.ARCSECOND);
1053
1381
  case 6611:
1054
- 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);
1382
+ return new DatumData(6611, CoordinateSystemManager.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);
1055
1383
  }
1056
1384
  return null;
1057
1385
  }
1058
1386
 
1387
+ /**
1388
+ * @param {number} srid
1389
+ */
1059
1390
  static srGetSpheroid(srid)
1060
1391
  {
1061
1392
  switch (srid)
@@ -1067,6 +1398,6 @@ export class CoordinateSystemManager
1067
1398
  case 7030:
1068
1399
  return new Spheroid(7030, new EarthEllipsoid(null, null, EarthEllipsoidType.WGS84), "WGS 84");
1069
1400
  }
1070
- return null;
1401
+ throw new Error("Unsupported srid: "+srid);
1071
1402
  }
1072
1403
  };