How to use pm method in wpt

Best JavaScript code snippet using wpt

leaflet-geoman-extend.d.ts

Source:leaflet-geoman-extend.d.ts Github

copy

Full Screen

1///2/// Copyright © 2016-2022 The Thingsboard Authors3///4/// Licensed under the Apache License, Version 2.0 (the "License");5/// you may not use this file except in compliance with the License.6/// You may obtain a copy of the License at7///8/// http://www.apache.org/licenses/LICENSE-2.09///10/// Unless required by applicable law or agreed to in writing, software11/// distributed under the License is distributed on an "AS IS" BASIS,12/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13/// See the License for the specific language governing permissions and14/// limitations under the License.15///16/* tslint:disable:adjacent-overload-signatures unified-signatures */17import * as L from 'leaflet';18declare module 'leaflet-pm' {19 /**20 * Extends built in leaflet Layer Options.21 */22 interface LayerOptions {23 pmIgnore?: boolean;24 snapIgnore?: boolean;25 }26 /**27 * Extends built in leaflet Map Options.28 */29 interface MapOptions {30 pmIgnore?: boolean;31 }32 /**33 * Extends built in leaflet Map.34 */35 interface Map {36 pm: PM.PMMap;37 }38 /**39 * Extends built in leaflet Path.40 */41 interface Path {42 pm: PM.PMLayer;43 }44 /**45 * Extends built in leaflet ImageOverlay.46 */47 interface ImageOverlay {48 pm: PM.PMLayer;49 }50 /**51 * Extends built in leaflet LayerGroup.52 */53 interface LayerGroup {54 pm: PM.PMLayerGroup;55 }56 /**57 * Extends built in leaflet Polyline.58 */59 interface Polyline {60 /** Returns true if Line or Polygon has a self intersection. */61 hasSelfIntersection(): boolean;62 }63 /**64 * Extends @types/leaflet events...65 *66 * Todo: This is kind of a mess, and it makes all these event handlers show67 * up on Layers and Map. Leaflet itself is based around Evented, and @types/leaflet68 * makes this very hard to work around.69 *70 */71 interface Evented {72 /******************************************73 *74 * AVAILABLE ON MAP + LAYER, THESE ARE OK ON EVENTED.75 *76 ********************************************/77 /** Fired when a layer is removed via Removal Mode. */78 on(type: 'pm:remove', fn: PM.RemoveEventHandler): this;79 once(type: 'pm:remove', fn: PM.RemoveEventHandler): this;80 off(type: 'pm:remove', fn?: PM.RemoveEventHandler): this;81 /** Fired when the layer being cut. Draw+Edit Mode */82 on(type: 'pm:cut', fn: PM.CutEventHandler): this;83 once(type: 'pm:cut', fn: PM.CutEventHandler): this;84 off(type: 'pm:cut', fn?: PM.CutEventHandler): this;85 /** Fired when rotation is enabled for a layer. */86 on(type: 'pm:rotateenable', fn: PM.RotateEnableEventHandler): this;87 once(type: 'pm:rotateenable', fn: PM.RotateEnableEventHandler): this;88 off(type: 'pm:rotateenable', fn?: PM.RotateEnableEventHandler): this;89 /** Fired when rotation is disabled for a layer. */90 on(type: 'pm:rotatedisable', fn: PM.RotateDisableEventHandler): this;91 once(type: 'pm:rotatedisable', fn: PM.RotateDisableEventHandler): this;92 off(type: 'pm:rotatedisable', fn?: PM.RotateDisableEventHandler): this;93 /** Fired when rotation starts on a layer. */94 on(type: 'pm:rotatestart', fn: PM.RotateStartEventHandler): this;95 once(type: 'pm:rotatestart', fn: PM.RotateStartEventHandler): this;96 off(type: 'pm:rotatestart', fn?: PM.RotateStartEventHandler): this;97 /** Fired when a layer is rotated. */98 on(type: 'pm:rotate', fn: PM.RotateEventHandler): this;99 once(type: 'pm:rotate', fn: PM.RotateEventHandler): this;100 off(type: 'pm:rotate', fn?: PM.RotateEventHandler): this;101 /** Fired when rotation ends on a layer. */102 on(type: 'pm:rotateend', fn: PM.RotateEndEventHandler): this;103 once(type: 'pm:rotateend', fn: PM.RotateEndEventHandler): this;104 off(type: 'pm:rotateend', fn?: PM.RotateEndEventHandler): this;105 /******************************************106 *107 * TODO: DRAW/EDIT MODE EVENTS LAYER ONLY108 *109 ********************************************/110 /** Fired during a marker move/drag. */111 on(type: 'pm:snapdrag', fn: PM.SnapEventHandler): this;112 once(type: 'pm:snapdrag', fn: PM.SnapEventHandler): this;113 off(type: 'pm:snapdrag', fn?: PM.SnapEventHandler): this;114 /** Fired when a vertex is snapped. */115 on(type: 'pm:snap', fn: PM.SnapEventHandler): this;116 once(type: 'pm:snap', fn: PM.SnapEventHandler): this;117 off(type: 'pm:snap', fn?: PM.SnapEventHandler): this;118 /** Fired when a vertex is unsnapped. */119 on(type: 'pm:unsnap', fn: PM.SnapEventHandler): this;120 once(type: 'pm:unsnap', fn: PM.SnapEventHandler): this;121 off(type: 'pm:unsnap', fn?: PM.SnapEventHandler): this;122 /** Called when the center of a circle is placed/moved. */123 on(type: 'pm:centerplaced', fn: PM.CenterPlacedEventHandler): this;124 once(type: 'pm:centerplaced', fn: PM.CenterPlacedEventHandler): this;125 off(type: 'pm:centerplaced', fn?: PM.CenterPlacedEventHandler): this;126 /******************************************127 *128 * TODO: CUT/EDIT MODE EVENTS LAYER ONLY129 *130 ********************************************/131 /** Fired when a layer is edited. */132 on(type: 'pm:edit', fn: PM.EditEventHandler): this;133 once(type: 'pm:edit', fn: PM.EditEventHandler): this;134 off(type: 'pm:edit', fn?: PM.EditEventHandler): this;135 /******************************************136 *137 * TODO: DRAW MODE EVENTS ON MAP ONLY138 *139 ********************************************/140 /** Fired when Drawing Mode is toggled. */141 on(142 type: 'pm:globaldrawmodetoggled',143 fn: PM.GlobalDrawModeToggledEventHandler,144 context?: any145 ): L.Evented;146 once(147 type: 'pm:globaldrawmodetoggled',148 fn: PM.GlobalDrawModeToggledEventHandler,149 context?: any150 ): L.Evented;151 off(152 type: 'pm:globaldrawmodetoggled',153 fn?: PM.GlobalDrawModeToggledEventHandler,154 context?: any155 ): L.Evented;156 /** Called when drawing mode is enabled. Payload includes the shape type and working layer. */157 on(158 type: 'pm:drawstart',159 fn: PM.DrawStartEventHandler,160 context?: any161 ): L.Evented;162 once(163 type: 'pm:drawstart',164 fn: PM.DrawStartEventHandler,165 context?: any166 ): L.Evented;167 off(168 type: 'pm:drawstart',169 fn?: PM.DrawStartEventHandler,170 context?: any171 ): L.Evented;172 /** Called when drawing mode is disabled. Payload includes the shape type. */173 on(174 type: 'pm:drawend',175 fn: PM.DrawEndEventHandler,176 context?: any177 ): L.Evented;178 once(179 type: 'pm:drawend',180 fn: PM.DrawEndEventHandler,181 context?: any182 ): L.Evented;183 off(184 type: 'pm:drawend',185 fn?: PM.DrawEndEventHandler,186 context?: any187 ): L.Evented;188 /** Called when drawing mode is disabled. Payload includes the shape type. */189 on(type: 'pm:create', fn: PM.CreateEventHandler, context?: any): L.Evented;190 once(191 type: 'pm:create',192 fn: PM.CreateEventHandler,193 context?: any194 ): L.Evented;195 off(196 type: 'pm:create',197 fn?: PM.CreateEventHandler,198 context?: any199 ): L.Evented;200 /******************************************201 *202 * TODO: DRAW MODE EVENTS ON LAYER ONLY203 *204 ********************************************/205 /** Called when a new vertex is added. */206 on(type: 'pm:vertexadded', fn: PM.VertexAddedEventHandler): this;207 once(type: 'pm:vertexadded', fn: PM.VertexAddedEventHandler): this;208 off(type: 'pm:vertexadded', fn?: PM.VertexAddedEventHandler): this;209 /******************************************210 *211 * TODO: EDIT MODE EVENTS ON LAYER ONLY212 *213 ********************************************/214 /** Fired when edit mode is disabled and a layer is edited and its coordinates have changed. */215 on(type: 'pm:update', fn: PM.UpdateEventHandler): this;216 once(type: 'pm:update', fn: PM.UpdateEventHandler): this;217 off(type: 'pm:update', fn?: PM.UpdateEventHandler): this;218 /** Fired when edit mode on a layer is enabled. */219 on(type: 'pm:enable', fn: PM.EnableEventHandler): this;220 once(type: 'pm:enable', fn: PM.EnableEventHandler): this;221 off(type: 'pm:enable', fn?: PM.EnableEventHandler): this;222 /** Fired when edit mode on a layer is disabled. */223 on(type: 'pm:disable', fn: PM.DisableEventHandler): this;224 once(type: 'pm:disable', fn: PM.DisableEventHandler): this;225 off(type: 'pm:disable', fn?: PM.DisableEventHandler): this;226 /** Fired when a vertex is added. */227 on(type: 'pm:vertexadded', fn: PM.VertexAddedEventHandler2): this;228 once(type: 'pm:vertexadded', fn: PM.VertexAddedEventHandler2): this;229 off(type: 'pm:vertexadded', fn?: PM.VertexAddedEventHandler2): this;230 /** Fired when a vertex is removed. */231 on(type: 'pm:vertexremoved', fn: PM.VertexRemovedEventHandler): this;232 once(type: 'pm:vertexremoved', fn: PM.VertexRemovedEventHandler): this;233 off(type: 'pm:vertexremoved', fn?: PM.VertexRemovedEventHandler): this;234 /** Fired when a vertex is clicked. */235 on(type: 'pm:vertexclick', fn: PM.VertexClickEventHandler): this;236 once(type: 'pm:vertexclick', fn: PM.VertexClickEventHandler): this;237 off(type: 'pm:vertexclick', fn?: PM.VertexClickEventHandler): this;238 /** Fired when dragging of a marker which corresponds to a vertex starts. */239 on(type: 'pm:markerdragstart', fn: PM.MarkerDragStartEventHandler): this;240 once(type: 'pm:markerdragstart', fn: PM.MarkerDragStartEventHandler): this;241 off(type: 'pm:markerdragstart', fn?: PM.MarkerDragStartEventHandler): this;242 /** Fired when dragging a vertex-marker. */243 on(type: 'pm:markerdrag', fn: PM.MarkerDragEventHandler): this;244 once(type: 'pm:markerdrag', fn: PM.MarkerDragEventHandler): this;245 off(type: 'pm:markerdrag', fn?: PM.MarkerDragEventHandler): this;246 /** Fired when dragging of a vertex-marker ends. */247 on(type: 'pm:markerdragend', fn: PM.MarkerDragEndEventHandler): this;248 once(type: 'pm:markerdragend', fn: PM.MarkerDragEndEventHandler): this;249 off(type: 'pm:markerdragend', fn?: PM.MarkerDragEndEventHandler): this;250 /** Fired when coords of a layer are reset. E.g. by self-intersection.. */251 on(type: 'pm:layerreset', fn: PM.LayerResetEventHandler): this;252 once(type: 'pm:layerreset', fn: PM.LayerResetEventHandler): this;253 off(type: 'pm:layerreset', fn?: PM.LayerResetEventHandler): this;254 /** When allowSelfIntersection: false, this event is fired as soon as a self-intersection is detected. */255 on(type: 'pm:intersect', fn: PM.IntersectEventHandler): this;256 once(type: 'pm:intersect', fn: PM.IntersectEventHandler): this;257 off(type: 'pm:intersect', fn?: PM.IntersectEventHandler): this;258 /******************************************259 *260 * TODO: EDIT MODE EVENTS ON MAP ONLY261 *262 ********************************************/263 /** Fired when Edit Mode is toggled. */264 on(265 type: 'pm:globaleditmodetoggled',266 fn: PM.GlobalEditModeToggledEventHandler267 ): this;268 once(269 type: 'pm:globaleditmodetoggled',270 fn: PM.GlobalEditModeToggledEventHandler271 ): this;272 off(273 type: 'pm:globaleditmodetoggled',274 fn?: PM.GlobalEditModeToggledEventHandler275 ): this;276 /******************************************277 *278 * TODO: DRAG MODE EVENTS ON MAP ONLY279 *280 ********************************************/281 /** Fired when Drag Mode is toggled. */282 on(283 type: 'pm:globaldragmodetoggled',284 fn: PM.GlobalDragModeToggledEventHandler285 ): this;286 once(287 type: 'pm:globaldragmodetoggled',288 fn: PM.GlobalDragModeToggledEventHandler289 ): this;290 off(291 type: 'pm:globaldragmodetoggled',292 fn?: PM.GlobalDragModeToggledEventHandler293 ): this;294 /******************************************295 *296 * TODO: DRAG MODE EVENTS ON LAYER ONLY297 *298 ********************************************/299 /** Fired when a layer starts being dragged. */300 on(type: 'pm:dragstart', fn: PM.DragStartEventHandler): this;301 once(type: 'pm:dragstart', fn: PM.DragStartEventHandler): this;302 off(type: 'pm:dragstart', fn?: PM.DragStartEventHandler): this;303 /** Fired when a layer is dragged. */304 on(type: 'pm:drag', fn: PM.DragEventHandler): this;305 once(type: 'pm:drag', fn: PM.DragEventHandler): this;306 off(type: 'pm:drag', fn?: PM.DragEventHandler): this;307 /** Fired when a layer stops being dragged. */308 on(type: 'pm:dragend', fn: PM.DragEndEventHandler): this;309 once(type: 'pm:dragend', fn: PM.DragEndEventHandler): this;310 off(type: 'pm:dragend', fn?: PM.DragEndEventHandler): this;311 /******************************************312 *313 * TODO: REMOVE MODE EVENTS ON MAP ONLY314 *315 ********************************************/316 /** Fired when Removal Mode is toggled. */317 on(318 type: 'pm:globalremovalmodetoggled',319 fn: PM.GlobalRemovalModeToggledEventHandler320 ): this;321 once(322 type: 'pm:globalremovalmodetoggled',323 fn: PM.GlobalRemovalModeToggledEventHandler324 ): this;325 off(326 type: 'pm:globalremovalmodetoggled',327 fn?: PM.GlobalRemovalModeToggledEventHandler328 ): this;329 /******************************************330 *331 * TODO: CUT MODE EVENTS ON MAP ONLY332 *333 ********************************************/334 /** Fired when a layer is removed via Removal Mode. */335 on(336 type: 'pm:globalcutmodetoggled',337 fn: PM.GlobalCutModeToggledEventHandler338 ): this;339 once(340 type: 'pm:globalcutmodetoggled',341 fn: PM.GlobalCutModeToggledEventHandler342 ): this;343 off(344 type: 'pm:globalcutmodetoggled',345 fn?: PM.GlobalCutModeToggledEventHandler346 ): this;347 /******************************************348 *349 * TODO: ROTATE MODE EVENTS ON MAP ONLY350 *351 ********************************************/352 /** Fired when Rotate Mode is toggled. */353 on(354 type: 'pm:globalrotatemodetoggled',355 fn: PM.GlobalRotateModeToggledEventHandler356 ): this;357 once(358 type: 'pm:globalrotatemodetoggled',359 fn: PM.GlobalRotateModeToggledEventHandler360 ): this;361 off(362 type: 'pm:globalrotatemodetoggled',363 fn?: PM.GlobalRotateModeToggledEventHandler364 ): this;365 /******************************************366 *367 * TODO: TRANSLATION EVENTS ON MAP ONLY368 *369 ********************************************/370 /** Standard Leaflet event. Fired when any layer is removed. */371 on(type: 'pm:langchange', fn: PM.LangChangeEventHandler): this;372 once(type: 'pm:langchange', fn: PM.LangChangeEventHandler): this;373 off(type: 'pm:langchange', fn?: PM.LangChangeEventHandler): this;374 /******************************************375 *376 * TODO: CONTROL EVENTS ON MAP ONLY377 *378 ********************************************/379 /** Fired when a Toolbar button is clicked. */380 on(type: 'pm:buttonclick', fn: PM.ButtonClickEventHandler): this;381 once(type: 'pm:buttonclick', fn: PM.ButtonClickEventHandler): this;382 off(type: 'pm:buttonclick', fn?: PM.ButtonClickEventHandler): this;383 /** Fired when a Toolbar action is clicked. */384 on(type: 'pm:actionclick', fn: PM.ActionClickEventHandler): this;385 once(type: 'pm:actionclick', fn: PM.ActionClickEventHandler): this;386 off(type: 'pm:actionclick', fn?: PM.ActionClickEventHandler): this;387 /******************************************388 *389 * TODO: Keyboard EVENT ON MAP ONLY390 *391 ********************************************/392 /** Fired when `keydown` or `keyup` on the document is fired. */393 on(type: 'pm:keyevent', fn: PM.KeyboardKeyEventHandler): this;394 once(type: 'pm:keyevent', fn: PM.KeyboardKeyEventHandler): this;395 off(type: 'pm:keyevent', fn?: PM.KeyboardKeyEventHandler): this;396 }397 namespace PM {398 /** Supported shape names. 'ImageOverlay' is in Edit Mode only. Also accepts custom shape name. */399 type SUPPORTED_SHAPES =400 | 'Marker'401 | 'Circle'402 | 'Line'403 | 'Rectangle'404 | 'Polygon'405 | 'Cut'406 | 'CircleMarker'407 | 'ImageOverlay'408 | string;409 /**410 * Changes default registration of leaflet-geoman on leaflet layers.411 *412 * @param optIn - if true, a layers pmIgnore property has to be set to false to get initiated.413 */414 function setOptIn(optIn: boolean): void;415 /**416 * Enable leaflet-geoman on an ignored layer.417 *418 * @param layer - re-reads layer.options.pmIgnore to initialize leaflet-geoman.419 */420 function reInitLayer(layer: L.Layer): void;421 /**422 * PM map interface.423 */424 interface PMMap425 extends PMDrawMap,426 PMEditMap,427 PMDragMap,428 PMRemoveMap,429 PMCutMap,430 PMRotateMap {431 Toolbar: PMMapToolbar;432 Keyboard: PMMapKeyboard;433 /** Adds the Toolbar to the map. */434 addControls(options?: ToolbarOptions): void;435 /** Toggle the visiblity of the Toolbar. */436 removeControls(): void;437 /** Returns true if the Toolbar is visible on the map. */438 controlsVisible(): boolean;439 /** Toggle the visiblity of the Toolbar. */440 toggleControls(): void;441 setLang(442 lang:443 | 'cz'444 | 'da'445 | 'de'446 | 'el'447 | 'en'448 | 'es'449 | 'fa'450 | 'fr'451 | 'hu'452 | 'id'453 | 'it'454 | 'nl'455 | 'no'456 | 'pl'457 | 'pt_br'458 | 'ro'459 | 'ru'460 | 'sv'461 | 'tr'462 | 'ua'463 | 'zh'464 | 'zh_tw',465 customTranslations?: Translations,466 fallbackLanguage?: string467 ): void;468 /** Set globalOptions and apply them. */469 setGlobalOptions(options: GlobalOptions): void;470 /** Apply the current globalOptions to all existing layers. */471 applyGlobalOptions(): void;472 /** Returns the globalOptions. */473 getGlobalOptions(): GlobalOptions;474 }475 class Translations {476 tooltips?: {477 placeMarker?: string;478 firstVertex?: string;479 continueLine?: string;480 finishLine?: string;481 finishPoly?: string;482 finishRect?: string;483 startCircle?: string;484 finishCircle?: string;485 placeCircleMarker?: string;486 };487 actions?: {488 finish?: string;489 cancel?: string;490 removeLastVertex?: string;491 };492 buttonTitles?: {493 drawMarkerButton?: string;494 drawPolyButton?: string;495 drawLineButton?: string;496 drawCircleButton?: string;497 drawRectButton?: string;498 editButton?: string;499 dragButton?: string;500 cutButton?: string;501 deleteButton?: string;502 drawCircleMarkerButton?: string;503 };504 }505 type ACTION_NAMES = 'cancel' | 'removeLastVertex' | 'finish' | 'finishMode';506 class Action {507 text: string;508 onClick?: (e: any) => void;509 }510 type TOOLBAR_CONTROL_ORDER =511 | 'drawMarker'512 | 'drawCircleMarker'513 | 'drawPolyline'514 | 'drawRectangle'515 | 'drawPolygon'516 | 'drawCircle'517 | 'editMode'518 | 'dragMode'519 | 'cutPolygon'520 | 'removalMode'521 | 'rotateMode'522 | string;523 interface PMMapToolbar {524 /** Pass an array of button names to reorder the buttons in the Toolbar. */525 changeControlOrder(order?: TOOLBAR_CONTROL_ORDER[]): void;526 /** Receive the current order with. */527 getControlOrder(): TOOLBAR_CONTROL_ORDER[];528 /** The position of a block (draw, edit, custom, options⭐) in the Toolbar can be changed. If not set, the value */529 /** from position of the Toolbar is taken. */530 setBlockPosition(531 block: 'draw' | 'edit' | 'custom' | 'options',532 position: L.ControlPosition533 ): void;534 /** Returns a Object with the positions for all blocks */535 getBlockPositions(): BlockPositions;536 /** To add a custom Control to the Toolbar */537 createCustomControl(options: CustomControlOptions): void;538 /** Creates a copy of a draw Control. Returns the drawInstance and the control. */539 copyDrawControl(540 copyInstance: string,541 options?: CustomControlOptions542 ): void;543 /** Change the actions of an existing button. */544 changeActionsOfControl(545 name: string,546 actions: (ACTION_NAMES | Action)[]547 ): void;548 /** Disable button by control name */549 setButtonDisabled(name: TOOLBAR_CONTROL_ORDER, state: boolean): void;550 }551 type KEYBOARD_EVENT_TYPE = 'current' | 'keydown' | 'keyup';552 interface PMMapKeyboard {553 /** Pass an array of button names to reorder the buttons in the Toolbar. */554 getLastKeyEvent(type: KEYBOARD_EVENT_TYPE[]): KeyboardKeyEventHandler;555 /** Returns the current pressed key. [KeyboardEvent.key](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key). */556 getPressedKey(): string;557 /** Returns true if the `Shift` key is currently pressed. */558 isShiftKeyPressed(): boolean;559 /** Returns true if the `Alt` key is currently pressed. */560 isAltKeyPressed(): boolean;561 /** Returns true if the `Ctrl` key is currently pressed. */562 isCtrlKeyPressed(): boolean;563 /** Returns true if the `Meta` key is currently pressed. */564 isMetaKeyPressed(): boolean;565 }566 interface Button {567 /** Actions */568 actions: (ACTION_NAMES | Action)[];569 /** Function fired after clicking the control. */570 afterClick: () => void;571 /** CSS class with the Icon. */572 className: string;573 /** If true, other buttons will be disabled on click (default: true) */574 disableOtherButtons: boolean;575 /** Control can be toggled. */576 doToggle: boolean;577 /** Extending Class f. ex. Line, Polygon, ... L.PM.Draw.EXTENDINGCLASS */578 jsClass: string;579 /** Function fired when clicking the control. */580 onClick: () => void;581 position: L.ControlPosition;582 /** Text showing when you hover the control. */583 title: string;584 /** Toggle state true -> enabled, false -> disabled (default: false) */585 toggleStatus: boolean;586 /** Block of the control. 'options' is ⭐ only. */587 tool?: 'draw' | 'edit' | 'custom' | 'options';588 }589 interface CustomControlOptions {590 /** Name of the control */591 name: string;592 /** Block of the control. 'options' is ⭐ only. */593 block?: 'draw' | 'edit' | 'custom' | 'options';594 /** Text showing when you hover the control. */595 title?: string;596 /** CSS class with the Icon. */597 className?: string;598 /** Function fired when clicking the control. */599 onClick?: () => void;600 /** Function fired after clicking the control. */601 afterClick?: () => void;602 /** Actions */603 actions?: (ACTION_NAMES | Action)[];604 /** Control can be toggled. */605 toggle?: boolean;606 /** Control is disabled. */607 disabled?: boolean;608 }609 type PANE =610 | 'mapPane'611 | 'tilePane'612 | 'overlayPane'613 | 'shadowPane'614 | 'markerPane'615 | 'tooltipPane'616 | 'popupPane'617 | string;618 interface GlobalOptions extends DrawModeOptions, EditModeOptions {619 /** Add the created layers to a layergroup instead to the map. */620 layerGroup?: L.Map | L.LayerGroup;621 /** Prioritize the order of snapping. Default: ['Marker','CircleMarker','Circle','Line','Polygon','Rectangle']. */622 snappingOrder: SUPPORTED_SHAPES[];623 /** Defines in which panes the layers and helper vertices are created. Default: */624 /** { vertexPane: 'markerPane', layerPane: 'overlayPane', markerPane: 'markerPane' } */625 panes: { vertexPane: PANE; layerPane: PANE; markerPane: PANE };626 }627 interface PMDrawMap {628 /** Draw */629 Draw: Draw;630 /** Enable Draw Mode with the passed shape. */631 enableDraw(shape: SUPPORTED_SHAPES, options?: DrawModeOptions): void;632 /** Disable all drawing */633 disableDraw(shape?: SUPPORTED_SHAPES): void;634 /** Returns true if global Draw Mode is enabled. false when disabled. */635 globalDrawModeEnabled(): boolean;636 /** Customize the style of the drawn layer. Only for L.Path layers. */637 /** Shapes can be excluded with a ignoreShapes array or merged with the current style with merge: true in optionsModifier. */638 setPathOptions(639 options: L.PathOptions,640 optionsModifier?: { ignoreShapes?: SUPPORTED_SHAPES[]; merge?: boolean }641 ): void;642 /** Returns all Geoman layers on the map as array. Pass true to get a L.FeatureGroup. */643 getGeomanLayers(asFeatureGroup?: boolean): L.FeatureGroup | L.Layer[];644 /** Returns all Geoman draw layers on the map as array. Pass true to get a L.FeatureGroup. */645 getGeomanDrawLayers(asFeatureGroup?: boolean): L.FeatureGroup | L.Layer[];646 }647 interface PMEditMap {648 /** Enables edit mode. The passed options are preserved, even when the mode is enabled via the Toolbar */649 enableGlobalEditMode(options?: EditModeOptions): void;650 /** Disables global edit mode. */651 disableGlobalEditMode(): void;652 /** Toggles global edit mode. */653 toggleGlobalEditMode(options?: EditModeOptions): void;654 /** Returns true if global edit mode is enabled. false when disabled. */655 globalEditModeEnabled(): boolean;656 }657 interface PMDragMap {658 /** Enables global drag mode. */659 enableGlobalDragMode(): void;660 /** Disables global drag mode. */661 disableGlobalDragMode(): void;662 /** Toggles global drag mode. */663 toggleGlobalDragMode(): void;664 /** Returns true if global drag mode is enabled. false when disabled. */665 globalDragModeEnabled(): boolean;666 }667 interface PMRemoveMap {668 /** Enables global removal mode. */669 enableGlobalRemovalMode(): void;670 /** Disables global removal mode. */671 disableGlobalRemovalMode(): void;672 /** Toggles global removal mode. */673 toggleGlobalRemovalMode(): void;674 /** Returns true if global removal mode is enabled. false when disabled. */675 globalRemovalModeEnabled(): boolean;676 }677 interface PMCutMap {678 /** Enables global cut mode. */679 enableGlobalCutMode(options?: CutModeOptions): void;680 /** Disables global cut mode. */681 disableGlobalCutMode(): void;682 /** Toggles global cut mode. */683 toggleGlobalCutMode(options?: CutModeOptions): void;684 /** Returns true if global cut mode is enabled. false when disabled. */685 globalCutModeEnabled(): boolean;686 }687 interface PMRotateMap {688 /** Enables global rotate mode. */689 enableGlobalRotateMode(): void;690 /** Disables global rotate mode. */691 disableGlobalRotateMode(): void;692 /** Toggles global rotate mode. */693 toggleGlobalRotateMode(): void;694 /** Returns true if global rotate mode is enabled. false when disabled. */695 globalRotateModeEnabled(): boolean;696 }697 interface PMRotateLayer {698 /** Enables rotate mode on the layer. */699 enableRotate(): void;700 /** Disables rotate mode on the layer. */701 disableRotate(): void;702 /** Toggles rotate mode on the layer. */703 rotateEnabled(): void;704 /** Rotates the layer by x degrees. */705 rotateLayer(degrees: number): void;706 /** Rotates the layer to x degrees. */707 rotateLayerToAngle(degrees: number): void;708 /** Returns the angle of the layer in degrees. */709 getAngle(): number;710 }711 interface Draw {712 /** Array of available shapes. */713 getShapes(): SUPPORTED_SHAPES[];714 /** Returns the active shape. */715 getActiveShape(): SUPPORTED_SHAPES;716 /** Set path options */717 setPathOptions(options: L.PathOptions): void;718 /** Set options */719 setOptions(options: DrawModeOptions): void;720 /** Get options */721 getOptions(): DrawModeOptions;722 }723 interface CutModeOptions {724 allowSelfIntersection?: boolean;725 }726 type VertexValidationHandler = (e: {727 layer: L.Layer;728 marker: L.Marker;729 event: any;730 }) => boolean;731 interface EditModeOptions {732 /** Enable snapping to other layers vertices for precision drawing. Can be disabled by holding the ALT key (default:true). */733 snappable?: boolean;734 /** The distance to another vertex when a snap should happen (default:20). */735 snapDistance?: number;736 /** Allow self intersections (default:true). */737 allowSelfIntersection?: boolean;738 /** Allow self intersections (default:true). */739 allowSelfIntersectionEdit?: boolean;740 /** Disable the removal of markers via right click / vertices via removeVertexOn. (default:false). */741 preventMarkerRemoval?: boolean;742 /** If true, vertex removal that cause a layer to fall below their minimum required vertices will remove the entire layer. */743 /** If false, these vertices can't be removed. Minimum vertices are 2 for Lines and 3 for Polygons (default:true). */744 removeLayerBelowMinVertexCount?: boolean;745 /** Defines which layers should dragged with this layer together. */746 /** true syncs all layers in the same LayerGroup(s) or you pass an `Array` of layers to sync. (default:false). */747 syncLayersOnDrag?: L.Layer[] | boolean;748 /** Edit-Mode for the layer can disabled (`pm.enable()`). (default:true). */749 allowEditing?: boolean;750 /** Removing can be disabled for the layer. (default:true). */751 allowRemoval?: boolean;752 /** Layer can be prevented from cutting. (default:true). */753 allowCutting?: boolean;754 /** Layer can be prevented from rotation. (default:true). */755 allowRotation?: boolean;756 /** Dragging can be disabled for the layer. (default:true). */757 draggable?: boolean;758 /** Leaflet layer event to add a vertex to a Line or Polygon, like dblclick. (default:click). */759 addVertexOn?:760 | 'click'761 | 'dblclick'762 | 'mousedown'763 | 'mouseover'764 | 'mouseout'765 | 'contextmenu';766 /** A function for validation if a vertex (of a Line / Polygon) is allowed to add. */767 /** It passes a object with `[layer, marker, event}`. For example to check if the layer */768 /** has a certain property or if the `Ctrl` key is pressed. (default:undefined). */769 addVertexValidation?: undefined | VertexValidationHandler;770 /** Leaflet layer event to remove a vertex from a Line or Polygon, like dblclick. (default:contextmenu). */771 removeVertexOn?:772 | 'click'773 | 'dblclick'774 | 'mousedown'775 | 'mouseover'776 | 'mouseout'777 | 'contextmenu';778 /** A function for validation if a vertex (of a Line / Polygon) is allowed to remove. */779 /** It passes a object with `[layer, marker, event}`. For example to check if the layer has a certain property */780 /** or if the `Ctrl` key is pressed. */781 removeVertexValidation?: undefined | VertexValidationHandler;782 /** A function for validation if a vertex / helper-marker is allowed to move / drag. It passes a object with */783 /** `[layer, marker, event}`. For example to check if the layer has a certain property or if the `Ctrl` key is pressed. */784 moveVertexValidation?: undefined | VertexValidationHandler;785 /** Shows only n markers closest to the cursor. Use -1 for no limit (default:-1). */786 limitMarkersToCount?: number;787 /** Shows markers when under the given zoom level ⭐ */788 limitMarkersToZoom?: number;789 /** Shows only markers in the viewport ⭐ */790 limitMarkersToViewport?: boolean;791 /** Shows markers only after the layer was clicked ⭐ */792 limitMarkersToClick?: boolean;793 /** Pin shared vertices/markers together during edit ⭐ */794 pinning?: boolean;795 /** Hide the middle Markers in edit mode from Polyline and Polygon. */796 hideMiddleMarkers?: boolean;797 }798 interface DrawModeOptions {799 /** Enable snapping to other layers vertices for precision drawing. Can be disabled by holding the ALT key (default:true). */800 snappable?: boolean;801 /** The distance to another vertex when a snap should happen (default:20). */802 snapDistance?: number;803 /** Allow snapping in the middle of two vertices (middleMarker)(default:false). */804 snapMiddle?: boolean;805 /** Allow snapping between two vertices. (default: true) */806 snapSegment?: boolean;807 /** Require the last point of a shape to be snapped. (default: false). */808 requireSnapToFinish?: boolean;809 /** Show helpful tooltips for your user (default:true). */810 tooltips?: boolean;811 /** Allow self intersections (default:true). */812 allowSelfIntersection?: boolean;813 /** Leaflet path options for the lines between drawn vertices/markers. (default:{color:'red'}). */814 templineStyle?: L.PathOptions;815 /** Leaflet path options for the helper line between last drawn vertex and the cursor. (default:{color:'red',dashArray:[5,5]}). */816 hintlineStyle?: L.PathOptions;817 /** Leaflet path options for the drawn layer (Only for L.Path layers). (default:null). */818 pathOptions?: L.PathOptions;819 /** Leaflet marker options (only for drawing markers). (default:{draggable:true}). */820 markerStyle?: L.MarkerOptions;821 /** Show a marker at the cursor (default:true). */822 cursorMarker?: boolean;823 /** Leaflet layer event to finish the drawn shape (default:null). */824 finishOn?:825 | null826 | 'click'827 | 'dblclick'828 | 'mousedown'829 | 'mouseover'830 | 'mouseout'831 | 'contextmenu'832 | 'snap';833 /** Hide the middle Markers in edit mode from Polyline and Polygon. (default:false). */834 hideMiddleMarkers?: boolean;835 /** Set the min radius of a Circle. (default:null). */836 minRadiusCircle?: number;837 /** Set the max radius of a Circle. (default:null). */838 maxRadiusCircle?: number;839 /** Set the min radius of a CircleMarker when editable is active. (default:null). */840 minRadiusCircleMarker?: number;841 /** Set the max radius of a CircleMarker when editable is active. (default:null). */842 maxRadiusCircleMarker?: number;843 /** Makes a CircleMarker editable like a Circle (default:false). */844 editable?: boolean;845 /** Markers and CircleMarkers are editable during the draw-session */846 /** (you can drag them around immediately after drawing them) (default:true). */847 markerEditable?: boolean;848 /** Draw-Mode stays enabled after finishing a layer to immediately draw the next layer. */849 /** Defaults to true for Markers and CircleMarkers and false for all other layers. */850 continueDrawing?: boolean;851 /** Angel of rectangle. */852 rectangleAngle?: number;853 /** Cut-Mode: Only the passed layers can be cut. Cutted layers are removed from the */854 /** Array until no layers are left anymore and cutting is working on all layers again. (Default: []) */855 layersToCut?: L.Layer[];856 }857 /**858 * PM toolbar options.859 */860 interface ToolbarOptions {861 /** Toolbar position. */862 position?: L.ControlPosition;863 /** The position of each block can be customized. If not set, the value from position is taken. */864 positions?: BlockPositions;865 /** Adds button to draw Markers (default:true) */866 drawMarker?: boolean;867 /** Adds button to draw CircleMarkers (default:true) */868 drawCircleMarker?: boolean;869 /** Adds button to draw Line (default:true) */870 drawPolyline?: boolean;871 /** Adds button to draw Rectangle (default:true) */872 drawRectangle?: boolean;873 /** Adds button to draw Polygon (default:true) */874 drawPolygon?: boolean;875 /** Adds button to draw Circle (default:true) */876 drawCircle?: boolean;877 /** Adds button to toggle edit mode for all layers (default:true) */878 editMode?: boolean;879 /** Adds button to toggle drag mode for all layers (default:true) */880 dragMode?: boolean;881 /** Adds button to cut a hole in a polygon or line (default:true) */882 cutPolygon?: boolean;883 /** Adds a button to remove layers (default:true) */884 removalMode?: boolean;885 /** Adds a button to rotate layers (default:true) */886 rotateMode?: boolean;887 /** All buttons will be displayed as one block Customize Controls (default:false) */888 oneBlock?: boolean;889 /** Shows all draw buttons / buttons in the draw block (default:true) */890 drawControls?: boolean;891 /** Shows all edit buttons / buttons in the edit block (default:true) */892 editControls?: boolean;893 /** Shows all buttons in the custom block (default:true) */894 customControls?: boolean;895 /** Shows all options buttons / buttons in the option block ⭐ */896 optionsControls?: boolean;897 /** Adds a button to toggle the Pinning Option ⭐ */898 pinningOption?: boolean;899 /** Adds a button to toggle the Snapping Option ⭐ */900 snappingOption?: boolean;901 }902 /** the position of each block. */903 interface BlockPositions {904 /** Draw control position (default:''). '' also refers to this position. */905 draw?: L.ControlPosition;906 /** Edit control position (default:''). */907 edit?: L.ControlPosition;908 /** Custom control position (default:''). */909 custom?: L.ControlPosition;910 /** Options control position (default:'') ⭐ */911 options?: L.ControlPosition;912 }913 interface PMEditLayer {914 /** Enables edit mode. The passed options are preserved, even when the mode is enabled via the Toolbar */915 enable(options?: EditModeOptions): void;916 /** Sets layer options */917 setOptions(options?: EditModeOptions): void;918 /** Gets layer options */919 getOptions(): EditModeOptions;920 /** Disables edit mode. */921 disable(): void;922 /** Toggles edit mode. Passed options are preserved. */923 toggleEdit(options?: EditModeOptions): void;924 /** Returns true if edit mode is enabled. false when disabled. */925 enabled(): boolean;926 /** Returns true if Line or Polygon has a self intersection. */927 hasSelfIntersection(): boolean;928 /** Removes the layer with the same checks as GlobalRemovalMode. */929 remove(): void;930 }931 interface PMDragLayer {932 /** Enables dragging for the layer. */933 enableLayerDrag(): void;934 /** Disables dragging for the layer. */935 disableLayerDrag(): void;936 /** Returns if the layer is currently dragging. */937 dragging(): boolean;938 /** Returns if drag mode is enabled for the layer. */939 layerDragEnabled(): boolean;940 }941 interface PMLayer extends PMRotateLayer, PMEditLayer, PMDragLayer {942 /** Get shape of the layer. */943 getShape(): SUPPORTED_SHAPES;944 }945 interface PMLayerGroup {946 /** Enables edit mode for all child layers. The passed options are preserved, even when the mode is enabled via the Toolbar */947 enable(options?: EditModeOptions): void;948 /** Disable edit mode for all child layers. */949 disable(): void;950 /** Returns if minimum one layer is enabled. */951 enabled(): boolean;952 /** Toggle enable / disable on all layers. */953 toggleEdit(options?: EditModeOptions): void;954 /** Returns the layers of the LayerGroup. `deep=true` return also the children of LayerGroup children. */955 /** `filterGeoman=true` filter out layers that don't have Leaflet-Geoman or temporary stuff. */956 /** `filterGroupsOut=true` does not return the LayerGroup layers self. */957 /** (Default: `deep=false`,`filterGeoman=true`, `filterGroupsOut=true` ) */958 getLayers(959 deep?: boolean,960 filterGeoman?: boolean,961 filterGroupsOut?: boolean962 ): L.Layer[];963 /** Apply Leaflet-Geoman options to all children. The passed options are preserved, even when the mode is enabled via the Toolbar */964 setOptions(options?: EditModeOptions): void;965 /** Returns the options of the LayerGroup. */966 getOptions(): EditModeOptions;967 /** Returns if currently a layer in the LayerGroup is dragging. */968 dragging(): boolean;969 }970 namespace Utils {971 /** Returns the translation of the passed path. path = json-string f.ex. tooltips.placeMarker */972 function getTranslation(path: string): string;973 /** Returns the middle LatLng between two LatLngs */974 function calcMiddleLatLng(975 map: L.Map,976 latlng1: L.LatLng,977 latlng2: L.LatLng978 ): L.LatLng;979 /** Returns all layers that are available for Geoman */980 function findLayers(map: L.Map): L.Layer[];981 /** Converts a circle into a polygon with default 60 sides. For CRS.Simple maps `withBearing` needs to be false */982 function circleToPolygon(983 circle: L.Circle,984 sides?: number,985 withBearing?: boolean986 ): L.Polygon;987 /** Converts a px-radius (CircleMarker) to meter-radius (Circle). */988 /** The center LatLng is needed because the earth has different projections on different places. */989 function pxRadiusToMeterRadius(990 radiusInPx: number,991 map: L.Map,992 center: L.LatLng993 ): number;994 }995 /**996 * DRAW MODE MAP EVENT HANDLERS997 */998 export type GlobalDrawModeToggledEventHandler = (event: {999 enabled: boolean;1000 shape: PM.SUPPORTED_SHAPES;1001 map: L.Map;1002 }) => void;1003 export type DrawStartEventHandler = (e: {1004 shape: PM.SUPPORTED_SHAPES;1005 workingLayer: L.Layer;1006 }) => void;1007 export type DrawEndEventHandler = (e: {1008 shape: PM.SUPPORTED_SHAPES;1009 }) => void;1010 export type CreateEventHandler = (e: {1011 shape: PM.SUPPORTED_SHAPES;1012 layer: L.Layer;1013 }) => void;1014 /**1015 * DRAW MODE LAYER EVENT HANDLERS1016 */1017 export type VertexAddedEventHandler = (e: {1018 shape: PM.SUPPORTED_SHAPES;1019 workingLayer: L.Layer;1020 marker: L.Marker;1021 latlng: L.LatLng;1022 }) => void;1023 export type SnapEventHandler = (e: {1024 shape: PM.SUPPORTED_SHAPES;1025 distance: number;1026 layer: L.Layer;1027 workingLayer: L.Layer;1028 marker: L.Marker;1029 layerInteractedWith: L.Layer;1030 segement: any;1031 snapLatLng: L.LatLng;1032 }) => void;1033 export type CenterPlacedEventHandler = (e: {1034 shape: PM.SUPPORTED_SHAPES;1035 workingLayer: L.Layer;1036 latlng: L.LatLng;1037 }) => void;1038 /**1039 * EDIT MODE LAYER EVENT HANDLERS1040 */1041 export type EditEventHandler = (e: {1042 shape: PM.SUPPORTED_SHAPES;1043 layer: L.Layer;1044 }) => void;1045 export type UpdateEventHandler = (e: {1046 shape: PM.SUPPORTED_SHAPES;1047 layer: L.Layer;1048 }) => void;1049 export type EnableEventHandler = (e: {1050 shape: PM.SUPPORTED_SHAPES;1051 layer: L.Layer;1052 }) => void;1053 export type DisableEventHandler = (e: {1054 shape: PM.SUPPORTED_SHAPES;1055 layer: L.Layer;1056 }) => void;1057 export type VertexAddedEventHandler2 = (e: {1058 layer: L.Layer;1059 indexPath: number;1060 latlng: L.LatLng;1061 marker: L.Marker;1062 shape: PM.SUPPORTED_SHAPES;1063 }) => void;1064 export type VertexRemovedEventHandler = (e: {1065 layer: L.Layer;1066 indexPath: number;1067 marker: L.Marker;1068 shape: PM.SUPPORTED_SHAPES;1069 }) => void;1070 export type VertexClickEventHandler = (e: {1071 layer: L.Layer;1072 indexPath: number;1073 markerEvent: any;1074 shape: PM.SUPPORTED_SHAPES;1075 }) => void;1076 export type MarkerDragStartEventHandler = (e: {1077 layer: L.Layer;1078 indexPath: number;1079 markerEvent: any;1080 shape: PM.SUPPORTED_SHAPES;1081 }) => void;1082 export type MarkerDragEventHandler = (e: {1083 layer: L.Layer;1084 indexPath: number;1085 markerEvent: any;1086 shape: PM.SUPPORTED_SHAPES;1087 }) => void;1088 export type MarkerDragEndEventHandler = (e: {1089 layer: L.Layer;1090 indexPath: number;1091 markerEvent: any;1092 shape: PM.SUPPORTED_SHAPES;1093 intersectionRest: boolean;1094 }) => void;1095 export type LayerResetEventHandler = (e: {1096 layer: L.Layer;1097 indexPath: number;1098 markerEvent: any;1099 shape: PM.SUPPORTED_SHAPES;1100 }) => void;1101 export type IntersectEventHandler = (e: {1102 shape: PM.SUPPORTED_SHAPES;1103 layer: L.Layer;1104 intersection: L.LatLng;1105 }) => void;1106 /**1107 * EDIT MODE MAP EVENT HANDLERS1108 */1109 export type GlobalEditModeToggledEventHandler = (event: {1110 enabled: boolean;1111 map: L.Map;1112 }) => void;1113 /**1114 * DRAG MODE MAP EVENT HANDLERS1115 */1116 export type GlobalDragModeToggledEventHandler = (event: {1117 enabled: boolean;1118 map: L.Map;1119 }) => void;1120 /**1121 * DRAG MODE LAYER EVENT HANDLERS1122 */1123 export type DragStartEventHandler = (e: {1124 layer: L.Layer;1125 shape: PM.SUPPORTED_SHAPES;1126 }) => void;1127 export type DragEventHandler = (e: {1128 layer: L.Layer;1129 containerPoint: any;1130 latlng: L.LatLng;1131 layerPoint: L.Point;1132 originalEvent: any;1133 shape: PM.SUPPORTED_SHAPES;1134 }) => void;1135 export type DragEndEventHandler = (e: {1136 layer: L.Layer;1137 shape: PM.SUPPORTED_SHAPES;1138 }) => void;1139 /**1140 * REMOVE MODE LAYER EVENT HANDLERS1141 */1142 export type RemoveEventHandler = (e: {1143 layer: L.Layer;1144 shape: PM.SUPPORTED_SHAPES;1145 }) => void;1146 /**1147 * REMOVE MODE MAP EVENT HANDLERS1148 */1149 export type GlobalRemovalModeToggledEventHandler = (e: {1150 enabled: boolean;1151 map: L.Map;1152 }) => void;1153 /**1154 * CUT MODE MAP EVENT HANDLERS1155 */1156 export type GlobalCutModeToggledEventHandler = (e: {1157 enabled: boolean;1158 map: L.Map;1159 }) => void;1160 export type CutEventHandler = (e: {1161 layer: L.Layer;1162 originalLayer: L.Layer;1163 shape: PM.SUPPORTED_SHAPES;1164 }) => void;1165 /**1166 * ROTATE MODE LAYER EVENT HANDLERS1167 */1168 export type RotateEnableEventHandler = (e: {1169 layer: L.Layer;1170 helpLayer: L.Layer;1171 }) => void;1172 export type RotateDisableEventHandler = (e: { layer: L.Layer }) => void;1173 export type RotateStartEventHandler = (e: {1174 layer: L.Layer;1175 helpLayer: L.Layer;1176 startAngle: number;1177 originLatLngs: L.LatLng[];1178 }) => void;1179 export type RotateEventHandler = (e: {1180 layer: L.Layer;1181 helpLayer: L.Layer;1182 startAngle: number;1183 angle: number;1184 angleDiff: number;1185 oldLatLngs: L.LatLng[];1186 newLatLngs: L.LatLng[];1187 }) => void;1188 export type RotateEndEventHandler = (e: {1189 layer: L.Layer;1190 helpLayer: L.Layer;1191 startAngle: number;1192 angle: number;1193 originLatLngs: L.LatLng[];1194 newLatLngs: L.LatLng[];1195 }) => void;1196 /**1197 * ROTATE MODE MAP EVENT HANDLERS1198 */1199 export type GlobalRotateModeToggledEventHandler = (e: {1200 enabled: boolean;1201 map: L.Map;1202 }) => void;1203 /**1204 * TRANSLATION EVENT HANDLERS1205 */1206 export type LangChangeEventHandler = (e: {1207 activeLang: string;1208 oldLang: string;1209 fallback: string;1210 translations: PM.Translations;1211 }) => void;1212 /**1213 * CONTROL MAP EVENT HANDLERS1214 */1215 export type ButtonClickEventHandler = (e: {1216 btnName: string;1217 button: PM.Button;1218 }) => void;1219 export type ActionClickEventHandler = (e: {1220 text: string;1221 action: string;1222 btnName: string;1223 button: PM.Button;1224 }) => void;1225 /**1226 * KEYBOARD EVENT HANDLERS1227 */1228 export type KeyboardKeyEventHandler = (e: {1229 focusOn: 'document' | 'map';1230 eventType: 'keydown' | 'keyup';1231 event: any;1232 }) => void;1233 }1234 namespace PM {1235 interface PMMapToolbar {1236 toggleButton(1237 name: string,1238 status: boolean,1239 disableOthers?: boolean1240 ): void;1241 }1242 }...

Full Screen

Full Screen

L.PM.js

Source:L.PM.js Github

copy

Full Screen

1/* A Leaflet Plugin For Editing Geometry Layers in Leaflet 1.02 * Copyright (C) Geoman.io and Sumit Kumar - All Rights Reserved3 * Unauthorized copying of this file, via any medium is strictly prohibited4 * Proprietary and confidential5 * Written by Sumit Kumar <sumit@geoman.io>, January 20206 * Twitter: @TweetsOfSumit7 * OSS Repo: https://github.com/geoman-io/leaflet-geoman8 * Get Pro: https://geoman.io/leaflet-geoman#pro9 */10import './polyfills';11import { version } from '../../package.json';12import Map from './L.PM.Map';13import Toolbar from './Toolbar/L.PM.Toolbar';14import Draw from './Draw/L.PM.Draw';15import './Draw/L.PM.Draw.Marker';16import './Draw/L.PM.Draw.Line';17import './Draw/L.PM.Draw.Polygon';18import './Draw/L.PM.Draw.Rectangle';19import './Draw/L.PM.Draw.Circle';20import './Draw/L.PM.Draw.CircleMarker';21import './Draw/L.PM.Draw.Cut';22import Edit from './Edit/L.PM.Edit';23import './Edit/L.PM.Edit.LayerGroup';24import './Edit/L.PM.Edit.Marker';25import './Edit/L.PM.Edit.Line';26import './Edit/L.PM.Edit.Polygon';27import './Edit/L.PM.Edit.Rectangle';28import './Edit/L.PM.Edit.Circle';29import './Edit/L.PM.Edit.CircleMarker';30import '../css/layers.css';31import '../css/controls.css';32L.PM = L.PM || {33 version,34 Map,35 Toolbar,36 Draw,37 Edit,38 activeLang: 'en',39 initialize(options) {40 this.addInitHooks(options);41 },42 addInitHooks(options = {}) {43 function initMap() {44 this.pm = undefined;45 if (options.optIn) {46 if (this.options.pmIgnore === false) {47 this.pm = new L.PM.Map(this);48 }49 } else if (!this.options.pmIgnore) {50 this.pm = new L.PM.Map(this);51 }52 }53 L.Map.addInitHook(initMap);54 function initLayerGroup() {55 // doesn't need pmIgnore condition as the init hook of the individual layers will check it56 this.pm = new L.PM.Edit.LayerGroup(this);57 }58 L.LayerGroup.addInitHook(initLayerGroup);59 function initMarker() {60 this.pm = undefined;61 if (options.optIn) {62 if (this.options.pmIgnore === false) {63 this.pm = new L.PM.Edit.Marker(this);64 }65 } else if (!this.options.pmIgnore) {66 this.pm = new L.PM.Edit.Marker(this);67 }68 }69 L.Marker.addInitHook(initMarker);70 function initCircleMarker() {71 this.pm = undefined;72 if (options.optIn) {73 if (this.options.pmIgnore === false) {74 this.pm = new L.PM.Edit.CircleMarker(this);75 }76 } else if (!this.options.pmIgnore) {77 this.pm = new L.PM.Edit.CircleMarker(this);78 }79 }80 L.CircleMarker.addInitHook(initCircleMarker);81 function initPolyline() {82 this.pm = undefined;83 if (options.optIn) {84 if (this.options.pmIgnore === false) {85 this.pm = new L.PM.Edit.Line(this);86 }87 } else if (!this.options.pmIgnore) {88 this.pm = new L.PM.Edit.Line(this);89 }90 }91 L.Polyline.addInitHook(initPolyline);92 function initPolygon() {93 this.pm = undefined;94 if (options.optIn) {95 if (this.options.pmIgnore === false) {96 this.pm = new L.PM.Edit.Polygon(this);97 }98 } else if (!this.options.pmIgnore) {99 this.pm = new L.PM.Edit.Polygon(this);100 }101 }102 L.Polygon.addInitHook(initPolygon);103 function initRectangle() {104 this.pm = undefined;105 if (options.optIn) {106 if (this.options.pmIgnore === false) {107 this.pm = new L.PM.Edit.Rectangle(this);108 }109 } else if (!this.options.pmIgnore) {110 this.pm = new L.PM.Edit.Rectangle(this);111 }112 }113 L.Rectangle.addInitHook(initRectangle);114 function initCircle() {115 this.pm = undefined;116 if (options.optIn) {117 if (this.options.pmIgnore === false) {118 this.pm = new L.PM.Edit.Circle(this);119 }120 } else if (!this.options.pmIgnore) {121 this.pm = new L.PM.Edit.Circle(this);122 }123 }124 L.Circle.addInitHook(initCircle);125 },126};127// initialize leaflet-geoman...

Full Screen

Full Screen

methonds.js

Source:methonds.js Github

copy

Full Screen

1//Probado en Postman2// Get Methonds3pm.test("Retorno OK", ()=> {4 pm.response.to.have.status(200);5});6pm.test("Tiempo de respuesta menor a 500ms", ()=> {7 pm.expect(pm.response.responseTime).to.be.below(500);8});910pm.test("Existe contenido en el body", ()=>{11 pm.response.to.be.withBody;12});1314pm.test("Esta retornado un Json", ()=>{15 pm.response.to.be.json;16})1718pm.test("El atributo de retorno es nombre ", ()=>{19 pm.expect(pm.response.text()).to.include("nombre")20});2122//Post Methonds2324pm.test("Retorno Ok", function () {25 pm.response.to.have.status(200);26});27pm.test("Duracion de la peticion menor a 500ms", function () {28 pm.expect(pm.response.responseTime).to.be.below(500);29});30pm.test("Insercion de datos", function () {31 pm.expect(pm.response.code).to.be.oneOf([201, 202]);32});3334// Put Methonds35pm.test("Retorno Ok", function () {36 pm.response.to.have.status(200);37});38pm.test("Duraccion de la peticion menor a 500ms", function () {39 pm.expect(pm.response.responseTime).to.be.below(500);40});4142pm.test("Esta retornado un Json", ()=>{43 pm.response.to.be.json;44})45pm.test("Modificacion exitosa", function (){46 pm.response.to.not.have.jsonBody("error")47});484950///Delete Methonds51pm.test("Retorno Ok", function () {52 pm.response.to.have.status(200);53});54pm.test("Duraccion de la peticion 600ms", function () {55 pm.expect(pm.response.responseTime).to.be.below(600);56});57pm.test("Content-Type esta presente", function () {58 pm.response.to.have.header("Content-Type"); ...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest')('www.webpagetest.org');2var options = {3};4 if (err) return console.error(err);5 console.log(data);6});

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run wpt automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful