vue-geojson-view-ts 1.3.20 → 1.3.22
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 +22 -0
- package/dist/vue-geojson-view-ts.js +9251 -9236
- package/dist/vue-geojson-view-ts.umd.cjs +20 -20
- package/package.json +1 -1
- package/src/components/MapView.vue +102 -83
package/package.json
CHANGED
|
@@ -70,6 +70,8 @@ export default defineComponent({
|
|
|
70
70
|
getCoodMarker: { type: Function, required: false },
|
|
71
71
|
getGeoJSON: { type: Function, required: false },
|
|
72
72
|
loadPolygon: { type: Boolean, required: false },
|
|
73
|
+
markerCircleSize: { type: Number, required: false, default: 14 }, // px
|
|
74
|
+
markerSvgSize: { type: Number, required: false, default: 10 }, // px
|
|
73
75
|
},
|
|
74
76
|
data() {
|
|
75
77
|
return {
|
|
@@ -497,48 +499,56 @@ export default defineComponent({
|
|
|
497
499
|
Array.isArray(feature.properties.coordProperties)
|
|
498
500
|
? feature.properties.coordProperties
|
|
499
501
|
: [];
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
let
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
Math.sin(
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
502
|
+
// Only render per-vertex markers/arrows when coordProperties exist and are non-empty
|
|
503
|
+
if (Array.isArray(coordProps) && coordProps.length) {
|
|
504
|
+
for (let i = 0; i < coords.length; i++) {
|
|
505
|
+
// Unificar círculo y flecha en un solo divIcon
|
|
506
|
+
const circleSize = this.markerCircleSize || 14;
|
|
507
|
+
const svgSize = this.markerSvgSize || 10;
|
|
508
|
+
let iconHtml = `<div style="display:flex;align-items:center;justify-content:center;width:${circleSize}px;height:${circleSize}px;">`;
|
|
509
|
+
// Círculo azul con padding, envuelve el SVG
|
|
510
|
+
let arrowSvg = "";
|
|
511
|
+
if (
|
|
512
|
+
i < coords.length - 1 &&
|
|
513
|
+
coordProps[i] &&
|
|
514
|
+
coordProps[i + 1] &&
|
|
515
|
+
coordProps[i].fecha &&
|
|
516
|
+
coordProps[i + 1].fecha &&
|
|
517
|
+
new Date(coordProps[i + 1].fecha) >
|
|
518
|
+
new Date(coordProps[i].fecha)
|
|
519
|
+
) {
|
|
520
|
+
// Calcular ángulo (bearing)
|
|
521
|
+
const toRad = (deg: number) => (deg * Math.PI) / 180;
|
|
522
|
+
const toDeg = (rad: number) => (rad * 180) / Math.PI;
|
|
523
|
+
const lat1 = toRad(coords[i][1]);
|
|
524
|
+
const lat2 = toRad(coords[i + 1][1]);
|
|
525
|
+
const dLon = toRad(coords[i + 1][0] - coords[i][0]);
|
|
526
|
+
const y = Math.sin(dLon) * Math.cos(lat2);
|
|
527
|
+
const x =
|
|
528
|
+
Math.cos(lat1) * Math.sin(lat2) -
|
|
529
|
+
Math.sin(lat1) * Math.cos(lat2) * Math.cos(dLon);
|
|
530
|
+
let brng = Math.atan2(y, x);
|
|
531
|
+
brng = toDeg(brng);
|
|
532
|
+
const angle = (brng + 360) % 360;
|
|
533
|
+
arrowSvg = `<svg width="${svgSize}" height="${svgSize}" viewBox="0 0 22 22" style="display:block;transform:rotate(${angle}deg);"><polygon points="11,3 15,17 11,14 7,17" fill="#fff" stroke="#fff"/></svg>`;
|
|
534
|
+
}
|
|
535
|
+
iconHtml +=
|
|
536
|
+
`<div style="background:#2196F3;border-radius:50%;border:1px solid #fff;box-shadow:0 0 2px #000;padding:1px;` +
|
|
537
|
+
`width:${circleSize - 6}px;` +
|
|
538
|
+
`height:${circleSize - 6}px;` +
|
|
539
|
+
`display:flex;align-items:center;justify-content:center;">${arrowSvg}</div>`;
|
|
540
|
+
iconHtml += "</div>";
|
|
541
|
+
const marker = L.marker([coords[i][1], coords[i][0]], {
|
|
542
|
+
icon: L.divIcon({
|
|
543
|
+
className: "",
|
|
544
|
+
html: iconHtml,
|
|
545
|
+
iconSize: [circleSize, circleSize],
|
|
546
|
+
iconAnchor: [circleSize / 2, circleSize / 2],
|
|
547
|
+
}),
|
|
548
|
+
zIndexOffset: -100,
|
|
549
|
+
});
|
|
550
|
+
marker.addTo(featureGroup);
|
|
529
551
|
}
|
|
530
|
-
iconHtml += `<div style="background:#2196F3;border-radius:50%;border:1px solid #fff;box-shadow:0 0 2px #000;padding:1px;width:8px;height:8px;display:flex;align-items:center;justify-content:center;">${arrowSvg}</div>`;
|
|
531
|
-
iconHtml += "</div>";
|
|
532
|
-
const marker = L.marker([coords[i][1], coords[i][0]], {
|
|
533
|
-
icon: L.divIcon({
|
|
534
|
-
className: "",
|
|
535
|
-
html: iconHtml,
|
|
536
|
-
iconSize: [14, 14],
|
|
537
|
-
iconAnchor: [7, 7],
|
|
538
|
-
}),
|
|
539
|
-
zIndexOffset: -100,
|
|
540
|
-
});
|
|
541
|
-
marker.addTo(featureGroup);
|
|
542
552
|
}
|
|
543
553
|
}
|
|
544
554
|
}
|
|
@@ -593,47 +603,52 @@ export default defineComponent({
|
|
|
593
603
|
Array.isArray(item.properties.coordProperties)
|
|
594
604
|
? item.properties.coordProperties
|
|
595
605
|
: [];
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
let
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
new Date(coordProps[i].fecha)
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
606
|
+
// Only render per-vertex markers/arrows when coordProperties exist and are non-empty
|
|
607
|
+
if (Array.isArray(coordProps) && coordProps.length) {
|
|
608
|
+
for (let i = 0; i < coords.length; i++) {
|
|
609
|
+
const circleSize = this.markerCircleSize || 14;
|
|
610
|
+
const svgSize = this.markerSvgSize || 10;
|
|
611
|
+
let iconHtml = `<div style="display:flex;align-items:center;justify-content:center;width:${circleSize}px;height:${circleSize}px;">`;
|
|
612
|
+
let arrowSvg = "";
|
|
613
|
+
if (
|
|
614
|
+
i < coords.length - 1 &&
|
|
615
|
+
coordProps[i] &&
|
|
616
|
+
coordProps[i + 1] &&
|
|
617
|
+
coordProps[i].fecha &&
|
|
618
|
+
coordProps[i + 1].fecha &&
|
|
619
|
+
new Date(coordProps[i + 1].fecha) >
|
|
620
|
+
new Date(coordProps[i].fecha)
|
|
621
|
+
) {
|
|
622
|
+
const toRad = (deg: number) => (deg * Math.PI) / 180;
|
|
623
|
+
const toDeg = (rad: number) => (rad * 180) / Math.PI;
|
|
624
|
+
const lat1 = toRad(coords[i][1]);
|
|
625
|
+
const lat2 = toRad(coords[i + 1][1]);
|
|
626
|
+
const dLon = toRad(coords[i + 1][0] - coords[i][0]);
|
|
627
|
+
const y = Math.sin(dLon) * Math.cos(lat2);
|
|
628
|
+
const x =
|
|
629
|
+
Math.cos(lat1) * Math.sin(lat2) -
|
|
630
|
+
Math.sin(lat1) * Math.cos(lat2) * Math.cos(dLon);
|
|
631
|
+
let brng = Math.atan2(y, x);
|
|
632
|
+
brng = toDeg(brng);
|
|
633
|
+
const angle = (brng + 360) % 360;
|
|
634
|
+
arrowSvg = `<svg width="${svgSize}" height="${svgSize}" viewBox="0 0 22 22" style="display:block;transform:rotate(${angle}deg);"><polygon points="11,3 15,17 11,14 7,17" fill="#fff" stroke="#fff"/></svg>`;
|
|
635
|
+
}
|
|
636
|
+
iconHtml +=
|
|
637
|
+
`<div style="background:#2196F3;border-radius:50%;border:1px solid #fff;box-shadow:0 0 2px #000;padding:1.5px;` +
|
|
638
|
+
`width:${circleSize - 6}px;` +
|
|
639
|
+
`height:${circleSize - 6}px;` +
|
|
640
|
+
`display:flex;align-items:center;justify-content:center;">${arrowSvg}</div>`;
|
|
641
|
+
iconHtml += "</div>";
|
|
642
|
+
const marker = L.marker([coords[i][1], coords[i][0]], {
|
|
643
|
+
icon: L.divIcon({
|
|
644
|
+
className: "",
|
|
645
|
+
html: iconHtml,
|
|
646
|
+
iconSize: [circleSize, circleSize],
|
|
647
|
+
iconAnchor: [circleSize / 2, circleSize / 2],
|
|
648
|
+
}),
|
|
649
|
+
});
|
|
650
|
+
marker.addTo(featureGroup);
|
|
625
651
|
}
|
|
626
|
-
iconHtml += `<div style="background:#2196F3;border-radius:50%;border:1px solid #fff;box-shadow:0 0 2px #000;padding:1.5px;width:8px;height:8px;display:flex;align-items:center;justify-content:center;">${arrowSvg}</div>`;
|
|
627
|
-
iconHtml += "</div>";
|
|
628
|
-
const marker = L.marker([coords[i][1], coords[i][0]], {
|
|
629
|
-
icon: L.divIcon({
|
|
630
|
-
className: "",
|
|
631
|
-
html: iconHtml,
|
|
632
|
-
iconSize: [14, 14],
|
|
633
|
-
iconAnchor: [7, 7],
|
|
634
|
-
}),
|
|
635
|
-
});
|
|
636
|
-
marker.addTo(featureGroup);
|
|
637
652
|
}
|
|
638
653
|
}
|
|
639
654
|
}
|
|
@@ -952,7 +967,11 @@ export default defineComponent({
|
|
|
952
967
|
// Seleccionar el icono de referencia según el tipo (1 -> Destino, else -> LLegadaSalida)
|
|
953
968
|
const tipo = props.tipo;
|
|
954
969
|
const referenciaIcon =
|
|
955
|
-
tipo ===
|
|
970
|
+
tipo === 0
|
|
971
|
+
? origenIconUrl
|
|
972
|
+
: tipo === 1
|
|
973
|
+
? destinoIconUrl
|
|
974
|
+
: llegadaIconUrl;
|
|
956
975
|
|
|
957
976
|
// Construir HTML del popup con mejor UI para la imagen
|
|
958
977
|
// Contenedor externo controla el ancho; el popup tiene su propia clase para limitar altura
|
|
@@ -965,7 +984,7 @@ export default defineComponent({
|
|
|
965
984
|
// Icono de referencia a la izquierda de la descripción
|
|
966
985
|
html += `<div style="display:flex;align-items:center;gap:8px;padding-top:6px;">`;
|
|
967
986
|
if (referenciaIcon) {
|
|
968
|
-
html += `<img src="${referenciaIcon}" style="width:
|
|
987
|
+
html += `<img src="${referenciaIcon}" style="width:30px;height:30px;flex:0 0 15px;"/>`;
|
|
969
988
|
}
|
|
970
989
|
if (fechaFormateada) {
|
|
971
990
|
html += `<div style="font-size:14px;"><b>${descripcion}:</b> ${fechaFormateada}</div>`;
|