@sswroom/sswr 1.5.1 → 1.5.3
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 +37 -0
- package/cesium.d.ts +9 -2
- package/cesium.js +263 -44
- package/data.d.ts +6 -0
- package/data.js +216 -204
- package/geometry.d.ts +5 -0
- package/geometry.js +62 -50
- package/hkoapi.js +10 -10
- package/kml.d.ts +4 -1
- package/kml.js +53 -24
- package/leaflet.js +154 -34
- package/map.js +22 -22
- package/math.js +127 -127
- package/net.d.ts +2 -0
- package/net.js +76 -0
- package/olayer2.d.ts +11 -0
- package/olayer2.js +328 -76
- package/osm.js +21 -22
- package/package.json +1 -1
- package/parser.js +342 -95
- package/text.d.ts +127 -1
- package/text.js +1142 -21
- package/web.d.ts +9 -0
- package/web.js +222 -58
package/math.js
CHANGED
|
@@ -6,7 +6,7 @@ export function roundToFloat(n, decimalPoints)
|
|
|
6
6
|
decimalPoints = 0;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
|
|
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
|
-
|
|
20
|
+
let multiplicator = Math.pow(10, decimalPoints);
|
|
21
21
|
n = parseFloat((n * multiplicator).toFixed(11));
|
|
22
|
-
|
|
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
|
-
|
|
85
|
-
|
|
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
|
-
|
|
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
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
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
|
-
|
|
246
|
-
|
|
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
|
-
|
|
249
|
-
|
|
250
|
-
|
|
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
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
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
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
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,7 +467,7 @@ export class DatumData
|
|
|
467
467
|
this.cX = cX;
|
|
468
468
|
this.cY = cY;
|
|
469
469
|
this.cZ = cZ;
|
|
470
|
-
|
|
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;
|
|
@@ -496,8 +496,8 @@ export class CoordinateSystem
|
|
|
496
496
|
{
|
|
497
497
|
if (this == csys)
|
|
498
498
|
return true;
|
|
499
|
-
|
|
500
|
-
|
|
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
|
-
|
|
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
|
-
|
|
550
|
-
|
|
551
|
-
|
|
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
|
-
|
|
580
|
+
let tmpPos;
|
|
581
581
|
if (destCoord.isProjected())
|
|
582
582
|
{
|
|
583
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
739
|
-
|
|
738
|
+
let diffX = x2 - x1;
|
|
739
|
+
let diffY = y2 - y1;
|
|
740
740
|
diffX = diffX * diffX;
|
|
741
741
|
diffY = diffY * diffY;
|
|
742
|
-
|
|
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
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
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
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
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
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
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
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
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
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
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
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
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
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
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
|
-
|
|
918
|
-
|
|
919
|
-
|
|
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
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
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
|
-
|
|
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
|
-
|
|
951
|
+
let gcsys = this.srCreateGeogCSys(geogcsSrid);
|
|
952
952
|
if (gcsys == null)
|
|
953
953
|
return null;
|
|
954
954
|
if (csysType == CoordinateSystemType.MercatorProjected || csysType == CoordinateSystemType.GausskrugerProjected)
|
package/net.d.ts
ADDED
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;
|