vue-geojson-view-ts 1.3.10 → 1.3.12
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/dist/components/MapView.vue.d.ts +1 -0
- package/dist/vue-geojson-view-ts.js +8665 -8642
- package/dist/vue-geojson-view-ts.umd.cjs +20 -20
- package/package.json +1 -1
- package/src/components/MapView.vue +38 -3
- package/dist/image/end.png +0 -0
- package/dist/image/home.png +0 -0
- package/dist/image/tracking.png +0 -0
package/package.json
CHANGED
|
@@ -7,6 +7,9 @@
|
|
|
7
7
|
<script lang="ts">
|
|
8
8
|
import { defineComponent } from "vue";
|
|
9
9
|
import { markerDefault } from "../helpers/imgBase64";
|
|
10
|
+
import homeIconUrl from "../assets/home.png";
|
|
11
|
+
import endIconUrl from "../assets/end.png";
|
|
12
|
+
import trackingIconUrl from "../assets/tracking.png";
|
|
10
13
|
import * as L from "leaflet";
|
|
11
14
|
import "leaflet-draw";
|
|
12
15
|
import "leaflet/dist/leaflet.css";
|
|
@@ -309,10 +312,16 @@ export default defineComponent({
|
|
|
309
312
|
feature.geometry.type === "MultiLineString" ||
|
|
310
313
|
feature.geometry.type === "Point"
|
|
311
314
|
) {
|
|
315
|
+
const self = this;
|
|
312
316
|
L.geoJson(feature, {
|
|
313
317
|
pointToLayer: this.getPointToLayer.bind(this),
|
|
314
318
|
onEachFeature: function (feature, layer) {
|
|
315
319
|
featureGroup.addLayer(layer);
|
|
320
|
+
// Mostrar popup solo para Point
|
|
321
|
+
if (feature.geometry.type === "Point") {
|
|
322
|
+
var popupContent = self.getPopupContent(feature);
|
|
323
|
+
layer.bindPopup(popupContent);
|
|
324
|
+
}
|
|
316
325
|
},
|
|
317
326
|
});
|
|
318
327
|
}
|
|
@@ -419,17 +428,17 @@ export default defineComponent({
|
|
|
419
428
|
if (geometryType === "Point") {
|
|
420
429
|
const tipo = feature.properties?.tipo;
|
|
421
430
|
const firstIcon = L.icon({
|
|
422
|
-
iconUrl:
|
|
431
|
+
iconUrl: homeIconUrl,
|
|
423
432
|
iconSize: [38, 38],
|
|
424
433
|
iconAnchor: [16, 41],
|
|
425
434
|
});
|
|
426
435
|
const lastIcon = L.icon({
|
|
427
|
-
iconUrl:
|
|
436
|
+
iconUrl: endIconUrl,
|
|
428
437
|
iconSize: [38, 38],
|
|
429
438
|
iconAnchor: [16, 41],
|
|
430
439
|
});
|
|
431
440
|
const pointerIcon = L.icon({
|
|
432
|
-
iconUrl:
|
|
441
|
+
iconUrl: trackingIconUrl,
|
|
433
442
|
iconSize: [38, 38],
|
|
434
443
|
iconAnchor: [16, 41],
|
|
435
444
|
});
|
|
@@ -478,6 +487,32 @@ export default defineComponent({
|
|
|
478
487
|
this.mapRender.panTo(newCenter, { animate: true, duration: 0.5 });
|
|
479
488
|
}
|
|
480
489
|
},
|
|
490
|
+
getPopupContent(feature: any): string {
|
|
491
|
+
// Puedes personalizar el contenido del popup aquí
|
|
492
|
+
const props = feature.properties || {};
|
|
493
|
+
// Solo toma en cuenta descripcion y fechaHoraLlegada
|
|
494
|
+
const descripcion = props.descripcion || "";
|
|
495
|
+
const fechaHoraLlegada = props.fechaHoraLlegada || "";
|
|
496
|
+
|
|
497
|
+
// Formatear fecha a dd-MM-yyyy hh:mm:ss
|
|
498
|
+
let fechaFormateada = "";
|
|
499
|
+
if (fechaHoraLlegada) {
|
|
500
|
+
const fecha = new Date(fechaHoraLlegada);
|
|
501
|
+
const pad = (n: number) => n.toString().padStart(2, "0");
|
|
502
|
+
fechaFormateada = `${pad(fecha.getDate())}-${pad(
|
|
503
|
+
fecha.getMonth() + 1
|
|
504
|
+
)}-${fecha.getFullYear()} ${pad(fecha.getHours())}:${pad(
|
|
505
|
+
fecha.getMinutes()
|
|
506
|
+
)}:${pad(fecha.getSeconds())}`;
|
|
507
|
+
}
|
|
508
|
+
let html = "<div>";
|
|
509
|
+
html += `<b>Descripción:</b> ${descripcion}<br>`;
|
|
510
|
+
if (fechaFormateada) {
|
|
511
|
+
html += `<b>Fecha Hora Llegada:</b> ${fechaFormateada}<br>`;
|
|
512
|
+
}
|
|
513
|
+
html += "</div>";
|
|
514
|
+
return html;
|
|
515
|
+
},
|
|
481
516
|
},
|
|
482
517
|
watch: {
|
|
483
518
|
coordinatesMap(newVal) {
|
package/dist/image/end.png
DELETED
|
Binary file
|
package/dist/image/home.png
DELETED
|
Binary file
|
package/dist/image/tracking.png
DELETED
|
Binary file
|