@mint-ui/map 0.5.3-beta → 0.5.5-beta
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/components/mint-map/core/advanced/MapBuildingProjection.js +2 -2
- package/dist/components/mint-map/core/advanced/shapes/CircleMarker.js +3 -2
- package/dist/components/mint-map/core/advanced/shapes/PolygonMarker.js +36 -46
- package/dist/components/mint-map/core/advanced/shapes/base/SVGPolygon.js +5 -5
- package/dist/components/mint-map/core/hooks/MarkerMovingHook.js +2 -2
- package/dist/components/mint-map/core/util/{calculate.d.ts → geo.d.ts} +0 -28
- package/dist/components/mint-map/core/util/geo.js +159 -0
- package/dist/components/mint-map/core/util/index.d.ts +2 -1
- package/dist/components/mint-map/core/util/polygon.d.ts +40 -0
- package/dist/components/mint-map/core/util/{calculate.js → polygon.js} +13 -159
- package/dist/components/mint-map/core/wrapper/MapCanvasWrapper.js +2 -2
- package/dist/components/mint-map/google/GoogleMintMapController.js +1 -1
- package/dist/components/mint-map/kakao/KakaoMintMapController.js +1 -1
- package/dist/components/mint-map/naver/NaverMintMapController.d.ts +2 -1
- package/dist/components/mint-map/naver/NaverMintMapController.js +10 -1
- package/dist/components/mint-map/types/MapDrawables.js +2 -2
- package/dist/components/mint-map/types/MapTypes.js +2 -2
- package/dist/index.es.js +215 -211
- package/dist/index.js +4 -3
- package/dist/index.umd.js +215 -211
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -14,6 +14,160 @@
|
|
|
14
14
|
var styles$2 = {"loading-point-container":"MintMap-module_loading-point-container__znk6l","ani-blink":"MintMap-module_ani-blink__K89JK","blink":"MintMap-module_blink__mqfeV","ani-fade-in":"MintMap-module_ani-fade-in__lpHuy","fade-in":"MintMap-module_fade-in__jHpv1","ani-fade-out":"MintMap-module_ani-fade-out__5-esw","fade-out":"MintMap-module_fade-out__CIjGe","ani-expansion":"MintMap-module_ani-expansion__S2vOZ","expansion":"MintMap-module_expansion__WMo5-"};
|
|
15
15
|
styleInject__default["default"](css_248z$2);
|
|
16
16
|
|
|
17
|
+
var PositionMirror$1 =
|
|
18
|
+
/** @class */
|
|
19
|
+
function () {
|
|
20
|
+
function PositionMirror(lat, lng) {
|
|
21
|
+
this.lat = lat;
|
|
22
|
+
this.lng = lng;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return PositionMirror;
|
|
26
|
+
}();
|
|
27
|
+
|
|
28
|
+
var GeoCalulator =
|
|
29
|
+
/** @class */
|
|
30
|
+
function () {
|
|
31
|
+
function GeoCalulator() {}
|
|
32
|
+
|
|
33
|
+
GeoCalulator.computeDistanceKiloMeter = function (pos1, pos2) {
|
|
34
|
+
var dLat = this.deg2rad(pos2.lat - pos1.lat);
|
|
35
|
+
var dLon = this.deg2rad(pos2.lng - pos1.lng);
|
|
36
|
+
var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.cos(this.deg2rad(pos1.lat)) * Math.cos(this.deg2rad(pos2.lat)) * Math.sin(dLon / 2) * Math.sin(dLon / 2);
|
|
37
|
+
var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
|
|
38
|
+
var d = this.EARTH_EQUATORIAL_RADIUS_KM * c; // Distance in km
|
|
39
|
+
|
|
40
|
+
return d;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
GeoCalulator.deg2rad = function (deg) {
|
|
44
|
+
return deg * (Math.PI / 180);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
GeoCalulator.convertMeterToLatitudeValue = function (meter) {
|
|
48
|
+
return meter * this.LATITUDE_POSITION_VALUE_PER_METER;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
GeoCalulator.convertLatitudeToMeterValue = function (lat) {
|
|
52
|
+
return lat * this.METER_VALUE_PER_LATITUDE;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
GeoCalulator.convertLongitudeToMeterValue = function (lat, lng) {
|
|
56
|
+
return lng * this.calculateLongitudeValueWithLatitudeInMeter(lat);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
GeoCalulator.getCacheUnitOfLongitudeValueWithLatitudeInMeter = function (lat) {
|
|
60
|
+
return lat.toFixed(2);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
GeoCalulator.getCacheOfLongitudeValueWithLatitudeInMeter = function (latUnit) {
|
|
64
|
+
return this.CACHE_OF_LNG_PER_METER.get(latUnit);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
GeoCalulator.setCacheOfLongitudeValueWithLatitudeInMeter = function (latUnit, lngValue) {
|
|
68
|
+
if (this.CACHE_OF_LNG_PER_METER.size > 10) {
|
|
69
|
+
this.CACHE_OF_LNG_PER_METER.clear();
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
this.CACHE_OF_LNG_PER_METER.set(latUnit, lngValue);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
GeoCalulator.calculateLongitudeValueWithLatitudeInMeter = function (lat) {
|
|
76
|
+
// const t = Date.now()
|
|
77
|
+
// Cache check
|
|
78
|
+
var latUnit = this.getCacheUnitOfLongitudeValueWithLatitudeInMeter(lat);
|
|
79
|
+
var fromCache = this.getCacheOfLongitudeValueWithLatitudeInMeter(latUnit);
|
|
80
|
+
|
|
81
|
+
if (fromCache !== undefined) {
|
|
82
|
+
// console.log(`cache hit!! ${Date.now() - t} ms`, fromCache, latUnit, this.CACHE_OF_LNG_PER_METER.size);
|
|
83
|
+
return fromCache;
|
|
84
|
+
} // Convert latitude and longitude to radians
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
var latRad = lat * Math.PI / 180; // Calculate Earth's radius at the given latitude
|
|
88
|
+
|
|
89
|
+
var radius = this.EARTH_EQUATORIAL_RADIUS * Math.sqrt(1 - Math.pow(this.EARTH_ECCENTRICITY * Math.sin(latRad), 2)); // Calculate the length of one degree of longitude in meters
|
|
90
|
+
|
|
91
|
+
var distance = 2 * Math.PI * radius * Math.cos(latRad) / 360; // Cache set
|
|
92
|
+
|
|
93
|
+
this.setCacheOfLongitudeValueWithLatitudeInMeter(latUnit, distance); // console.log(`calculated ${Date.now() - t} ms`)
|
|
94
|
+
|
|
95
|
+
return distance;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
GeoCalulator.computeNextPositionAndDistances = function (context) {
|
|
99
|
+
var pos1 = context.pos1,
|
|
100
|
+
pos2 = context.pos2,
|
|
101
|
+
prevPos2 = context.prevPos2,
|
|
102
|
+
velocityKmh = context.velocityKmh,
|
|
103
|
+
prevVelocityKmh = context.prevVelocityKmh,
|
|
104
|
+
elapsedTimeMs = context.elapsedTimeMs; // console.log('velocityKmh / elapsedTimeMs',velocityKmh , elapsedTimeMs);
|
|
105
|
+
//총 가야할 거리 (km)
|
|
106
|
+
|
|
107
|
+
if (pos2 !== prevPos2) {
|
|
108
|
+
//목표가 바뀌면 거리 및 비율 재계산
|
|
109
|
+
context.totalDistance = this.computeDistanceKiloMeter(pos1, pos2);
|
|
110
|
+
context.currDistance = 0;
|
|
111
|
+
context.prevPos2 = pos2;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
var totalDistance = context.totalDistance; // console.log('totalDistance', totalDistance);
|
|
115
|
+
//ms 속으로 환산
|
|
116
|
+
|
|
117
|
+
if (velocityKmh !== prevVelocityKmh) {
|
|
118
|
+
//속도가 바뀌면 재계산
|
|
119
|
+
context.vPerMs = velocityKmh / this.MS_FROM_HOUR;
|
|
120
|
+
context.prevVelocityKmh = velocityKmh;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
var vPerMs = context.vPerMs; //console.log('vPerMs', vPerMs);
|
|
124
|
+
//실제 가는 거리 계산
|
|
125
|
+
|
|
126
|
+
var nextDistance = context.distanceRemain ? context.distanceRemain : context.currDistance + elapsedTimeMs * vPerMs; //console.log('nextDistance', nextDistance);
|
|
127
|
+
//목표점까지 이동 후에도 남는 거리
|
|
128
|
+
|
|
129
|
+
context.currDistance = nextDistance;
|
|
130
|
+
|
|
131
|
+
if (totalDistance < context.currDistance) {
|
|
132
|
+
//이동 거리가 현재 목표점을 넘어가는 경우
|
|
133
|
+
context.distanceRemain = context.currDistance - totalDistance;
|
|
134
|
+
context.nextPos = pos2;
|
|
135
|
+
return context;
|
|
136
|
+
} else {
|
|
137
|
+
context.distanceRemain = 0;
|
|
138
|
+
} //각 축으로 나가야할 비율
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
var ratio = nextDistance / totalDistance; //console.log('ratio', ratio);
|
|
142
|
+
//방향값 체크
|
|
143
|
+
|
|
144
|
+
var latCalib = pos2.lat > pos1.lat ? 1 : -1;
|
|
145
|
+
var lngCalib = pos2.lng > pos1.lng ? 1 : -1; //각 축에 보정된 새로운 지점 리턴
|
|
146
|
+
|
|
147
|
+
var newPos = new PositionMirror$1(pos1.lat + (pos2.lat - pos1.lat) * ratio, pos1.lng + (pos2.lng - pos1.lng) * ratio);
|
|
148
|
+
|
|
149
|
+
if ((latCalib === 1 && pos2.lat <= newPos.lat || latCalib === -1 && pos2.lat >= newPos.lat) && (lngCalib === 1 && pos2.lng <= newPos.lng || lngCalib === -1 && pos2.lng >= newPos.lng)) {
|
|
150
|
+
newPos = pos2;
|
|
151
|
+
} // console.log('newPos', newPos);
|
|
152
|
+
//console.log('==============================================================\n');
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
context.nextPos = newPos;
|
|
156
|
+
return context;
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
GeoCalulator.EARTH_EQUATORIAL_RADIUS = 6378137; //meter (6,378,137 m)
|
|
160
|
+
|
|
161
|
+
GeoCalulator.EARTH_EQUATORIAL_RADIUS_KM = GeoCalulator.EARTH_EQUATORIAL_RADIUS / 1000;
|
|
162
|
+
GeoCalulator.EARTH_ECCENTRICITY = 0.08181919;
|
|
163
|
+
GeoCalulator.METER_VALUE_PER_LATITUDE = 110.32 * 1000; //위도 기준 1도는 110.32km
|
|
164
|
+
|
|
165
|
+
GeoCalulator.LATITUDE_POSITION_VALUE_PER_METER = 1 / GeoCalulator.METER_VALUE_PER_LATITUDE;
|
|
166
|
+
GeoCalulator.CACHE_OF_LNG_PER_METER = new Map();
|
|
167
|
+
GeoCalulator.MS_FROM_HOUR = 60 * 60 * 1000;
|
|
168
|
+
return GeoCalulator;
|
|
169
|
+
}();
|
|
170
|
+
|
|
17
171
|
var LinePoints =
|
|
18
172
|
/** @class */
|
|
19
173
|
function () {
|
|
@@ -213,11 +367,7 @@
|
|
|
213
367
|
|
|
214
368
|
PolygonCalculator.simplifyPoints = function (polygon, tolerance, lastRepeated) {
|
|
215
369
|
var target = lastRepeated ? polygon.slice(0, polygon.length - 1) : polygon;
|
|
216
|
-
return this.simplify(target.
|
|
217
|
-
return [position.lng, position.lat];
|
|
218
|
-
}), tolerance !== undefined ? tolerance : this.TOLERANCE_NAVER_STYLE).map(function (point) {
|
|
219
|
-
return new PositionMirror(point[1], point[0]);
|
|
220
|
-
});
|
|
370
|
+
return this.simplify(target, tolerance !== undefined ? tolerance : this.TOLERANCE_NAVER_STYLE);
|
|
221
371
|
};
|
|
222
372
|
|
|
223
373
|
PolygonCalculator.simplify = function (points, tolerance) {
|
|
@@ -251,12 +401,12 @@
|
|
|
251
401
|
|
|
252
402
|
|
|
253
403
|
PolygonCalculator.perpendicularDistance = function (point, lineStart, lineEnd) {
|
|
254
|
-
var x = point
|
|
255
|
-
var y = point
|
|
256
|
-
var x1 = lineStart
|
|
257
|
-
var y1 = lineStart
|
|
258
|
-
var x2 = lineEnd
|
|
259
|
-
var y2 = lineEnd
|
|
404
|
+
var x = point.x;
|
|
405
|
+
var y = point.y;
|
|
406
|
+
var x1 = lineStart.x;
|
|
407
|
+
var y1 = lineStart.y;
|
|
408
|
+
var x2 = lineEnd.x;
|
|
409
|
+
var y2 = lineEnd.y;
|
|
260
410
|
var numerator = Math.abs((y2 - y1) * x - (x2 - x1) * y + x2 * y1 - y2 * x1);
|
|
261
411
|
var denominator = Math.sqrt(Math.pow(y2 - y1, 2) + Math.pow(x2 - x1, 2));
|
|
262
412
|
return numerator / denominator;
|
|
@@ -293,154 +443,11 @@
|
|
|
293
443
|
return area;
|
|
294
444
|
};
|
|
295
445
|
|
|
296
|
-
PolygonCalculator.TOLERANCE_NAVER_STYLE =
|
|
297
|
-
PolygonCalculator.TOLERANCE_GOOGLE_STYLE =
|
|
446
|
+
PolygonCalculator.TOLERANCE_NAVER_STYLE = 1;
|
|
447
|
+
PolygonCalculator.TOLERANCE_GOOGLE_STYLE = 1;
|
|
298
448
|
return PolygonCalculator;
|
|
299
449
|
}();
|
|
300
450
|
|
|
301
|
-
var GeoCalulator =
|
|
302
|
-
/** @class */
|
|
303
|
-
function () {
|
|
304
|
-
function GeoCalulator() {}
|
|
305
|
-
|
|
306
|
-
GeoCalulator.computeDistanceKiloMeter = function (pos1, pos2) {
|
|
307
|
-
var dLat = this.deg2rad(pos2.lat - pos1.lat);
|
|
308
|
-
var dLon = this.deg2rad(pos2.lng - pos1.lng);
|
|
309
|
-
var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.cos(this.deg2rad(pos1.lat)) * Math.cos(this.deg2rad(pos2.lat)) * Math.sin(dLon / 2) * Math.sin(dLon / 2);
|
|
310
|
-
var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
|
|
311
|
-
var d = this.EARTH_EQUATORIAL_RADIUS_KM * c; // Distance in km
|
|
312
|
-
|
|
313
|
-
return d;
|
|
314
|
-
};
|
|
315
|
-
|
|
316
|
-
GeoCalulator.deg2rad = function (deg) {
|
|
317
|
-
return deg * (Math.PI / 180);
|
|
318
|
-
};
|
|
319
|
-
|
|
320
|
-
GeoCalulator.convertMeterToLatitudeValue = function (meter) {
|
|
321
|
-
return meter * this.LATITUDE_POSITION_VALUE_PER_METER;
|
|
322
|
-
};
|
|
323
|
-
|
|
324
|
-
GeoCalulator.convertLatitudeToMeterValue = function (lat) {
|
|
325
|
-
return lat * this.METER_VALUE_PER_LATITUDE;
|
|
326
|
-
};
|
|
327
|
-
|
|
328
|
-
GeoCalulator.convertLongitudeToMeterValue = function (lat, lng) {
|
|
329
|
-
return lng * this.calculateLongitudeValueWithLatitudeInMeter(lat);
|
|
330
|
-
};
|
|
331
|
-
|
|
332
|
-
GeoCalulator.getCacheUnitOfLongitudeValueWithLatitudeInMeter = function (lat) {
|
|
333
|
-
return lat.toFixed(2);
|
|
334
|
-
};
|
|
335
|
-
|
|
336
|
-
GeoCalulator.getCacheOfLongitudeValueWithLatitudeInMeter = function (latUnit) {
|
|
337
|
-
return this.CACHE_OF_LNG_PER_METER.get(latUnit);
|
|
338
|
-
};
|
|
339
|
-
|
|
340
|
-
GeoCalulator.setCacheOfLongitudeValueWithLatitudeInMeter = function (latUnit, lngValue) {
|
|
341
|
-
if (this.CACHE_OF_LNG_PER_METER.size > 10) {
|
|
342
|
-
this.CACHE_OF_LNG_PER_METER.clear();
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
this.CACHE_OF_LNG_PER_METER.set(latUnit, lngValue);
|
|
346
|
-
};
|
|
347
|
-
|
|
348
|
-
GeoCalulator.calculateLongitudeValueWithLatitudeInMeter = function (lat) {
|
|
349
|
-
// const t = Date.now()
|
|
350
|
-
// Cache check
|
|
351
|
-
var latUnit = this.getCacheUnitOfLongitudeValueWithLatitudeInMeter(lat);
|
|
352
|
-
var fromCache = this.getCacheOfLongitudeValueWithLatitudeInMeter(latUnit);
|
|
353
|
-
|
|
354
|
-
if (fromCache !== undefined) {
|
|
355
|
-
// console.log(`cache hit!! ${Date.now() - t} ms`, fromCache, latUnit, this.CACHE_OF_LNG_PER_METER.size);
|
|
356
|
-
return fromCache;
|
|
357
|
-
} // Convert latitude and longitude to radians
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
var latRad = lat * Math.PI / 180; // Calculate Earth's radius at the given latitude
|
|
361
|
-
|
|
362
|
-
var radius = this.EARTH_EQUATORIAL_RADIUS * Math.sqrt(1 - Math.pow(this.EARTH_ECCENTRICITY * Math.sin(latRad), 2)); // Calculate the length of one degree of longitude in meters
|
|
363
|
-
|
|
364
|
-
var distance = 2 * Math.PI * radius * Math.cos(latRad) / 360; // Cache set
|
|
365
|
-
|
|
366
|
-
this.setCacheOfLongitudeValueWithLatitudeInMeter(latUnit, distance); // console.log(`calculated ${Date.now() - t} ms`)
|
|
367
|
-
|
|
368
|
-
return distance;
|
|
369
|
-
};
|
|
370
|
-
|
|
371
|
-
GeoCalulator.computeNextPositionAndDistances = function (context) {
|
|
372
|
-
var pos1 = context.pos1,
|
|
373
|
-
pos2 = context.pos2,
|
|
374
|
-
prevPos2 = context.prevPos2,
|
|
375
|
-
velocityKmh = context.velocityKmh,
|
|
376
|
-
prevVelocityKmh = context.prevVelocityKmh,
|
|
377
|
-
elapsedTimeMs = context.elapsedTimeMs; // console.log('velocityKmh / elapsedTimeMs',velocityKmh , elapsedTimeMs);
|
|
378
|
-
//총 가야할 거리 (km)
|
|
379
|
-
|
|
380
|
-
if (pos2 !== prevPos2) {
|
|
381
|
-
//목표가 바뀌면 거리 및 비율 재계산
|
|
382
|
-
context.totalDistance = this.computeDistanceKiloMeter(pos1, pos2);
|
|
383
|
-
context.currDistance = 0;
|
|
384
|
-
context.prevPos2 = pos2;
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
var totalDistance = context.totalDistance; // console.log('totalDistance', totalDistance);
|
|
388
|
-
//ms 속으로 환산
|
|
389
|
-
|
|
390
|
-
if (velocityKmh !== prevVelocityKmh) {
|
|
391
|
-
//속도가 바뀌면 재계산
|
|
392
|
-
context.vPerMs = velocityKmh / this.MS_FROM_HOUR;
|
|
393
|
-
context.prevVelocityKmh = velocityKmh;
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
var vPerMs = context.vPerMs; //console.log('vPerMs', vPerMs);
|
|
397
|
-
//실제 가는 거리 계산
|
|
398
|
-
|
|
399
|
-
var nextDistance = context.distanceRemain ? context.distanceRemain : context.currDistance + elapsedTimeMs * vPerMs; //console.log('nextDistance', nextDistance);
|
|
400
|
-
//목표점까지 이동 후에도 남는 거리
|
|
401
|
-
|
|
402
|
-
context.currDistance = nextDistance;
|
|
403
|
-
|
|
404
|
-
if (totalDistance < context.currDistance) {
|
|
405
|
-
//이동 거리가 현재 목표점을 넘어가는 경우
|
|
406
|
-
context.distanceRemain = context.currDistance - totalDistance;
|
|
407
|
-
context.nextPos = pos2;
|
|
408
|
-
return context;
|
|
409
|
-
} else {
|
|
410
|
-
context.distanceRemain = 0;
|
|
411
|
-
} //각 축으로 나가야할 비율
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
var ratio = nextDistance / totalDistance; //console.log('ratio', ratio);
|
|
415
|
-
//방향값 체크
|
|
416
|
-
|
|
417
|
-
var latCalib = pos2.lat > pos1.lat ? 1 : -1;
|
|
418
|
-
var lngCalib = pos2.lng > pos1.lng ? 1 : -1; //각 축에 보정된 새로운 지점 리턴
|
|
419
|
-
|
|
420
|
-
var newPos = new PositionMirror(pos1.lat + (pos2.lat - pos1.lat) * ratio, pos1.lng + (pos2.lng - pos1.lng) * ratio);
|
|
421
|
-
|
|
422
|
-
if ((latCalib === 1 && pos2.lat <= newPos.lat || latCalib === -1 && pos2.lat >= newPos.lat) && (lngCalib === 1 && pos2.lng <= newPos.lng || lngCalib === -1 && pos2.lng >= newPos.lng)) {
|
|
423
|
-
newPos = pos2;
|
|
424
|
-
} // console.log('newPos', newPos);
|
|
425
|
-
//console.log('==============================================================\n');
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
context.nextPos = newPos;
|
|
429
|
-
return context;
|
|
430
|
-
};
|
|
431
|
-
|
|
432
|
-
GeoCalulator.EARTH_EQUATORIAL_RADIUS = 6378137; //meter (6,378,137 m)
|
|
433
|
-
|
|
434
|
-
GeoCalulator.EARTH_EQUATORIAL_RADIUS_KM = GeoCalulator.EARTH_EQUATORIAL_RADIUS / 1000;
|
|
435
|
-
GeoCalulator.EARTH_ECCENTRICITY = 0.08181919;
|
|
436
|
-
GeoCalulator.METER_VALUE_PER_LATITUDE = 110.32 * 1000; //위도 기준 1도는 110.32km
|
|
437
|
-
|
|
438
|
-
GeoCalulator.LATITUDE_POSITION_VALUE_PER_METER = 1 / GeoCalulator.METER_VALUE_PER_LATITUDE;
|
|
439
|
-
GeoCalulator.CACHE_OF_LNG_PER_METER = new Map();
|
|
440
|
-
GeoCalulator.MS_FROM_HOUR = 60 * 60 * 1000;
|
|
441
|
-
return GeoCalulator;
|
|
442
|
-
}();
|
|
443
|
-
|
|
444
451
|
/**
|
|
445
452
|
* 좌표값
|
|
446
453
|
* @description 위도/경도, DOM 상의 X/Y 좌표
|
|
@@ -1614,7 +1621,7 @@
|
|
|
1614
1621
|
case 2:
|
|
1615
1622
|
options = {
|
|
1616
1623
|
center: (_a = this.mapProps.base) === null || _a === void 0 ? void 0 : _a.center,
|
|
1617
|
-
zoom: (_b = this.mapProps.base) === null || _b === void 0 ? void 0 : _b.zoomLevel,
|
|
1624
|
+
zoom: ((_b = this.mapProps.base) === null || _b === void 0 ? void 0 : _b.zoomLevel) || this.getBaseToMapZoom(15),
|
|
1618
1625
|
draggable: this.mapProps.draggable === false ? false : true,
|
|
1619
1626
|
scrollWheel: this.mapProps.draggable === false ? false : true,
|
|
1620
1627
|
keyboardShortcuts: this.mapProps.keyboardShortcuts === false ? false : true,
|
|
@@ -1765,6 +1772,15 @@
|
|
|
1765
1772
|
(_a = this.map) === null || _a === void 0 ? void 0 : _a.setCenter(position);
|
|
1766
1773
|
};
|
|
1767
1774
|
|
|
1775
|
+
NaverMintMapController.prototype.naverPositionToOffset = function (position) {
|
|
1776
|
+
if (!this.map) {
|
|
1777
|
+
return new Offset(0, 0);
|
|
1778
|
+
}
|
|
1779
|
+
|
|
1780
|
+
var offset = this.map.getProjection().fromCoordToOffset(new naver.maps.LatLng(position.lat, position.lng));
|
|
1781
|
+
return new Offset(offset.x, offset.y);
|
|
1782
|
+
};
|
|
1783
|
+
|
|
1768
1784
|
NaverMintMapController.prototype.addEventListener = function (eventName, callback) {
|
|
1769
1785
|
var _this = this;
|
|
1770
1786
|
|
|
@@ -2313,7 +2329,7 @@
|
|
|
2313
2329
|
center: (_a = this.mapProps.base) === null || _a === void 0 ? void 0 : _a.center,
|
|
2314
2330
|
maxZoom: (_b = this.mapProps.base) === null || _b === void 0 ? void 0 : _b.maxZoomLevel,
|
|
2315
2331
|
minZoom: (_c = this.mapProps.base) === null || _c === void 0 ? void 0 : _c.minZoomLevel,
|
|
2316
|
-
zoom: (_d = this.mapProps.base) === null || _d === void 0 ? void 0 : _d.zoomLevel,
|
|
2332
|
+
zoom: ((_d = this.mapProps.base) === null || _d === void 0 ? void 0 : _d.zoomLevel) || this.getBaseToMapZoom(15),
|
|
2317
2333
|
disableDefaultUI: true,
|
|
2318
2334
|
gestureHandling: this.mapProps.draggable === false ? 'none' : 'greedy',
|
|
2319
2335
|
keyboardShortcuts: this.mapProps.keyboardShortcuts === false ? false : true,
|
|
@@ -2974,7 +2990,7 @@
|
|
|
2974
2990
|
case 2:
|
|
2975
2991
|
options = {
|
|
2976
2992
|
center: this.positionToLatLng((_a = this.mapProps.base) === null || _a === void 0 ? void 0 : _a.center),
|
|
2977
|
-
level: this.getBaseToMapZoom(((_b = this.mapProps.base) === null || _b === void 0 ? void 0 : _b.zoomLevel) ||
|
|
2993
|
+
level: this.getBaseToMapZoom(((_b = this.mapProps.base) === null || _b === void 0 ? void 0 : _b.zoomLevel) || 15),
|
|
2978
2994
|
draggable: this.mapProps.draggable === false ? false : true,
|
|
2979
2995
|
scrollWheel: this.mapProps.draggable === false ? false : true,
|
|
2980
2996
|
keyboardShortcuts: this.mapProps.keyboardShortcuts === false ? false : true
|
|
@@ -3452,10 +3468,10 @@
|
|
|
3452
3468
|
var width = maxX - minX;
|
|
3453
3469
|
var height = maxY - minY;
|
|
3454
3470
|
return {
|
|
3455
|
-
containerLeft:
|
|
3456
|
-
containerTop:
|
|
3457
|
-
containerWidth:
|
|
3458
|
-
containerHeight:
|
|
3471
|
+
containerLeft: minX,
|
|
3472
|
+
containerTop: minY,
|
|
3473
|
+
containerWidth: width,
|
|
3474
|
+
containerHeight: height
|
|
3459
3475
|
};
|
|
3460
3476
|
}, []);
|
|
3461
3477
|
var getD = React.useCallback(function (_a) {
|
|
@@ -3529,7 +3545,7 @@
|
|
|
3529
3545
|
height: height,
|
|
3530
3546
|
fill: mode === 'POLYLINE' ? 'none' : background,
|
|
3531
3547
|
stroke: mode === 'POLYLINE' ? 'black' : 'green',
|
|
3532
|
-
strokeLinejoin: "
|
|
3548
|
+
strokeLinejoin: "miter",
|
|
3533
3549
|
strokeLinecap: "butt",
|
|
3534
3550
|
d: d
|
|
3535
3551
|
}, shapeProperties))), React__default["default"].createElement("div", {
|
|
@@ -4376,11 +4392,9 @@
|
|
|
4376
4392
|
|
|
4377
4393
|
var _l = React.useState([]),
|
|
4378
4394
|
innerOffsets = _l[0],
|
|
4379
|
-
setInnerOffsets = _l[1]; //
|
|
4395
|
+
setInnerOffsets = _l[1]; //polygon props ref
|
|
4380
4396
|
|
|
4381
4397
|
|
|
4382
|
-
var offsetCache = React.useRef(new Map()); //polygon props ref
|
|
4383
|
-
|
|
4384
4398
|
var polygonPropsRef = React.useRef({
|
|
4385
4399
|
position: position,
|
|
4386
4400
|
innerPositions: innerPositions,
|
|
@@ -4391,7 +4405,6 @@
|
|
|
4391
4405
|
|
|
4392
4406
|
React.useEffect(function () {
|
|
4393
4407
|
// console.log('polygon changed');
|
|
4394
|
-
offsetCache.current.clear();
|
|
4395
4408
|
polygonPropsRef.current = {
|
|
4396
4409
|
position: position,
|
|
4397
4410
|
innerPositions: innerPositions,
|
|
@@ -4413,53 +4426,44 @@
|
|
|
4413
4426
|
innerPositions = _a.innerPositions,
|
|
4414
4427
|
simplifyPath = _a.simplifyPath,
|
|
4415
4428
|
simplifyTolerance = _a.simplifyTolerance,
|
|
4416
|
-
lastReapeated = _a.lastReapeated;
|
|
4417
|
-
var prevCache = offsetCache.current.get(zoomLevel.current);
|
|
4418
|
-
|
|
4419
|
-
if (prevCache) {
|
|
4420
|
-
var offsets_1 = [];
|
|
4421
|
-
offsets_1.push.apply(offsets_1, prevCache.offsets);
|
|
4422
|
-
setOffsets(offsets_1);
|
|
4423
|
-
var innerOffsets_1 = [];
|
|
4424
|
-
innerOffsets_1.push.apply(innerOffsets_1, prevCache.innerOffsets);
|
|
4425
|
-
setInnerOffsets(innerOffsets_1);
|
|
4426
|
-
setPolygonStart(prevCache.start);
|
|
4427
|
-
} else {
|
|
4428
|
-
// path
|
|
4429
|
-
var simplified = simplifyPath ? PolygonCalculator.simplifyPoints(position, simplifyTolerance, lastReapeated) : position;
|
|
4430
|
-
var offsets_2 = simplified.map(function (pos) {
|
|
4431
|
-
var off = controller.positionToOffset(pos);
|
|
4432
|
-
return new Offset(Math.floor(off.x), Math.floor(off.y));
|
|
4433
|
-
});
|
|
4434
|
-
setOffsets(offsets_2); //inner path
|
|
4429
|
+
lastReapeated = _a.lastReapeated; // path
|
|
4435
4430
|
|
|
4436
|
-
|
|
4431
|
+
var maxLat = undefined;
|
|
4432
|
+
var minLng = undefined;
|
|
4433
|
+
var offsets = position.map(function (pos) {
|
|
4434
|
+
if (maxLat === undefined || maxLat < pos.lat) {
|
|
4435
|
+
maxLat = pos.lat;
|
|
4436
|
+
}
|
|
4437
4437
|
|
|
4438
|
-
if (
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
var simplified_1 = simplifyPath ? PolygonCalculator.simplifyPoints(innerPosition, simplifyTolerance, lastReapeated) : innerPosition;
|
|
4442
|
-
var offsets_3 = simplified_1.map(function (pos) {
|
|
4443
|
-
var off = controller.positionToOffset(pos);
|
|
4444
|
-
return new Offset(Math.floor(off.x), Math.floor(off.y));
|
|
4445
|
-
});
|
|
4446
|
-
innerPath.push(offsets_3);
|
|
4447
|
-
}
|
|
4438
|
+
if (minLng === undefined || minLng > pos.lng) {
|
|
4439
|
+
minLng = pos.lng;
|
|
4440
|
+
} //offset 계산 정확도를 위해 네이버 맵은 전용 projection 베이스의 function 을 사용한다.
|
|
4448
4441
|
|
|
4449
|
-
setInnerOffsets(innerPath);
|
|
4450
|
-
} //start point
|
|
4451
4442
|
|
|
4443
|
+
return controller instanceof NaverMintMapController ? controller.naverPositionToOffset(pos) : controller.positionToOffset(pos);
|
|
4444
|
+
});
|
|
4445
|
+
var simplified = simplifyPath ? PolygonCalculator.simplifyPoints(offsets, simplifyTolerance, lastReapeated) : offsets;
|
|
4446
|
+
setOffsets(simplified); //inner path
|
|
4452
4447
|
|
|
4453
|
-
|
|
4454
|
-
var startPosition = regionInfo.maxLat && regionInfo.minLng ? new Position(regionInfo.maxLat, regionInfo.minLng) : undefined;
|
|
4455
|
-
setPolygonStart(startPosition); //cache set
|
|
4448
|
+
var innerPath = [];
|
|
4456
4449
|
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4450
|
+
if (innerPositions) {
|
|
4451
|
+
for (var _i = 0, innerPositions_1 = innerPositions; _i < innerPositions_1.length; _i++) {
|
|
4452
|
+
var innerPosition = innerPositions_1[_i];
|
|
4453
|
+
var offsets_1 = innerPosition.map(function (pos) {
|
|
4454
|
+
//offset 계산 정확도를 위해 네이버 맵은 전용 projection 베이스의 function 을 사용한다.
|
|
4455
|
+
return controller instanceof NaverMintMapController ? controller.naverPositionToOffset(pos) : controller.positionToOffset(pos);
|
|
4456
|
+
});
|
|
4457
|
+
var simplified_1 = simplifyPath ? PolygonCalculator.simplifyPoints(offsets_1, simplifyTolerance, lastReapeated) : offsets_1;
|
|
4458
|
+
innerPath.push(simplified_1);
|
|
4459
|
+
}
|
|
4460
|
+
|
|
4461
|
+
setInnerOffsets(innerPath);
|
|
4462
|
+
} //start point
|
|
4463
|
+
|
|
4464
|
+
|
|
4465
|
+
var startPosition = maxLat && minLng ? new Position(maxLat, minLng) : undefined;
|
|
4466
|
+
setPolygonStart(startPosition);
|
|
4463
4467
|
}, []);
|
|
4464
4468
|
return React__default["default"].createElement(React__default["default"].Fragment, null, polygonStart && React__default["default"].createElement(MapMarkerWrapper, {
|
|
4465
4469
|
position: polygonStart,
|
|
@@ -5192,7 +5196,7 @@
|
|
|
5192
5196
|
|
|
5193
5197
|
if (map) {
|
|
5194
5198
|
// const center = controller.getCenter()
|
|
5195
|
-
// center.offset =
|
|
5199
|
+
// center.offset = positionToOffset(center)
|
|
5196
5200
|
// if(center.offset){
|
|
5197
5201
|
// prevX.current = center.offset.x
|
|
5198
5202
|
// prevY.current = center.offset.y
|
|
@@ -5212,7 +5216,7 @@
|
|
|
5212
5216
|
|
|
5213
5217
|
if (containerRef.current) {
|
|
5214
5218
|
// const pos = controller.getCenter()
|
|
5215
|
-
// pos.offset =
|
|
5219
|
+
// pos.offset = positionToOffset(pos)
|
|
5216
5220
|
// const deltaX = prevX.current - pos.offset.x
|
|
5217
5221
|
// const deltaY = prevY.current - pos.offset.y
|
|
5218
5222
|
// offsetProvider.current.x += deltaX
|