vue-geojson-view-ts 1.3.0 → 1.3.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-geojson-view-ts",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",
@@ -65,6 +65,8 @@
65
65
  "leaflet": "1.9.3",
66
66
  "leaflet-draw": "^1.0.4",
67
67
  "leaflet-draw-locales": "^1.2.2",
68
+ "leaflet.fullscreen": "^2.4.0",
69
+ "screenfull": "^6.0.2",
68
70
  "typewriter-effect": "^2.19.0"
69
71
  }
70
72
  }
@@ -1,64 +1,67 @@
1
1
  <template>
2
- <div ref="maps" id="maps"></div>
3
- </template>
2
+ <div ref="maps" id="maps"></div>
3
+ </template>
4
4
 
5
- <script lang="ts">
6
- import {markerDefault} from '../helpers/imgBase64'
5
+ <script lang="ts">
6
+ import { markerDefault } from '../helpers/imgBase64'
7
7
 
8
- import { defineComponent } from 'vue';
8
+ import { defineComponent } from 'vue';
9
9
  import * as L from 'leaflet';
10
- import 'leaflet/dist/leaflet.css';
11
- import * as turf from '@turf/turf';
10
+ import 'leaflet/dist/leaflet.css';
11
+ import * as turf from '@turf/turf';
12
12
  import { IconOptions } from 'leaflet';
13
-
14
- export default defineComponent({
15
- name:"CoordinatesVerifyPolygon",
16
- props: {
17
- dataPolygon: Object,
18
- iconMarker:Object,
19
- coordinatesMap: Array,
20
- checkPointInPolygon:Function
21
- },
22
- data(){
23
- return {
24
- markerIconDefault:{
25
- iconUrl: markerDefault,
26
- iconSize: [25, 41],
27
- iconAnchor: [12, 41],
28
- }
29
- }
30
- },
31
- mounted() {
32
- this.verificarPuntoEnPoligono();
33
- },
34
- methods: {
35
- verificarPuntoEnPoligono() {
36
- const iconDefaultMarket = this.iconMarker?this.iconMarker:this.markerIconDefault
37
- const data = this.dataPolygon?.geometry.coordinates[0].map((e: number[]) => [e[1], e[0]]);
38
- const polygonCoordinates: L.LatLngExpression[] = JSON.parse(JSON.stringify(data))
39
- const pointCoordinates = [this.coordinatesMap?this.coordinatesMap[0] as number:0,this.coordinatesMap?this.coordinatesMap[1] as number:0];
40
- const map =L.map('maps').setView([this.coordinatesMap?this.coordinatesMap[0] as number:0,this.coordinatesMap?this.coordinatesMap[1] as number:0],this.coordinatesMap?this.coordinatesMap[2]as number:0);
41
- L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
42
- maxZoom: 19,
43
- attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
44
- }).addTo(map)
45
- L.polygon(polygonCoordinates).addTo(map);
46
- const markerCoordinates: L.LatLngExpression = [this.coordinatesMap?this.coordinatesMap[0] as number:0,this.coordinatesMap?this.coordinatesMap[1] as number:0];
47
- const markerIcon = L.icon(iconDefaultMarket as IconOptions);
48
- L.marker(markerCoordinates,{icon:markerIcon}).addTo(map);
49
- const pointGeoJSON = turf.point(pointCoordinates);
50
- const polygonGeoJSON = turf.polygon([data]);
51
- const isPointInside = turf.booleanPointInPolygon(pointGeoJSON, polygonGeoJSON);
52
- if(this.checkPointInPolygon)
53
- this.checkPointInPolygon(isPointInside)
13
+ import 'leaflet.fullscreen/Control.FullScreen.css'
14
+ import 'leaflet.fullscreen'
15
+
16
+
17
+ export default defineComponent({
18
+ name: "CoordinatesVerifyPolygon",
19
+ props: {
20
+ dataPolygon: Object,
21
+ iconMarker: Object,
22
+ coordinatesMap: Array,
23
+ checkPointInPolygon: Function
24
+ },
25
+ data() {
26
+ return {
27
+ markerIconDefault: {
28
+ iconUrl: markerDefault,
29
+ iconSize: [25, 41],
30
+ iconAnchor: [12, 41],
54
31
  }
55
32
  }
56
- });
57
- </script>
58
-
59
- <style>
60
- #maps {
61
- height: 500px;
33
+ },
34
+ mounted() {
35
+ this.verificarPuntoEnPoligono();
36
+ },
37
+ methods: {
38
+ verificarPuntoEnPoligono() {
39
+ const iconDefaultMarket = this.iconMarker ? this.iconMarker : this.markerIconDefault
40
+ const data = this.dataPolygon?.geometry.coordinates[0].map((e: number[]) => [e[1], e[0]]);
41
+ const polygonCoordinates: L.LatLngExpression[] = JSON.parse(JSON.stringify(data))
42
+ const pointCoordinates = [this.coordinatesMap ? this.coordinatesMap[0] as number : 0, this.coordinatesMap ? this.coordinatesMap[1] as number : 0];
43
+ const map = L.map('maps', { fullscreenControl: true } as any).setView([this.coordinatesMap ? this.coordinatesMap[0] as number : 0, this.coordinatesMap ? this.coordinatesMap[1] as number : 0], this.coordinatesMap ? this.coordinatesMap[2] as number : 0);
44
+ L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
45
+ maxZoom: 19,
46
+ attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
47
+ }).addTo(map)
48
+ L.polygon(polygonCoordinates).addTo(map);
49
+ const markerCoordinates: L.LatLngExpression = [this.coordinatesMap ? this.coordinatesMap[0] as number : 0, this.coordinatesMap ? this.coordinatesMap[1] as number : 0];
50
+ const markerIcon = L.icon(iconDefaultMarket as IconOptions);
51
+ L.marker(markerCoordinates, { icon: markerIcon }).addTo(map);
52
+ const pointGeoJSON = turf.point(pointCoordinates);
53
+ const polygonGeoJSON = turf.polygon([data]);
54
+ const isPointInside = turf.booleanPointInPolygon(pointGeoJSON, polygonGeoJSON);
55
+ if (this.checkPointInPolygon)
56
+ this.checkPointInPolygon(isPointInside)
57
+ }
62
58
  }
63
- </style>
59
+ });
60
+ </script>
61
+
62
+ <style>
63
+ #maps {
64
+ height: 500px;
65
+ }
66
+ </style>
64
67
 
@@ -9,6 +9,8 @@ import * as L from "leaflet";
9
9
  import "leaflet/dist/leaflet.css";
10
10
  import { onMounted, ref } from "vue";
11
11
  import { markerDefault } from "../helpers/imgBase64";
12
+ import 'leaflet.fullscreen/Control.FullScreen.css'
13
+ import 'leaflet.fullscreen'
12
14
  import axios from "axios";
13
15
 
14
16
  export type TIconMaker = {
@@ -91,7 +93,7 @@ const renderMap = async () => {
91
93
 
92
94
  const createMap = async () => {
93
95
  const iconMarker = props.configurationMap?.iconMarker;
94
- const map = L.map(idMap.value).setView(
96
+ const map = L.map(idMap.value,{fullscreenControl:true} as any).setView(
95
97
  [coords.value.lat, coords.value.lng],
96
98
  coords.value.zoom
97
99
  );
@@ -13,6 +13,8 @@ import "leaflet/dist/leaflet.css";
13
13
  import "leaflet-draw/dist/leaflet.draw.css";
14
14
  import drawLocales from "leaflet-draw-locales";
15
15
  import axios from "axios";
16
+ import 'leaflet.fullscreen/Control.FullScreen.css'
17
+ import 'leaflet.fullscreen'
16
18
 
17
19
  declare global {
18
20
  interface Window {
@@ -134,7 +136,7 @@ export default defineComponent({
134
136
  : this.markerIcon
135
137
  : this.markerIcon;
136
138
  window.type = true;
137
- const map = L.map(this.idMap).setView(
139
+ const map = L.map(this.idMap,{fullscreenControl:true} as any).setView(
138
140
  [
139
141
  this.renderCoordinates ? (this.renderCoordinates[0] as number) : 0,
140
142
  this.renderCoordinates ? (this.renderCoordinates[1] as number) : 0,
@@ -230,7 +232,7 @@ export default defineComponent({
230
232
  : this.markerIcon
231
233
  : this.markerIcon;
232
234
  window.type = true;
233
- const map = L.map(this.idMap).setView(
235
+ const map = L.map(this.idMap,{fullscreenControl:true} as any).setView(
234
236
  [
235
237
  this.renderCoordinates ? (this.renderCoordinates[0] as number) : 0,
236
238
  this.renderCoordinates ? (this.renderCoordinates[1] as number) : 0,