@rural-environmental-registry/map_component 1.0.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.
- package/LICENSE +674 -0
- package/dist/constants/coordinatePanel.d.ts +2 -0
- package/dist/handlers/constants.d.ts +3 -0
- package/dist/handlers/drawingControl.d.ts +22 -0
- package/dist/handlers/mapHandler.d.ts +16 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +31321 -0
- package/dist/types/index.d.ts +162 -0
- package/dist/utils/CoordinateConverter.d.ts +16 -0
- package/package.json +49 -0
- package/readme.md +215 -0
- package/readme.ptbr.md +215 -0
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { MapOptions, Layer, PathOptions, ControlOptions, ControlPosition } from 'leaflet';
|
|
2
|
+
import { GeoJsonObject } from 'geojson';
|
|
3
|
+
import { PM } from '@geoman-io/leaflet-geoman-free';
|
|
4
|
+
export type FaIconName = 'check' | 'xmark' | 'chevron-right' | 'chevron-left' | 'terminal' | 'file-lines' | 'upload' | 'pencil' | 'trash' | 'chevron-down';
|
|
5
|
+
export type DrawnArea = {
|
|
6
|
+
m2: number;
|
|
7
|
+
km2: number;
|
|
8
|
+
ha: number;
|
|
9
|
+
};
|
|
10
|
+
export type IncrementedLayer = Layer & {
|
|
11
|
+
drawnArea: DrawnArea;
|
|
12
|
+
};
|
|
13
|
+
export type LayerData = {
|
|
14
|
+
baseUrl: string;
|
|
15
|
+
geojson?: GeoJsonObject | GeoJsonObject[];
|
|
16
|
+
layers: string;
|
|
17
|
+
format: string;
|
|
18
|
+
transparent: boolean;
|
|
19
|
+
name: string;
|
|
20
|
+
activeDefault: boolean;
|
|
21
|
+
cqlFilter?: string;
|
|
22
|
+
active: boolean;
|
|
23
|
+
key: string;
|
|
24
|
+
toggle: {
|
|
25
|
+
active: string;
|
|
26
|
+
inactive: string;
|
|
27
|
+
};
|
|
28
|
+
style: {
|
|
29
|
+
color: string;
|
|
30
|
+
fillColor: string;
|
|
31
|
+
};
|
|
32
|
+
options?: any;
|
|
33
|
+
};
|
|
34
|
+
export type GroupLayerData = {
|
|
35
|
+
name: string;
|
|
36
|
+
key: string;
|
|
37
|
+
toggle: {
|
|
38
|
+
active: string;
|
|
39
|
+
inactive: string;
|
|
40
|
+
};
|
|
41
|
+
layers: LayerData[];
|
|
42
|
+
};
|
|
43
|
+
export type LayersConfig = GroupLayerData[];
|
|
44
|
+
export type DrawingEvent = {
|
|
45
|
+
type: 'created' | 'edited' | 'deleted';
|
|
46
|
+
layer: IncrementedLayer;
|
|
47
|
+
};
|
|
48
|
+
export type BaseMapLayer = {
|
|
49
|
+
name: string;
|
|
50
|
+
key: string;
|
|
51
|
+
default: boolean;
|
|
52
|
+
url: string;
|
|
53
|
+
};
|
|
54
|
+
export type BaseMapLayers = BaseMapLayer[];
|
|
55
|
+
export type MapLayers = {
|
|
56
|
+
mapLayers: BaseMapLayers;
|
|
57
|
+
customLayers?: LayersConfig;
|
|
58
|
+
};
|
|
59
|
+
export type MapConfigConfig = MapOptions & {
|
|
60
|
+
id: string;
|
|
61
|
+
removeControlLayers?: boolean;
|
|
62
|
+
zoomControlPosition?: ControlPosition;
|
|
63
|
+
};
|
|
64
|
+
export type MapConfig = {
|
|
65
|
+
config?: MapConfigConfig;
|
|
66
|
+
};
|
|
67
|
+
export type LayersMenuConfig = {
|
|
68
|
+
size: 'small' | 'medium' | 'large';
|
|
69
|
+
removeMenu?: boolean;
|
|
70
|
+
};
|
|
71
|
+
export type MemorialConfig = {
|
|
72
|
+
show: boolean;
|
|
73
|
+
config?: any;
|
|
74
|
+
controlTexts?: any;
|
|
75
|
+
};
|
|
76
|
+
export type MapOptionsConfig = {
|
|
77
|
+
layersMenu?: LayersMenuConfig;
|
|
78
|
+
map: MapConfig;
|
|
79
|
+
drawing?: DrawingConfig;
|
|
80
|
+
};
|
|
81
|
+
export type DrawingConfig = DrawingControlOptions & DisplayDrawingControl;
|
|
82
|
+
export type TranslationConfig = {
|
|
83
|
+
lang?: PM.SupportLocales;
|
|
84
|
+
customTexts?: PM.Translations;
|
|
85
|
+
};
|
|
86
|
+
export type GeomanDrawingEvent = {
|
|
87
|
+
shape: PM.SUPPORTED_SHAPES;
|
|
88
|
+
layer: Layer;
|
|
89
|
+
[key: string]: any;
|
|
90
|
+
};
|
|
91
|
+
export type ToolbarOptions = {
|
|
92
|
+
[K in PM.ToolbarOptions]: ControlOptions | PM.BlockPositions | boolean | PathOptions | undefined;
|
|
93
|
+
};
|
|
94
|
+
export type PMToolbarOptions = PM.ToolbarOptions;
|
|
95
|
+
export type DrawingControlOptions = {
|
|
96
|
+
options: ToolbarOptions;
|
|
97
|
+
translation: TranslationConfig;
|
|
98
|
+
};
|
|
99
|
+
type DisplayDrawingControl = {
|
|
100
|
+
show: boolean;
|
|
101
|
+
};
|
|
102
|
+
export type PMSupportedShapes = PM.SUPPORTED_SHAPES;
|
|
103
|
+
export type CoordinatePanelTexts = {
|
|
104
|
+
title?: string;
|
|
105
|
+
addPoint?: string;
|
|
106
|
+
editPoint?: string;
|
|
107
|
+
removePoint?: string;
|
|
108
|
+
actions?: string;
|
|
109
|
+
clearGeometries?: string;
|
|
110
|
+
index?: string;
|
|
111
|
+
x?: string;
|
|
112
|
+
y?: string;
|
|
113
|
+
azimuth?: string;
|
|
114
|
+
distance?: string;
|
|
115
|
+
noPoints?: string;
|
|
116
|
+
addPointTitle?: string;
|
|
117
|
+
editPointTitle?: string;
|
|
118
|
+
removePointTitle?: string;
|
|
119
|
+
clearGeometriesTitle?: string;
|
|
120
|
+
addPointDescription?: string;
|
|
121
|
+
editPointDescription?: string;
|
|
122
|
+
removePointDescription?: string;
|
|
123
|
+
clearGeometriesDescription?: string;
|
|
124
|
+
memorialDescriptive?: string;
|
|
125
|
+
referenceSystem?: string;
|
|
126
|
+
selectSystem?: string;
|
|
127
|
+
sirgas2000?: string;
|
|
128
|
+
coordinateFormat?: string;
|
|
129
|
+
selectFormat?: string;
|
|
130
|
+
decimalDegrees?: string;
|
|
131
|
+
degreesMinutesSeconds?: string;
|
|
132
|
+
manualInput?: string;
|
|
133
|
+
insertCoordinates?: string;
|
|
134
|
+
xLongitude?: string;
|
|
135
|
+
yLatitude?: string;
|
|
136
|
+
degrees?: string;
|
|
137
|
+
minutes?: string;
|
|
138
|
+
seconds?: string;
|
|
139
|
+
addedPoints?: string;
|
|
140
|
+
finalizeGeometry?: string;
|
|
141
|
+
csvUpload?: string;
|
|
142
|
+
csvFileUpload?: string;
|
|
143
|
+
dragCsvFile?: string;
|
|
144
|
+
csvColumnsInfo?: string;
|
|
145
|
+
applyCsvCoordinates?: string;
|
|
146
|
+
placeholderLongitude?: string;
|
|
147
|
+
placeholderLatitude?: string;
|
|
148
|
+
placeholderAzimuth?: string;
|
|
149
|
+
placeholderDistance?: string;
|
|
150
|
+
placeholderDegrees?: string;
|
|
151
|
+
placeholderMinutes?: string;
|
|
152
|
+
placeholderSeconds?: string;
|
|
153
|
+
errorXYRequired?: string;
|
|
154
|
+
errorDegreesRequired?: string;
|
|
155
|
+
errorFirstRowXY?: string;
|
|
156
|
+
errorProvideCoordinatesOrAzimuthDistance?: string;
|
|
157
|
+
};
|
|
158
|
+
export type DescriptiveMemorial = {
|
|
159
|
+
show: boolean;
|
|
160
|
+
customTexts?: CoordinatePanelTexts;
|
|
161
|
+
};
|
|
162
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare class CoordinateConverter {
|
|
2
|
+
static dmsToDD(degrees: number, minutes: number, seconds: number): number;
|
|
3
|
+
static ddToDMS(decimalDegrees: number): {
|
|
4
|
+
degrees: number;
|
|
5
|
+
minutes: number;
|
|
6
|
+
seconds: number;
|
|
7
|
+
};
|
|
8
|
+
static dmmToDD(degrees: number, decimalMinutes: number): number;
|
|
9
|
+
static ddToDMM(decimalDegrees: number): {
|
|
10
|
+
degrees: number;
|
|
11
|
+
decimalMinutes: number;
|
|
12
|
+
};
|
|
13
|
+
static formatDMS(degrees: number, minutes: number, seconds: number): string;
|
|
14
|
+
static formatDMM(degrees: number, decimalMinutes: number): string;
|
|
15
|
+
static formatDD(decimalDegrees: number): string;
|
|
16
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@rural-environmental-registry/map_component",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Map component for Vue.js applications",
|
|
5
|
+
"main": "dist/index.mjs",
|
|
6
|
+
"module": "dist/index.mjs",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"dev": "vite build --watch",
|
|
10
|
+
"build": "vite build && tsc",
|
|
11
|
+
"prepublishOnly": "npm run build"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist",
|
|
15
|
+
"README.md"
|
|
16
|
+
],
|
|
17
|
+
"keywords": ["vue", "map", "leaflet", "component", "dataprev"],
|
|
18
|
+
"author": "Dataprev",
|
|
19
|
+
"license": "GPL-3.0",
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "git+https://github.com/Rural-Environmental-Registry/map_component.git",
|
|
23
|
+
"directory": "map_component"
|
|
24
|
+
},
|
|
25
|
+
"peerDependencies": {
|
|
26
|
+
"vue": "^3.0.0"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@fortawesome/fontawesome-svg-core": "6.7.2",
|
|
30
|
+
"@fortawesome/free-solid-svg-icons": "6.7.2",
|
|
31
|
+
"@fortawesome/vue-fontawesome": "3.0.8",
|
|
32
|
+
"@geoman-io/leaflet-geoman-free": "2.18.3",
|
|
33
|
+
"@turf/turf": "7.2.0",
|
|
34
|
+
"element-plus": "2.9.3",
|
|
35
|
+
"leaflet": "1.9.4",
|
|
36
|
+
"leaflet-draw": "1.0.4",
|
|
37
|
+
"papaparse": "5.5.3"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@types/geojson": "7946.0.16",
|
|
41
|
+
"@types/leaflet": "1.9.16",
|
|
42
|
+
"@types/papaparse": "5.3.16",
|
|
43
|
+
"@vitejs/plugin-vue": "5.2.1",
|
|
44
|
+
"typescript": "5.7.3",
|
|
45
|
+
"unplugin-element-plus": "0.9.1",
|
|
46
|
+
"vite": "6.3.5",
|
|
47
|
+
"vue": "3.5.17"
|
|
48
|
+
}
|
|
49
|
+
}
|
package/readme.md
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
# RER - Map Component
|
|
2
|
+
|
|
3
|
+
[](https://vuejs.org/) [](https://www.typescriptlang.org/) [](https://leafletjs.com/) [](https://vitejs.dev/)
|
|
4
|
+
|
|
5
|
+
## 📑 Table of Contents
|
|
6
|
+
|
|
7
|
+
- [🎯 About the Module](#-about-the-module)
|
|
8
|
+
- [Installation](#installation)
|
|
9
|
+
- [Usage](#usage)
|
|
10
|
+
- [Properties](#properties)
|
|
11
|
+
- [Events](#events)
|
|
12
|
+
- [Instances](#instances)
|
|
13
|
+
- [Side Menu Injection](#side-menu-injection)
|
|
14
|
+
- [Configuration Examples](#configuration-examples)
|
|
15
|
+
- [Technologies](#technologies)
|
|
16
|
+
- [License](#license)
|
|
17
|
+
- [Contribution](#contribution)
|
|
18
|
+
- [Support](#support)
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## 🎯 About the Module
|
|
23
|
+
|
|
24
|
+
The **RER** (Rural Environmental Registry) is a modern, comprehensive solution for managing rural environmental registrations, developed as a digital public good. This project provides a robust and scalable architecture for systems that register rural land properties with support for geospatial data. The **Map Component** module is part of RER project as a submodule from it.
|
|
25
|
+
|
|
26
|
+
It is an interactive map component for Vue.js applications that allows customization of layers, map options, and drawing tools. The library is based on Leaflet.js and offers support for multiple layers, custom drawing tools, and an adaptable interface.
|
|
27
|
+
|
|
28
|
+
*Note: This library can only be used for Vue.js 3 projects.*
|
|
29
|
+
|
|
30
|
+
### Main Features
|
|
31
|
+
|
|
32
|
+
- 🗺️ Interactive map based on Leaflet.js
|
|
33
|
+
- 🎨 Customizable layers and drawing tools
|
|
34
|
+
- 🔧 Flexible configuration options
|
|
35
|
+
- 📐 Drawing and measurement tools
|
|
36
|
+
- 🌐 Support for WMS, GeoJSON, and custom vectors
|
|
37
|
+
- 📍 Side menu content injection
|
|
38
|
+
- ⚡ Built with Vite for optimal performance
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Installation
|
|
43
|
+
|
|
44
|
+
### Prerequisites
|
|
45
|
+
|
|
46
|
+
- **Node.js** version 18+
|
|
47
|
+
- **Vue.js** version 3
|
|
48
|
+
- **Git** credentials for private repository access
|
|
49
|
+
|
|
50
|
+
### Global Registration
|
|
51
|
+
|
|
52
|
+
In your `main.js`:
|
|
53
|
+
|
|
54
|
+
```js
|
|
55
|
+
import { createApp } from 'vue'
|
|
56
|
+
import MapaDpg from 'node_modules/dpg-mapa/dist'
|
|
57
|
+
|
|
58
|
+
const app = createApp({})
|
|
59
|
+
|
|
60
|
+
app.component('MapaDpg', MapaDpg)
|
|
61
|
+
|
|
62
|
+
app.mount('#app')
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Local Registration
|
|
66
|
+
|
|
67
|
+
```vue
|
|
68
|
+
<template>
|
|
69
|
+
<MapaDpg />
|
|
70
|
+
</template>
|
|
71
|
+
|
|
72
|
+
<script setup>
|
|
73
|
+
import MapaDpg from 'node_modules/dpg-mapa/dist'
|
|
74
|
+
</script>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Import Styles
|
|
78
|
+
|
|
79
|
+
In both cases, you need to import the map styles:
|
|
80
|
+
|
|
81
|
+
```css
|
|
82
|
+
@import 'node_modules/dpg-mapa/dist/index.css';
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Usage
|
|
88
|
+
|
|
89
|
+
The component accepts parameters and emits events. It also exposes instances through refs.
|
|
90
|
+
|
|
91
|
+
```vue
|
|
92
|
+
<MapaDpg
|
|
93
|
+
:layers="layers"
|
|
94
|
+
:options="options"
|
|
95
|
+
:showLoading="showLoading"
|
|
96
|
+
:disableLoading="disableLoading"
|
|
97
|
+
:descriptiveMemorial="descriptiveMemorial"
|
|
98
|
+
@onChildLayerToggle="onChildLayerToggle"
|
|
99
|
+
@onGroupLayerToggle="onGroupLayerToggle"
|
|
100
|
+
@onDrawing="onDrawing"
|
|
101
|
+
ref="mapRef"
|
|
102
|
+
/>
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
```js
|
|
106
|
+
const mapRef = ref(null)
|
|
107
|
+
|
|
108
|
+
const mapRefInstances = computed(() => {
|
|
109
|
+
return {
|
|
110
|
+
map: mapRef.value?.map,
|
|
111
|
+
layerControl: mapRef.value?.layerControl,
|
|
112
|
+
drawItemsGroup: mapRef.value?.drawItemsGroup,
|
|
113
|
+
leaflet: mapRef.value?.leaflet
|
|
114
|
+
}
|
|
115
|
+
})
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## Properties
|
|
121
|
+
|
|
122
|
+
| Name | Type | Required | Description |
|
|
123
|
+
|---------------------|-------------------------------------------|----------|------------------------------------------------------------------------------|
|
|
124
|
+
| showLoading | boolean | Optional | Controls the visibility of the loading animation |
|
|
125
|
+
| layers | [MapLayers](docs/properties.md) | Optional | Defines base layers and custom layers |
|
|
126
|
+
| options | [MapOptionsConfig](docs/properties.md) | Optional | Defines map settings, layer menu, and drawing tools |
|
|
127
|
+
| disableLoading | boolean | Optional | Disables the loading animation |
|
|
128
|
+
| descriptiveMemorial | [DescriptiveMemorial](docs/properties.md) | Optional | Controls the visibility of the descriptive memorial |
|
|
129
|
+
|
|
130
|
+
For detailed property documentation, see [Properties Documentation](docs/properties.md).
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## Events
|
|
135
|
+
|
|
136
|
+
| Name | Description |
|
|
137
|
+
|--------------------|---------------------------------------------------------------------------------------------------------------------------------------------|
|
|
138
|
+
| onChildLayerToggle | Emits data of the layer added/removed from the map |
|
|
139
|
+
| onGroupLayerToggle | Emits data of the group and its layers added/removed from the map |
|
|
140
|
+
| onDrawing | Emits data of the drawing(s) added/removed from the map. Polygons and rectangles are incremented with the "drawnArea" property |
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## Instances
|
|
145
|
+
|
|
146
|
+
| Name | Description |
|
|
147
|
+
|----------------|--------------------------------------------------------------------------------------|
|
|
148
|
+
| map | Leaflet map. Used for map manipulation |
|
|
149
|
+
| layerControl | Leaflet layer control. Used for layer manipulation |
|
|
150
|
+
| drawItemsGroup | Leaflet drawing group. Used for drawing manipulation |
|
|
151
|
+
| leaflet | Leaflet instance |
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## Side Menu Injection
|
|
156
|
+
|
|
157
|
+
These points allow consuming applications to inject their own content into the MapaDPG side menu.
|
|
158
|
+
|
|
159
|
+
| Name | ID | Menu Position | Description |
|
|
160
|
+
|-------------|----------------------------|---------------|---------------------------------------------------------------------|
|
|
161
|
+
| Top menu | `external-id-top-menu` | top | Container to insert content before the layer listing |
|
|
162
|
+
| Bottom menu | `external-id-bottom-menu` | bottom | Container to insert content after the layer listing |
|
|
163
|
+
|
|
164
|
+
For examples, see the guide: [Content Injection](docs/contentInjection.md)
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## Configuration Examples
|
|
169
|
+
|
|
170
|
+
For complete configuration examples including layers, drawing tools, and map options, see the original README or refer to the [Properties Documentation](docs/properties.md).
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## Technologies
|
|
175
|
+
|
|
176
|
+
- **Vue.js 3** - Progressive JavaScript framework
|
|
177
|
+
- **TypeScript** - Typed superset of JavaScript
|
|
178
|
+
- **Leaflet.js** - Open-source JavaScript library for interactive maps
|
|
179
|
+
- **Vite** - Next generation frontend tooling
|
|
180
|
+
- **Geoman** - Leaflet plugin for drawing and editing
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## License
|
|
185
|
+
|
|
186
|
+
This project is distributed under the [GPL-3.0](https://github.com/Rural-Environmental-Registry/core/blob/main/LICENSE).
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## Contribution
|
|
191
|
+
|
|
192
|
+
Contributions are welcome! To contribute:
|
|
193
|
+
|
|
194
|
+
1. Fork the repository
|
|
195
|
+
2. Create a branch for your feature (`git checkout -b feature/AmazingFeature`)
|
|
196
|
+
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
|
|
197
|
+
4. Push to the branch (`git push origin feature/AmazingFeature`)
|
|
198
|
+
5. Open a Pull Request
|
|
199
|
+
|
|
200
|
+
By submitting a pull request or patch, you affirm that you are the author of the code and that you agree to license your contribution under the terms of the GNU General Public License v3.0 (or later) for this project. You also agree to assign the copyright of your contribution to the Ministry of Management and Innovation in Public Services (MGI), the owner of this project.
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## Support
|
|
205
|
+
|
|
206
|
+
For technical support or project-related questions:
|
|
207
|
+
|
|
208
|
+
- **Documentation:** Check the individual READMEs for each submodule
|
|
209
|
+
- **Issues:** Report problems via the repository issue tracker
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
Copyright (C) 2024-2025 Ministry of Management and Innovation in Public Services (MGI), Government of Brazil.
|
|
214
|
+
|
|
215
|
+
This program was developed by Dataprev as part of a contract with the Ministry of Management and Innovation in Public Services (MGI).
|
package/readme.ptbr.md
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
# RER - Componente de Mapa
|
|
2
|
+
|
|
3
|
+
[](https://vuejs.org/) [](https://www.typescriptlang.org/) [](https://leafletjs.com/) [](https://vitejs.dev/)
|
|
4
|
+
|
|
5
|
+
## 📑 Índice
|
|
6
|
+
|
|
7
|
+
- [🎯 Sobre o Módulo](#-sobre-o-módulo)
|
|
8
|
+
- [Instalação](#instalação)
|
|
9
|
+
- [Uso](#uso)
|
|
10
|
+
- [Propriedades](#propriedades)
|
|
11
|
+
- [Eventos](#eventos)
|
|
12
|
+
- [Instâncias](#instâncias)
|
|
13
|
+
- [Injeção de Menu Lateral](#injeção-de-menu-lateral)
|
|
14
|
+
- [Exemplos de Configuração](#exemplos-de-configuração)
|
|
15
|
+
- [Tecnologias](#tecnologias)
|
|
16
|
+
- [Licença](#licença)
|
|
17
|
+
- [Contribuição](#contribuição)
|
|
18
|
+
- [Suporte](#suporte)
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## 🎯 Sobre o Módulo
|
|
23
|
+
|
|
24
|
+
O **RER** (Registro Eletrônico Rural) é uma solução moderna e abrangente para gerenciamento de registros ambientais rurais, desenvolvida como um bem público digital. Este projeto fornece uma arquitetura robusta e escalável para sistemas que registram propriedades rurais com suporte para dados geoespaciais. O módulo **Componente de Mapa** faz parte do projeto RER como um submódulo.
|
|
25
|
+
|
|
26
|
+
É um componente de mapa interativo para aplicações Vue.js que permite personalização de camadas, opções de mapa e ferramentas de desenho. A biblioteca é baseada em Leaflet.js e oferece suporte para múltiplas camadas, ferramentas de desenho personalizadas e uma interface adaptável.
|
|
27
|
+
|
|
28
|
+
*Nota: Esta biblioteca só pode ser usada para projetos Vue.js 3.*
|
|
29
|
+
|
|
30
|
+
### Principais Funcionalidades
|
|
31
|
+
|
|
32
|
+
- 🗺️ Mapa interativo baseado em Leaflet.js
|
|
33
|
+
- 🎨 Camadas e ferramentas de desenho personalizáveis
|
|
34
|
+
- 🔧 Opções de configuração flexíveis
|
|
35
|
+
- 📐 Ferramentas de desenho e medição
|
|
36
|
+
- 🌐 Suporte para WMS, GeoJSON e vetores personalizados
|
|
37
|
+
- 📍 Injeção de conteúdo no menu lateral
|
|
38
|
+
- ⚡ Construído com Vite para desempenho otimizado
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Instalação
|
|
43
|
+
|
|
44
|
+
### Pré-requisitos
|
|
45
|
+
|
|
46
|
+
- **Node.js** versão 18+
|
|
47
|
+
- **Vue.js** versão 3
|
|
48
|
+
- Credenciais **Git** para acesso ao repositório privado
|
|
49
|
+
|
|
50
|
+
### Registro Global
|
|
51
|
+
|
|
52
|
+
No seu `main.js`:
|
|
53
|
+
|
|
54
|
+
```js
|
|
55
|
+
import { createApp } from 'vue'
|
|
56
|
+
import MapaDpg from 'node_modules/dpg-mapa/dist'
|
|
57
|
+
|
|
58
|
+
const app = createApp({})
|
|
59
|
+
|
|
60
|
+
app.component('MapaDpg', MapaDpg)
|
|
61
|
+
|
|
62
|
+
app.mount('#app')
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Registro Local
|
|
66
|
+
|
|
67
|
+
```vue
|
|
68
|
+
<template>
|
|
69
|
+
<MapaDpg />
|
|
70
|
+
</template>
|
|
71
|
+
|
|
72
|
+
<script setup>
|
|
73
|
+
import MapaDpg from 'node_modules/dpg-mapa/dist'
|
|
74
|
+
</script>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Importar Estilos
|
|
78
|
+
|
|
79
|
+
Em ambos os casos, você precisa importar os estilos do mapa:
|
|
80
|
+
|
|
81
|
+
```css
|
|
82
|
+
@import 'node_modules/dpg-mapa/dist/index.css';
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Uso
|
|
88
|
+
|
|
89
|
+
O componente aceita parâmetros e emite eventos. Ele também expõe instâncias através de refs.
|
|
90
|
+
|
|
91
|
+
```vue
|
|
92
|
+
<MapaDpg
|
|
93
|
+
:layers="layers"
|
|
94
|
+
:options="options"
|
|
95
|
+
:showLoading="showLoading"
|
|
96
|
+
:disableLoading="disableLoading"
|
|
97
|
+
:descriptiveMemorial="descriptiveMemorial"
|
|
98
|
+
@onChildLayerToggle="onChildLayerToggle"
|
|
99
|
+
@onGroupLayerToggle="onGroupLayerToggle"
|
|
100
|
+
@onDrawing="onDrawing"
|
|
101
|
+
ref="mapRef"
|
|
102
|
+
/>
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
```js
|
|
106
|
+
const mapRef = ref(null)
|
|
107
|
+
|
|
108
|
+
const mapRefInstances = computed(() => {
|
|
109
|
+
return {
|
|
110
|
+
map: mapRef.value?.map,
|
|
111
|
+
layerControl: mapRef.value?.layerControl,
|
|
112
|
+
drawItemsGroup: mapRef.value?.drawItemsGroup,
|
|
113
|
+
leaflet: mapRef.value?.leaflet
|
|
114
|
+
}
|
|
115
|
+
})
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## Propriedades
|
|
121
|
+
|
|
122
|
+
| Nome | Tipo | Obrigatório | Descrição |
|
|
123
|
+
|---------------------|-------------------------------------------|-------------|------------------------------------------------------------------------------|
|
|
124
|
+
| showLoading | boolean | Opcional | Controla a visibilidade da animação de carregamento |
|
|
125
|
+
| layers | [MapLayers](docs/properties.md) | Opcional | Define camadas base e camadas personalizadas |
|
|
126
|
+
| options | [MapOptionsConfig](docs/properties.md) | Opcional | Define configurações do mapa, menu de camadas e ferramentas de desenho |
|
|
127
|
+
| disableLoading | boolean | Opcional | Desabilita a animação de carregamento |
|
|
128
|
+
| descriptiveMemorial | [DescriptiveMemorial](docs/properties.md) | Opcional | Controla a visibilidade do memorial descritivo |
|
|
129
|
+
|
|
130
|
+
Para documentação detalhada das propriedades, consulte [Documentação de Propriedades](docs/properties.md).
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## Eventos
|
|
135
|
+
|
|
136
|
+
| Nome | Descrição |
|
|
137
|
+
|--------------------|---------------------------------------------------------------------------------------------------------------------------------------------|
|
|
138
|
+
| onChildLayerToggle | Emite dados da camada adicionada/removida do mapa |
|
|
139
|
+
| onGroupLayerToggle | Emite dados do grupo e suas camadas adicionadas/removidas do mapa |
|
|
140
|
+
| onDrawing | Emite dados do(s) desenho(s) adicionado(s)/removido(s) do mapa. Polígonos e retângulos são incrementados com a propriedade "drawnArea" |
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## Instâncias
|
|
145
|
+
|
|
146
|
+
| Nome | Descrição |
|
|
147
|
+
|----------------|--------------------------------------------------------------------------------------|
|
|
148
|
+
| map | Mapa Leaflet. Usado para manipulação do mapa |
|
|
149
|
+
| layerControl | Controle de camadas Leaflet. Usado para manipulação de camadas |
|
|
150
|
+
| drawItemsGroup | Grupo de desenhos Leaflet. Usado para manipulação de desenhos |
|
|
151
|
+
| leaflet | Instância Leaflet |
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## Injeção de Menu Lateral
|
|
156
|
+
|
|
157
|
+
Estes pontos permitem que aplicações consumidoras injetem seu próprio conteúdo no menu lateral do MapaDPG.
|
|
158
|
+
|
|
159
|
+
| Nome | ID | Posição no Menu | Descrição |
|
|
160
|
+
|-------------|----------------------------|-----------------|---------------------------------------------------------------------|
|
|
161
|
+
| Menu topo | `external-id-top-menu` | topo | Container para inserir conteúdo antes da listagem de camadas |
|
|
162
|
+
| Menu rodapé | `external-id-bottom-menu` | rodapé | Container para inserir conteúdo após a listagem de camadas |
|
|
163
|
+
|
|
164
|
+
Para exemplos, consulte o guia: [Injeção de Conteúdo](docs/contentInjection.md)
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## Exemplos de Configuração
|
|
169
|
+
|
|
170
|
+
Para exemplos completos de configuração incluindo camadas, ferramentas de desenho e opções de mapa, consulte o README original ou a [Documentação de Propriedades](docs/properties.md).
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## Tecnologias
|
|
175
|
+
|
|
176
|
+
- **Vue.js 3** - Framework JavaScript progressivo
|
|
177
|
+
- **TypeScript** - Superconjunto tipado de JavaScript
|
|
178
|
+
- **Leaflet.js** - Biblioteca JavaScript de código aberto para mapas interativos
|
|
179
|
+
- **Vite** - Ferramenta de frontend de próxima geração
|
|
180
|
+
- **Geoman** - Plugin Leaflet para desenho e edição
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## Licença
|
|
185
|
+
|
|
186
|
+
Este projeto é distribuído sob a [GPL-3.0](https://github.com/Rural-Environmental-Registry/core/blob/main/LICENSE).
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## Contribuição
|
|
191
|
+
|
|
192
|
+
Contribuições são bem-vindas! Para contribuir:
|
|
193
|
+
|
|
194
|
+
1. Faça um fork do repositório
|
|
195
|
+
2. Crie uma branch para sua funcionalidade (`git checkout -b feature/FuncionalidadeIncrivel`)
|
|
196
|
+
3. Faça commit das suas alterações (`git commit -m 'Adiciona FuncionalidadeIncrivel'`)
|
|
197
|
+
4. Faça push para a branch (`git push origin feature/FuncionalidadeIncrivel`)
|
|
198
|
+
5. Abra um Pull Request
|
|
199
|
+
|
|
200
|
+
Ao enviar um pull request ou patch, você afirma que é o autor do código e que concorda em licenciar sua contribuição sob os termos da Licença Pública Geral GNU v3.0 (ou posterior) para este projeto. Você também concorda em atribuir os direitos autorais de sua contribuição ao Ministério da Gestão e da Inovação em Serviços Públicos (MGI), proprietário deste projeto.
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## Suporte
|
|
205
|
+
|
|
206
|
+
Para suporte técnico ou questões relacionadas ao projeto:
|
|
207
|
+
|
|
208
|
+
- **Documentação:** Consulte os READMEs individuais de cada submódulo
|
|
209
|
+
- **Issues:** Reporte problemas através do rastreador de issues do repositório
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
Copyright (C) 2024-2025 Ministério da Gestão e da Inovação em Serviços Públicos (MGI), Governo do Brasil.
|
|
214
|
+
|
|
215
|
+
Este programa foi desenvolvido pela Dataprev como parte de um contrato com o Ministério da Gestão e da Inovação em Serviços Públicos (MGI).
|