@mint-ui/map 0.4.5-beta → 0.5.0-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 -117
- package/dist/components/mint-map/MintMap.js +24 -421
- package/dist/components/mint-map/core/MintMapCanvasRenderer.d.ts +4 -4
- package/dist/components/mint-map/core/MintMapCanvasRenderer.js +3 -1
- package/dist/components/mint-map/core/MintMapController.d.ts +64 -44
- package/dist/components/mint-map/core/MintMapController.js +49 -15
- package/dist/components/mint-map/core/MintMapCore.d.ts +3 -3
- package/dist/components/mint-map/core/MintMapCore.js +22 -10
- package/dist/components/mint-map/core/advanced/MapBuildingProjection.d.ts +15 -15
- package/dist/components/mint-map/core/advanced/MapBuildingProjection.js +11 -7
- package/dist/components/mint-map/core/advanced/MapLoadingComponents.d.ts +17 -0
- package/dist/components/mint-map/core/advanced/MapLoadingComponents.js +257 -0
- package/dist/components/mint-map/core/advanced/index.d.ts +3 -1
- package/dist/components/mint-map/core/advanced/shapes/CircleMarker.d.ts +20 -0
- package/dist/components/mint-map/core/advanced/shapes/CircleMarker.js +137 -0
- package/dist/components/mint-map/core/advanced/shapes/PolygonMarker.d.ts +23 -0
- package/dist/components/mint-map/core/advanced/shapes/PolygonMarker.js +188 -0
- package/dist/components/mint-map/core/advanced/shapes/base/SVGCircle.d.ts +8 -0
- package/dist/components/mint-map/core/advanced/shapes/base/SVGCircle.js +54 -0
- package/dist/components/mint-map/core/advanced/shapes/base/SVGPolygon.d.ts +12 -0
- package/dist/components/mint-map/core/advanced/shapes/base/SVGPolygon.js +152 -0
- package/dist/components/mint-map/core/advanced/shapes/base/SVGRect.d.ts +10 -0
- package/dist/components/mint-map/core/advanced/shapes/base/SVGRect.js +60 -0
- package/dist/components/mint-map/core/advanced/shapes/base/index.d.ts +3 -0
- package/dist/components/mint-map/core/advanced/shapes/index.d.ts +3 -0
- package/dist/components/mint-map/core/hooks/MarkerMovingHook.d.ts +6 -6
- package/dist/components/mint-map/core/hooks/MarkerMovingHook.js +21 -9
- 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/animation.js +14 -5
- package/dist/components/mint-map/core/util/calculate.d.ts +66 -34
- package/dist/components/mint-map/core/util/calculate.js +233 -27
- package/dist/components/mint-map/core/util/cluster.d.ts +18 -18
- package/dist/components/mint-map/core/util/cluster.js +14 -9
- package/dist/components/mint-map/core/util/index.d.ts +4 -4
- package/dist/components/mint-map/core/util/waiting.d.ts +1 -1
- package/dist/components/mint-map/core/util/waiting.js +6 -2
- package/dist/components/mint-map/core/wrapper/MapCanvasMarkerWrapper.d.ts +27 -19
- package/dist/components/mint-map/core/wrapper/MapCanvasMarkerWrapper.js +9 -0
- package/dist/components/mint-map/core/wrapper/MapCanvasWrapper.d.ts +11 -4
- package/dist/components/mint-map/core/wrapper/MapCanvasWrapper.js +107 -35
- package/dist/components/mint-map/core/wrapper/MapControlWrapper.d.ts +18 -11
- package/dist/components/mint-map/core/wrapper/MapControlWrapper.js +8 -0
- package/dist/components/mint-map/core/wrapper/MapMarkerWrapper.d.ts +32 -23
- package/dist/components/mint-map/core/wrapper/MapMarkerWrapper.js +76 -28
- package/dist/components/mint-map/core/wrapper/MapPolygonWrapper.d.ts +12 -5
- package/dist/components/mint-map/core/wrapper/MapPolygonWrapper.js +21 -6
- package/dist/components/mint-map/core/wrapper/MapPolylineWrapper.d.ts +12 -5
- package/dist/components/mint-map/core/wrapper/MapPolylineWrapper.js +21 -7
- package/dist/components/mint-map/core/wrapper/index.d.ts +6 -6
- package/dist/components/mint-map/google/GoogleMintMapController.d.ts +51 -39
- package/dist/components/mint-map/google/GoogleMintMapController.js +224 -44
- package/dist/components/mint-map/index.d.ts +5 -4
- package/dist/components/mint-map/kakao/KakaoMintMapController.d.ts +56 -44
- package/dist/components/mint-map/kakao/KakaoMintMapController.js +265 -66
- package/dist/components/mint-map/naver/NaverMintMapController.d.ts +53 -42
- package/dist/components/mint-map/naver/NaverMintMapController.js +237 -50
- package/dist/components/mint-map/types/CommonTypes.d.ts +11 -0
- package/dist/components/mint-map/types/MapDrawables.d.ts +110 -0
- package/dist/components/mint-map/types/MapDrawables.js +92 -0
- package/dist/components/mint-map/types/MapEventTypes.d.ts +41 -0
- package/dist/components/mint-map/types/MapEventTypes.js +57 -0
- package/dist/components/mint-map/types/MapTypes.d.ts +60 -0
- package/dist/components/mint-map/types/MapTypes.js +155 -0
- package/dist/components/mint-map/types/MintMapEvents.d.ts +25 -0
- package/dist/components/mint-map/types/MintMapProps.d.ts +92 -0
- package/dist/components/mint-map/types/index.d.ts +6 -0
- package/dist/index.d.ts +7 -1
- package/dist/index.es.js +2638 -975
- package/dist/index.js +25 -9
- package/dist/index.umd.js +2644 -974
- package/package.json +77 -77
- package/test.ts +0 -7
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { Offset, Position } from "./MapTypes";
|
|
2
|
+
export interface DrawableOptions {
|
|
3
|
+
/**
|
|
4
|
+
* 좌표값
|
|
5
|
+
*/
|
|
6
|
+
position: Position | Position[] | [number, number][];
|
|
7
|
+
/**
|
|
8
|
+
* 좌표값
|
|
9
|
+
*/
|
|
10
|
+
visible?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* 이벤트 목록
|
|
13
|
+
*/
|
|
14
|
+
event?: Map<keyof DocumentEventMap, (e: Event) => boolean | void>;
|
|
15
|
+
}
|
|
16
|
+
export declare abstract class Drawable {
|
|
17
|
+
/**
|
|
18
|
+
* 지도의 native drawable object
|
|
19
|
+
*/
|
|
20
|
+
native?: any;
|
|
21
|
+
/**
|
|
22
|
+
* Drawable options
|
|
23
|
+
*/
|
|
24
|
+
abstract options: DrawableOptions;
|
|
25
|
+
}
|
|
26
|
+
export interface MarkerOptions extends DrawableOptions {
|
|
27
|
+
/**
|
|
28
|
+
* 마커의 좌표와 Element 사이의 offset 값
|
|
29
|
+
*/
|
|
30
|
+
anchor?: Offset;
|
|
31
|
+
/**
|
|
32
|
+
* zIndex 설정
|
|
33
|
+
*/
|
|
34
|
+
zIndex?: number;
|
|
35
|
+
}
|
|
36
|
+
export declare class Marker extends Drawable {
|
|
37
|
+
/**
|
|
38
|
+
* Marker 의 옵션
|
|
39
|
+
*/
|
|
40
|
+
options: MarkerOptions;
|
|
41
|
+
/**
|
|
42
|
+
* 커스텀 마커 Element
|
|
43
|
+
*/
|
|
44
|
+
element?: string | HTMLElement;
|
|
45
|
+
/**
|
|
46
|
+
* 지도에 표시할 마커정보
|
|
47
|
+
*/
|
|
48
|
+
constructor(options: MarkerOptions);
|
|
49
|
+
}
|
|
50
|
+
export interface PolylineOptions extends DrawableOptions {
|
|
51
|
+
/**
|
|
52
|
+
* 외곽선 의 색상
|
|
53
|
+
* @description css 의 color 에 준함
|
|
54
|
+
*/
|
|
55
|
+
lineColor?: string;
|
|
56
|
+
/**
|
|
57
|
+
* 외곽선 의 굵기
|
|
58
|
+
* @description 픽셀
|
|
59
|
+
*/
|
|
60
|
+
lineSize?: number;
|
|
61
|
+
/**
|
|
62
|
+
* 외곽선 의 투명도
|
|
63
|
+
* @description 0.0과 1.0 사이의 불투명도
|
|
64
|
+
*/
|
|
65
|
+
lineOpacity?: number;
|
|
66
|
+
/**
|
|
67
|
+
* 편집가능 여부
|
|
68
|
+
*/
|
|
69
|
+
editable?: boolean;
|
|
70
|
+
}
|
|
71
|
+
export declare class Polyline extends Drawable {
|
|
72
|
+
/**
|
|
73
|
+
* Polygon 의 옵션
|
|
74
|
+
*/
|
|
75
|
+
options: PolylineOptions;
|
|
76
|
+
/**
|
|
77
|
+
* 지도에 표시할 폴리곤정보
|
|
78
|
+
*/
|
|
79
|
+
constructor(options: PolylineOptions);
|
|
80
|
+
}
|
|
81
|
+
export interface PolygonOptions extends PolylineOptions {
|
|
82
|
+
/**
|
|
83
|
+
* 폴리곤 외곽선의 내부 다각형 position
|
|
84
|
+
*/
|
|
85
|
+
innerPositions?: Position[][];
|
|
86
|
+
/**
|
|
87
|
+
* 면의 배경색
|
|
88
|
+
* @description css 의 color 에 준함
|
|
89
|
+
*/
|
|
90
|
+
fillColor?: string;
|
|
91
|
+
/**
|
|
92
|
+
* 면의 투명도
|
|
93
|
+
* @description 0~1 의 값
|
|
94
|
+
*/
|
|
95
|
+
fillOpacity?: number;
|
|
96
|
+
}
|
|
97
|
+
export declare class Polygon extends Drawable {
|
|
98
|
+
/**
|
|
99
|
+
* Polygon 의 옵션
|
|
100
|
+
*/
|
|
101
|
+
options: PolygonOptions;
|
|
102
|
+
/**
|
|
103
|
+
* 지도에 표시할 폴리곤정보
|
|
104
|
+
*/
|
|
105
|
+
constructor(options: PolygonOptions);
|
|
106
|
+
/**
|
|
107
|
+
* 폴리곤의 중점을 구한다.
|
|
108
|
+
*/
|
|
109
|
+
getCenter(): Position;
|
|
110
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var tslib = require('tslib');
|
|
6
|
+
var calculate = require('../core/util/calculate.js');
|
|
7
|
+
var MapTypes = require('./MapTypes.js');
|
|
8
|
+
|
|
9
|
+
var Drawable =
|
|
10
|
+
/** @class */
|
|
11
|
+
function () {
|
|
12
|
+
function Drawable() {}
|
|
13
|
+
|
|
14
|
+
return Drawable;
|
|
15
|
+
}();
|
|
16
|
+
|
|
17
|
+
var Marker =
|
|
18
|
+
/** @class */
|
|
19
|
+
function (_super) {
|
|
20
|
+
tslib.__extends(Marker, _super);
|
|
21
|
+
/**
|
|
22
|
+
* 지도에 표시할 마커정보
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
function Marker(options) {
|
|
27
|
+
var _this = _super.call(this) || this;
|
|
28
|
+
|
|
29
|
+
_this.options = options;
|
|
30
|
+
return _this;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return Marker;
|
|
34
|
+
}(Drawable);
|
|
35
|
+
|
|
36
|
+
var Polyline =
|
|
37
|
+
/** @class */
|
|
38
|
+
function (_super) {
|
|
39
|
+
tslib.__extends(Polyline, _super);
|
|
40
|
+
/**
|
|
41
|
+
* 지도에 표시할 폴리곤정보
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
function Polyline(options) {
|
|
46
|
+
var _this = _super.call(this) || this;
|
|
47
|
+
|
|
48
|
+
_this.options = options;
|
|
49
|
+
return _this;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return Polyline;
|
|
53
|
+
}(Drawable);
|
|
54
|
+
|
|
55
|
+
var Polygon =
|
|
56
|
+
/** @class */
|
|
57
|
+
function (_super) {
|
|
58
|
+
tslib.__extends(Polygon, _super);
|
|
59
|
+
/**
|
|
60
|
+
* 지도에 표시할 폴리곤정보
|
|
61
|
+
*/
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
function Polygon(options) {
|
|
65
|
+
var _this = _super.call(this) || this;
|
|
66
|
+
|
|
67
|
+
_this.options = options;
|
|
68
|
+
return _this;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* 폴리곤의 중점을 구한다.
|
|
72
|
+
*/
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
Polygon.prototype.getCenter = function () {
|
|
76
|
+
if (Array.isArray(this.options.position) && this.options.position.length > 0) {
|
|
77
|
+
var paths = this.options.position.map(function (elem) {
|
|
78
|
+
return elem instanceof MapTypes.Position ? elem : new MapTypes.Position(elem[0], elem[1]);
|
|
79
|
+
});
|
|
80
|
+
return calculate.PolygonCalculator.getCenter(paths);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
throw new Error('center 를 찾을 수 없습니다.');
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
return Polygon;
|
|
87
|
+
}(Drawable);
|
|
88
|
+
|
|
89
|
+
exports.Drawable = Drawable;
|
|
90
|
+
exports.Marker = Marker;
|
|
91
|
+
exports.Polygon = Polygon;
|
|
92
|
+
exports.Polyline = Polyline;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { MapType } from "./CommonTypes";
|
|
2
|
+
import { Bounds, Offset, Position } from "./MapTypes";
|
|
3
|
+
export declare class MapEvent {
|
|
4
|
+
BOUNDS_CHANGED: string;
|
|
5
|
+
CENTER_CHANGED: string;
|
|
6
|
+
IDLE: string;
|
|
7
|
+
ZOOM_CHANGED: string;
|
|
8
|
+
ZOOMSTART: string;
|
|
9
|
+
get(eventName: MapEventName): string | undefined;
|
|
10
|
+
}
|
|
11
|
+
export declare class MapUIEvent {
|
|
12
|
+
CLICK: string;
|
|
13
|
+
DBLCLICK: string;
|
|
14
|
+
MOUSEDOWN: string;
|
|
15
|
+
MOUSEUP: string;
|
|
16
|
+
MOUSEOUT: string;
|
|
17
|
+
MOUSEMOVE: string;
|
|
18
|
+
MOUSEOVER: string;
|
|
19
|
+
DRAG: string;
|
|
20
|
+
DRAGSTART: string;
|
|
21
|
+
DRAGEND: string;
|
|
22
|
+
get(eventName: MapEventName): string | undefined;
|
|
23
|
+
}
|
|
24
|
+
export declare type MapEventName = keyof MapEvent | keyof MapUIEvent;
|
|
25
|
+
export declare type MapEventParam = {
|
|
26
|
+
center: Position;
|
|
27
|
+
bounds: Bounds;
|
|
28
|
+
zoomLevel: number;
|
|
29
|
+
};
|
|
30
|
+
export declare type MapUIEventParam = {
|
|
31
|
+
offset: Offset;
|
|
32
|
+
position: Position;
|
|
33
|
+
};
|
|
34
|
+
export declare type EventParamType = MapEventParam & MapUIEventParam;
|
|
35
|
+
export interface EventParam<T> {
|
|
36
|
+
mapType: MapType;
|
|
37
|
+
name: MapEventName;
|
|
38
|
+
vendorEventName: string;
|
|
39
|
+
param: T;
|
|
40
|
+
}
|
|
41
|
+
export declare type EventCallback<T> = (e: EventParam<T>) => void;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
// export type MapEvent = 'bounds_changed'|'center_changed'|'idle'|'zoom_changed'|'zoomstart'
|
|
6
|
+
// export type MapUIEvent = 'click'|'dblclick'|''
|
|
7
|
+
var MapEvent =
|
|
8
|
+
/** @class */
|
|
9
|
+
function () {
|
|
10
|
+
function MapEvent() {
|
|
11
|
+
this.BOUNDS_CHANGED = 'bounds_changed';
|
|
12
|
+
this.CENTER_CHANGED = 'center_changed';
|
|
13
|
+
this.IDLE = 'idle';
|
|
14
|
+
this.ZOOM_CHANGED = 'zoom_changed';
|
|
15
|
+
this.ZOOMSTART = 'zoomstart';
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
MapEvent.prototype.get = function (eventName) {
|
|
19
|
+
var value = this[eventName];
|
|
20
|
+
|
|
21
|
+
if (typeof value === 'string') {
|
|
22
|
+
return value;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
return MapEvent;
|
|
27
|
+
}();
|
|
28
|
+
|
|
29
|
+
var MapUIEvent =
|
|
30
|
+
/** @class */
|
|
31
|
+
function () {
|
|
32
|
+
function MapUIEvent() {
|
|
33
|
+
this.CLICK = 'click';
|
|
34
|
+
this.DBLCLICK = 'dblclick';
|
|
35
|
+
this.MOUSEDOWN = 'mousedown';
|
|
36
|
+
this.MOUSEUP = 'mouseup';
|
|
37
|
+
this.MOUSEOUT = 'mouseout';
|
|
38
|
+
this.MOUSEMOVE = 'mousemove';
|
|
39
|
+
this.MOUSEOVER = 'mouseover';
|
|
40
|
+
this.DRAG = 'drag';
|
|
41
|
+
this.DRAGSTART = 'dragstart';
|
|
42
|
+
this.DRAGEND = 'dragend';
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
MapUIEvent.prototype.get = function (eventName) {
|
|
46
|
+
var value = this[eventName];
|
|
47
|
+
|
|
48
|
+
if (typeof value === 'string') {
|
|
49
|
+
return value;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
return MapUIEvent;
|
|
54
|
+
}();
|
|
55
|
+
|
|
56
|
+
exports.MapEvent = MapEvent;
|
|
57
|
+
exports.MapUIEvent = MapUIEvent;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 좌표값
|
|
3
|
+
* @description 위도/경도, DOM 상의 X/Y 좌표
|
|
4
|
+
*/
|
|
5
|
+
export declare class Position {
|
|
6
|
+
/**
|
|
7
|
+
* 위도
|
|
8
|
+
* @description 위도(latitude)
|
|
9
|
+
*/
|
|
10
|
+
lat: number;
|
|
11
|
+
/**
|
|
12
|
+
* 경도
|
|
13
|
+
* @description 경도(longitude)
|
|
14
|
+
*/
|
|
15
|
+
lng: number;
|
|
16
|
+
/**
|
|
17
|
+
* offset 좌표
|
|
18
|
+
* @description DOM 상에서의 offset 정보
|
|
19
|
+
*/
|
|
20
|
+
offset?: Offset;
|
|
21
|
+
constructor(lat: number, lng: number);
|
|
22
|
+
static equals(pos1: Position, pos2: Position): boolean;
|
|
23
|
+
}
|
|
24
|
+
export declare class Bounds {
|
|
25
|
+
nw: Position;
|
|
26
|
+
se: Position;
|
|
27
|
+
ne: Position;
|
|
28
|
+
sw: Position;
|
|
29
|
+
constructor(nw?: Position, se?: Position, ne?: Position, sw?: Position);
|
|
30
|
+
static fromNWSE(nw: Position, se: Position): Bounds;
|
|
31
|
+
static fromNESW(ne: Position, sw: Position): Bounds;
|
|
32
|
+
private covertNWSEtoNESW;
|
|
33
|
+
private covertNESWtoNWSE;
|
|
34
|
+
getCenter(): Position;
|
|
35
|
+
includesPosition(pos: Position): boolean;
|
|
36
|
+
getIncludedPositions(positions: Position[]): Position[];
|
|
37
|
+
includes(positions: Position | Position[]): boolean;
|
|
38
|
+
includesOnlyOnePoint(positions: Position[]): boolean;
|
|
39
|
+
intersects(positions: Position[]): boolean;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* DOM 상에서의 좌표를 표현 (픽셀을 나타내는 숫자)
|
|
43
|
+
*/
|
|
44
|
+
export declare class Offset {
|
|
45
|
+
/**
|
|
46
|
+
* x 좌표
|
|
47
|
+
* @description DOM 상에서의 offsetX
|
|
48
|
+
*/
|
|
49
|
+
x: number;
|
|
50
|
+
/**
|
|
51
|
+
* y 좌표
|
|
52
|
+
* @description DOM 상에서의 offsetY
|
|
53
|
+
*/
|
|
54
|
+
y: number;
|
|
55
|
+
/**
|
|
56
|
+
* DOM 상에서의 좌표를 표현 (픽셀을 나타내는 숫자)
|
|
57
|
+
*/
|
|
58
|
+
constructor(x: number, y: number);
|
|
59
|
+
equals(other?: Offset): boolean | undefined;
|
|
60
|
+
}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var calculate = require('../core/util/calculate.js');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* 좌표값
|
|
9
|
+
* @description 위도/경도, DOM 상의 X/Y 좌표
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
var Position =
|
|
13
|
+
/** @class */
|
|
14
|
+
function () {
|
|
15
|
+
function Position(lat, lng) {
|
|
16
|
+
/**
|
|
17
|
+
* 위도
|
|
18
|
+
* @description 위도(latitude)
|
|
19
|
+
*/
|
|
20
|
+
this.lat = 0;
|
|
21
|
+
/**
|
|
22
|
+
* 경도
|
|
23
|
+
* @description 경도(longitude)
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
this.lng = 0;
|
|
27
|
+
this.lat = lat;
|
|
28
|
+
this.lng = lng;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
Position.equals = function (pos1, pos2) {
|
|
32
|
+
return pos1.lat === pos2.lat && pos1.lng === pos2.lng;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
return Position;
|
|
36
|
+
}();
|
|
37
|
+
|
|
38
|
+
var Bounds =
|
|
39
|
+
/** @class */
|
|
40
|
+
function () {
|
|
41
|
+
function Bounds(nw, se, ne, sw) {
|
|
42
|
+
if (!(nw && se || ne && sw)) {
|
|
43
|
+
throw new Error('nw/se or ne/sw needed');
|
|
44
|
+
} //@ts-ignore
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
this.nw = nw;
|
|
48
|
+
this.se = se;
|
|
49
|
+
this.ne = ne;
|
|
50
|
+
this.sw = sw;
|
|
51
|
+
|
|
52
|
+
if (nw && se) {
|
|
53
|
+
this.covertNWSEtoNESW(nw, se);
|
|
54
|
+
} else if (ne && sw) {
|
|
55
|
+
this.covertNESWtoNWSE(ne, sw);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
Bounds.fromNWSE = function (nw, se) {
|
|
60
|
+
return new Bounds(nw, se, undefined, undefined);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
Bounds.fromNESW = function (ne, sw) {
|
|
64
|
+
return new Bounds(undefined, undefined, ne, sw);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
Bounds.prototype.covertNWSEtoNESW = function (nw, se) {
|
|
68
|
+
this.ne = new Position(nw.lat, se.lng);
|
|
69
|
+
this.sw = new Position(se.lat, nw.lng);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
Bounds.prototype.covertNESWtoNWSE = function (ne, sw) {
|
|
73
|
+
this.nw = new Position(ne.lat, sw.lng);
|
|
74
|
+
this.se = new Position(sw.lat, ne.lng);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
Bounds.prototype.getCenter = function () {
|
|
78
|
+
return new Position(this.se.lat + (this.nw.lat - this.se.lat) / 2, this.nw.lng + (this.se.lng - this.nw.lng) / 2);
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
Bounds.prototype.includesPosition = function (pos) {
|
|
82
|
+
return this.nw.lng < pos.lng && this.se.lng > pos.lng && this.se.lat < pos.lat && this.nw.lat > pos.lat;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
Bounds.prototype.getIncludedPositions = function (positions) {
|
|
86
|
+
var result = [];
|
|
87
|
+
|
|
88
|
+
for (var _i = 0, positions_1 = positions; _i < positions_1.length; _i++) {
|
|
89
|
+
var pos = positions_1[_i];
|
|
90
|
+
|
|
91
|
+
if (this.includesPosition(pos)) {
|
|
92
|
+
result.push(pos);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return result;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
Bounds.prototype.includes = function (positions) {
|
|
100
|
+
positions = Array.isArray(positions) ? positions : [positions];
|
|
101
|
+
|
|
102
|
+
for (var _i = 0, positions_2 = positions; _i < positions_2.length; _i++) {
|
|
103
|
+
var pos = positions_2[_i];
|
|
104
|
+
|
|
105
|
+
if (!this.includesPosition(pos)) {
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return true;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
Bounds.prototype.includesOnlyOnePoint = function (positions) {
|
|
114
|
+
for (var _i = 0, positions_3 = positions; _i < positions_3.length; _i++) {
|
|
115
|
+
var pos = positions_3[_i];
|
|
116
|
+
|
|
117
|
+
if (this.includesPosition(pos)) {
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return false;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
Bounds.prototype.intersects = function (positions) {
|
|
126
|
+
return calculate.PolygonCalculator.intersects([this.nw, this.se], positions);
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
return Bounds;
|
|
130
|
+
}();
|
|
131
|
+
/**
|
|
132
|
+
* DOM 상에서의 좌표를 표현 (픽셀을 나타내는 숫자)
|
|
133
|
+
*/
|
|
134
|
+
|
|
135
|
+
var Offset =
|
|
136
|
+
/** @class */
|
|
137
|
+
function () {
|
|
138
|
+
/**
|
|
139
|
+
* DOM 상에서의 좌표를 표현 (픽셀을 나타내는 숫자)
|
|
140
|
+
*/
|
|
141
|
+
function Offset(x, y) {
|
|
142
|
+
this.x = x;
|
|
143
|
+
this.y = y;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
Offset.prototype.equals = function (other) {
|
|
147
|
+
return other && this.x === other.x && this.y === other.y;
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
return Offset;
|
|
151
|
+
}();
|
|
152
|
+
|
|
153
|
+
exports.Bounds = Bounds;
|
|
154
|
+
exports.Offset = Offset;
|
|
155
|
+
exports.Position = Position;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { MapVendorType } from "./CommonTypes";
|
|
2
|
+
import { Bounds, Position } from "./MapTypes";
|
|
3
|
+
import { MintMapController } from "../core/MintMapController";
|
|
4
|
+
export interface MintMapEvents {
|
|
5
|
+
/**
|
|
6
|
+
* 지도의 보여지는 영역이 변경되었을때 호출되는 콜백
|
|
7
|
+
*/
|
|
8
|
+
onBoundsChanged?: (bounds: Bounds) => void;
|
|
9
|
+
/**
|
|
10
|
+
* 지도의 줌이 변경되었을때 호출되는 콜백
|
|
11
|
+
*/
|
|
12
|
+
onZoomChanged?: (level: number) => void;
|
|
13
|
+
/**
|
|
14
|
+
* 지도 준비완료시 호출되는 콜백
|
|
15
|
+
*/
|
|
16
|
+
onLoad?: (map: MapVendorType, controller: MintMapController) => void;
|
|
17
|
+
/**
|
|
18
|
+
* 지도 클릭시 호출되는 콜백
|
|
19
|
+
*/
|
|
20
|
+
onClick?: (positon: Position) => void;
|
|
21
|
+
/**
|
|
22
|
+
* 지도 위에서 마우스 이동시 호출되는 콜백
|
|
23
|
+
*/
|
|
24
|
+
onMouseMove?: (positon: Position) => void;
|
|
25
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { MapType } from "./CommonTypes";
|
|
3
|
+
import { Position } from "./MapTypes";
|
|
4
|
+
import { MintMapEvents } from "./MintMapEvents";
|
|
5
|
+
/**
|
|
6
|
+
* Mint Map Props
|
|
7
|
+
*/
|
|
8
|
+
export interface MintMapProps extends MintMapEvents {
|
|
9
|
+
/**
|
|
10
|
+
* Mint Map 에서 지원하는 지도 타입
|
|
11
|
+
*/
|
|
12
|
+
mapType: MapType | null;
|
|
13
|
+
/**
|
|
14
|
+
* Map 종류에 따른 인증키
|
|
15
|
+
* @description 각 지도 타입에 맞는 키를 입력해야한다.
|
|
16
|
+
*/
|
|
17
|
+
mapKey: string;
|
|
18
|
+
/**
|
|
19
|
+
* Map 종류에 따른 추가 맵 ID
|
|
20
|
+
* @description 특정 지도에서는 맵ID 가 추가로 요구된다 (ex: Google Maps)
|
|
21
|
+
*/
|
|
22
|
+
mapId?: string;
|
|
23
|
+
/**
|
|
24
|
+
* 지도의 기본 설정 정보
|
|
25
|
+
*/
|
|
26
|
+
base?: BaseProps;
|
|
27
|
+
/**
|
|
28
|
+
* 지도의 보기 설정
|
|
29
|
+
*/
|
|
30
|
+
visible?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* 지도 중심 좌표
|
|
33
|
+
*/
|
|
34
|
+
center?: Position;
|
|
35
|
+
/**
|
|
36
|
+
* center 값을 통해 지도의 중심 으로 이동할때 panning 효과 적용 여부
|
|
37
|
+
*/
|
|
38
|
+
centerMoveWithPanning?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* 지도 줌레벨
|
|
41
|
+
*/
|
|
42
|
+
zoomLevel?: number;
|
|
43
|
+
/**
|
|
44
|
+
* 마우스의 드래그로 지도 위치 움직임 가능 여부
|
|
45
|
+
*/
|
|
46
|
+
draggable?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* 키보드 방향키로 지도 위치 움직임 가능 여부
|
|
49
|
+
*/
|
|
50
|
+
keyboardShortcuts?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* 마커 cache 사용 여부
|
|
53
|
+
*/
|
|
54
|
+
markerCache?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* 마커 cache 사용시 초기 pool 갯수
|
|
57
|
+
*/
|
|
58
|
+
markerCachePoolSize?: number;
|
|
59
|
+
/**
|
|
60
|
+
* 마커 cache 사용시 초기 pool 갯수
|
|
61
|
+
*/
|
|
62
|
+
boundsChangeThrottlingTime?: number;
|
|
63
|
+
/**
|
|
64
|
+
* 로딩 완료 후 장면전환 효과 여부
|
|
65
|
+
*/
|
|
66
|
+
dissolveEffectWhenLoaded?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* 맵 로딩화면
|
|
69
|
+
*/
|
|
70
|
+
mapLoadingComponent?: () => JSX.Element;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* 지도의 기본 설정
|
|
74
|
+
*/
|
|
75
|
+
export interface BaseProps {
|
|
76
|
+
/**
|
|
77
|
+
* 지도 시작시의 중심 좌표
|
|
78
|
+
*/
|
|
79
|
+
center?: Position;
|
|
80
|
+
/**
|
|
81
|
+
* 지도 시작시의 줌레벨
|
|
82
|
+
*/
|
|
83
|
+
zoomLevel?: number;
|
|
84
|
+
/**
|
|
85
|
+
* 지도의 최대 줌 레벨
|
|
86
|
+
*/
|
|
87
|
+
maxZoomLevel?: number;
|
|
88
|
+
/**
|
|
89
|
+
* 지도의 최소 줌 레벨
|
|
90
|
+
*/
|
|
91
|
+
minZoomLevel?: number;
|
|
92
|
+
}
|