raintee-maputils 1.0.45 → 1.0.47

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/index.js CHANGED
@@ -7422,10 +7422,7 @@ class CustomSearchSelectControl {
7422
7422
  `;
7423
7423
  this._container.innerHTML = `
7424
7424
  <button class="vector-layer-btn" title="${this.options.title}">
7425
- <svg viewBox="0 0 24 24" width="18" height="18">
7426
- <path d="M9,2V7.5L12,10.5L15,7.5V2H9ZM2,9H7.5L10.5,12L7.5,15H2V9ZM22,9H16.5L13.5,12L16.5,15H22V9ZM9,22V16.5L12,13.5L15,16.5V22H9Z"
7427
- fill="currentColor"/>
7428
- </svg>
7425
+ <svg t="1765250004086" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2929" width="16" height="16"><path d="M1002.666667 768L512 1002.666667 21.333333 768l267.733334-128L512 746.666667l222.933333-106.666667L1002.666667 768z" fill="#00A6FF" p-id="2930"></path><path d="M734.933333 640L512 746.666667l-222.933333-106.666667L512 533.333333l222.933333 106.666667z" fill="#00C7B1" p-id="2931"></path><path d="M735.146667 384L512 490.666667l-222.933333-106.666667L21.333333 512l267.733334 128L512 533.333333l222.933333 106.666667L1002.666667 512l-267.52-128z" fill="#24F2DC" p-id="2932"></path><path d="M735.146667 384L512 490.666667l-222.933333-106.666667L512 277.333333l223.146667 106.666667z" fill="#FFC247" p-id="2933"></path><path d="M1002.666667 256l-267.52 128L512 277.333333l-222.933333 106.666667L21.333333 256 512 21.333333l490.666667 234.666667z" fill="#FFD747" p-id="2934"></path><path d="M815.082667 189.930667l18.410666-38.506667 50.432 24.106667-18.410666 38.528zM37.333333 752l-5.952-12.437333-19.2 9.194666a21.333333 21.333333 0 0 0 0 38.4l19.2 9.194667 5.952-12.437333 12.458667-5.952L44.970667 768l4.821333-10.048zM72.490667 719.893333l41.109333-19.669333 18.410667 38.506667-41.109334 19.669333zM401.322667 562.581333l41.109333-19.648 18.410667 38.506667-41.109334 19.648zM154.688 680.576l41.109333-19.669333 18.432 38.506666-41.109333 19.669334zM522.048 561.792l18.410667-38.4-19.2-9.194667a21.461333 21.461333 0 0 0-18.432 0l-19.2 9.194667 18.410666 38.4 9.962667-4.821333zM809.813333 699.392l18.389334-38.506667 41.109333 19.648-18.410667 38.506667zM563.157333 581.461333l18.410667-38.506666 41.109333 19.648-18.410666 38.506666zM891.989333 738.730667l18.410667-38.506667 41.109333 19.648-18.410666 38.528zM1011.882667 748.8l-19.2-9.194667-5.952 12.437334-12.458667 5.952 4.821333 10.048-4.821333 10.048 12.458667 5.952 5.952 12.437333 19.2-9.194667a21.333333 21.333333 0 0 0 0-38.4zM809.813333 836.608l41.088-19.648 18.432 38.506667-41.109333 19.669333zM645.354667 915.242667l41.109333-19.669334 18.432 38.506667-41.109333 19.669333zM727.552 875.925333l41.109333-19.669333 18.410667 38.485333-41.088 19.669334zM891.989333 797.248l41.109334-19.669333 18.432 38.506666-41.109334 19.669334zM563.157333 954.56l41.109334-19.669333 18.410666 38.506666-41.109333 19.669334zM512 979.029333l-10.048-4.821333-18.410667 38.4 19.2 9.194667a21.333333 21.333333 0 0 0 18.432 0l19.2-9.194667-18.410666-38.4zM72.490667 816.128l18.410666-38.528 41.109334 19.669333-18.410667 38.506667zM154.666667 855.424l18.432-38.506667 41.109333 19.648-18.410667 38.506667zM236.906667 894.72l18.410666-38.485333 41.109334 19.669333-18.410667 38.485333zM401.322667 973.397333l18.432-38.506666 41.109333 19.648-18.432 38.528zM319.146667 934.058667l18.410666-38.506667 41.109334 19.648-18.410667 38.528zM510.72 300.373333l18.410667-38.528 38.485333 18.410667-18.432 38.506667zM356.714667 327.936l38.528-18.410667 18.410666 38.485334-38.528 18.432zM433.706667 291.114667l38.506666-18.410667 18.410667 38.528-38.485333 18.389333zM587.690667 337.173333L606.122667 298.666667l38.485333 18.410666-18.432 38.485334z" p-id="2935"></path><path d="M1011.882667 492.8L784.490667 384l227.392-108.8a21.333333 21.333333 0 0 0 0-38.4l-85.333334-40.810667-18.432 38.4L953.237333 256l-239.68 114.624 8-16.725333-38.4-18.389334-18.432 38.4 20.928 10.005334L512 467.029333l-176.384-84.352-17.365333-36.266666-29.290667 13.994666L70.762667 256 512 44.970667 770.496 168.533333l18.410667-38.4-267.690667-128a21.461333 21.461333 0 0 0-18.432 0l-490.666667 234.666667a21.333333 21.333333 0 0 0 0 38.4L239.509333 384l-48.96 23.466667 18.517334 38.4 80-38.250667L502.784 509.866667a21.333333 21.333333 0 0 0 18.432 0l213.824-102.250667L953.237333 512 686.933333 639.338667l17.898667-37.418667-41.109333-19.648-18.410667 38.4 40.213333 19.2L512 723.029333 338.432 640l40.213333-19.2-18.410666-38.4-41.109334 19.648 17.898667 37.418667L70.762667 512l93.610666-44.8-18.410666-38.4-133.845334 64a21.333333 21.333333 0 0 0 0 38.4l227.413334 108.8-2.624 1.258667 18.432 38.4 33.621333-16.085334L502.784 765.866667a21.333333 21.333333 0 0 0 18.432 0l213.824-102.272 33.642667 16.106666 18.432-38.4-2.645334-1.301333 227.413334-108.8a21.333333 21.333333 0 0 0 0-38.4z" p-id="2936"></path></svg>
7429
7426
  </button>
7430
7427
  `;
7431
7428
 
@@ -7929,8 +7926,8 @@ class CustomSearchSelectControl {
7929
7926
  background: white;
7930
7927
  border: 1px solid #d9d9d9;
7931
7928
  border-radius: 4px;
7932
- width: 28px;
7933
- height: 28px;
7929
+ width: 29px;
7930
+ height: 29px;
7934
7931
  display: flex;
7935
7932
  align-items: center;
7936
7933
  justify-content: center;
@@ -10093,5 +10090,124 @@ const useDrawCache = () => {
10093
10090
  }
10094
10091
  };
10095
10092
 
10096
- export { CustomOptionsControl, CustomSearchSelectControl, CustomToggleControl, DrawCacheFeatureManager, RainteeConstants, RainteeGISUtil, RainteeSourceMapTool, RasterLayerControl, RulerControl, TerrainToggleControl, useDrawCache };
10093
+ /**
10094
+ * 经纬度坐标系转换
10095
+ * @param {number} lng - 经度
10096
+ * @param {number} lat - 纬度
10097
+ * @param {string} fromType - 起始坐标系: 'wgs84' | 'gcj02' | 'bd09'
10098
+ * @param {string} toType - 目标坐标系: 'wgs84' | 'gcj02' | 'bd09'
10099
+ * @returns {Object} 转换后的坐标 {lng, lat}
10100
+ */
10101
+ function convertCoordinate(lng, lat, fromType, toType) {
10102
+ // 如果起始坐标系和目标坐标系相同,直接返回
10103
+ if (fromType === toType) {
10104
+ return { lng, lat };
10105
+ }
10106
+
10107
+ // 转换链:确保通过中间坐标系正确转换
10108
+ if (fromType === 'wgs84' && toType === 'gcj02') {
10109
+ return wgs84ToGcj02(lng, lat);
10110
+ } else if (fromType === 'wgs84' && toType === 'bd09') {
10111
+ const gcj = wgs84ToGcj02(lng, lat);
10112
+ return gcj02ToBd09(gcj.lng, gcj.lat);
10113
+ } else if (fromType === 'gcj02' && toType === 'wgs84') {
10114
+ return gcj02ToWgs84(lng, lat);
10115
+ } else if (fromType === 'gcj02' && toType === 'bd09') {
10116
+ return gcj02ToBd09(lng, lat);
10117
+ } else if (fromType === 'bd09' && toType === 'wgs84') {
10118
+ const gcj = bd09ToGcj02(lng, lat);
10119
+ return gcj02ToWgs84(gcj.lng, gcj.lat);
10120
+ } else if (fromType === 'bd09' && toType === 'gcj02') {
10121
+ return bd09ToGcj02(lng, lat);
10122
+ }
10123
+
10124
+ return { lng, lat };
10125
+ }
10126
+
10127
+ // ---------- 核心转换算法 ----------
10128
+
10129
+ // WGS84转GCJ-02
10130
+ function wgs84ToGcj02(lng, lat) {
10131
+ const PI = 3.1415926535897932384626;
10132
+ const a = 6378245.0; // 长半轴
10133
+ const ee = 0.00669342162296594323; // 扁率
10134
+
10135
+ if (outOfChina(lng, lat)) {
10136
+ return { lng, lat };
10137
+ }
10138
+
10139
+ let dlat = transformLat(lng - 105.0, lat - 35.0);
10140
+ let dlng = transformLng(lng - 105.0, lat - 35.0);
10141
+
10142
+ const radlat = lat / 180.0 * PI;
10143
+ let magic = Math.sin(radlat);
10144
+ magic = 1 - ee * magic * magic;
10145
+ const sqrtmagic = Math.sqrt(magic);
10146
+
10147
+ dlat = (dlat * 180.0) / ((a * (1 - ee)) / (magic * sqrtmagic) * PI);
10148
+ dlng = (dlng * 180.0) / (a / sqrtmagic * Math.cos(radlat) * PI);
10149
+
10150
+ const mglat = lat + dlat;
10151
+ const mglng = lng + dlng;
10152
+
10153
+ return { lng: mglng, lat: mglat };
10154
+ }
10155
+
10156
+ // GCJ-02转WGS84
10157
+ function gcj02ToWgs84(lng, lat) {
10158
+ const gps = wgs84ToGcj02(lng, lat);
10159
+ const dlng = lng - gps.lng;
10160
+ const dlat = lat - gps.lat;
10161
+ return { lng: lng - dlng, lat: lat - dlat };
10162
+ }
10163
+
10164
+ // GCJ-02转BD-09
10165
+ function gcj02ToBd09(lng, lat) {
10166
+ const z = Math.sqrt(lng * lng + lat * lat) + 0.00002 * Math.sin(lat * Math.PI * 3000.0 / 180.0);
10167
+ const theta = Math.atan2(lat, lng) + 0.000003 * Math.cos(lng * Math.PI * 3000.0 / 180.0);
10168
+ const bd_lng = z * Math.cos(theta) + 0.0065;
10169
+ const bd_lat = z * Math.sin(theta) + 0.006;
10170
+ return { lng: bd_lng, lat: bd_lat };
10171
+ }
10172
+
10173
+ // BD-09转GCJ-02
10174
+ function bd09ToGcj02(lng, lat) {
10175
+ const x = lng - 0.0065;
10176
+ const y = lat - 0.006;
10177
+ const z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * Math.PI * 3000.0 / 180.0);
10178
+ const theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * Math.PI * 3000.0 / 180.0);
10179
+ const gcj_lng = z * Math.cos(theta);
10180
+ const gcj_lat = z * Math.sin(theta);
10181
+ return { lng: gcj_lng, lat: gcj_lat };
10182
+ }
10183
+
10184
+ // 判断是否在中国境外
10185
+ function outOfChina(lng, lat) {
10186
+ return lng < 72.004 || lng > 137.8347 || lat < 0.8293 || lat > 55.8271;
10187
+ }
10188
+
10189
+ // 纬度转换
10190
+ function transformLat(lng, lat) {
10191
+ let ret = -100 + 2.0 * lng + 3.0 * lat + 0.2 * lat * lat + 0.1 * lng * lat + 0.2 * Math.sqrt(Math.abs(lng));
10192
+ ret += (20.0 * Math.sin(6.0 * lng * Math.PI) + 20.0 * Math.sin(2.0 * lng * Math.PI)) * 2.0 / 3.0;
10193
+ ret += (20.0 * Math.sin(lat * Math.PI) + 40.0 * Math.sin(lat / 3.0 * Math.PI)) * 2.0 / 3.0;
10194
+ ret += (160.0 * Math.sin(lat / 12.0 * Math.PI) + 320 * Math.sin(lat * Math.PI / 30.0)) * 2.0 / 3.0;
10195
+ return ret;
10196
+ }
10197
+
10198
+ // 经度转换
10199
+ function transformLng(lng, lat) {
10200
+ let ret = 300.0 + lng + 2.0 * lat + 0.1 * lng * lng + 0.1 * lng * lat + 0.1 * Math.sqrt(Math.abs(lng));
10201
+ ret += (20.0 * Math.sin(6.0 * lng * Math.PI) + 20.0 * Math.sin(2.0 * lng * Math.PI)) * 2.0 / 3.0;
10202
+ ret += (20.0 * Math.sin(lng * Math.PI) + 40.0 * Math.sin(lng / 3.0 * Math.PI)) * 2.0 / 3.0;
10203
+ ret += (150.0 * Math.sin(lng / 12.0 * Math.PI) + 300.0 * Math.sin(lng / 30.0 * Math.PI)) * 2.0 / 3.0;
10204
+ return ret;
10205
+ }
10206
+
10207
+ var CoordinateConverter = /*#__PURE__*/Object.freeze({
10208
+ __proto__: null,
10209
+ convertCoordinate: convertCoordinate
10210
+ });
10211
+
10212
+ export { CoordinateConverter, CustomOptionsControl, CustomSearchSelectControl, CustomToggleControl, DrawCacheFeatureManager, RainteeConstants, RainteeGISUtil, RainteeSourceMapTool, RasterLayerControl, RulerControl, TerrainToggleControl, useDrawCache };
10097
10213
  //# sourceMappingURL=index.js.map