forked from geoman-io/leaflet-geoman
-
Notifications
You must be signed in to change notification settings - Fork 0
/
leaflet-geoman.d.ts
164 lines (138 loc) · 4.79 KB
/
leaflet-geoman.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
import * as L from 'leaflet';
declare module 'leaflet' {
export interface GeomanLayerOptions {
pmIgnore?: boolean;
}
namespace PM {
export type SUPPORTED_SHAPES = (
'Marker' | 'Circle' | 'Line' |
'Rectangle' | 'Polygon' | 'Cut'
);
export type GEOMAN_MAP_DRAW_MODE_EVENTS = (
'pm:drawstart' | 'pm:drawend' | 'pm:create'
);
export type GEOMAN_MAP_EDIT_MODE_EVENTS = (
'pm:globaleditmodetoggled'
);
export type GEOMAN_MAP_DRAG_MODE_EVENTS = (
'pm:globaldrawmodetoggled'
);
export type GEOMAN_MAP_REMOVAL_MODE_EVENTS = (
'pm:globalremovalmodetoggled'
);
export type GEOMAN_MAP_CUT_MODE_EVENTS = (
'pm:cut'
);
export type GEOMAN_LAYER_DRAW_MODE_EVENTS = (
'pm:vertexadded' | 'pm:snapdrag' |
'pm:snap' | 'pm:unsnap' |
'pm:centerplaced'
);
export type GEOMAN_LAYER_EDIT_MODE_EVENTS = (
'pm:edit' | 'pm:vertexadded' | 'pm:vertexremoved' |
'pm:markerdragstart' | 'pm:markerdragend' | 'pm:snap' |
'pm:unsnap' | 'pm:intersect' | 'pm:centerplaced'
);
export type GEOMAN_LAYER_DRAG_MODE_EVENTS = (
'pm:dragstart' | 'pm:drag' | 'pm:dragend'
);
export type GEOMAN_LAYER_CUT_MODE_EVENTS = (
'pm:cut'
);
export interface GeomanHelpers {
getShapes(): string[];
}
export class MapDrawOptions {
snappable?: boolean;
snapDistance?: number;
snapMiddle?: boolean;
tooltips?: boolean;
allowSelfIntersection?: true;
templineStyle?: L.PathOptions;
hintlineStyle?: L.PathOptions;
cursorMarker?: boolean;
finishOn?: null | 'click' | 'dblclick' | 'mousedown' | 'mouseover' | 'mouseout' | 'contextmenu';
}
export class LayerDrawOptions {
snappable?: boolean;
snapDistance?: number;
allowSelfIntersection?: boolean;
preventMarkerRemoval?: boolean;
}
export class DrawControlOptions {
position?: ControlPosition;
drawMarker?: boolean;
drawCircleMarker?: boolean;
drawPolyline?: boolean;
drawRectangle?: boolean;
drawPolygon?: boolean;
drawCircle?: boolean;
editMode?: boolean;
dragMode?: boolean;
cutPolygon?: boolean;
removalMode?: boolean;
}
export function initialize(options?: { optIn: boolean }): void;
export class Translations {
tooltips?: {
placeMarker?: string;
firstVertex?: string;
continueLine?: string;
finishLine?: string;
finishPoly?: string;
finishRect?: string;
startCircle?: string;
finishCircle?: string;
placeCircleMarker?: string;
};
actions?: {
finish?: string;
cancel?: string;
removeLastVertex?: string;
};
buttonTitles?: {
drawMarkerButton?: string;
drawPolyButton?: string;
drawLineButton?: string;
drawCircleButton?: string;
drawRectButton?: string;
editButton?: string;
dragButton?: string;
cutButton?: string;
deleteButton?: string;
drawCircleMarkerButton?: string;
};
}
interface Map {
addControls(options?: DrawControlOptions): void;
enableDraw(shape: SUPPORTED_SHAPES, options?: MapDrawOptions): void;
disableDraw(shape: SUPPORTED_SHAPES): void;
enableGlobalEditMode(options): void;
disableGlobalEditMode(): void;
toggleGlobalEditMode(options): void;
globalEditEnabled(): boolean;
setLang(lang: 'en' | 'de' | 'it' | 'ru' | 'ro' | 'es' | 'fr' | 'pt_br' | 'zh' | 'nl', customTranslations?: Translations, fallbackLanguage?: string);
setPathOptions(options: PathOptions): void;
Draw: GeomanHelpers;
}
interface Layer {
enable(options?: LayerDrawOptions): void;
disable(): void;
toggleEdit(options?: LayerDrawOptions): void;
enabled(): boolean;
hasSelfIntersection(): boolean;
}
}
interface Map {
pm: PM.Map;
}
interface Layer {
pm: PM.Layer
}
interface LayerOptions {
pmIgnore?: boolean
}
interface MapOptions {
pmIgnore?: boolean;
}
}