mirage2d 1.1.12 → 1.1.13
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/dist/mirage2d.es.js +305 -175
- package/dist/mirage2d.umd.js +18 -18
- package/dist/src/Enum/typeEnum.d.ts +4 -0
- package/dist/src/Enum/typeEnum.d.ts.map +1 -1
- package/dist/src/Layer/XMap.d.ts +2 -0
- package/dist/src/Layer/XMap.d.ts.map +1 -1
- package/dist/src/Tools/SpatialAnalysis.d.ts +0 -6
- package/dist/src/Tools/SpatialAnalysis.d.ts.map +1 -1
- package/dist/src/graphic/Curve.d.ts.map +1 -1
- package/dist/src/graphic/Polygon.d.ts.map +1 -1
- package/dist/src/graphic/baseGraphic.d.ts +3 -1
- package/dist/src/graphic/baseGraphic.d.ts.map +1 -1
- package/dist/src/proj4/proj.d.ts +73 -4
- package/dist/src/proj4/proj.d.ts.map +1 -1
- package/dist/src/query/GaodePOI.d.ts +2 -0
- package/dist/src/query/GaodePOI.d.ts.map +1 -1
- package/dist/src/query/GaodeRoute.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/mirage2d.es.js
CHANGED
|
@@ -35684,6 +35684,7 @@ var crsType;
|
|
|
35684
35684
|
crsType2["IMAGE"] = "IMAGE";
|
|
35685
35685
|
crsType2["PGIS"] = "PGIS";
|
|
35686
35686
|
crsType2["BAIDU"] = "BAIDU";
|
|
35687
|
+
crsType2["GCJ02"] = "GCJ02";
|
|
35687
35688
|
crsType2["CGCS2000_GK_Zone_3"] = "CGCS2000_GK_Zone_3";
|
|
35688
35689
|
crsType2["CGCS2000_GK_Zone_6"] = "CGCS2000_GK_Zone_6";
|
|
35689
35690
|
crsType2["CGCS2000_GK_CM_3"] = "CGCS2000_GK_CM_3";
|
|
@@ -79437,74 +79438,6 @@ class SpatialAnalysis {
|
|
|
79437
79438
|
return getCenter$1(feature2.getExtent());
|
|
79438
79439
|
}
|
|
79439
79440
|
}
|
|
79440
|
-
static ConvertCoordinatesTo3857(wkid, Coordinates) {
|
|
79441
|
-
return proj4("EPSG:" + wkid, "EPSG:3857", Coordinates);
|
|
79442
|
-
}
|
|
79443
|
-
static ConvertCoordinatesTo4326(wkid, Coordinates) {
|
|
79444
|
-
return proj4("EPSG:" + wkid, "EPSG:4326", Coordinates);
|
|
79445
|
-
}
|
|
79446
|
-
static ConvertLnglatToCGCS2000(lng, lat2, zone = 3) {
|
|
79447
|
-
let daihao;
|
|
79448
|
-
if (zone == 3) {
|
|
79449
|
-
daihao = parseInt(((lng + 1.5) / 3).toString()) * 3;
|
|
79450
|
-
} else {
|
|
79451
|
-
daihao = parseInt(((lng + 6) / 6).toString()) * 6 - 3;
|
|
79452
|
-
}
|
|
79453
|
-
let data2 = [];
|
|
79454
|
-
data2.push({ dh: 13, wkid: 4502 });
|
|
79455
|
-
data2.push({ dh: 14, wkid: 4503 });
|
|
79456
|
-
data2.push({ dh: 15, wkid: 4504 });
|
|
79457
|
-
data2.push({ dh: 16, wkid: 4505 });
|
|
79458
|
-
data2.push({ dh: 17, wkid: 4506 });
|
|
79459
|
-
data2.push({ dh: 18, wkid: 4507 });
|
|
79460
|
-
data2.push({ dh: 19, wkid: 4508 });
|
|
79461
|
-
data2.push({ dh: 20, wkid: 4509 });
|
|
79462
|
-
data2.push({ dh: 21, wkid: 4510 });
|
|
79463
|
-
data2.push({ dh: 22, wkid: 4511 });
|
|
79464
|
-
data2.push({ dh: 23, wkid: 4512 });
|
|
79465
|
-
data2.push({ dh: 78, wkid: 4535 });
|
|
79466
|
-
data2.push({ dh: 81, wkid: 4536 });
|
|
79467
|
-
data2.push({ dh: 84, wkid: 4537 });
|
|
79468
|
-
data2.push({ dh: 87, wkid: 4538 });
|
|
79469
|
-
data2.push({ dh: 90, wkid: 4539 });
|
|
79470
|
-
data2.push({ dh: 93, wkid: 4540 });
|
|
79471
|
-
data2.push({ dh: 96, wkid: 4541 });
|
|
79472
|
-
data2.push({ dh: 99, wkid: 4542 });
|
|
79473
|
-
data2.push({ dh: 102, wkid: 4543 });
|
|
79474
|
-
data2.push({ dh: 105, wkid: 4544 });
|
|
79475
|
-
data2.push({ dh: 108, wkid: 4545 });
|
|
79476
|
-
data2.push({ dh: 111, wkid: 4546 });
|
|
79477
|
-
data2.push({ dh: 114, wkid: 4547 });
|
|
79478
|
-
data2.push({ dh: 117, wkid: 4548 });
|
|
79479
|
-
data2.push({ dh: 120, wkid: 4549 });
|
|
79480
|
-
data2.push({ dh: 123, wkid: 4550 });
|
|
79481
|
-
data2.push({ dh: 126, wkid: 4551 });
|
|
79482
|
-
data2.push({ dh: 129, wkid: 4552 });
|
|
79483
|
-
data2.push({ dh: 132, wkid: 4553 });
|
|
79484
|
-
data2.push({ dh: 135, wkid: 4554 });
|
|
79485
|
-
let wkid;
|
|
79486
|
-
data2.forEach((element) => {
|
|
79487
|
-
if (element.dh == daihao) {
|
|
79488
|
-
wkid = element.wkid;
|
|
79489
|
-
return;
|
|
79490
|
-
}
|
|
79491
|
-
});
|
|
79492
|
-
if (wkid) {
|
|
79493
|
-
return proj4("EPSG:4326", "EPSG:" + wkid, [lng, lat2]);
|
|
79494
|
-
} else {
|
|
79495
|
-
return [0, 0];
|
|
79496
|
-
}
|
|
79497
|
-
}
|
|
79498
|
-
static ConvertWebMercatorToCGCS2000(x2, y2, zone = 3) {
|
|
79499
|
-
let lnglat = toLonLat([x2, y2]);
|
|
79500
|
-
return SpatialAnalysis.ConvertLnglatToCGCS2000(lnglat[0], lnglat[1], zone);
|
|
79501
|
-
}
|
|
79502
|
-
static webMktToLngLat(Coordinates) {
|
|
79503
|
-
return toLonLat(Coordinates);
|
|
79504
|
-
}
|
|
79505
|
-
static lngLatToWebMkt(Coordinates) {
|
|
79506
|
-
return fromLonLat(Coordinates);
|
|
79507
|
-
}
|
|
79508
79441
|
static to3857(Feature2) {
|
|
79509
79442
|
let format2 = new GeoJSON$1();
|
|
79510
79443
|
return format2.readFeature(Feature2, {
|
|
@@ -159696,6 +159629,240 @@ class SelectTransform {
|
|
|
159696
159629
|
this.transformInteraction.setActive(b2);
|
|
159697
159630
|
}
|
|
159698
159631
|
}
|
|
159632
|
+
class proj {
|
|
159633
|
+
constructor() {
|
|
159634
|
+
__publicField(this, "data");
|
|
159635
|
+
__publicField(this, "pi");
|
|
159636
|
+
__publicField(this, "x_pi");
|
|
159637
|
+
__publicField(this, "a");
|
|
159638
|
+
__publicField(this, "ee");
|
|
159639
|
+
registerProj4();
|
|
159640
|
+
register$3(proj4);
|
|
159641
|
+
this.data = [];
|
|
159642
|
+
this.data.push({ dh: 13, wkid: 4502 });
|
|
159643
|
+
this.data.push({ dh: 14, wkid: 4503 });
|
|
159644
|
+
this.data.push({ dh: 15, wkid: 4504 });
|
|
159645
|
+
this.data.push({ dh: 16, wkid: 4505 });
|
|
159646
|
+
this.data.push({ dh: 17, wkid: 4506 });
|
|
159647
|
+
this.data.push({ dh: 18, wkid: 4507 });
|
|
159648
|
+
this.data.push({ dh: 19, wkid: 4508 });
|
|
159649
|
+
this.data.push({ dh: 20, wkid: 4509 });
|
|
159650
|
+
this.data.push({ dh: 21, wkid: 4510 });
|
|
159651
|
+
this.data.push({ dh: 22, wkid: 4511 });
|
|
159652
|
+
this.data.push({ dh: 23, wkid: 4512 });
|
|
159653
|
+
this.data.push({ dh: 78, wkid: 4535 });
|
|
159654
|
+
this.data.push({ dh: 81, wkid: 4536 });
|
|
159655
|
+
this.data.push({ dh: 84, wkid: 4537 });
|
|
159656
|
+
this.data.push({ dh: 87, wkid: 4538 });
|
|
159657
|
+
this.data.push({ dh: 90, wkid: 4539 });
|
|
159658
|
+
this.data.push({ dh: 93, wkid: 4540 });
|
|
159659
|
+
this.data.push({ dh: 96, wkid: 4541 });
|
|
159660
|
+
this.data.push({ dh: 99, wkid: 4542 });
|
|
159661
|
+
this.data.push({ dh: 102, wkid: 4543 });
|
|
159662
|
+
this.data.push({ dh: 105, wkid: 4544 });
|
|
159663
|
+
this.data.push({ dh: 108, wkid: 4545 });
|
|
159664
|
+
this.data.push({ dh: 111, wkid: 4546 });
|
|
159665
|
+
this.data.push({ dh: 114, wkid: 4547 });
|
|
159666
|
+
this.data.push({ dh: 117, wkid: 4548 });
|
|
159667
|
+
this.data.push({ dh: 120, wkid: 4549 });
|
|
159668
|
+
this.data.push({ dh: 123, wkid: 4550 });
|
|
159669
|
+
this.data.push({ dh: 126, wkid: 4551 });
|
|
159670
|
+
this.data.push({ dh: 129, wkid: 4552 });
|
|
159671
|
+
this.data.push({ dh: 132, wkid: 4553 });
|
|
159672
|
+
this.data.push({ dh: 135, wkid: 4554 });
|
|
159673
|
+
this.pi = 3.141592653589793;
|
|
159674
|
+
this.x_pi = 3.141592653589793 * 3e3 / 180;
|
|
159675
|
+
this.a = 6378245;
|
|
159676
|
+
this.ee = 0.006693421622965943;
|
|
159677
|
+
}
|
|
159678
|
+
ConvertToMapCoord(wkid, Coordinates) {
|
|
159679
|
+
return { "Coord3857": this.ConvertCoordinatesTo3857(wkid, Coordinates), "Coord4326": this.ConvertCoordinatesTo4326(wkid, Coordinates) };
|
|
159680
|
+
}
|
|
159681
|
+
ConvertCoordinatesTo3857(wkid, Coordinates) {
|
|
159682
|
+
if (wkid.toUpperCase().indexOf("EPSG:") == -1) {
|
|
159683
|
+
wkid = "EPSG:" + wkid;
|
|
159684
|
+
}
|
|
159685
|
+
return proj4(wkid, "EPSG:3857", Coordinates);
|
|
159686
|
+
}
|
|
159687
|
+
ConvertCoordinatesTo4326(wkid, Coordinates) {
|
|
159688
|
+
if (wkid.toUpperCase().indexOf("EPSG:") == -1) {
|
|
159689
|
+
wkid = "EPSG:" + wkid;
|
|
159690
|
+
}
|
|
159691
|
+
return proj4(wkid, "EPSG:4326", Coordinates);
|
|
159692
|
+
}
|
|
159693
|
+
formatJsonTo3857(GeoJson) {
|
|
159694
|
+
let featureList;
|
|
159695
|
+
if (GeoJson.crs.properties.name == "EPSG:3857") {
|
|
159696
|
+
featureList = new GeoJSON$1().readFeatures(GeoJson);
|
|
159697
|
+
} else if (GeoJson.crs.properties.name == "EPSG:4326") {
|
|
159698
|
+
featureList = new GeoJSON$1().readFeatures(GeoJson, {
|
|
159699
|
+
dataProjection: "EPSG:4326",
|
|
159700
|
+
featureProjection: "EPSG:3857"
|
|
159701
|
+
});
|
|
159702
|
+
} else {
|
|
159703
|
+
featureList = new GeoJSON$1().readFeatures(GeoJson, {
|
|
159704
|
+
dataProjection: GeoJson.crs.properties.name,
|
|
159705
|
+
featureProjection: "EPSG:3857"
|
|
159706
|
+
});
|
|
159707
|
+
}
|
|
159708
|
+
return featureList;
|
|
159709
|
+
}
|
|
159710
|
+
formatJsonTo4326Json(GeoJson) {
|
|
159711
|
+
let featureList;
|
|
159712
|
+
let format2 = new GeoJSON$1();
|
|
159713
|
+
if (GeoJson.crs.properties.name == "EPSG:4326") {
|
|
159714
|
+
featureList = format2.readFeatures(GeoJson);
|
|
159715
|
+
} else if (GeoJson.crs.properties.name == "EPSG:3857") {
|
|
159716
|
+
featureList = format2.readFeatures(GeoJson, {
|
|
159717
|
+
dataProjection: "EPSG:3857",
|
|
159718
|
+
featureProjection: "EPSG:4326"
|
|
159719
|
+
});
|
|
159720
|
+
} else {
|
|
159721
|
+
featureList = format2.readFeatures(GeoJson, {
|
|
159722
|
+
dataProjection: GeoJson.crs.properties.name,
|
|
159723
|
+
featureProjection: "EPSG:4326"
|
|
159724
|
+
});
|
|
159725
|
+
}
|
|
159726
|
+
return format2.writeFeaturesObject(featureList);
|
|
159727
|
+
}
|
|
159728
|
+
formatJsonToPoint(GeoJson) {
|
|
159729
|
+
let featureList = this.formatJsonTo3857(GeoJson);
|
|
159730
|
+
let newFeature = [];
|
|
159731
|
+
featureList.forEach((feature2) => {
|
|
159732
|
+
switch (feature2.getGeometry().getType()) {
|
|
159733
|
+
case "Polygon":
|
|
159734
|
+
newFeature.push(new Feature$1({
|
|
159735
|
+
geometry: feature2.getGeometry().getInteriorPoint(),
|
|
159736
|
+
properties: feature2.getProperties().properties
|
|
159737
|
+
}));
|
|
159738
|
+
break;
|
|
159739
|
+
case "Point":
|
|
159740
|
+
newFeature.push(feature2);
|
|
159741
|
+
break;
|
|
159742
|
+
}
|
|
159743
|
+
});
|
|
159744
|
+
return newFeature;
|
|
159745
|
+
}
|
|
159746
|
+
LnglatToCGCS2000(lng, lat2, zone = 3) {
|
|
159747
|
+
let daihao;
|
|
159748
|
+
if (zone == 3) {
|
|
159749
|
+
daihao = parseInt(((lng + 1.5) / 3).toString()) * 3;
|
|
159750
|
+
} else {
|
|
159751
|
+
daihao = parseInt(((lng + 6) / 6).toString()) * 6 - 3;
|
|
159752
|
+
}
|
|
159753
|
+
let wkid;
|
|
159754
|
+
this.data.forEach((element) => {
|
|
159755
|
+
if (element.dh == daihao) {
|
|
159756
|
+
wkid = element.wkid;
|
|
159757
|
+
return;
|
|
159758
|
+
}
|
|
159759
|
+
});
|
|
159760
|
+
if (wkid) {
|
|
159761
|
+
return proj4("EPSG:4326", "EPSG:" + wkid, [lng, lat2]);
|
|
159762
|
+
} else {
|
|
159763
|
+
return [0, 0];
|
|
159764
|
+
}
|
|
159765
|
+
}
|
|
159766
|
+
ConvertWebMercatorToCGCS2000(x2, y2, zone = 3) {
|
|
159767
|
+
let lnglat = toLonLat([x2, y2]);
|
|
159768
|
+
return this.LnglatToCGCS2000(lnglat[0], lnglat[1], zone);
|
|
159769
|
+
}
|
|
159770
|
+
webMktToLngLat(Coordinates) {
|
|
159771
|
+
return toLonLat(Coordinates);
|
|
159772
|
+
}
|
|
159773
|
+
lngLatToWebMkt(Coordinates) {
|
|
159774
|
+
return fromLonLat(Coordinates);
|
|
159775
|
+
}
|
|
159776
|
+
transformLat(x2, y2) {
|
|
159777
|
+
let ret = -100 + 2 * x2 + 3 * y2 + 0.2 * y2 * y2 + 0.1 * x2 * y2 + 0.2 * Math.sqrt(Math.abs(x2));
|
|
159778
|
+
ret += (20 * Math.sin(6 * x2 * this.pi) + 20 * Math.sin(2 * x2 * this.pi)) * 2 / 3;
|
|
159779
|
+
ret += (20 * Math.sin(y2 * this.pi) + 40 * Math.sin(y2 / 3 * this.pi)) * 2 / 3;
|
|
159780
|
+
ret += (160 * Math.sin(y2 / 12 * this.pi) + 320 * Math.sin(y2 * this.pi / 30)) * 2 / 3;
|
|
159781
|
+
return ret;
|
|
159782
|
+
}
|
|
159783
|
+
transformLon(x2, y2) {
|
|
159784
|
+
let ret = 300 + x2 + 2 * y2 + 0.1 * x2 * x2 + 0.1 * x2 * y2 + 0.1 * Math.sqrt(Math.abs(x2));
|
|
159785
|
+
ret += (20 * Math.sin(6 * x2 * this.pi) + 20 * Math.sin(2 * x2 * this.pi)) * 2 / 3;
|
|
159786
|
+
ret += (20 * Math.sin(x2 * this.pi) + 40 * Math.sin(x2 / 3 * this.pi)) * 2 / 3;
|
|
159787
|
+
ret += (150 * Math.sin(x2 / 12 * this.pi) + 300 * Math.sin(x2 / 30 * this.pi)) * 2 / 3;
|
|
159788
|
+
return ret;
|
|
159789
|
+
}
|
|
159790
|
+
transform(lat2, lon2) {
|
|
159791
|
+
if (this.outOfChina(lat2, lon2)) {
|
|
159792
|
+
return [lat2, lon2];
|
|
159793
|
+
}
|
|
159794
|
+
let dLat = this.transformLat(lon2 - 105, lat2 - 35);
|
|
159795
|
+
let dLon = this.transformLon(lon2 - 105, lat2 - 35);
|
|
159796
|
+
let radLat = lat2 / 180 * this.pi;
|
|
159797
|
+
let magic = Math.sin(radLat);
|
|
159798
|
+
magic = 1 - this.ee * magic * magic;
|
|
159799
|
+
let sqrtMagic = Math.sqrt(magic);
|
|
159800
|
+
dLat = dLat * 180 / (this.a * (1 - this.ee) / (magic * sqrtMagic) * this.pi);
|
|
159801
|
+
dLon = dLon * 180 / (this.a / sqrtMagic * Math.cos(radLat) * this.pi);
|
|
159802
|
+
let mgLat = lat2 + dLat;
|
|
159803
|
+
let mgLon = lon2 + dLon;
|
|
159804
|
+
return [mgLat, mgLon];
|
|
159805
|
+
}
|
|
159806
|
+
outOfChina(lat2, lon2) {
|
|
159807
|
+
if (lon2 < 72.004 || lon2 > 137.8347)
|
|
159808
|
+
return true;
|
|
159809
|
+
if (lat2 < 0.8293 || lat2 > 55.8271)
|
|
159810
|
+
return true;
|
|
159811
|
+
return false;
|
|
159812
|
+
}
|
|
159813
|
+
wgs84ToGcj02(lat2, lon2) {
|
|
159814
|
+
if (this.outOfChina(lat2, lon2)) {
|
|
159815
|
+
return { lat: lat2, lon: lon2 };
|
|
159816
|
+
}
|
|
159817
|
+
let dLat = this.transformLat(lon2 - 105, lat2 - 35);
|
|
159818
|
+
let dLon = this.transformLon(lon2 - 105, lat2 - 35);
|
|
159819
|
+
let radLat = lat2 / 180 * this.pi;
|
|
159820
|
+
let magic = Math.sin(radLat);
|
|
159821
|
+
magic = 1 - this.ee * magic * magic;
|
|
159822
|
+
let sqrtMagic = Math.sqrt(magic);
|
|
159823
|
+
dLat = dLat * 180 / (this.a * (1 - this.ee) / (magic * sqrtMagic) * this.pi);
|
|
159824
|
+
dLon = dLon * 180 / (this.a / sqrtMagic * Math.cos(radLat) * this.pi);
|
|
159825
|
+
let mgLat = lat2 + dLat;
|
|
159826
|
+
let mgLon = lon2 + dLon;
|
|
159827
|
+
return { mgLat, mgLon };
|
|
159828
|
+
}
|
|
159829
|
+
gcj02ToWgs84(lat2, lon2) {
|
|
159830
|
+
let gps = this.transform(lat2, lon2);
|
|
159831
|
+
let lontitude = lon2 * 2 - gps[1];
|
|
159832
|
+
let latitude = lat2 * 2 - gps[0];
|
|
159833
|
+
return { latitude, lontitude };
|
|
159834
|
+
}
|
|
159835
|
+
gcj02ToBd09(lat2, lon2) {
|
|
159836
|
+
let x2 = lon2, y2 = lat2;
|
|
159837
|
+
let z2 = Math.sqrt(x2 * x2 + y2 * y2) + 2e-5 * Math.sin(y2 * this.x_pi);
|
|
159838
|
+
let theta = Math.atan2(y2, x2) + 3e-6 * Math.cos(x2 * this.x_pi);
|
|
159839
|
+
let tempLon = z2 * Math.cos(theta) + 65e-4;
|
|
159840
|
+
let tempLat = z2 * Math.sin(theta) + 6e-3;
|
|
159841
|
+
let gps = { tempLat, tempLon };
|
|
159842
|
+
return gps;
|
|
159843
|
+
}
|
|
159844
|
+
bd09ToGcj02(lat2, lon2) {
|
|
159845
|
+
let x2 = lon2 - 65e-4, y2 = lat2 - 6e-3;
|
|
159846
|
+
let z2 = Math.sqrt(x2 * x2 + y2 * y2) - 2e-5 * Math.sin(y2 * this.x_pi);
|
|
159847
|
+
let theta = Math.atan2(y2, x2) - 3e-6 * Math.cos(x2 * this.x_pi);
|
|
159848
|
+
let tempLon = z2 * Math.cos(theta);
|
|
159849
|
+
let tempLat = z2 * Math.sin(theta);
|
|
159850
|
+
let gps = { tempLat, tempLon };
|
|
159851
|
+
return gps;
|
|
159852
|
+
}
|
|
159853
|
+
wgs84ToBd09(lat2, lon2) {
|
|
159854
|
+
let gcj02 = this.wgs84ToGcj02(lat2, lon2);
|
|
159855
|
+
let bd09 = this.gcj02ToBd09(gcj02[0], gcj02[1]);
|
|
159856
|
+
return bd09;
|
|
159857
|
+
}
|
|
159858
|
+
bd09_To_gps84(lat2, lon2) {
|
|
159859
|
+
let gcj02 = this.bd09ToGcj02(lat2, lon2);
|
|
159860
|
+
let gps84 = this.gcj02ToWgs84(gcj02[0], gcj02[1]);
|
|
159861
|
+
gps84[0] = gps84[0].toFixed(6);
|
|
159862
|
+
gps84[1] = gps84[1].toFixed(6);
|
|
159863
|
+
return gps84;
|
|
159864
|
+
}
|
|
159865
|
+
}
|
|
159699
159866
|
class MirageMap extends baseMap {
|
|
159700
159867
|
constructor(mapID = "map", option) {
|
|
159701
159868
|
super();
|
|
@@ -159720,6 +159887,7 @@ class MirageMap extends baseMap {
|
|
|
159720
159887
|
__publicField(this, "option");
|
|
159721
159888
|
__publicField(this, "controls");
|
|
159722
159889
|
__publicField(this, "selectTransform");
|
|
159890
|
+
__publicField(this, "Proj");
|
|
159723
159891
|
this._mapOption = {
|
|
159724
159892
|
zoom: 13,
|
|
159725
159893
|
center: { lng: 102.103952024454, lat: 26.1693520685273 },
|
|
@@ -159788,6 +159956,7 @@ class MirageMap extends baseMap {
|
|
|
159788
159956
|
baseLayerSwitch: null,
|
|
159789
159957
|
swipe: new swipeControl(this)
|
|
159790
159958
|
};
|
|
159959
|
+
this.Proj = new proj();
|
|
159791
159960
|
this.init(mapID);
|
|
159792
159961
|
} else {
|
|
159793
159962
|
return;
|
|
@@ -159936,14 +160105,14 @@ class MirageMap extends baseMap {
|
|
|
159936
160105
|
let xy = (_a2 = this._map) == null ? void 0 : _a2.getEventCoordinate(evt.originalEvent);
|
|
159937
160106
|
if (xy) {
|
|
159938
160107
|
let lnglat = transform$4(xy, "EPSG:3857", "EPSG:4326");
|
|
160108
|
+
let xy2000 = this.Proj.LnglatToCGCS2000(lnglat[0], lnglat[1], 3);
|
|
159939
160109
|
this.trigger(XMapEventType.onMapMove, {
|
|
159940
160110
|
lng: lnglat[0],
|
|
159941
160111
|
lat: lnglat[1],
|
|
159942
|
-
crsx:
|
|
159943
|
-
crsy:
|
|
160112
|
+
crsx: xy2000[0].toFixed(2),
|
|
160113
|
+
crsy: xy2000[1].toFixed(2),
|
|
159944
160114
|
level: Math.round(this._view.getZoom())
|
|
159945
160115
|
});
|
|
159946
|
-
let xy2000 = SpatialAnalysis.ConvertLnglatToCGCS2000(lnglat[0], lnglat[1], 3);
|
|
159947
160116
|
this.controls.locationbar.updateMousePosition(toolbox.format(this._mapOption.controls.locationBar.template, {
|
|
159948
160117
|
lng: lnglat[0].toFixed(6),
|
|
159949
160118
|
lat: lnglat[1].toFixed(6),
|
|
@@ -159961,11 +160130,12 @@ class MirageMap extends baseMap {
|
|
|
159961
160130
|
if (evt.frameState) {
|
|
159962
160131
|
const state = evt.frameState.viewState;
|
|
159963
160132
|
let lnglat = transform$4(state.center, "EPSG:3857", "EPSG:4326");
|
|
160133
|
+
let xy2000 = this.Proj.LnglatToCGCS2000(lnglat[0], lnglat[1], 3);
|
|
159964
160134
|
this.trigger(XMapEventType.onMapMove, {
|
|
159965
160135
|
lng: lnglat[0],
|
|
159966
160136
|
lat: lnglat[1],
|
|
159967
|
-
crsx:
|
|
159968
|
-
crsy:
|
|
160137
|
+
crsx: xy2000[0].toFixed(2),
|
|
160138
|
+
crsy: xy2000[1].toFixed(2),
|
|
159969
160139
|
level: Math.round(state.zoom)
|
|
159970
160140
|
});
|
|
159971
160141
|
}
|
|
@@ -160241,11 +160411,11 @@ class MirageMap extends baseMap {
|
|
|
160241
160411
|
setCenter(lnglat, zoom, dataWkID = crsType.EPSG3857, flash = false) {
|
|
160242
160412
|
let mlnglat;
|
|
160243
160413
|
if (dataWkID == crsType.EPSG4326) {
|
|
160244
|
-
mlnglat =
|
|
160414
|
+
mlnglat = this.Proj.ConvertCoordinatesTo3857(dataWkID, lnglat);
|
|
160245
160415
|
} else if (dataWkID == crsType.EPSG3857) {
|
|
160246
160416
|
mlnglat = lnglat;
|
|
160247
160417
|
} else {
|
|
160248
|
-
mlnglat =
|
|
160418
|
+
mlnglat = this.Proj.ConvertCoordinatesTo3857(dataWkID, lnglat);
|
|
160249
160419
|
}
|
|
160250
160420
|
this._view.setCenter(mlnglat);
|
|
160251
160421
|
if (zoom) {
|
|
@@ -169485,6 +169655,7 @@ class baseGraphic extends Feature$1 {
|
|
|
169485
169655
|
constructor(options) {
|
|
169486
169656
|
super();
|
|
169487
169657
|
__publicField(this, "option");
|
|
169658
|
+
__publicField(this, "Proj");
|
|
169488
169659
|
this.option = {
|
|
169489
169660
|
lnglat: [0, 0],
|
|
169490
169661
|
dataWkID: crsType.EPSG3857,
|
|
@@ -169559,6 +169730,7 @@ class baseGraphic extends Feature$1 {
|
|
|
169559
169730
|
attribute: null
|
|
169560
169731
|
};
|
|
169561
169732
|
this.option = UJson.merge(this.option, options, true);
|
|
169733
|
+
this.Proj = new proj();
|
|
169562
169734
|
}
|
|
169563
169735
|
setAttribute(attribute) {
|
|
169564
169736
|
let featureAtt = UJson.merge(this.getProperties(), attribute, true);
|
|
@@ -169631,7 +169803,7 @@ class LabelGraphic extends baseGraphic {
|
|
|
169631
169803
|
case crsType.CGCS2000_GK_CM_6:
|
|
169632
169804
|
break;
|
|
169633
169805
|
default:
|
|
169634
|
-
this.setGeometry(new Point$4(
|
|
169806
|
+
this.setGeometry(new Point$4(this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID, options.lnglat)));
|
|
169635
169807
|
break;
|
|
169636
169808
|
}
|
|
169637
169809
|
}
|
|
@@ -169685,7 +169857,7 @@ class LabelGraphic extends baseGraphic {
|
|
|
169685
169857
|
} else if (this.option.dataWkID == crsType.EPSG3857) {
|
|
169686
169858
|
pp.setCoordinates([lng, lat2]);
|
|
169687
169859
|
} else {
|
|
169688
|
-
pp.setCoordinates(
|
|
169860
|
+
pp.setCoordinates(this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID, [lng, lat2]));
|
|
169689
169861
|
}
|
|
169690
169862
|
}
|
|
169691
169863
|
}
|
|
@@ -169706,7 +169878,7 @@ class PointGraphic extends baseGraphic {
|
|
|
169706
169878
|
case crsType.CGCS2000_GK_CM_6:
|
|
169707
169879
|
break;
|
|
169708
169880
|
default:
|
|
169709
|
-
this.setGeometry(new Point$4(
|
|
169881
|
+
this.setGeometry(new Point$4(this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID, options.lnglat)));
|
|
169710
169882
|
break;
|
|
169711
169883
|
}
|
|
169712
169884
|
}
|
|
@@ -169748,7 +169920,7 @@ class PointGraphic extends baseGraphic {
|
|
|
169748
169920
|
} else if (this.option.dataWkID == crsType.EPSG3857) {
|
|
169749
169921
|
pp.setCoordinates([lng, lat2]);
|
|
169750
169922
|
} else {
|
|
169751
|
-
pp.setCoordinates(
|
|
169923
|
+
pp.setCoordinates(this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID, [lng, lat2]));
|
|
169752
169924
|
}
|
|
169753
169925
|
}
|
|
169754
169926
|
}
|
|
@@ -169768,7 +169940,7 @@ class ImagePointGraphic extends baseGraphic {
|
|
|
169768
169940
|
case crsType.CGCS2000_GK_CM_6:
|
|
169769
169941
|
break;
|
|
169770
169942
|
default:
|
|
169771
|
-
this.setGeometry(new Point$4(
|
|
169943
|
+
this.setGeometry(new Point$4(this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID, options.lnglat)));
|
|
169772
169944
|
break;
|
|
169773
169945
|
}
|
|
169774
169946
|
}
|
|
@@ -169830,7 +170002,7 @@ class ImagePointGraphic extends baseGraphic {
|
|
|
169830
170002
|
} else if (this.option.dataWkID == crsType.EPSG3857) {
|
|
169831
170003
|
pp.setCoordinates([lng, lat2]);
|
|
169832
170004
|
} else {
|
|
169833
|
-
pp.setCoordinates(
|
|
170005
|
+
pp.setCoordinates(this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID, [lng, lat2]));
|
|
169834
170006
|
}
|
|
169835
170007
|
}
|
|
169836
170008
|
}
|
|
@@ -170065,7 +170237,7 @@ class LineGraphic extends baseGraphic {
|
|
|
170065
170237
|
break;
|
|
170066
170238
|
default:
|
|
170067
170239
|
this.option.lnglat.forEach((element, index2) => {
|
|
170068
|
-
this.option.lnglat[index2] =
|
|
170240
|
+
this.option.lnglat[index2] = this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID, element);
|
|
170069
170241
|
});
|
|
170070
170242
|
this.setGeometry(new LineString$2(this.option.lnglat));
|
|
170071
170243
|
break;
|
|
@@ -170147,7 +170319,7 @@ class PolygonGraphic extends baseGraphic {
|
|
|
170147
170319
|
default:
|
|
170148
170320
|
this.option.lnglat.forEach((element) => {
|
|
170149
170321
|
element.forEach((xy, index2) => {
|
|
170150
|
-
element[index2] =
|
|
170322
|
+
element[index2] = this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID, xy);
|
|
170151
170323
|
});
|
|
170152
170324
|
});
|
|
170153
170325
|
this.setGeometry(new ol_geom_Polygon(this.option.lnglat));
|
|
@@ -170258,8 +170430,12 @@ class CurveGraphic extends baseGraphic {
|
|
|
170258
170430
|
break;
|
|
170259
170431
|
case crsType.CGCS2000_GK_CM_6:
|
|
170260
170432
|
break;
|
|
170433
|
+
case crsType.BAIDU:
|
|
170434
|
+
break;
|
|
170435
|
+
case crsType.GCJ02:
|
|
170436
|
+
break;
|
|
170261
170437
|
default:
|
|
170262
|
-
this.setGeometry(this.createRegularPolygonCurve(
|
|
170438
|
+
this.setGeometry(this.createRegularPolygonCurve(this.Proj.ConvertCoordinatesTo4326(this.option.dataWkID, this.option.lnglat), this.option.style.radius, this.option.style.startAngle, this.option.style.stopAngle, this.option.style.rotation));
|
|
170263
170439
|
break;
|
|
170264
170440
|
}
|
|
170265
170441
|
}
|
|
@@ -170295,7 +170471,7 @@ class CurveGraphic extends baseGraphic {
|
|
|
170295
170471
|
} else if (this.option.dataWkID == crsType.EPSG3857) {
|
|
170296
170472
|
this.setGeometry(this.createRegularPolygonCurve(toLonLat(this.option.lnglat), this.option.style.radius, startAngle, stopAngle, this.option.style.rotation));
|
|
170297
170473
|
} else {
|
|
170298
|
-
this.setGeometry(this.createRegularPolygonCurve(
|
|
170474
|
+
this.setGeometry(this.createRegularPolygonCurve(this.Proj.ConvertCoordinatesTo4326(this.option.dataWkID, this.option.lnglat), this.option.style.radius, startAngle, stopAngle, this.option.style.rotation));
|
|
170299
170475
|
}
|
|
170300
170476
|
}
|
|
170301
170477
|
createRegularPolygonCurve(origin, radius, startAngle, stopAngle, rotation) {
|
|
@@ -210907,80 +211083,6 @@ var resource = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
|
|
|
210907
211083
|
__proto__: null,
|
|
210908
211084
|
getJSON
|
|
210909
211085
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
210910
|
-
class proj {
|
|
210911
|
-
constructor() {
|
|
210912
|
-
registerProj4();
|
|
210913
|
-
register$3(proj4);
|
|
210914
|
-
}
|
|
210915
|
-
ConvertToMapCoord(wkid, Coordinates) {
|
|
210916
|
-
return { "Coord3857": this.ConvertCoordinatesTo3857(wkid, Coordinates), "Coord4326": this.ConvertCoordinatesTo4326(wkid, Coordinates) };
|
|
210917
|
-
}
|
|
210918
|
-
ConvertCoordinatesTo3857(wkid, Coordinates) {
|
|
210919
|
-
if (wkid.toUpperCase().indexOf("EPSG:") == -1) {
|
|
210920
|
-
wkid = "EPSG:" + wkid;
|
|
210921
|
-
}
|
|
210922
|
-
return proj4(wkid, "EPSG:3857", Coordinates);
|
|
210923
|
-
}
|
|
210924
|
-
ConvertCoordinatesTo4326(wkid, Coordinates) {
|
|
210925
|
-
if (wkid.toUpperCase().indexOf("EPSG:") == -1) {
|
|
210926
|
-
wkid = "EPSG:" + wkid;
|
|
210927
|
-
}
|
|
210928
|
-
return proj4(wkid, "EPSG:4326", Coordinates);
|
|
210929
|
-
}
|
|
210930
|
-
formatJsonTo3857(GeoJson) {
|
|
210931
|
-
let featureList;
|
|
210932
|
-
if (GeoJson.crs.properties.name == "EPSG:3857") {
|
|
210933
|
-
featureList = new GeoJSON$1().readFeatures(GeoJson);
|
|
210934
|
-
} else if (GeoJson.crs.properties.name == "EPSG:4326") {
|
|
210935
|
-
featureList = new GeoJSON$1().readFeatures(GeoJson, {
|
|
210936
|
-
dataProjection: "EPSG:4326",
|
|
210937
|
-
featureProjection: "EPSG:3857"
|
|
210938
|
-
});
|
|
210939
|
-
} else {
|
|
210940
|
-
featureList = new GeoJSON$1().readFeatures(GeoJson, {
|
|
210941
|
-
dataProjection: GeoJson.crs.properties.name,
|
|
210942
|
-
featureProjection: "EPSG:3857"
|
|
210943
|
-
});
|
|
210944
|
-
}
|
|
210945
|
-
return featureList;
|
|
210946
|
-
}
|
|
210947
|
-
formatJsonTo4326Json(GeoJson) {
|
|
210948
|
-
let featureList;
|
|
210949
|
-
let format2 = new GeoJSON$1();
|
|
210950
|
-
if (GeoJson.crs.properties.name == "EPSG:4326") {
|
|
210951
|
-
featureList = format2.readFeatures(GeoJson);
|
|
210952
|
-
} else if (GeoJson.crs.properties.name == "EPSG:3857") {
|
|
210953
|
-
featureList = format2.readFeatures(GeoJson, {
|
|
210954
|
-
dataProjection: "EPSG:3857",
|
|
210955
|
-
featureProjection: "EPSG:4326"
|
|
210956
|
-
});
|
|
210957
|
-
} else {
|
|
210958
|
-
featureList = format2.readFeatures(GeoJson, {
|
|
210959
|
-
dataProjection: GeoJson.crs.properties.name,
|
|
210960
|
-
featureProjection: "EPSG:4326"
|
|
210961
|
-
});
|
|
210962
|
-
}
|
|
210963
|
-
return format2.writeFeaturesObject(featureList);
|
|
210964
|
-
}
|
|
210965
|
-
formatJsonToPoint(GeoJson) {
|
|
210966
|
-
let featureList = this.formatJsonTo3857(GeoJson);
|
|
210967
|
-
let newFeature = [];
|
|
210968
|
-
featureList.forEach((feature2) => {
|
|
210969
|
-
switch (feature2.getGeometry().getType()) {
|
|
210970
|
-
case "Polygon":
|
|
210971
|
-
newFeature.push(new Feature$1({
|
|
210972
|
-
geometry: feature2.getGeometry().getInteriorPoint(),
|
|
210973
|
-
properties: feature2.getProperties().properties
|
|
210974
|
-
}));
|
|
210975
|
-
break;
|
|
210976
|
-
case "Point":
|
|
210977
|
-
newFeature.push(feature2);
|
|
210978
|
-
break;
|
|
210979
|
-
}
|
|
210980
|
-
});
|
|
210981
|
-
return newFeature;
|
|
210982
|
-
}
|
|
210983
|
-
}
|
|
210984
211086
|
class eventTarget {
|
|
210985
211087
|
constructor() {
|
|
210986
211088
|
__publicField(this, "events", new Map());
|
|
@@ -211036,6 +211138,7 @@ class GaodeRoute extends baseGaode {
|
|
|
211036
211138
|
super(options);
|
|
211037
211139
|
}
|
|
211038
211140
|
query(option) {
|
|
211141
|
+
let ccf = new proj();
|
|
211039
211142
|
let apitype = [{
|
|
211040
211143
|
type: "\u9A7E\u8F66",
|
|
211041
211144
|
url: "/amap/v3/direction/driving"
|
|
@@ -211060,7 +211163,9 @@ class GaodeRoute extends baseGaode {
|
|
|
211060
211163
|
let points = element.polyline.split(";");
|
|
211061
211164
|
points.forEach((element2) => {
|
|
211062
211165
|
let p5 = element2.split(",");
|
|
211063
|
-
|
|
211166
|
+
debugger;
|
|
211167
|
+
let wgs = ccf.gcj02ToWgs84(parseFloat(p5[1]), parseFloat(p5[0]));
|
|
211168
|
+
paths.points.push([wgs.lontitude, wgs.latitude]);
|
|
211064
211169
|
});
|
|
211065
211170
|
});
|
|
211066
211171
|
console.log(paths.points);
|
|
@@ -211077,39 +211182,64 @@ class GaodePOI extends baseGaode {
|
|
|
211077
211182
|
super(options);
|
|
211078
211183
|
}
|
|
211079
211184
|
query(option) {
|
|
211185
|
+
let ccf = new proj();
|
|
211186
|
+
let obj = {
|
|
211187
|
+
queryType: 1,
|
|
211188
|
+
keywords: "",
|
|
211189
|
+
location: "",
|
|
211190
|
+
radius: "3000",
|
|
211191
|
+
city: "\u897F\u5B89\u5E02",
|
|
211192
|
+
city_limit: true,
|
|
211193
|
+
polygon: "",
|
|
211194
|
+
extensions: "base",
|
|
211195
|
+
offset: 20,
|
|
211196
|
+
page: 1,
|
|
211197
|
+
success: null,
|
|
211198
|
+
error: null
|
|
211199
|
+
};
|
|
211200
|
+
obj = Object.assign({}, obj, option);
|
|
211080
211201
|
let apitype = [{
|
|
211081
211202
|
type: "\u5468\u8FB9\u641C\u7D22",
|
|
211082
211203
|
url: "/amap/v3/place/around",
|
|
211083
211204
|
parameters: {
|
|
211084
|
-
|
|
211085
|
-
|
|
211086
|
-
|
|
211205
|
+
key: this.option.key,
|
|
211206
|
+
keywords: obj.keywords,
|
|
211207
|
+
location: obj.location,
|
|
211208
|
+
radius: obj.radius,
|
|
211209
|
+
offset: obj.offset,
|
|
211210
|
+
page: obj.page
|
|
211087
211211
|
}
|
|
211088
211212
|
}, {
|
|
211089
211213
|
type: "\u5173\u952E\u5B57\u641C\u7D22",
|
|
211090
211214
|
url: "/amap/v3/place/text",
|
|
211091
211215
|
parameters: {
|
|
211092
|
-
|
|
211093
|
-
|
|
211094
|
-
city: option.city
|
|
211095
|
-
city_limit: option.city_limit
|
|
211216
|
+
key: this.option.key,
|
|
211217
|
+
keywords: obj.keywords,
|
|
211218
|
+
city: option.city,
|
|
211219
|
+
city_limit: option.city_limit,
|
|
211220
|
+
offset: obj.offset,
|
|
211221
|
+
page: obj.page
|
|
211096
211222
|
}
|
|
211097
211223
|
}, {
|
|
211098
211224
|
type: "\u591A\u8FB9\u5F62\u533A\u57DF\u641C\u7D22",
|
|
211099
211225
|
url: "/amap/v3/place/polygon",
|
|
211100
211226
|
parameters: {
|
|
211227
|
+
key: this.option.key,
|
|
211101
211228
|
keywords: option.keywords,
|
|
211102
|
-
polygon: option.
|
|
211103
|
-
|
|
211229
|
+
polygon: option.polygon,
|
|
211230
|
+
offset: obj.offset,
|
|
211231
|
+
page: obj.page
|
|
211104
211232
|
}
|
|
211105
211233
|
}];
|
|
211106
|
-
|
|
211107
|
-
|
|
211108
|
-
extensions: "base"
|
|
211109
|
-
};
|
|
211110
|
-
obj = Object.assign({}, obj, apitype[option.queryType].parameters);
|
|
211111
|
-
let url = apitype[option.queryType].url + paramsToUrl(obj);
|
|
211234
|
+
obj.keywords = obj.keywords.replace("", "|");
|
|
211235
|
+
let url = apitype[obj.queryType].url + paramsToUrl(apitype[obj.queryType].parameters);
|
|
211112
211236
|
fetchJson(url).then(function(data2) {
|
|
211237
|
+
data2.pois.forEach((element) => {
|
|
211238
|
+
let p5 = element.location.split(",");
|
|
211239
|
+
debugger;
|
|
211240
|
+
let wgs = ccf.gcj02ToWgs84(parseFloat(p5[1]), parseFloat(p5[0]));
|
|
211241
|
+
element.lnglat = [wgs.lontitude, wgs.latitude];
|
|
211242
|
+
});
|
|
211113
211243
|
option.success(data2);
|
|
211114
211244
|
}).catch(function(e2) {
|
|
211115
211245
|
if (option.error)
|