@rural-environmental-registry/map_component 1.0.0 → 1.2.0

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.
Files changed (71) hide show
  1. package/README.md +444 -0
  2. package/dist/constants/coordinatePanel.d.ts +1 -1
  3. package/dist/handlers/drawingControl.d.ts +0 -1
  4. package/dist/handlers/mapHandler.d.ts +8 -3
  5. package/dist/handlers/mapToolsHandler.d.ts +39 -0
  6. package/dist/handlers/measureToolsHandler.d.ts +51 -0
  7. package/dist/handlers/memorialButtonControl.d.ts +19 -0
  8. package/dist/handlers/toolsConstants.d.ts +3 -0
  9. package/dist/index.css +1 -1
  10. package/dist/index.d.ts +2 -0
  11. package/dist/index.mjs +32914 -25131
  12. package/dist/types/index.d.ts +69 -0
  13. package/dist/utils/areaCalculator.d.ts +3 -0
  14. package/dist/utils/drawingPathOptions.d.ts +8 -0
  15. package/dist/utils/geometryCalculator.d.ts +13 -0
  16. package/dist/utils/geometryFileParseResult.d.ts +8 -0
  17. package/dist/utils/memorialLayer.d.ts +3 -0
  18. package/dist/utils/menuHistory.d.ts +8 -0
  19. package/dist/utils/normalizeGeoJsonToFeatures.d.ts +2 -0
  20. package/dist/utils/parseGeoJsonFile.d.ts +2 -0
  21. package/dist/utils/parseKmlFile.d.ts +2 -0
  22. package/dist/utils/parseShapefileZip.d.ts +3 -0
  23. package/dist/utils/stableMarker.d.ts +15 -0
  24. package/dist/utils/validateImportedPolygonGeometry.d.ts +9 -0
  25. package/package.json +22 -4
  26. package/src/assets/icons/file-import-regular-full-gray.svg +1 -0
  27. package/src/assets/icons/file-lines-regular-full-gray.svg +1 -0
  28. package/src/assets/icons/layer-icon.svg +3 -0
  29. package/src/assets/icons/loading.gif +0 -0
  30. package/src/assets/icons/marker-icon.svg +1 -0
  31. package/src/assets/icons/measure-icon.svg +5 -0
  32. package/src/assets/layers/mapLayers.json +16 -0
  33. package/src/assets/main.css +187 -0
  34. package/src/assets/styles/element-plus.css +25 -0
  35. package/src/assets/styles/layers-menu.css +95 -0
  36. package/src/assets/styles/leaflet.css +361 -0
  37. package/src/components/MapDPG.vue +302 -0
  38. package/src/components/coordinate/CoordinatePanel.vue +1206 -0
  39. package/src/components/fa-icon/FontAwesomeIcon.vue +44 -0
  40. package/src/components/loading/Loading.vue +25 -0
  41. package/src/components/map/LeafletMap.vue +183 -0
  42. package/src/components/menu/ChildMenu.vue +112 -0
  43. package/src/components/menu/LayerMenu.vue +294 -0
  44. package/src/components/menu/ParentMenu.vue +132 -0
  45. package/src/constants/coordinatePanel.ts +68 -0
  46. package/src/handlers/constants.ts +35 -0
  47. package/src/handlers/drawingControl.ts +143 -0
  48. package/src/handlers/mapHandler.ts +124 -0
  49. package/src/handlers/mapToolsHandler.ts +281 -0
  50. package/src/handlers/measureToolsHandler.ts +424 -0
  51. package/src/handlers/memorialButtonControl.ts +171 -0
  52. package/src/handlers/toolsConstants.ts +69 -0
  53. package/src/index.ts +6 -0
  54. package/src/shims-vue.d.ts +5 -0
  55. package/src/types/index.ts +260 -0
  56. package/src/types/json.d.ts +4 -0
  57. package/src/types/shpjs.d.ts +7 -0
  58. package/src/types/svg.d.ts +4 -0
  59. package/src/utils/CoordinateConverter.ts +43 -0
  60. package/src/utils/areaCalculator.ts +9 -0
  61. package/src/utils/drawingPathOptions.ts +57 -0
  62. package/src/utils/geometryCalculator.ts +62 -0
  63. package/src/utils/geometryFileParseResult.ts +5 -0
  64. package/src/utils/memorialLayer.ts +7 -0
  65. package/src/utils/menuHistory.ts +71 -0
  66. package/src/utils/normalizeGeoJsonToFeatures.ts +52 -0
  67. package/src/utils/parseGeoJsonFile.ts +23 -0
  68. package/src/utils/parseKmlFile.ts +31 -0
  69. package/src/utils/parseShapefileZip.ts +29 -0
  70. package/src/utils/stableMarker.ts +52 -0
  71. package/src/utils/validateImportedPolygonGeometry.ts +62 -0
package/README.md ADDED
@@ -0,0 +1,444 @@
1
+ # MAPA DPG
2
+
3
+ MapaDPG é um componente de mapa interativo para aplicações Vue.js que permite customização de camadas, opções de mapa e
4
+ ferramentas de desenho. A biblioteca é baseada em Leaflet.js e oferece suporte a múltiplas camadas, ferramentas de
5
+ desenho personalizadas e interface adaptável.
6
+
7
+ *Atenção: Essa biblioteca pode ser utilizada apenas para projetos em Vue.js 3.*
8
+
9
+
10
+ > *** Antes de editar,
11
+ > leia [Wiki versionamento](https://inovacao.dataprev.gov.br/git/car-dpg/map-component/wikis/Versionamento) ***
12
+
13
+ ## Instalação
14
+
15
+ Execute o seguinte comando uma única vez em sua máquina, substituindo `<SEU_USUARIO>` e `<SEU_TOKEN>` por suas
16
+ credenciais de acesso:
17
+
18
+ ```bash
19
+ git config --global url."https://<SEU_USUARIO>:<SEU_TOKEN>@inovacao.dataprev.gov.br".insteadOf "https://inovacao.dataprev.gov.br"
20
+ ```
21
+
22
+ Após executar este comando, o Git irá automaticamente usar suas credenciais ao buscar dependências do
23
+ `inovacao.dataprev.gov.br`.
24
+
25
+ Por se tratar de uma biblioteca versionada, substitua `<VERSION>` pela versão que deseja. Exemplo v3.0
26
+
27
+ ```package.json
28
+ "dependencies": {
29
+ "dpg-mapa": "git+https://inovacao.dataprev.gov.br/git/car-dpg/map-component.git#<VERSION>",
30
+ }
31
+
32
+ ```
33
+
34
+ Registrando globalmente no main.js:
35
+
36
+ ```js
37
+ import { createApp } from 'vue'
38
+ import MapaDpg from 'node_modules/dpg-mapa/dist'
39
+
40
+ const app = createApp({})
41
+
42
+
43
+ app.component('MapaDpg', MapaDpg)
44
+
45
+ app.mount('#app')
46
+ ```
47
+
48
+ Ou registrando localmente:
49
+
50
+ ```js
51
+ <template>
52
+ <MapaDpg/>
53
+ </template>
54
+
55
+ <script setup>
56
+ import MapaDpg from 'node_modules/dpg-mapa/dist'
57
+ </script>
58
+ ```
59
+
60
+ Em ambos os casos é necessário importar o arquivo de estilos do mapa.
61
+
62
+ ```css
63
+ @import 'node_modules/dpg-mapa/dist/index.css';
64
+ ```
65
+
66
+ ## Utilização
67
+
68
+ O componente aceita parametros e emite eventos. Além disso, expôe instâncias atraves de refs.
69
+
70
+ ```vue
71
+
72
+ <template>
73
+ <MapaDpg
74
+ :layers="layers"
75
+ :options="options"
76
+ :showLoading="showLoading"
77
+ :disableLoading="disableLoading"
78
+ :descriptiveMemorial="descriptiveMemorial"
79
+ @onChildLayerToggle="onChildLayerToggle"
80
+ @onGroupLayerToggle="onGroupLayerToggle"
81
+ @onDrawing="onDrawing"
82
+ ref="mapRef"
83
+ />
84
+ </template>
85
+ <script setup>
86
+ const mapRef = ref(null)
87
+
88
+ const mapRefInstances = computed(() => {
89
+ return {
90
+ map: mapRef.value?.map,
91
+ layerControl: mapRef.value?.layerControl,
92
+ drawItemsGroup: mapRef.value?.drawItemsGroup,
93
+ leaflet: mapRef.value?.leaflet
94
+ }
95
+ })
96
+ </script>
97
+ ```
98
+
99
+ ### Propriedades
100
+
101
+ | Nome | Tipo | Obrigatório | Descrição |
102
+ |---------------------|-------------------------------------------|-------------|----------------------------------------------------------------------------|
103
+ | showLoading | boolean | Opcional | Controla a visibilidade da animação de carregamento. |
104
+ | layers | [MapLayers](docs/properties.md) | Opcional | Define as camadas base e camadas customizadas. |
105
+ | options | [MapOptionsConfig](docs/properties.md) | Opcional | Define as configurações do mapa, menu de camadas e ferramentas de desenho. |
106
+ | disableLoading | boolean | Opcional | Desabilita o animação de carregamento. |
107
+ | descriptiveMemorial | [DescriptiveMemorial](docs/properties.md) | Opcional | Controla a visibilidade do memorial descritivo. |
108
+
109
+ ### Eventos
110
+
111
+ | Nome | Descrição |
112
+ |--------------------|-------------------------------------------------------------------------------------------------------------------------------------------|
113
+ | onChildLayerToggle | Emite os dados da camada adicionada/removida do mapa |
114
+ | onGroupLayerToggle | Emite os dados do grupo e das suas camadas adicionadas/removidas do mapa |
115
+ | onDrawing | Emite os dados do(s) desenho(s) adicionado(s)/removido(s) do mapa. Poligonos e retângulos são incrementados com a propriedade "drawnArea" |
116
+ | onCoordinateSystemChange | Emite o sistema de referência selecionado no memorial descritivo (ex.: `SIRGAS2000`) |
117
+ | onFullscreenChange | Emite `true`/`false` quando o mapa entra ou sai de tela cheia |
118
+ | onMeasureComplete | Emite área medida (`m2`, `km2`, `ha`, `geojson`) após medição efêmera (não dispara `onDrawing`) |
119
+
120
+ ### Instâncias
121
+
122
+ | Nome | Descrição |
123
+ |-------------------|---------------------------------------------------------------------|
124
+ | map | Mapa Leaflet. Utilizada para manipulação do mapa |
125
+ | layerControl | Controle de camadas Leaflet. Utilizada para manipulação das camadas |
126
+ | drawItemsGroup | Grupo de desenhos Leaflet. Utilizada para manipulação dos desenhos |
127
+ | leaflet | Instância Leaflet. |
128
+ | centerMap | Centraliza/enquadra o mapa conforme `options.tools.center` |
129
+ | toggleFullscreen | Alterna tela cheia |
130
+ | enterFullscreen | Entra em tela cheia |
131
+ | exitFullscreen | Sai de tela cheia |
132
+ | toggleMeasureArea | Ativa/desativa modo de medição de área (legado; preferir os botões de linha/polígono em `options.tools`) |
133
+ | toggleCoordinatePanel | Abre ou fecha o painel do memorial descritivo |
134
+ | closeCoordinatePanel | Fecha o painel do memorial descritivo |
135
+
136
+ ### Memorial descritivo
137
+
138
+ Quando `descriptiveMemorial.show` é `true`, o mapa exibe um painel lateral com três formas de informar a geometria da propriedade:
139
+
140
+ | Aba | Entrada | Saída no mapa |
141
+ |-----|---------|---------------|
142
+ | Preenchimento manual | Pontos com coordenadas (DD ou DMS), azimute e distância | WKT (`POINT`, `LINESTRING` ou `POLYGON`) |
143
+ | Upload CSV | Arquivo `.csv` com colunas `X`, `Y`, `AZIMUTH`, `DISTANCIA` (ou `DISTANCE`) | WKT (`POLYGON`) |
144
+ | Upload Shapefile | Arquivo `.zip` contendo shapefile (`.shp`, `.shx`, `.dbf`) | GeoJSON (`Polygon` ou `MultiPolygon`) |
145
+
146
+ Geometrias do memorial são marcadas internamente com `options.memorialKey = 'memorial'` e disparam `onDrawing` com `type: 'created'`, permitindo que a aplicação consumidora aplique a geometria na camada de propriedade.
147
+
148
+ #### Upload Shapefile (.zip)
149
+
150
+ Requisitos do arquivo:
151
+
152
+ - Formato: `.zip` com shapefile completo (`.shp`, `.shx` e `.dbf`; `.prj` recomendado).
153
+ - **Uma única geometria** (um feature no shapefile).
154
+ - Tipos aceitos: `Polygon` ou `MultiPolygon` (MultiPolygon com várias partes é válido).
155
+ - A geometria deve estar **fechada** e **topologicamente válida** (sem auto-interseção, área maior que zero).
156
+
157
+ Validações rejeitam, entre outros:
158
+
159
+ - Mais de um feature no shapefile.
160
+ - Geometrias do tipo `Point`, `LineString` etc.
161
+ - Anéis abertos ou polígonos com área zero.
162
+ - Auto-interseções.
163
+
164
+ O parse é feito no browser (`shpjs`); não há envio ao backend. A projeção do shapefile deve coincidir com o sistema de referência esperado pela aplicação (ex.: SIRGAS 2000) — não há reprojeção automática.
165
+
166
+ Textos da aba e mensagens de erro podem ser customizados via `descriptiveMemorial.customTexts` (chaves `shapefileUpload`, `shapefileFileUpload`, `dragShapefileZip`, `shapefileZipInfo`, `shapefileAppliedSuccess`).
167
+
168
+ #### Ferramentas de medição
169
+
170
+ Com `options.tools.show: true`, o mapa exibe controles de tela cheia, centralização e medição efêmera (linha e polígono). A medição **não** adiciona camadas permanentes nem dispara `onDrawing`; o resultado é emitido em `onMeasureComplete`.
171
+
172
+ Configuração adicional em `options.tools`:
173
+
174
+ | Propriedade | Descrição |
175
+ |-------------|-----------|
176
+ | `measureLine` | Botão de medição de distância entre dois pontos |
177
+ | `measurePolygon` | Botão de medição de área por polígono desenhado |
178
+ | `measureArea` | Modo legado de medição de área |
179
+ | `texts` | Rótulos do painel de medição (distância, área, ajuda, cancelar, finalizar) |
180
+
181
+ ### Injeção menu lateral
182
+
183
+ Esses pontos permitem que aplicações consumidoras injetem conteúdo próprio no menu lateral do MapaDPG.
184
+
185
+ | Nome | ID | Posição no menu | Descrição |
186
+ |-------------|---------------------------|-----------------|---------------------------------------------------------------|
187
+ | Top menu | `external-id-top-menu` | topo | Contêiner para inserir conteúdo antes da listagem de camadas. |
188
+ | Bottom menu | `external-id-bottom-menu` | base | Contêiner para inserir conteúdo após a listagem de camadas. |
189
+
190
+ Para exemplos, consulte o guia: [Injeção de Conteúdo](docs/contentInjection.md)
191
+
192
+ ## Exemplos de parametros
193
+
194
+ ```js
195
+ const props = {
196
+ showLoading: true,
197
+ disableLoading: false,
198
+ descriptiveMemorial: {
199
+ show: true,
200
+ customTexts: {
201
+ title: 'New title',
202
+ addPoint: 'Custom text',
203
+ shapefileUpload: 'Upload Shapefile',
204
+ shapefileZipInfo: 'Envie um .zip com .shp, .shx e .dbf contendo uma única geometria Polygon ou MultiPolygon'
205
+ }
206
+ },
207
+ layers: {
208
+ baseMapLayers: [
209
+ {
210
+ name: 'OpenStreetMap',
211
+ url: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
212
+ key: 'osm',
213
+ default: true,
214
+ tms: false,
215
+ minZoom: 3,
216
+ maxZoom: 17,
217
+ maxNativeZoom: 18,
218
+ errorTileUrl: 'https://...',
219
+ minZoomWarning: 3
220
+ }
221
+ ],
222
+ customLayers: [
223
+ {
224
+ name: 'Camadas Customizadas',
225
+ key: 'custom',
226
+ toggle: {
227
+ active: 'Ativar',
228
+ inactive: 'Desativar'
229
+ },
230
+ layers: [
231
+ {
232
+ baseUrl: 'https://...',
233
+ layers: 'geoserver_key',
234
+ format: 'image/png',
235
+ transparent: true,
236
+ name: 'WMS Layer',
237
+ activeDefault: true,
238
+ active: true,
239
+ key: 'wms_layer',
240
+ cqlFilter: '...',
241
+ toggle: {
242
+ active: 'Ativar',
243
+ inactive: 'Desativar'
244
+ },
245
+ style: {
246
+ color: '#ff0000',
247
+ fillColor: '#00ff00'
248
+ },
249
+ },
250
+ {
251
+ geojson: {
252
+ "type": "Feature",
253
+ "properties": {},
254
+ "geometry": {
255
+ "type": "Polygon",
256
+ "coordinates": []
257
+ },
258
+ },
259
+ name: 'GEOJSON Layer',
260
+ activeDefault: true,
261
+ active: true,
262
+ key: 'geojson_layer',
263
+ toggle: {
264
+ active: 'Ativar',
265
+ inactive: 'Desativar'
266
+ },
267
+ style: {
268
+ color: '#ff0000',
269
+ fillColor: '#00ff00'
270
+ },
271
+ }
272
+ ]
273
+ }
274
+ ]
275
+ },
276
+ options: {
277
+ map: {
278
+ config: {
279
+ id: 'map',
280
+ zoomControl: true,
281
+ zoomControlPosition: 'topright',
282
+ minZoom: 3,
283
+ maxZoom: 17,
284
+ center: [-15.235, -51.9253],
285
+ zoom: 4,
286
+ dragging: true,
287
+ scrollWheelZoom: true,
288
+ removeControlLayers: true
289
+ }
290
+ },
291
+ layersMenu: {
292
+ size: 'small',
293
+ persist: true,
294
+ removeMenu: false
295
+ },
296
+ tools: {
297
+ show: true,
298
+ position: 'topright',
299
+ fullscreen: { show: true, title: 'Tela cheia' },
300
+ center: { show: true, title: 'Centralizar', target: 'drawn' },
301
+ measureArea: { show: true, title: 'Medir área' },
302
+ measureLine: { show: true, title: 'Medir distância' },
303
+ measurePolygon: { show: true, title: 'Medir polígono' },
304
+ texts: {
305
+ measureResult: 'Medição',
306
+ measureLength: 'Distância',
307
+ measureArea: 'Área',
308
+ measureLineHelp: 'Clique em dois pontos no mapa. Duplo clique para finalizar.',
309
+ measurePolygonHelp: 'Clique para adicionar vértices. Finalize no primeiro ponto, em Finalizar ou com duplo clique.',
310
+ measureCancel: 'Cancelar',
311
+ measureFinish: 'Finalizar medição'
312
+ }
313
+ },
314
+ drawing: {
315
+ show: true,
316
+ translation: {
317
+ lang: 'pt_br',
318
+ customTexts: {
319
+ tooltips: {
320
+ placeMarker: 'Clique para posicionar o marcador',
321
+ firstVertex: 'Clique para posicionar o primeiro vértice',
322
+ continueLine: 'Clique para continuar desenhando',
323
+ finishLine: 'Clique em qualquer marcador existente para finalizar',
324
+ finishPoly: 'Clique no primeiro marcador para finalizar',
325
+ finishRect: 'Clique para finalizar',
326
+ startCircle: 'Clique para posicionar o centro do círculo',
327
+ finishCircle: 'Clique para finalizar o círculo',
328
+ placeCircleMarker: 'Clique para posicionar o marcador circular',
329
+ placeText: 'Clique para inserir texto'
330
+ },
331
+ actions: {
332
+ finish: 'Finalizar',
333
+ cancel: 'Cancelar',
334
+ removeLastVertex: 'Remover último vértice'
335
+ },
336
+ buttonTitles: {
337
+ drawMarkerButton: 'Desenhar Marcador',
338
+ drawPolyButton: 'Desenhar Polígonos',
339
+ drawLineButton: 'Desenhar Linha Poligonal',
340
+ drawCircleButton: 'Desenhar Círculo',
341
+ drawRectButton: 'Desenhar Retângulo',
342
+ editButton: 'Editar Camadas',
343
+ dragButton: 'Arrastar Camadas',
344
+ cutButton: 'Recortar Camadas',
345
+ deleteButton: 'Remover Camadas',
346
+ drawCircleMarkerButton: 'Desenhar Marcador de Círculo',
347
+ snappingButton: 'Ajustar marcador arrastado a outras camadas e vértices',
348
+ pinningButton: 'Unir vértices compartilhados',
349
+ rotateButton: 'Rotacionar Camadas',
350
+ drawTextButton: 'Desenhar Texto',
351
+ scaleButton: 'Redimensionar Camadas',
352
+ autoTracingButton: 'Traçado Automático de Linha'
353
+ },
354
+ measurements: {
355
+ totalLength: 'Comprimento',
356
+ segmentLength: 'Comprimento do Segmento',
357
+ area: 'Área',
358
+ radius: 'Raio',
359
+ perimeter: 'Perímetro',
360
+ height: 'Altura',
361
+ width: 'Largura',
362
+ coordinates: 'Posição',
363
+ coordinatesMarker: 'Marcador de Posição'
364
+ }
365
+ }
366
+ },
367
+ options: {
368
+ drawMarker: true,
369
+ drawRectangle: true,
370
+ drawPolyline: {
371
+ color: '#ff0000',
372
+ weight: 5,
373
+ opacity: 0.5,
374
+ stroke: true,
375
+ fill: true,
376
+ fillColor: '#ff0000',
377
+ fillOpacity: 0.2
378
+ },
379
+ drawPolygon: true,
380
+ drawCircle: true,
381
+ drawCircleMarker: true,
382
+ drawText: true,
383
+ editMode: true,
384
+ dragMode: true,
385
+ cutPolygon: false,
386
+ rotateMode: false,
387
+ removalMode: true,
388
+ drawControls: true,
389
+ editControls: true,
390
+ position: 'topright',
391
+ positions: {
392
+ draw: {
393
+ position: 'topleft',
394
+ },
395
+ edit: {
396
+ position: 'bottomright',
397
+ },
398
+ }
399
+ }
400
+ }
401
+ }
402
+ }
403
+ ```
404
+
405
+ ## Desenvolvimento local
406
+
407
+ No repositório **core**, o `map_component` é consumido pelo frontend como pacote local (`file:./map_component`). Para alterar o componente:
408
+
409
+ ```bash
410
+ cd map_component
411
+ npm install
412
+ npm run build
413
+ ```
414
+
415
+ Em seguida, sincronize para o frontend (o `./start.sh` na raiz do core faz isso automaticamente via `rsync`, excluindo `.git` e `node_modules`).
416
+
417
+ ### Marcadores estáveis no zoom
418
+
419
+ Opções em `options.map.config`:
420
+
421
+ | Opção | Descrição |
422
+ |-------|-----------|
423
+ | `markerZoomAnimation: false` | Desativa animação de marcadores no zoom (padrão no componente) |
424
+ | `stabilizeMarkersOnZoom: true` | Reposiciona marcadores após `zoomend` (evita drift de `divIcon`) |
425
+
426
+ Utilitários exportados pelo pacote (para consumidores que criam marcadores fora do fluxo interno):
427
+
428
+ ```typescript
429
+ import { createStableMarker, bindMarkerZoomStability } from '@rural-environmental-registry/map_component'
430
+
431
+ const marker = createStableMarker(L, latlng, { icon: customDivIcon, layerCode: 'hq' })
432
+ ```
433
+
434
+ O `LeafletMap` aplica `bindMarkerZoomStability` automaticamente no `drawItemsGroup` quando `stabilizeMarkersOnZoom` não é `false`.
435
+
436
+ ### Dependências relevantes
437
+
438
+ | Pacote | Uso |
439
+ |--------|-----|
440
+ | `leaflet`, `@geoman-io/leaflet-geoman-free` | Mapa, desenho e medição |
441
+ | `@turf/turf` | Validação geométrica do shapefile |
442
+ | `shpjs` | Parse de shapefile em `.zip` no memorial descritivo |
443
+ | `papaparse` | Parse de CSV no memorial descritivo |
444
+ | `element-plus` | UI do painel de coordenadas |
@@ -1,2 +1,2 @@
1
- import { CoordinatePanelTexts } from "../types";
1
+ import { CoordinatePanelTexts } from '../types';
2
2
  export declare const COORDINATE_PANEL_TEXTS: CoordinatePanelTexts;
@@ -10,7 +10,6 @@ export default class DrawingControlHandler {
10
10
  get drawItemsGroup(): FeatureGroup;
11
11
  get map(): Map;
12
12
  get options(): ToolbarOptions;
13
- private calculateAreas;
14
13
  private incrementLayerInfos;
15
14
  handleDrawingEvents(eventEmitterCallback: Function): void;
16
15
  private handleUpdateDrawingEvents;
@@ -3,14 +3,19 @@ import L from 'leaflet';
3
3
  export default class MapHandler {
4
4
  private readonly _map;
5
5
  private readonly _mapOptions;
6
+ private readonly _initialView;
6
7
  private _mapLayers;
7
- private _layerControl;
8
8
  constructor(mapOptions: MapConfigConfig | undefined);
9
- get map(): L.Map;
9
+ private _layerControl;
10
10
  get layerControl(): L.Control.Layers;
11
+ get map(): L.Map;
12
+ get initialView(): {
13
+ center: L.LatLngExpression;
14
+ zoom: number;
15
+ };
16
+ init(mapLayers: MapLayers, eventEmitterCallback: Function): void;
11
17
  private addControls;
12
18
  private addBaseLayer;
13
19
  private disableLayerControlHover;
14
20
  private watchLayerStatus;
15
- init(mapLayers: MapLayers, eventEmitterCallback: Function): void;
16
21
  }
@@ -0,0 +1,39 @@
1
+ import L, { FeatureGroup, LatLngBounds, Map } from 'leaflet';
2
+ import { MapToolsConfig, MeasureCompleteEvent } from '../types';
3
+ type MapToolsCallbacks = {
4
+ onFullscreenChange?: (active: boolean) => void;
5
+ onMeasureComplete?: (data: MeasureCompleteEvent) => void;
6
+ };
7
+ type InitialView = {
8
+ center: L.LatLngExpression;
9
+ zoom: number;
10
+ };
11
+ export default class MapToolsHandler {
12
+ private readonly _map;
13
+ private readonly _config;
14
+ private readonly _initialView;
15
+ private readonly _callbacks;
16
+ private readonly _fullscreenContainer;
17
+ private _drawItemsGroup;
18
+ private _control;
19
+ private _measureTools;
20
+ private _fullscreenBtn;
21
+ private _boundFullscreenChange;
22
+ constructor(map: Map, toolsConfig: MapToolsConfig | undefined, initialView: InitialView, drawItemsGroup: FeatureGroup | null, fullscreenContainer: HTMLElement, callbacks?: MapToolsCallbacks);
23
+ setDrawItemsGroup(group: FeatureGroup | null): void;
24
+ centerMap(): void;
25
+ enterFullscreen(): void;
26
+ exitFullscreen(): void;
27
+ toggleFullscreen(): void;
28
+ toggleMeasureArea(): void;
29
+ destroy(): void;
30
+ private addControl;
31
+ private removeNativeZoomControl;
32
+ alignTopRightControls(): void;
33
+ private createButton;
34
+ private bindFullscreenEvents;
35
+ private handleFullscreenChange;
36
+ }
37
+ export declare function isMeasureModeActive(map: Map): boolean;
38
+ export declare function getDrawnBounds(drawItemsGroup: FeatureGroup | null): LatLngBounds | null;
39
+ export {};
@@ -0,0 +1,51 @@
1
+ import { Map } from 'leaflet';
2
+ import '@geoman-io/leaflet-geoman-free';
3
+ import { MapToolsConfig, MeasureCompleteEvent } from '../types';
4
+ type MeasureToolsCallbacks = {
5
+ onMeasureComplete?: (data: MeasureCompleteEvent) => void;
6
+ };
7
+ export default class MeasureToolsHandler {
8
+ private readonly _map;
9
+ private readonly _mapContainer;
10
+ private readonly _outerContainer;
11
+ private readonly _config;
12
+ private readonly _callbacks;
13
+ private readonly _measureGroup;
14
+ private readonly _measureSvgRenderer;
15
+ private readonly _boundMeasureCreate;
16
+ private readonly _boundMeasureCancel;
17
+ private readonly _boundEscapeKey;
18
+ private _control;
19
+ private _lineBtn;
20
+ private _polygonBtn;
21
+ private _interactionPanel;
22
+ private _resultsEl;
23
+ private _helpEl;
24
+ private _activeMode;
25
+ private _suppressMeasureCancel;
26
+ private _restoreZoomAnimation;
27
+ private _measureCreateTimeoutId;
28
+ constructor(map: Map, config: MapToolsConfig, callbacks?: MeasureToolsCallbacks);
29
+ destroy(): void;
30
+ cancel(): void;
31
+ isActive(): boolean;
32
+ startLine(): void;
33
+ startPolygon(): void;
34
+ private addControl;
35
+ private buildInteractionHtml;
36
+ private createToolButton;
37
+ private toggleMode;
38
+ private startMode;
39
+ private stopMode;
40
+ private finishDrawing;
41
+ private handleMeasureCreate;
42
+ private clearMeasureCreateTimeout;
43
+ private handleMeasureCancel;
44
+ private buildMeasurePopup;
45
+ private applyMeasureLayerOptions;
46
+ private showInteractionPanel;
47
+ private hideInteractionPanel;
48
+ private updateButtons;
49
+ private setMeasureActive;
50
+ }
51
+ export {};
@@ -0,0 +1,19 @@
1
+ import { Map } from 'leaflet';
2
+ /** Controles Leaflet do memorial descritivo e importação de shapefile no toolbar de desenho. */
3
+ export default class MemorialButtonControl {
4
+ private readonly _map;
5
+ private _memorialButtonControl;
6
+ private _shapefileRetryTimeoutId;
7
+ constructor(map: Map);
8
+ private getOrCreateMemorialContainer;
9
+ private ensureMemorialControlOnMap;
10
+ private getPolygonButtonContainer;
11
+ addMemorial(toggleCallback: () => void, buttonTitle: string): void;
12
+ attachShapefileToDrawToolbar(importCallback: () => void, buttonTitle: string): boolean;
13
+ addShapefile(importCallback: () => void, buttonTitle: string, retries?: number): void;
14
+ private cancelShapefileRetries;
15
+ updateMemorialTitle(newTitle: string): void;
16
+ updateShapefileTitle(newTitle: string): void;
17
+ removeShapefileFromToolbar(): void;
18
+ remove(): void;
19
+ }
@@ -0,0 +1,3 @@
1
+ import { MapToolsConfig } from '../types';
2
+ export declare const DEFAULT_MAP_TOOLS: MapToolsConfig;
3
+ export declare function resolveMapToolsConfig(tools?: MapToolsConfig): MapToolsConfig | null;