@mint-ui/map 0.5.2-beta → 0.5.4-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/.eslintrc.js +109 -109
- package/LICENSE +21 -21
- package/README.md +73 -73
- package/dist/components/mint-map/MintMap.d.ts +10 -10
- package/dist/components/mint-map/MintMap.js +14 -21
- package/dist/components/mint-map/core/MintMapCanvasRenderer.d.ts +4 -4
- package/dist/components/mint-map/core/MintMapController.d.ts +64 -64
- package/dist/components/mint-map/core/MintMapController.js +9 -9
- package/dist/components/mint-map/core/MintMapCore.d.ts +3 -3
- package/dist/components/mint-map/core/MintMapCore.js +13 -11
- package/dist/components/mint-map/core/advanced/MapBuildingProjection.d.ts +15 -15
- package/dist/components/mint-map/core/advanced/MapBuildingProjection.js +2 -2
- package/dist/components/mint-map/core/advanced/MapLoadingComponents.d.ts +17 -17
- package/dist/components/mint-map/core/advanced/index.d.ts +3 -3
- package/dist/components/mint-map/core/advanced/shapes/CircleMarker.d.ts +20 -20
- package/dist/components/mint-map/core/advanced/shapes/CircleMarker.js +9 -8
- package/dist/components/mint-map/core/advanced/shapes/PolygonMarker.d.ts +23 -23
- package/dist/components/mint-map/core/advanced/shapes/PolygonMarker.js +45 -58
- package/dist/components/mint-map/core/advanced/shapes/base/SVGCircle.d.ts +8 -8
- package/dist/components/mint-map/core/advanced/shapes/base/SVGPolygon.d.ts +12 -12
- package/dist/components/mint-map/core/advanced/shapes/base/SVGPolygon.js +5 -5
- package/dist/components/mint-map/core/advanced/shapes/base/SVGRect.d.ts +10 -10
- package/dist/components/mint-map/core/advanced/shapes/base/index.d.ts +3 -3
- package/dist/components/mint-map/core/advanced/shapes/index.d.ts +3 -3
- package/dist/components/mint-map/core/hooks/MarkerMovingHook.d.ts +6 -6
- package/dist/components/mint-map/core/hooks/MarkerMovingHook.js +2 -2
- package/dist/components/mint-map/core/hooks/index.d.ts +1 -1
- package/dist/components/mint-map/core/index.d.ts +8 -8
- package/dist/components/mint-map/core/provider/MintMapProvider.d.ts +8 -8
- package/dist/components/mint-map/core/provider/index.d.ts +1 -1
- package/dist/components/mint-map/core/util/animation.d.ts +16 -16
- package/dist/components/mint-map/core/util/cluster.d.ts +18 -18
- package/dist/components/mint-map/core/util/{calculate.d.ts → geo.d.ts} +38 -66
- package/dist/components/mint-map/core/util/geo.js +159 -0
- package/dist/components/mint-map/core/util/index.d.ts +5 -4
- 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/util/waiting.d.ts +1 -1
- package/dist/components/mint-map/core/wrapper/MapCanvasMarkerWrapper.d.ts +27 -27
- package/dist/components/mint-map/core/wrapper/MapCanvasMarkerWrapper.js +6 -6
- package/dist/components/mint-map/core/wrapper/MapCanvasWrapper.d.ts +11 -11
- package/dist/components/mint-map/core/wrapper/MapCanvasWrapper.js +28 -12
- package/dist/components/mint-map/core/wrapper/MapControlWrapper.d.ts +18 -18
- package/dist/components/mint-map/core/wrapper/MapControlWrapper.js +6 -6
- package/dist/components/mint-map/core/wrapper/MapMarkerWrapper.d.ts +42 -32
- package/dist/components/mint-map/core/wrapper/MapMarkerWrapper.js +15 -62
- package/dist/components/mint-map/core/wrapper/MapPolygonWrapper.d.ts +12 -12
- package/dist/components/mint-map/core/wrapper/MapPolygonWrapper.js +7 -6
- package/dist/components/mint-map/core/wrapper/MapPolylineWrapper.d.ts +12 -12
- package/dist/components/mint-map/core/wrapper/MapPolylineWrapper.js +8 -7
- package/dist/components/mint-map/core/wrapper/index.d.ts +6 -6
- package/dist/components/mint-map/google/GoogleMintMapController.d.ts +51 -51
- package/dist/components/mint-map/google/GoogleMintMapController.js +1 -1
- package/dist/components/mint-map/index.d.ts +5 -5
- package/dist/components/mint-map/kakao/KakaoMintMapController.d.ts +56 -56
- package/dist/components/mint-map/kakao/KakaoMintMapController.js +9 -8
- package/dist/components/mint-map/naver/NaverMintMapController.d.ts +54 -53
- package/dist/components/mint-map/naver/NaverMintMapController.js +16 -6
- package/dist/components/mint-map/types/CommonTypes.d.ts +11 -11
- package/dist/components/mint-map/types/MapDrawables.d.ts +110 -110
- package/dist/components/mint-map/types/MapDrawables.js +10 -10
- package/dist/components/mint-map/types/MapEventTypes.d.ts +44 -44
- package/dist/components/mint-map/types/MapTypes.d.ts +60 -60
- package/dist/components/mint-map/types/MapTypes.js +15 -15
- package/dist/components/mint-map/types/MintMapEvents.d.ts +25 -25
- package/dist/components/mint-map/types/MintMapProps.d.ts +92 -92
- package/dist/components/mint-map/types/index.d.ts +6 -6
- package/dist/index.d.ts +7 -7
- package/dist/index.es.js +364 -394
- package/dist/index.js +4 -3
- package/dist/index.umd.js +364 -394
- package/package.json +77 -77
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { Bounds, Position } from "../../types/MapTypes";
|
|
2
|
-
export interface ClusterInfo {
|
|
3
|
-
bounds: Bounds;
|
|
4
|
-
checked: boolean;
|
|
5
|
-
center: boolean;
|
|
6
|
-
centerPosition: Position;
|
|
7
|
-
incList: any;
|
|
8
|
-
itemList: Position[];
|
|
9
|
-
size: number;
|
|
10
|
-
}
|
|
11
|
-
export interface ClusterStatus {
|
|
12
|
-
total: number;
|
|
13
|
-
average: number;
|
|
14
|
-
min: number;
|
|
15
|
-
max: number;
|
|
16
|
-
}
|
|
17
|
-
export declare type ClusterSizeCalculator = (info: ClusterInfo, status: ClusterStatus) => number;
|
|
18
|
-
export declare const getClusterInfo: (basePixelSize: number, mapBounds: Bounds, mapWidth: number, mapHeight: number, itemList: Position[], sizeFunction?: ClusterSizeCalculator) => ClusterInfo[];
|
|
1
|
+
import { Bounds, Position } from "../../types/MapTypes";
|
|
2
|
+
export interface ClusterInfo {
|
|
3
|
+
bounds: Bounds;
|
|
4
|
+
checked: boolean;
|
|
5
|
+
center: boolean;
|
|
6
|
+
centerPosition: Position;
|
|
7
|
+
incList: any;
|
|
8
|
+
itemList: Position[];
|
|
9
|
+
size: number;
|
|
10
|
+
}
|
|
11
|
+
export interface ClusterStatus {
|
|
12
|
+
total: number;
|
|
13
|
+
average: number;
|
|
14
|
+
min: number;
|
|
15
|
+
max: number;
|
|
16
|
+
}
|
|
17
|
+
export declare type ClusterSizeCalculator = (info: ClusterInfo, status: ClusterStatus) => number;
|
|
18
|
+
export declare const getClusterInfo: (basePixelSize: number, mapBounds: Bounds, mapWidth: number, mapHeight: number, itemList: Position[], sizeFunction?: ClusterSizeCalculator) => ClusterInfo[];
|
|
@@ -1,66 +1,38 @@
|
|
|
1
|
-
declare class PositionMirror {
|
|
2
|
-
lat: number;
|
|
3
|
-
lng: number;
|
|
4
|
-
constructor(lat: number, lng: number);
|
|
5
|
-
}
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
private static
|
|
21
|
-
private static
|
|
22
|
-
private static
|
|
23
|
-
private static
|
|
24
|
-
private static
|
|
25
|
-
|
|
26
|
-
static
|
|
27
|
-
static
|
|
28
|
-
static
|
|
29
|
-
|
|
30
|
-
private static
|
|
31
|
-
static
|
|
32
|
-
private static
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
totalDistance: number;
|
|
40
|
-
currDistance: number;
|
|
41
|
-
distanceRemain: number;
|
|
42
|
-
prevPos2: PositionMirror;
|
|
43
|
-
prevVelocityKmh: number;
|
|
44
|
-
vPerMs: number;
|
|
45
|
-
nextPos: PositionMirror;
|
|
46
|
-
}
|
|
47
|
-
export declare class GeoCalulator {
|
|
48
|
-
private static readonly EARTH_EQUATORIAL_RADIUS;
|
|
49
|
-
private static readonly EARTH_EQUATORIAL_RADIUS_KM;
|
|
50
|
-
private static readonly EARTH_ECCENTRICITY;
|
|
51
|
-
private static readonly METER_VALUE_PER_LATITUDE;
|
|
52
|
-
private static readonly LATITUDE_POSITION_VALUE_PER_METER;
|
|
53
|
-
static computeDistanceKiloMeter(pos1: PositionMirror, pos2: PositionMirror): number;
|
|
54
|
-
private static deg2rad;
|
|
55
|
-
static convertMeterToLatitudeValue(meter: number): number;
|
|
56
|
-
static convertLatitudeToMeterValue(lat: number): number;
|
|
57
|
-
static convertLongitudeToMeterValue(lat: number, lng: number): number;
|
|
58
|
-
private static readonly CACHE_OF_LNG_PER_METER;
|
|
59
|
-
private static getCacheUnitOfLongitudeValueWithLatitudeInMeter;
|
|
60
|
-
private static getCacheOfLongitudeValueWithLatitudeInMeter;
|
|
61
|
-
private static setCacheOfLongitudeValueWithLatitudeInMeter;
|
|
62
|
-
static calculateLongitudeValueWithLatitudeInMeter(lat: number): number;
|
|
63
|
-
private static readonly MS_FROM_HOUR;
|
|
64
|
-
static computeNextPositionAndDistances(context: NextPositionContext): NextPositionContext;
|
|
65
|
-
}
|
|
66
|
-
export {};
|
|
1
|
+
declare class PositionMirror {
|
|
2
|
+
lat: number;
|
|
3
|
+
lng: number;
|
|
4
|
+
constructor(lat: number, lng: number);
|
|
5
|
+
}
|
|
6
|
+
export interface NextPositionContext {
|
|
7
|
+
pos1: PositionMirror;
|
|
8
|
+
pos2: PositionMirror;
|
|
9
|
+
velocityKmh: number;
|
|
10
|
+
elapsedTimeMs: number;
|
|
11
|
+
totalDistance: number;
|
|
12
|
+
currDistance: number;
|
|
13
|
+
distanceRemain: number;
|
|
14
|
+
prevPos2: PositionMirror;
|
|
15
|
+
prevVelocityKmh: number;
|
|
16
|
+
vPerMs: number;
|
|
17
|
+
nextPos: PositionMirror;
|
|
18
|
+
}
|
|
19
|
+
export declare class GeoCalulator {
|
|
20
|
+
private static readonly EARTH_EQUATORIAL_RADIUS;
|
|
21
|
+
private static readonly EARTH_EQUATORIAL_RADIUS_KM;
|
|
22
|
+
private static readonly EARTH_ECCENTRICITY;
|
|
23
|
+
private static readonly METER_VALUE_PER_LATITUDE;
|
|
24
|
+
private static readonly LATITUDE_POSITION_VALUE_PER_METER;
|
|
25
|
+
static computeDistanceKiloMeter(pos1: PositionMirror, pos2: PositionMirror): number;
|
|
26
|
+
private static deg2rad;
|
|
27
|
+
static convertMeterToLatitudeValue(meter: number): number;
|
|
28
|
+
static convertLatitudeToMeterValue(lat: number): number;
|
|
29
|
+
static convertLongitudeToMeterValue(lat: number, lng: number): number;
|
|
30
|
+
private static readonly CACHE_OF_LNG_PER_METER;
|
|
31
|
+
private static getCacheUnitOfLongitudeValueWithLatitudeInMeter;
|
|
32
|
+
private static getCacheOfLongitudeValueWithLatitudeInMeter;
|
|
33
|
+
private static setCacheOfLongitudeValueWithLatitudeInMeter;
|
|
34
|
+
static calculateLongitudeValueWithLatitudeInMeter(lat: number): number;
|
|
35
|
+
private static readonly MS_FROM_HOUR;
|
|
36
|
+
static computeNextPositionAndDistances(context: NextPositionContext): NextPositionContext;
|
|
37
|
+
}
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var PositionMirror =
|
|
6
|
+
/** @class */
|
|
7
|
+
function () {
|
|
8
|
+
function PositionMirror(lat, lng) {
|
|
9
|
+
this.lat = lat;
|
|
10
|
+
this.lng = lng;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return PositionMirror;
|
|
14
|
+
}();
|
|
15
|
+
|
|
16
|
+
var GeoCalulator =
|
|
17
|
+
/** @class */
|
|
18
|
+
function () {
|
|
19
|
+
function GeoCalulator() {}
|
|
20
|
+
|
|
21
|
+
GeoCalulator.computeDistanceKiloMeter = function (pos1, pos2) {
|
|
22
|
+
var dLat = this.deg2rad(pos2.lat - pos1.lat);
|
|
23
|
+
var dLon = this.deg2rad(pos2.lng - pos1.lng);
|
|
24
|
+
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);
|
|
25
|
+
var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
|
|
26
|
+
var d = this.EARTH_EQUATORIAL_RADIUS_KM * c; // Distance in km
|
|
27
|
+
|
|
28
|
+
return d;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
GeoCalulator.deg2rad = function (deg) {
|
|
32
|
+
return deg * (Math.PI / 180);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
GeoCalulator.convertMeterToLatitudeValue = function (meter) {
|
|
36
|
+
return meter * this.LATITUDE_POSITION_VALUE_PER_METER;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
GeoCalulator.convertLatitudeToMeterValue = function (lat) {
|
|
40
|
+
return lat * this.METER_VALUE_PER_LATITUDE;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
GeoCalulator.convertLongitudeToMeterValue = function (lat, lng) {
|
|
44
|
+
return lng * this.calculateLongitudeValueWithLatitudeInMeter(lat);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
GeoCalulator.getCacheUnitOfLongitudeValueWithLatitudeInMeter = function (lat) {
|
|
48
|
+
return lat.toFixed(2);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
GeoCalulator.getCacheOfLongitudeValueWithLatitudeInMeter = function (latUnit) {
|
|
52
|
+
return this.CACHE_OF_LNG_PER_METER.get(latUnit);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
GeoCalulator.setCacheOfLongitudeValueWithLatitudeInMeter = function (latUnit, lngValue) {
|
|
56
|
+
if (this.CACHE_OF_LNG_PER_METER.size > 10) {
|
|
57
|
+
this.CACHE_OF_LNG_PER_METER.clear();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
this.CACHE_OF_LNG_PER_METER.set(latUnit, lngValue);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
GeoCalulator.calculateLongitudeValueWithLatitudeInMeter = function (lat) {
|
|
64
|
+
// const t = Date.now()
|
|
65
|
+
// Cache check
|
|
66
|
+
var latUnit = this.getCacheUnitOfLongitudeValueWithLatitudeInMeter(lat);
|
|
67
|
+
var fromCache = this.getCacheOfLongitudeValueWithLatitudeInMeter(latUnit);
|
|
68
|
+
|
|
69
|
+
if (fromCache !== undefined) {
|
|
70
|
+
// console.log(`cache hit!! ${Date.now() - t} ms`, fromCache, latUnit, this.CACHE_OF_LNG_PER_METER.size);
|
|
71
|
+
return fromCache;
|
|
72
|
+
} // Convert latitude and longitude to radians
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
var latRad = lat * Math.PI / 180; // Calculate Earth's radius at the given latitude
|
|
76
|
+
|
|
77
|
+
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
|
|
78
|
+
|
|
79
|
+
var distance = 2 * Math.PI * radius * Math.cos(latRad) / 360; // Cache set
|
|
80
|
+
|
|
81
|
+
this.setCacheOfLongitudeValueWithLatitudeInMeter(latUnit, distance); // console.log(`calculated ${Date.now() - t} ms`)
|
|
82
|
+
|
|
83
|
+
return distance;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
GeoCalulator.computeNextPositionAndDistances = function (context) {
|
|
87
|
+
var pos1 = context.pos1,
|
|
88
|
+
pos2 = context.pos2,
|
|
89
|
+
prevPos2 = context.prevPos2,
|
|
90
|
+
velocityKmh = context.velocityKmh,
|
|
91
|
+
prevVelocityKmh = context.prevVelocityKmh,
|
|
92
|
+
elapsedTimeMs = context.elapsedTimeMs; // console.log('velocityKmh / elapsedTimeMs',velocityKmh , elapsedTimeMs);
|
|
93
|
+
//총 가야할 거리 (km)
|
|
94
|
+
|
|
95
|
+
if (pos2 !== prevPos2) {
|
|
96
|
+
//목표가 바뀌면 거리 및 비율 재계산
|
|
97
|
+
context.totalDistance = this.computeDistanceKiloMeter(pos1, pos2);
|
|
98
|
+
context.currDistance = 0;
|
|
99
|
+
context.prevPos2 = pos2;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
var totalDistance = context.totalDistance; // console.log('totalDistance', totalDistance);
|
|
103
|
+
//ms 속으로 환산
|
|
104
|
+
|
|
105
|
+
if (velocityKmh !== prevVelocityKmh) {
|
|
106
|
+
//속도가 바뀌면 재계산
|
|
107
|
+
context.vPerMs = velocityKmh / this.MS_FROM_HOUR;
|
|
108
|
+
context.prevVelocityKmh = velocityKmh;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
var vPerMs = context.vPerMs; //console.log('vPerMs', vPerMs);
|
|
112
|
+
//실제 가는 거리 계산
|
|
113
|
+
|
|
114
|
+
var nextDistance = context.distanceRemain ? context.distanceRemain : context.currDistance + elapsedTimeMs * vPerMs; //console.log('nextDistance', nextDistance);
|
|
115
|
+
//목표점까지 이동 후에도 남는 거리
|
|
116
|
+
|
|
117
|
+
context.currDistance = nextDistance;
|
|
118
|
+
|
|
119
|
+
if (totalDistance < context.currDistance) {
|
|
120
|
+
//이동 거리가 현재 목표점을 넘어가는 경우
|
|
121
|
+
context.distanceRemain = context.currDistance - totalDistance;
|
|
122
|
+
context.nextPos = pos2;
|
|
123
|
+
return context;
|
|
124
|
+
} else {
|
|
125
|
+
context.distanceRemain = 0;
|
|
126
|
+
} //각 축으로 나가야할 비율
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
var ratio = nextDistance / totalDistance; //console.log('ratio', ratio);
|
|
130
|
+
//방향값 체크
|
|
131
|
+
|
|
132
|
+
var latCalib = pos2.lat > pos1.lat ? 1 : -1;
|
|
133
|
+
var lngCalib = pos2.lng > pos1.lng ? 1 : -1; //각 축에 보정된 새로운 지점 리턴
|
|
134
|
+
|
|
135
|
+
var newPos = new PositionMirror(pos1.lat + (pos2.lat - pos1.lat) * ratio, pos1.lng + (pos2.lng - pos1.lng) * ratio);
|
|
136
|
+
|
|
137
|
+
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)) {
|
|
138
|
+
newPos = pos2;
|
|
139
|
+
} // console.log('newPos', newPos);
|
|
140
|
+
//console.log('==============================================================\n');
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
context.nextPos = newPos;
|
|
144
|
+
return context;
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
GeoCalulator.EARTH_EQUATORIAL_RADIUS = 6378137; //meter (6,378,137 m)
|
|
148
|
+
|
|
149
|
+
GeoCalulator.EARTH_EQUATORIAL_RADIUS_KM = GeoCalulator.EARTH_EQUATORIAL_RADIUS / 1000;
|
|
150
|
+
GeoCalulator.EARTH_ECCENTRICITY = 0.08181919;
|
|
151
|
+
GeoCalulator.METER_VALUE_PER_LATITUDE = 110.32 * 1000; //위도 기준 1도는 110.32km
|
|
152
|
+
|
|
153
|
+
GeoCalulator.LATITUDE_POSITION_VALUE_PER_METER = 1 / GeoCalulator.METER_VALUE_PER_LATITUDE;
|
|
154
|
+
GeoCalulator.CACHE_OF_LNG_PER_METER = new Map();
|
|
155
|
+
GeoCalulator.MS_FROM_HOUR = 60 * 60 * 1000;
|
|
156
|
+
return GeoCalulator;
|
|
157
|
+
}();
|
|
158
|
+
|
|
159
|
+
exports.GeoCalulator = GeoCalulator;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export * from './animation';
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './waiting';
|
|
4
|
-
export * from './cluster';
|
|
1
|
+
export * from './animation';
|
|
2
|
+
export * from './geo';
|
|
3
|
+
export * from './waiting';
|
|
4
|
+
export * from './cluster';
|
|
5
|
+
export * from './polygon';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
declare class PositionMirror {
|
|
2
|
+
lat: number;
|
|
3
|
+
lng: number;
|
|
4
|
+
constructor(lat: number, lng: number);
|
|
5
|
+
}
|
|
6
|
+
declare class OffsetMirror {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
constructor(x: number, y: number);
|
|
10
|
+
equals(other?: OffsetMirror): boolean | undefined;
|
|
11
|
+
}
|
|
12
|
+
export declare class PolygonCalculator {
|
|
13
|
+
static getRegionInfo(positions: PositionMirror[]): {
|
|
14
|
+
maxLat: number | undefined;
|
|
15
|
+
minLat: number | undefined;
|
|
16
|
+
maxLng: number | undefined;
|
|
17
|
+
minLng: number | undefined;
|
|
18
|
+
centerLat: number | undefined;
|
|
19
|
+
centerLng: number | undefined;
|
|
20
|
+
};
|
|
21
|
+
static getRegionStart(positions: PositionMirror[]): PositionMirror;
|
|
22
|
+
static getRegionEnd(positions: PositionMirror[]): PositionMirror;
|
|
23
|
+
static getCenter(positions: PositionMirror[]): PositionMirror;
|
|
24
|
+
static intersects(positions1: PositionMirror[], positions2: PositionMirror[]): boolean;
|
|
25
|
+
static getIncludedPositions(polygon: PositionMirror[], position: PositionMirror | PositionMirror[]): PositionMirror[];
|
|
26
|
+
private static convertPolygonToLinePoints;
|
|
27
|
+
private static convertPositionToPoints;
|
|
28
|
+
private static getCrossPoint;
|
|
29
|
+
private static toFixedPosition;
|
|
30
|
+
private static getCrossPointAll;
|
|
31
|
+
private static findCrossPoint;
|
|
32
|
+
static readonly TOLERANCE_NAVER_STYLE = 1;
|
|
33
|
+
static readonly TOLERANCE_GOOGLE_STYLE = 1;
|
|
34
|
+
static simplifyPoints(polygon: OffsetMirror[], tolerance?: number, lastRepeated?: boolean): OffsetMirror[];
|
|
35
|
+
private static simplify;
|
|
36
|
+
private static perpendicularDistance;
|
|
37
|
+
static calculatePolygonSize(polygon: PositionMirror[], innerPolygons?: PositionMirror[][]): number;
|
|
38
|
+
private static calculatePolygonSizeMain;
|
|
39
|
+
}
|
|
40
|
+
export {};
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var geo = require('./geo.js');
|
|
6
|
+
|
|
5
7
|
var LinePoints =
|
|
6
8
|
/** @class */
|
|
7
9
|
function () {
|
|
@@ -201,11 +203,7 @@ function () {
|
|
|
201
203
|
|
|
202
204
|
PolygonCalculator.simplifyPoints = function (polygon, tolerance, lastRepeated) {
|
|
203
205
|
var target = lastRepeated ? polygon.slice(0, polygon.length - 1) : polygon;
|
|
204
|
-
return this.simplify(target.
|
|
205
|
-
return [position.lng, position.lat];
|
|
206
|
-
}), tolerance !== undefined ? tolerance : this.TOLERANCE_NAVER_STYLE).map(function (point) {
|
|
207
|
-
return new PositionMirror(point[1], point[0]);
|
|
208
|
-
});
|
|
206
|
+
return this.simplify(target, tolerance !== undefined ? tolerance : this.TOLERANCE_NAVER_STYLE);
|
|
209
207
|
};
|
|
210
208
|
|
|
211
209
|
PolygonCalculator.simplify = function (points, tolerance) {
|
|
@@ -239,12 +237,12 @@ function () {
|
|
|
239
237
|
|
|
240
238
|
|
|
241
239
|
PolygonCalculator.perpendicularDistance = function (point, lineStart, lineEnd) {
|
|
242
|
-
var x = point
|
|
243
|
-
var y = point
|
|
244
|
-
var x1 = lineStart
|
|
245
|
-
var y1 = lineStart
|
|
246
|
-
var x2 = lineEnd
|
|
247
|
-
var y2 = lineEnd
|
|
240
|
+
var x = point.x;
|
|
241
|
+
var y = point.y;
|
|
242
|
+
var x1 = lineStart.x;
|
|
243
|
+
var y1 = lineStart.y;
|
|
244
|
+
var x2 = lineEnd.x;
|
|
245
|
+
var y2 = lineEnd.y;
|
|
248
246
|
var numerator = Math.abs((y2 - y1) * x - (x2 - x1) * y + x2 * y1 - y2 * x1);
|
|
249
247
|
var denominator = Math.sqrt(Math.pow(y2 - y1, 2) + Math.pow(x2 - x1, 2));
|
|
250
248
|
return numerator / denominator;
|
|
@@ -264,8 +262,8 @@ function () {
|
|
|
264
262
|
PolygonCalculator.calculatePolygonSizeMain = function (polygon) {
|
|
265
263
|
var vertices = polygon.map(function (pos) {
|
|
266
264
|
return {
|
|
267
|
-
x: GeoCalulator.convertLongitudeToMeterValue(pos.lat, pos.lng),
|
|
268
|
-
y: GeoCalulator.convertLatitudeToMeterValue(pos.lat)
|
|
265
|
+
x: geo.GeoCalulator.convertLongitudeToMeterValue(pos.lat, pos.lng),
|
|
266
|
+
y: geo.GeoCalulator.convertLatitudeToMeterValue(pos.lat)
|
|
269
267
|
};
|
|
270
268
|
});
|
|
271
269
|
var n = vertices.length;
|
|
@@ -281,153 +279,9 @@ function () {
|
|
|
281
279
|
return area;
|
|
282
280
|
};
|
|
283
281
|
|
|
284
|
-
PolygonCalculator.TOLERANCE_NAVER_STYLE =
|
|
285
|
-
PolygonCalculator.TOLERANCE_GOOGLE_STYLE =
|
|
282
|
+
PolygonCalculator.TOLERANCE_NAVER_STYLE = 1;
|
|
283
|
+
PolygonCalculator.TOLERANCE_GOOGLE_STYLE = 1;
|
|
286
284
|
return PolygonCalculator;
|
|
287
285
|
}();
|
|
288
286
|
|
|
289
|
-
var GeoCalulator =
|
|
290
|
-
/** @class */
|
|
291
|
-
function () {
|
|
292
|
-
function GeoCalulator() {}
|
|
293
|
-
|
|
294
|
-
GeoCalulator.computeDistanceKiloMeter = function (pos1, pos2) {
|
|
295
|
-
var dLat = this.deg2rad(pos2.lat - pos1.lat);
|
|
296
|
-
var dLon = this.deg2rad(pos2.lng - pos1.lng);
|
|
297
|
-
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);
|
|
298
|
-
var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
|
|
299
|
-
var d = this.EARTH_EQUATORIAL_RADIUS_KM * c; // Distance in km
|
|
300
|
-
|
|
301
|
-
return d;
|
|
302
|
-
};
|
|
303
|
-
|
|
304
|
-
GeoCalulator.deg2rad = function (deg) {
|
|
305
|
-
return deg * (Math.PI / 180);
|
|
306
|
-
};
|
|
307
|
-
|
|
308
|
-
GeoCalulator.convertMeterToLatitudeValue = function (meter) {
|
|
309
|
-
return meter * this.LATITUDE_POSITION_VALUE_PER_METER;
|
|
310
|
-
};
|
|
311
|
-
|
|
312
|
-
GeoCalulator.convertLatitudeToMeterValue = function (lat) {
|
|
313
|
-
return lat * this.METER_VALUE_PER_LATITUDE;
|
|
314
|
-
};
|
|
315
|
-
|
|
316
|
-
GeoCalulator.convertLongitudeToMeterValue = function (lat, lng) {
|
|
317
|
-
return lng * this.calculateLongitudeValueWithLatitudeInMeter(lat);
|
|
318
|
-
};
|
|
319
|
-
|
|
320
|
-
GeoCalulator.getCacheUnitOfLongitudeValueWithLatitudeInMeter = function (lat) {
|
|
321
|
-
return lat.toFixed(2);
|
|
322
|
-
};
|
|
323
|
-
|
|
324
|
-
GeoCalulator.getCacheOfLongitudeValueWithLatitudeInMeter = function (latUnit) {
|
|
325
|
-
return this.CACHE_OF_LNG_PER_METER.get(latUnit);
|
|
326
|
-
};
|
|
327
|
-
|
|
328
|
-
GeoCalulator.setCacheOfLongitudeValueWithLatitudeInMeter = function (latUnit, lngValue) {
|
|
329
|
-
if (this.CACHE_OF_LNG_PER_METER.size > 10) {
|
|
330
|
-
this.CACHE_OF_LNG_PER_METER.clear();
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
this.CACHE_OF_LNG_PER_METER.set(latUnit, lngValue);
|
|
334
|
-
};
|
|
335
|
-
|
|
336
|
-
GeoCalulator.calculateLongitudeValueWithLatitudeInMeter = function (lat) {
|
|
337
|
-
// const t = Date.now()
|
|
338
|
-
// Cache check
|
|
339
|
-
var latUnit = this.getCacheUnitOfLongitudeValueWithLatitudeInMeter(lat);
|
|
340
|
-
var fromCache = this.getCacheOfLongitudeValueWithLatitudeInMeter(latUnit);
|
|
341
|
-
|
|
342
|
-
if (fromCache !== undefined) {
|
|
343
|
-
// console.log(`cache hit!! ${Date.now() - t} ms`, fromCache, latUnit, this.CACHE_OF_LNG_PER_METER.size);
|
|
344
|
-
return fromCache;
|
|
345
|
-
} // Convert latitude and longitude to radians
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
var latRad = lat * Math.PI / 180; // Calculate Earth's radius at the given latitude
|
|
349
|
-
|
|
350
|
-
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
|
|
351
|
-
|
|
352
|
-
var distance = 2 * Math.PI * radius * Math.cos(latRad) / 360; // Cache set
|
|
353
|
-
|
|
354
|
-
this.setCacheOfLongitudeValueWithLatitudeInMeter(latUnit, distance); // console.log(`calculated ${Date.now() - t} ms`)
|
|
355
|
-
|
|
356
|
-
return distance;
|
|
357
|
-
};
|
|
358
|
-
|
|
359
|
-
GeoCalulator.computeNextPositionAndDistances = function (context) {
|
|
360
|
-
var pos1 = context.pos1,
|
|
361
|
-
pos2 = context.pos2,
|
|
362
|
-
prevPos2 = context.prevPos2,
|
|
363
|
-
velocityKmh = context.velocityKmh,
|
|
364
|
-
prevVelocityKmh = context.prevVelocityKmh,
|
|
365
|
-
elapsedTimeMs = context.elapsedTimeMs; // console.log('velocityKmh / elapsedTimeMs',velocityKmh , elapsedTimeMs);
|
|
366
|
-
//총 가야할 거리 (km)
|
|
367
|
-
|
|
368
|
-
if (pos2 !== prevPos2) {
|
|
369
|
-
//목표가 바뀌면 거리 및 비율 재계산
|
|
370
|
-
context.totalDistance = this.computeDistanceKiloMeter(pos1, pos2);
|
|
371
|
-
context.currDistance = 0;
|
|
372
|
-
context.prevPos2 = pos2;
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
var totalDistance = context.totalDistance; // console.log('totalDistance', totalDistance);
|
|
376
|
-
//ms 속으로 환산
|
|
377
|
-
|
|
378
|
-
if (velocityKmh !== prevVelocityKmh) {
|
|
379
|
-
//속도가 바뀌면 재계산
|
|
380
|
-
context.vPerMs = velocityKmh / this.MS_FROM_HOUR;
|
|
381
|
-
context.prevVelocityKmh = velocityKmh;
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
var vPerMs = context.vPerMs; //console.log('vPerMs', vPerMs);
|
|
385
|
-
//실제 가는 거리 계산
|
|
386
|
-
|
|
387
|
-
var nextDistance = context.distanceRemain ? context.distanceRemain : context.currDistance + elapsedTimeMs * vPerMs; //console.log('nextDistance', nextDistance);
|
|
388
|
-
//목표점까지 이동 후에도 남는 거리
|
|
389
|
-
|
|
390
|
-
context.currDistance = nextDistance;
|
|
391
|
-
|
|
392
|
-
if (totalDistance < context.currDistance) {
|
|
393
|
-
//이동 거리가 현재 목표점을 넘어가는 경우
|
|
394
|
-
context.distanceRemain = context.currDistance - totalDistance;
|
|
395
|
-
context.nextPos = pos2;
|
|
396
|
-
return context;
|
|
397
|
-
} else {
|
|
398
|
-
context.distanceRemain = 0;
|
|
399
|
-
} //각 축으로 나가야할 비율
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
var ratio = nextDistance / totalDistance; //console.log('ratio', ratio);
|
|
403
|
-
//방향값 체크
|
|
404
|
-
|
|
405
|
-
var latCalib = pos2.lat > pos1.lat ? 1 : -1;
|
|
406
|
-
var lngCalib = pos2.lng > pos1.lng ? 1 : -1; //각 축에 보정된 새로운 지점 리턴
|
|
407
|
-
|
|
408
|
-
var newPos = new PositionMirror(pos1.lat + (pos2.lat - pos1.lat) * ratio, pos1.lng + (pos2.lng - pos1.lng) * ratio);
|
|
409
|
-
|
|
410
|
-
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)) {
|
|
411
|
-
newPos = pos2;
|
|
412
|
-
} // console.log('newPos', newPos);
|
|
413
|
-
//console.log('==============================================================\n');
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
context.nextPos = newPos;
|
|
417
|
-
return context;
|
|
418
|
-
};
|
|
419
|
-
|
|
420
|
-
GeoCalulator.EARTH_EQUATORIAL_RADIUS = 6378137; //meter (6,378,137 m)
|
|
421
|
-
|
|
422
|
-
GeoCalulator.EARTH_EQUATORIAL_RADIUS_KM = GeoCalulator.EARTH_EQUATORIAL_RADIUS / 1000;
|
|
423
|
-
GeoCalulator.EARTH_ECCENTRICITY = 0.08181919;
|
|
424
|
-
GeoCalulator.METER_VALUE_PER_LATITUDE = 110.32 * 1000; //위도 기준 1도는 110.32km
|
|
425
|
-
|
|
426
|
-
GeoCalulator.LATITUDE_POSITION_VALUE_PER_METER = 1 / GeoCalulator.METER_VALUE_PER_LATITUDE;
|
|
427
|
-
GeoCalulator.CACHE_OF_LNG_PER_METER = new Map();
|
|
428
|
-
GeoCalulator.MS_FROM_HOUR = 60 * 60 * 1000;
|
|
429
|
-
return GeoCalulator;
|
|
430
|
-
}();
|
|
431
|
-
|
|
432
|
-
exports.GeoCalulator = GeoCalulator;
|
|
433
287
|
exports.PolygonCalculator = PolygonCalculator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function waiting(evaluation: () => boolean, timeoutSeconds?: number): Promise<boolean>;
|
|
1
|
+
export declare function waiting(evaluation: () => boolean, timeoutSeconds?: number): Promise<boolean>;
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { MarkerOptions } from "../../types/MapDrawables";
|
|
3
|
-
import { Offset } from "../../types/MapTypes";
|
|
4
|
-
import { MintMapCanvasRenderer } from "../MintMapCanvasRenderer";
|
|
5
|
-
export declare type CanvasMarkerRenderer<T> = (ctx: MintMapCanvasRenderer, offset: Offset, payload?: T) => void;
|
|
6
|
-
export interface CanvasMarkerMouseEvent {
|
|
7
|
-
x: number;
|
|
8
|
-
y: number;
|
|
9
|
-
}
|
|
10
|
-
export declare type CanvasMarkerMouseEventCallback = (e: CanvasMarkerMouseEvent) => boolean | undefined | void;
|
|
11
|
-
export interface MapCanvasMarkerWrapperProps<T> extends MarkerOptions {
|
|
12
|
-
renderer: CanvasMarkerRenderer<T>;
|
|
13
|
-
payload?: T;
|
|
14
|
-
boxWidth: number;
|
|
15
|
-
boxHeight: number;
|
|
16
|
-
onClick?: CanvasMarkerMouseEventCallback;
|
|
17
|
-
onMouseOver?: CanvasMarkerMouseEventCallback;
|
|
18
|
-
onMouseOut?: CanvasMarkerMouseEventCallback;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Mint Map 컴포넌트
|
|
22
|
-
*
|
|
23
|
-
* @param {MapControlWrapperProps} MapControlWrapperProps
|
|
24
|
-
*
|
|
25
|
-
* @returns {JSX.Element} JSX
|
|
26
|
-
*/
|
|
27
|
-
export declare function MapCanvasMarkerWrapper<T>(_props: MapCanvasMarkerWrapperProps<T>): JSX.Element;
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { MarkerOptions } from "../../types/MapDrawables";
|
|
3
|
+
import { Offset } from "../../types/MapTypes";
|
|
4
|
+
import { MintMapCanvasRenderer } from "../MintMapCanvasRenderer";
|
|
5
|
+
export declare type CanvasMarkerRenderer<T> = (ctx: MintMapCanvasRenderer, offset: Offset, payload?: T) => void;
|
|
6
|
+
export interface CanvasMarkerMouseEvent {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
}
|
|
10
|
+
export declare type CanvasMarkerMouseEventCallback = (e: CanvasMarkerMouseEvent) => boolean | undefined | void;
|
|
11
|
+
export interface MapCanvasMarkerWrapperProps<T> extends MarkerOptions {
|
|
12
|
+
renderer: CanvasMarkerRenderer<T>;
|
|
13
|
+
payload?: T;
|
|
14
|
+
boxWidth: number;
|
|
15
|
+
boxHeight: number;
|
|
16
|
+
onClick?: CanvasMarkerMouseEventCallback;
|
|
17
|
+
onMouseOver?: CanvasMarkerMouseEventCallback;
|
|
18
|
+
onMouseOut?: CanvasMarkerMouseEventCallback;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Mint Map 컴포넌트
|
|
22
|
+
*
|
|
23
|
+
* @param {MapControlWrapperProps} MapControlWrapperProps
|
|
24
|
+
*
|
|
25
|
+
* @returns {JSX.Element} JSX
|
|
26
|
+
*/
|
|
27
|
+
export declare function MapCanvasMarkerWrapper<T>(_props: MapCanvasMarkerWrapperProps<T>): JSX.Element;
|
|
@@ -8,12 +8,12 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
8
8
|
|
|
9
9
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
10
10
|
|
|
11
|
-
/**
|
|
12
|
-
* Mint Map 컴포넌트
|
|
13
|
-
*
|
|
14
|
-
* @param {MapControlWrapperProps} MapControlWrapperProps
|
|
15
|
-
*
|
|
16
|
-
* @returns {JSX.Element} JSX
|
|
11
|
+
/**
|
|
12
|
+
* Mint Map 컴포넌트
|
|
13
|
+
*
|
|
14
|
+
* @param {MapControlWrapperProps} MapControlWrapperProps
|
|
15
|
+
*
|
|
16
|
+
* @returns {JSX.Element} JSX
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
function MapCanvasMarkerWrapper(_props) {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
export interface MapCanvasWrapperProps {
|
|
3
|
-
}
|
|
4
|
-
/**
|
|
5
|
-
* Mint Map 컴포넌트
|
|
6
|
-
*
|
|
7
|
-
* @param {MapControlWrapperProps} MapControlWrapperProps
|
|
8
|
-
*
|
|
9
|
-
* @returns {JSX.Element} JSX
|
|
10
|
-
*/
|
|
11
|
-
export declare function MapCanvasWrapper<T>({ children, ...props }: React.PropsWithChildren<MapCanvasWrapperProps>): JSX.Element;
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface MapCanvasWrapperProps {
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* Mint Map 컴포넌트
|
|
6
|
+
*
|
|
7
|
+
* @param {MapControlWrapperProps} MapControlWrapperProps
|
|
8
|
+
*
|
|
9
|
+
* @returns {JSX.Element} JSX
|
|
10
|
+
*/
|
|
11
|
+
export declare function MapCanvasWrapper<T>({ children, ...props }: React.PropsWithChildren<MapCanvasWrapperProps>): JSX.Element;
|