mirage2d 1.1.12 → 1.1.14

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.
@@ -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";
@@ -78819,8 +78820,8 @@ class toolbox {
78819
78820
  static randomHexColor() {
78820
78821
  return "#" + Math.random().toString(16).substring(2, 6).toUpperCase();
78821
78822
  }
78822
- static randomRgbColor() {
78823
- return toolbox.hexToRgba(toolbox.randomHexColor(), 1);
78823
+ static randomRgbColor(alpha = 1) {
78824
+ return toolbox.hexToRgba(toolbox.randomHexColor(), alpha);
78824
78825
  }
78825
78826
  static rgbToHex(rgb2) {
78826
78827
  var rRgba = /rgba?\((\d{1,3}),(\d{1,3}),(\d{1,3})(,([.\d]+))?\)/, r2, g2, b2, a2, rsa = rgb2.replace(/\s+/g, "").match(rRgba);
@@ -78837,7 +78838,7 @@ class toolbox {
78837
78838
  return { hex: rgb2, alpha: 1 };
78838
78839
  }
78839
78840
  }
78840
- static hexToRgba(hex, al) {
78841
+ static hexToRgba(hex, alpha) {
78841
78842
  var reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
78842
78843
  var sColor = hex.toLowerCase();
78843
78844
  if (sColor && reg.test(sColor)) {
@@ -78852,7 +78853,7 @@ class toolbox {
78852
78853
  for (var i2 = 1; i2 < 7; i2 += 2) {
78853
78854
  sColorChange.push(parseInt("0x" + sColor.slice(i2, i2 + 2)));
78854
78855
  }
78855
- return "rgba(" + sColorChange.join(",") + "," + al + ")";
78856
+ return "rgba(" + sColorChange.join(",") + "," + alpha + ")";
78856
78857
  } else {
78857
78858
  return sColor;
78858
78859
  }
@@ -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, {
@@ -80305,6 +80238,85 @@ class baseGraphicLayer extends baseLayer {
80305
80238
  feature2.setStyle(mStyle);
80306
80239
  });
80307
80240
  }
80241
+ setSymbolLevelColor(colorOption) {
80242
+ let arr = [];
80243
+ let max4 = 0;
80244
+ let average2 = 0;
80245
+ if (colorOption.autolevel === void 0 || colorOption.autolevel === null) {
80246
+ colorOption.autolevel = true;
80247
+ }
80248
+ let mLevelColor = [
80249
+ {
80250
+ maxnum: 0,
80251
+ fillcolor: "rgba(255,0,0,0.2)",
80252
+ strokecolor: "rgba(255, 255, 255,1)",
80253
+ strokewidth: 1
80254
+ },
80255
+ {
80256
+ maxnum: 0,
80257
+ fillcolor: "rgba(255,0,0,0.4)",
80258
+ strokecolor: "rgba(255, 255, 255,1)",
80259
+ strokewidth: 1
80260
+ },
80261
+ {
80262
+ maxnum: 0,
80263
+ fillcolor: "rgba(255,0,0,0.6)",
80264
+ strokecolor: "rgba(255, 255, 255,1)",
80265
+ strokewidth: 1
80266
+ },
80267
+ {
80268
+ maxnum: 0,
80269
+ fillcolor: "rgba(255,0,0,0.8)",
80270
+ strokecolor: "rgba(255, 255, 255,1)",
80271
+ strokewidth: 1
80272
+ },
80273
+ {
80274
+ maxnum: 0,
80275
+ fillcolor: "rgba(255,0,0,1)",
80276
+ strokecolor: "rgba(255, 255, 255,1)",
80277
+ strokewidth: 1
80278
+ }
80279
+ ];
80280
+ if (colorOption.levelColor) {
80281
+ mLevelColor = colorOption.levelColor;
80282
+ }
80283
+ if (colorOption.autolevel) {
80284
+ let level = mLevelColor.length;
80285
+ this._source.getFeatures().forEach((feature2) => {
80286
+ let data2 = feature2.get(colorOption.attributeName);
80287
+ if (data2) {
80288
+ arr.push(parseInt(data2));
80289
+ }
80290
+ });
80291
+ max4 = Math.max(...arr);
80292
+ average2 = max4 / level;
80293
+ this._source.getFeatures().forEach((feature2) => {
80294
+ let data2 = feature2.get(colorOption.attributeName);
80295
+ if (data2) {
80296
+ for (let i2 = 1; i2 <= level; i2++) {
80297
+ if (parseInt(data2) <= average2 * i2) {
80298
+ let mStyle = MirageDefaultStyle.getStyle(feature2.getGeometry().getType(), { fillcolor: mLevelColor[i2 - 1].fillcolor, strokecolor: mLevelColor[i2 - 1].strokecolor, strokewidth: mLevelColor[i2 - 1].strokewidth });
80299
+ feature2.setStyle(mStyle);
80300
+ break;
80301
+ }
80302
+ }
80303
+ }
80304
+ });
80305
+ } else {
80306
+ this._source.getFeatures().forEach((feature2) => {
80307
+ let data2 = feature2.get(colorOption.attributeName);
80308
+ if (data2) {
80309
+ mLevelColor.forEach((element) => {
80310
+ if (parseInt(data2) <= element.maxnum) {
80311
+ let mStyle = MirageDefaultStyle.getStyle(feature2.getGeometry().getType(), { fillcolor: element.fillcolor, strokecolor: element.strokecolor, strokewidth: element.strokewidth });
80312
+ feature2.setStyle(mStyle);
80313
+ return;
80314
+ }
80315
+ });
80316
+ }
80317
+ });
80318
+ }
80319
+ }
80308
80320
  setSymbolByClassname(classname, styleOptions, callback) {
80309
80321
  this._source.getFeatures().forEach((feature2) => {
80310
80322
  if (feature2.get("classname") == classname) {
@@ -159696,6 +159708,240 @@ class SelectTransform {
159696
159708
  this.transformInteraction.setActive(b2);
159697
159709
  }
159698
159710
  }
159711
+ class proj {
159712
+ constructor() {
159713
+ __publicField(this, "data");
159714
+ __publicField(this, "pi");
159715
+ __publicField(this, "x_pi");
159716
+ __publicField(this, "a");
159717
+ __publicField(this, "ee");
159718
+ registerProj4();
159719
+ register$3(proj4);
159720
+ this.data = [];
159721
+ this.data.push({ dh: 13, wkid: 4502 });
159722
+ this.data.push({ dh: 14, wkid: 4503 });
159723
+ this.data.push({ dh: 15, wkid: 4504 });
159724
+ this.data.push({ dh: 16, wkid: 4505 });
159725
+ this.data.push({ dh: 17, wkid: 4506 });
159726
+ this.data.push({ dh: 18, wkid: 4507 });
159727
+ this.data.push({ dh: 19, wkid: 4508 });
159728
+ this.data.push({ dh: 20, wkid: 4509 });
159729
+ this.data.push({ dh: 21, wkid: 4510 });
159730
+ this.data.push({ dh: 22, wkid: 4511 });
159731
+ this.data.push({ dh: 23, wkid: 4512 });
159732
+ this.data.push({ dh: 78, wkid: 4535 });
159733
+ this.data.push({ dh: 81, wkid: 4536 });
159734
+ this.data.push({ dh: 84, wkid: 4537 });
159735
+ this.data.push({ dh: 87, wkid: 4538 });
159736
+ this.data.push({ dh: 90, wkid: 4539 });
159737
+ this.data.push({ dh: 93, wkid: 4540 });
159738
+ this.data.push({ dh: 96, wkid: 4541 });
159739
+ this.data.push({ dh: 99, wkid: 4542 });
159740
+ this.data.push({ dh: 102, wkid: 4543 });
159741
+ this.data.push({ dh: 105, wkid: 4544 });
159742
+ this.data.push({ dh: 108, wkid: 4545 });
159743
+ this.data.push({ dh: 111, wkid: 4546 });
159744
+ this.data.push({ dh: 114, wkid: 4547 });
159745
+ this.data.push({ dh: 117, wkid: 4548 });
159746
+ this.data.push({ dh: 120, wkid: 4549 });
159747
+ this.data.push({ dh: 123, wkid: 4550 });
159748
+ this.data.push({ dh: 126, wkid: 4551 });
159749
+ this.data.push({ dh: 129, wkid: 4552 });
159750
+ this.data.push({ dh: 132, wkid: 4553 });
159751
+ this.data.push({ dh: 135, wkid: 4554 });
159752
+ this.pi = 3.141592653589793;
159753
+ this.x_pi = 3.141592653589793 * 3e3 / 180;
159754
+ this.a = 6378245;
159755
+ this.ee = 0.006693421622965943;
159756
+ }
159757
+ ConvertToMapCoord(wkid, Coordinates) {
159758
+ return { "Coord3857": this.ConvertCoordinatesTo3857(wkid, Coordinates), "Coord4326": this.ConvertCoordinatesTo4326(wkid, Coordinates) };
159759
+ }
159760
+ ConvertCoordinatesTo3857(wkid, Coordinates) {
159761
+ if (wkid.toUpperCase().indexOf("EPSG:") == -1) {
159762
+ wkid = "EPSG:" + wkid;
159763
+ }
159764
+ return proj4(wkid, "EPSG:3857", Coordinates);
159765
+ }
159766
+ ConvertCoordinatesTo4326(wkid, Coordinates) {
159767
+ if (wkid.toUpperCase().indexOf("EPSG:") == -1) {
159768
+ wkid = "EPSG:" + wkid;
159769
+ }
159770
+ return proj4(wkid, "EPSG:4326", Coordinates);
159771
+ }
159772
+ formatJsonTo3857(GeoJson) {
159773
+ let featureList;
159774
+ if (GeoJson.crs.properties.name == "EPSG:3857") {
159775
+ featureList = new GeoJSON$1().readFeatures(GeoJson);
159776
+ } else if (GeoJson.crs.properties.name == "EPSG:4326") {
159777
+ featureList = new GeoJSON$1().readFeatures(GeoJson, {
159778
+ dataProjection: "EPSG:4326",
159779
+ featureProjection: "EPSG:3857"
159780
+ });
159781
+ } else {
159782
+ featureList = new GeoJSON$1().readFeatures(GeoJson, {
159783
+ dataProjection: GeoJson.crs.properties.name,
159784
+ featureProjection: "EPSG:3857"
159785
+ });
159786
+ }
159787
+ return featureList;
159788
+ }
159789
+ formatJsonTo4326Json(GeoJson) {
159790
+ let featureList;
159791
+ let format2 = new GeoJSON$1();
159792
+ if (GeoJson.crs.properties.name == "EPSG:4326") {
159793
+ featureList = format2.readFeatures(GeoJson);
159794
+ } else if (GeoJson.crs.properties.name == "EPSG:3857") {
159795
+ featureList = format2.readFeatures(GeoJson, {
159796
+ dataProjection: "EPSG:3857",
159797
+ featureProjection: "EPSG:4326"
159798
+ });
159799
+ } else {
159800
+ featureList = format2.readFeatures(GeoJson, {
159801
+ dataProjection: GeoJson.crs.properties.name,
159802
+ featureProjection: "EPSG:4326"
159803
+ });
159804
+ }
159805
+ return format2.writeFeaturesObject(featureList);
159806
+ }
159807
+ formatJsonToPoint(GeoJson) {
159808
+ let featureList = this.formatJsonTo3857(GeoJson);
159809
+ let newFeature = [];
159810
+ featureList.forEach((feature2) => {
159811
+ switch (feature2.getGeometry().getType()) {
159812
+ case "Polygon":
159813
+ newFeature.push(new Feature$1({
159814
+ geometry: feature2.getGeometry().getInteriorPoint(),
159815
+ properties: feature2.getProperties().properties
159816
+ }));
159817
+ break;
159818
+ case "Point":
159819
+ newFeature.push(feature2);
159820
+ break;
159821
+ }
159822
+ });
159823
+ return newFeature;
159824
+ }
159825
+ LnglatToCGCS2000(lng, lat2, zone = 3) {
159826
+ let daihao;
159827
+ if (zone == 3) {
159828
+ daihao = parseInt(((lng + 1.5) / 3).toString()) * 3;
159829
+ } else {
159830
+ daihao = parseInt(((lng + 6) / 6).toString()) * 6 - 3;
159831
+ }
159832
+ let wkid;
159833
+ this.data.forEach((element) => {
159834
+ if (element.dh == daihao) {
159835
+ wkid = element.wkid;
159836
+ return;
159837
+ }
159838
+ });
159839
+ if (wkid) {
159840
+ return proj4("EPSG:4326", "EPSG:" + wkid, [lng, lat2]);
159841
+ } else {
159842
+ return [0, 0];
159843
+ }
159844
+ }
159845
+ ConvertWebMercatorToCGCS2000(x2, y2, zone = 3) {
159846
+ let lnglat = toLonLat([x2, y2]);
159847
+ return this.LnglatToCGCS2000(lnglat[0], lnglat[1], zone);
159848
+ }
159849
+ webMktToLngLat(Coordinates) {
159850
+ return toLonLat(Coordinates);
159851
+ }
159852
+ lngLatToWebMkt(Coordinates) {
159853
+ return fromLonLat(Coordinates);
159854
+ }
159855
+ transformLat(x2, y2) {
159856
+ let ret = -100 + 2 * x2 + 3 * y2 + 0.2 * y2 * y2 + 0.1 * x2 * y2 + 0.2 * Math.sqrt(Math.abs(x2));
159857
+ ret += (20 * Math.sin(6 * x2 * this.pi) + 20 * Math.sin(2 * x2 * this.pi)) * 2 / 3;
159858
+ ret += (20 * Math.sin(y2 * this.pi) + 40 * Math.sin(y2 / 3 * this.pi)) * 2 / 3;
159859
+ ret += (160 * Math.sin(y2 / 12 * this.pi) + 320 * Math.sin(y2 * this.pi / 30)) * 2 / 3;
159860
+ return ret;
159861
+ }
159862
+ transformLon(x2, y2) {
159863
+ let ret = 300 + x2 + 2 * y2 + 0.1 * x2 * x2 + 0.1 * x2 * y2 + 0.1 * Math.sqrt(Math.abs(x2));
159864
+ ret += (20 * Math.sin(6 * x2 * this.pi) + 20 * Math.sin(2 * x2 * this.pi)) * 2 / 3;
159865
+ ret += (20 * Math.sin(x2 * this.pi) + 40 * Math.sin(x2 / 3 * this.pi)) * 2 / 3;
159866
+ ret += (150 * Math.sin(x2 / 12 * this.pi) + 300 * Math.sin(x2 / 30 * this.pi)) * 2 / 3;
159867
+ return ret;
159868
+ }
159869
+ transform(lat2, lon2) {
159870
+ if (this.outOfChina(lat2, lon2)) {
159871
+ return [lat2, lon2];
159872
+ }
159873
+ let dLat = this.transformLat(lon2 - 105, lat2 - 35);
159874
+ let dLon = this.transformLon(lon2 - 105, lat2 - 35);
159875
+ let radLat = lat2 / 180 * this.pi;
159876
+ let magic = Math.sin(radLat);
159877
+ magic = 1 - this.ee * magic * magic;
159878
+ let sqrtMagic = Math.sqrt(magic);
159879
+ dLat = dLat * 180 / (this.a * (1 - this.ee) / (magic * sqrtMagic) * this.pi);
159880
+ dLon = dLon * 180 / (this.a / sqrtMagic * Math.cos(radLat) * this.pi);
159881
+ let mgLat = lat2 + dLat;
159882
+ let mgLon = lon2 + dLon;
159883
+ return [mgLat, mgLon];
159884
+ }
159885
+ outOfChina(lat2, lon2) {
159886
+ if (lon2 < 72.004 || lon2 > 137.8347)
159887
+ return true;
159888
+ if (lat2 < 0.8293 || lat2 > 55.8271)
159889
+ return true;
159890
+ return false;
159891
+ }
159892
+ wgs84ToGcj02(lat2, lon2) {
159893
+ if (this.outOfChina(lat2, lon2)) {
159894
+ return { lat: lat2, lon: lon2 };
159895
+ }
159896
+ let dLat = this.transformLat(lon2 - 105, lat2 - 35);
159897
+ let dLon = this.transformLon(lon2 - 105, lat2 - 35);
159898
+ let radLat = lat2 / 180 * this.pi;
159899
+ let magic = Math.sin(radLat);
159900
+ magic = 1 - this.ee * magic * magic;
159901
+ let sqrtMagic = Math.sqrt(magic);
159902
+ dLat = dLat * 180 / (this.a * (1 - this.ee) / (magic * sqrtMagic) * this.pi);
159903
+ dLon = dLon * 180 / (this.a / sqrtMagic * Math.cos(radLat) * this.pi);
159904
+ let mgLat = lat2 + dLat;
159905
+ let mgLon = lon2 + dLon;
159906
+ return { mgLat, mgLon };
159907
+ }
159908
+ gcj02ToWgs84(lat2, lon2) {
159909
+ let gps = this.transform(lat2, lon2);
159910
+ let lontitude = lon2 * 2 - gps[1];
159911
+ let latitude = lat2 * 2 - gps[0];
159912
+ return { latitude, lontitude };
159913
+ }
159914
+ gcj02ToBd09(lat2, lon2) {
159915
+ let x2 = lon2, y2 = lat2;
159916
+ let z2 = Math.sqrt(x2 * x2 + y2 * y2) + 2e-5 * Math.sin(y2 * this.x_pi);
159917
+ let theta = Math.atan2(y2, x2) + 3e-6 * Math.cos(x2 * this.x_pi);
159918
+ let tempLon = z2 * Math.cos(theta) + 65e-4;
159919
+ let tempLat = z2 * Math.sin(theta) + 6e-3;
159920
+ let gps = { tempLat, tempLon };
159921
+ return gps;
159922
+ }
159923
+ bd09ToGcj02(lat2, lon2) {
159924
+ let x2 = lon2 - 65e-4, y2 = lat2 - 6e-3;
159925
+ let z2 = Math.sqrt(x2 * x2 + y2 * y2) - 2e-5 * Math.sin(y2 * this.x_pi);
159926
+ let theta = Math.atan2(y2, x2) - 3e-6 * Math.cos(x2 * this.x_pi);
159927
+ let tempLon = z2 * Math.cos(theta);
159928
+ let tempLat = z2 * Math.sin(theta);
159929
+ let gps = { tempLat, tempLon };
159930
+ return gps;
159931
+ }
159932
+ wgs84ToBd09(lat2, lon2) {
159933
+ let gcj02 = this.wgs84ToGcj02(lat2, lon2);
159934
+ let bd09 = this.gcj02ToBd09(gcj02[0], gcj02[1]);
159935
+ return bd09;
159936
+ }
159937
+ bd09_To_gps84(lat2, lon2) {
159938
+ let gcj02 = this.bd09ToGcj02(lat2, lon2);
159939
+ let gps84 = this.gcj02ToWgs84(gcj02[0], gcj02[1]);
159940
+ gps84[0] = gps84[0].toFixed(6);
159941
+ gps84[1] = gps84[1].toFixed(6);
159942
+ return gps84;
159943
+ }
159944
+ }
159699
159945
  class MirageMap extends baseMap {
159700
159946
  constructor(mapID = "map", option) {
159701
159947
  super();
@@ -159720,6 +159966,7 @@ class MirageMap extends baseMap {
159720
159966
  __publicField(this, "option");
159721
159967
  __publicField(this, "controls");
159722
159968
  __publicField(this, "selectTransform");
159969
+ __publicField(this, "Proj");
159723
159970
  this._mapOption = {
159724
159971
  zoom: 13,
159725
159972
  center: { lng: 102.103952024454, lat: 26.1693520685273 },
@@ -159788,6 +160035,7 @@ class MirageMap extends baseMap {
159788
160035
  baseLayerSwitch: null,
159789
160036
  swipe: new swipeControl(this)
159790
160037
  };
160038
+ this.Proj = new proj();
159791
160039
  this.init(mapID);
159792
160040
  } else {
159793
160041
  return;
@@ -159936,14 +160184,14 @@ class MirageMap extends baseMap {
159936
160184
  let xy = (_a2 = this._map) == null ? void 0 : _a2.getEventCoordinate(evt.originalEvent);
159937
160185
  if (xy) {
159938
160186
  let lnglat = transform$4(xy, "EPSG:3857", "EPSG:4326");
160187
+ let xy2000 = this.Proj.LnglatToCGCS2000(lnglat[0], lnglat[1], 3);
159939
160188
  this.trigger(XMapEventType.onMapMove, {
159940
160189
  lng: lnglat[0],
159941
160190
  lat: lnglat[1],
159942
- crsx: xy[0],
159943
- crsy: xy[1],
160191
+ crsx: xy2000[0].toFixed(2),
160192
+ crsy: xy2000[1].toFixed(2),
159944
160193
  level: Math.round(this._view.getZoom())
159945
160194
  });
159946
- let xy2000 = SpatialAnalysis.ConvertLnglatToCGCS2000(lnglat[0], lnglat[1], 3);
159947
160195
  this.controls.locationbar.updateMousePosition(toolbox.format(this._mapOption.controls.locationBar.template, {
159948
160196
  lng: lnglat[0].toFixed(6),
159949
160197
  lat: lnglat[1].toFixed(6),
@@ -159961,11 +160209,12 @@ class MirageMap extends baseMap {
159961
160209
  if (evt.frameState) {
159962
160210
  const state = evt.frameState.viewState;
159963
160211
  let lnglat = transform$4(state.center, "EPSG:3857", "EPSG:4326");
160212
+ let xy2000 = this.Proj.LnglatToCGCS2000(lnglat[0], lnglat[1], 3);
159964
160213
  this.trigger(XMapEventType.onMapMove, {
159965
160214
  lng: lnglat[0],
159966
160215
  lat: lnglat[1],
159967
- crsx: state.center[0],
159968
- crsy: state.center[1],
160216
+ crsx: xy2000[0].toFixed(2),
160217
+ crsy: xy2000[1].toFixed(2),
159969
160218
  level: Math.round(state.zoom)
159970
160219
  });
159971
160220
  }
@@ -160241,11 +160490,11 @@ class MirageMap extends baseMap {
160241
160490
  setCenter(lnglat, zoom, dataWkID = crsType.EPSG3857, flash = false) {
160242
160491
  let mlnglat;
160243
160492
  if (dataWkID == crsType.EPSG4326) {
160244
- mlnglat = SpatialAnalysis.ConvertCoordinatesTo3857(dataWkID, lnglat);
160493
+ mlnglat = this.Proj.ConvertCoordinatesTo3857(dataWkID, lnglat);
160245
160494
  } else if (dataWkID == crsType.EPSG3857) {
160246
160495
  mlnglat = lnglat;
160247
160496
  } else {
160248
- mlnglat = SpatialAnalysis.ConvertCoordinatesTo3857(dataWkID, lnglat);
160497
+ mlnglat = this.Proj.ConvertCoordinatesTo3857(dataWkID, lnglat);
160249
160498
  }
160250
160499
  this._view.setCenter(mlnglat);
160251
160500
  if (zoom) {
@@ -169485,6 +169734,7 @@ class baseGraphic extends Feature$1 {
169485
169734
  constructor(options) {
169486
169735
  super();
169487
169736
  __publicField(this, "option");
169737
+ __publicField(this, "Proj");
169488
169738
  this.option = {
169489
169739
  lnglat: [0, 0],
169490
169740
  dataWkID: crsType.EPSG3857,
@@ -169559,6 +169809,7 @@ class baseGraphic extends Feature$1 {
169559
169809
  attribute: null
169560
169810
  };
169561
169811
  this.option = UJson.merge(this.option, options, true);
169812
+ this.Proj = new proj();
169562
169813
  }
169563
169814
  setAttribute(attribute) {
169564
169815
  let featureAtt = UJson.merge(this.getProperties(), attribute, true);
@@ -169631,7 +169882,7 @@ class LabelGraphic extends baseGraphic {
169631
169882
  case crsType.CGCS2000_GK_CM_6:
169632
169883
  break;
169633
169884
  default:
169634
- this.setGeometry(new Point$4(SpatialAnalysis.ConvertCoordinatesTo3857(this.option.dataWkID, options.lnglat)));
169885
+ this.setGeometry(new Point$4(this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID, options.lnglat)));
169635
169886
  break;
169636
169887
  }
169637
169888
  }
@@ -169685,7 +169936,7 @@ class LabelGraphic extends baseGraphic {
169685
169936
  } else if (this.option.dataWkID == crsType.EPSG3857) {
169686
169937
  pp.setCoordinates([lng, lat2]);
169687
169938
  } else {
169688
- pp.setCoordinates(SpatialAnalysis.ConvertCoordinatesTo3857(this.option.dataWkID, [lng, lat2]));
169939
+ pp.setCoordinates(this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID, [lng, lat2]));
169689
169940
  }
169690
169941
  }
169691
169942
  }
@@ -169706,7 +169957,7 @@ class PointGraphic extends baseGraphic {
169706
169957
  case crsType.CGCS2000_GK_CM_6:
169707
169958
  break;
169708
169959
  default:
169709
- this.setGeometry(new Point$4(SpatialAnalysis.ConvertCoordinatesTo3857(this.option.dataWkID, options.lnglat)));
169960
+ this.setGeometry(new Point$4(this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID, options.lnglat)));
169710
169961
  break;
169711
169962
  }
169712
169963
  }
@@ -169748,7 +169999,7 @@ class PointGraphic extends baseGraphic {
169748
169999
  } else if (this.option.dataWkID == crsType.EPSG3857) {
169749
170000
  pp.setCoordinates([lng, lat2]);
169750
170001
  } else {
169751
- pp.setCoordinates(SpatialAnalysis.ConvertCoordinatesTo3857(this.option.dataWkID, [lng, lat2]));
170002
+ pp.setCoordinates(this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID, [lng, lat2]));
169752
170003
  }
169753
170004
  }
169754
170005
  }
@@ -169768,7 +170019,7 @@ class ImagePointGraphic extends baseGraphic {
169768
170019
  case crsType.CGCS2000_GK_CM_6:
169769
170020
  break;
169770
170021
  default:
169771
- this.setGeometry(new Point$4(SpatialAnalysis.ConvertCoordinatesTo3857(this.option.dataWkID, options.lnglat)));
170022
+ this.setGeometry(new Point$4(this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID, options.lnglat)));
169772
170023
  break;
169773
170024
  }
169774
170025
  }
@@ -169830,7 +170081,7 @@ class ImagePointGraphic extends baseGraphic {
169830
170081
  } else if (this.option.dataWkID == crsType.EPSG3857) {
169831
170082
  pp.setCoordinates([lng, lat2]);
169832
170083
  } else {
169833
- pp.setCoordinates(SpatialAnalysis.ConvertCoordinatesTo3857(this.option.dataWkID, [lng, lat2]));
170084
+ pp.setCoordinates(this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID, [lng, lat2]));
169834
170085
  }
169835
170086
  }
169836
170087
  }
@@ -170065,7 +170316,7 @@ class LineGraphic extends baseGraphic {
170065
170316
  break;
170066
170317
  default:
170067
170318
  this.option.lnglat.forEach((element, index2) => {
170068
- this.option.lnglat[index2] = SpatialAnalysis.ConvertCoordinatesTo3857(this.option.dataWkID, element);
170319
+ this.option.lnglat[index2] = this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID, element);
170069
170320
  });
170070
170321
  this.setGeometry(new LineString$2(this.option.lnglat));
170071
170322
  break;
@@ -170147,7 +170398,7 @@ class PolygonGraphic extends baseGraphic {
170147
170398
  default:
170148
170399
  this.option.lnglat.forEach((element) => {
170149
170400
  element.forEach((xy, index2) => {
170150
- element[index2] = SpatialAnalysis.ConvertCoordinatesTo3857(this.option.dataWkID, xy);
170401
+ element[index2] = this.Proj.ConvertCoordinatesTo3857(this.option.dataWkID, xy);
170151
170402
  });
170152
170403
  });
170153
170404
  this.setGeometry(new ol_geom_Polygon(this.option.lnglat));
@@ -170258,8 +170509,12 @@ class CurveGraphic extends baseGraphic {
170258
170509
  break;
170259
170510
  case crsType.CGCS2000_GK_CM_6:
170260
170511
  break;
170512
+ case crsType.BAIDU:
170513
+ break;
170514
+ case crsType.GCJ02:
170515
+ break;
170261
170516
  default:
170262
- this.setGeometry(this.createRegularPolygonCurve(SpatialAnalysis.ConvertCoordinatesTo4326(this.option.dataWkID, this.option.lnglat), this.option.style.radius, this.option.style.startAngle, this.option.style.stopAngle, this.option.style.rotation));
170517
+ 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
170518
  break;
170264
170519
  }
170265
170520
  }
@@ -170295,7 +170550,7 @@ class CurveGraphic extends baseGraphic {
170295
170550
  } else if (this.option.dataWkID == crsType.EPSG3857) {
170296
170551
  this.setGeometry(this.createRegularPolygonCurve(toLonLat(this.option.lnglat), this.option.style.radius, startAngle, stopAngle, this.option.style.rotation));
170297
170552
  } else {
170298
- this.setGeometry(this.createRegularPolygonCurve(SpatialAnalysis.ConvertCoordinatesTo4326(this.option.dataWkID, this.option.lnglat), this.option.style.radius, startAngle, stopAngle, this.option.style.rotation));
170553
+ this.setGeometry(this.createRegularPolygonCurve(this.Proj.ConvertCoordinatesTo4326(this.option.dataWkID, this.option.lnglat), this.option.style.radius, startAngle, stopAngle, this.option.style.rotation));
170299
170554
  }
170300
170555
  }
170301
170556
  createRegularPolygonCurve(origin, radius, startAngle, stopAngle, rotation) {
@@ -210907,80 +211162,6 @@ var resource = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
210907
211162
  __proto__: null,
210908
211163
  getJSON
210909
211164
  }, 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
211165
  class eventTarget {
210985
211166
  constructor() {
210986
211167
  __publicField(this, "events", new Map());
@@ -211036,6 +211217,7 @@ class GaodeRoute extends baseGaode {
211036
211217
  super(options);
211037
211218
  }
211038
211219
  query(option) {
211220
+ let ccf = new proj();
211039
211221
  let apitype = [{
211040
211222
  type: "\u9A7E\u8F66",
211041
211223
  url: "/amap/v3/direction/driving"
@@ -211060,7 +211242,9 @@ class GaodeRoute extends baseGaode {
211060
211242
  let points = element.polyline.split(";");
211061
211243
  points.forEach((element2) => {
211062
211244
  let p5 = element2.split(",");
211063
- paths.points.push([parseFloat(p5[0]), parseFloat(p5[1])]);
211245
+ debugger;
211246
+ let wgs = ccf.gcj02ToWgs84(parseFloat(p5[1]), parseFloat(p5[0]));
211247
+ paths.points.push([wgs.lontitude, wgs.latitude]);
211064
211248
  });
211065
211249
  });
211066
211250
  console.log(paths.points);
@@ -211077,39 +211261,64 @@ class GaodePOI extends baseGaode {
211077
211261
  super(options);
211078
211262
  }
211079
211263
  query(option) {
211264
+ let ccf = new proj();
211265
+ let obj = {
211266
+ queryType: 1,
211267
+ keywords: "",
211268
+ location: "",
211269
+ radius: "3000",
211270
+ city: "\u897F\u5B89\u5E02",
211271
+ city_limit: true,
211272
+ polygon: "",
211273
+ extensions: "base",
211274
+ offset: 20,
211275
+ page: 1,
211276
+ success: null,
211277
+ error: null
211278
+ };
211279
+ obj = Object.assign({}, obj, option);
211080
211280
  let apitype = [{
211081
211281
  type: "\u5468\u8FB9\u641C\u7D22",
211082
211282
  url: "/amap/v3/place/around",
211083
211283
  parameters: {
211084
- keywords: option.keywords,
211085
- location: option.location,
211086
- radius: option.radius
211284
+ key: this.option.key,
211285
+ keywords: obj.keywords,
211286
+ location: obj.location,
211287
+ radius: obj.radius,
211288
+ offset: obj.offset,
211289
+ page: obj.page
211087
211290
  }
211088
211291
  }, {
211089
211292
  type: "\u5173\u952E\u5B57\u641C\u7D22",
211090
211293
  url: "/amap/v3/place/text",
211091
211294
  parameters: {
211092
- keywords: option.keywords,
211093
- region: option.region || "",
211094
- city: option.city || "",
211095
- city_limit: option.city_limit || false
211295
+ key: this.option.key,
211296
+ keywords: obj.keywords,
211297
+ city: option.city,
211298
+ city_limit: option.city_limit,
211299
+ offset: obj.offset,
211300
+ page: obj.page
211096
211301
  }
211097
211302
  }, {
211098
211303
  type: "\u591A\u8FB9\u5F62\u533A\u57DF\u641C\u7D22",
211099
211304
  url: "/amap/v3/place/polygon",
211100
211305
  parameters: {
211306
+ key: this.option.key,
211101
211307
  keywords: option.keywords,
211102
- polygon: option.location,
211103
- radius: option.radius
211308
+ polygon: option.polygon,
211309
+ offset: obj.offset,
211310
+ page: obj.page
211104
211311
  }
211105
211312
  }];
211106
- let obj = {
211107
- key: this.option.key,
211108
- extensions: "base"
211109
- };
211110
- obj = Object.assign({}, obj, apitype[option.queryType].parameters);
211111
- let url = apitype[option.queryType].url + paramsToUrl(obj);
211313
+ obj.keywords = obj.keywords.replace("", "|");
211314
+ let url = apitype[obj.queryType].url + paramsToUrl(apitype[obj.queryType].parameters);
211112
211315
  fetchJson(url).then(function(data2) {
211316
+ data2.pois.forEach((element) => {
211317
+ let p5 = element.location.split(",");
211318
+ debugger;
211319
+ let wgs = ccf.gcj02ToWgs84(parseFloat(p5[1]), parseFloat(p5[0]));
211320
+ element.lnglat = [wgs.lontitude, wgs.latitude];
211321
+ });
211113
211322
  option.success(data2);
211114
211323
  }).catch(function(e2) {
211115
211324
  if (option.error)