diff --git a/RutasDBUS/Components/Pages/PlanificadorRutas.Estado.cs b/RutasDBUS/Components/Pages/PlanificadorRutas.Estado.cs
index 4676425..865f754 100644
--- a/RutasDBUS/Components/Pages/PlanificadorRutas.Estado.cs
+++ b/RutasDBUS/Components/Pages/PlanificadorRutas.Estado.cs
@@ -1084,7 +1084,7 @@ public partial class PlanificadorRutas : ComponentBase
if (string.IsNullOrWhiteSpace(_callejeroOrigenResumenRuta))
return string.Empty;
- return $"O callejero: {_callejeroOrigenResumenRuta}";
+ return $"O: {_callejeroOrigenResumenRuta}";
}
private string FormatearResumenCallejeroDestino()
@@ -1092,7 +1092,7 @@ public partial class PlanificadorRutas : ComponentBase
if (string.IsNullOrWhiteSpace(_callejeroDestinoResumenRuta))
return string.Empty;
- return $"D callejero: {_callejeroDestinoResumenRuta}";
+ return $"D: {_callejeroDestinoResumenRuta}";
}
private static string FormatearLugarCallejeroResumen(LugarGeocodificadoCercano? cercano)
diff --git a/RutasDBUS/Components/Pages/PlanificadorRutas.Itinerarios.cs b/RutasDBUS/Components/Pages/PlanificadorRutas.Itinerarios.cs
index 75a9562..ec2854d 100644
--- a/RutasDBUS/Components/Pages/PlanificadorRutas.Itinerarios.cs
+++ b/RutasDBUS/Components/Pages/PlanificadorRutas.Itinerarios.cs
@@ -1181,7 +1181,7 @@ public partial class PlanificadorRutas : ComponentBase
private bool _elevPopupMinimizado = false;
- private const string _versionApp = "(v-20260714a)";
+ private const string _versionApp = "(v-20260715a)";
private double? _paradaElevG;
diff --git a/RutasDBUS/Components/Pages/PlanificadorRutas.Renderizado.cs b/RutasDBUS/Components/Pages/PlanificadorRutas.Renderizado.cs
index 37b3f29..3926c32 100644
--- a/RutasDBUS/Components/Pages/PlanificadorRutas.Renderizado.cs
+++ b/RutasDBUS/Components/Pages/PlanificadorRutas.Renderizado.cs
@@ -216,7 +216,8 @@ public partial class PlanificadorRutas : ComponentBase
category = categoria,
slope = pendiente,
distance = distancia,
- elevation = elevActual,
+ elevationStart = elevAnterior,
+ elevationEnd = elevActual,
label = pendiente is null
? "-"
: pendiente.Value.ToString("+0.0;-0.0;0.0", CultureInfo.InvariantCulture) + " %"
diff --git a/RutasDBUS/wwwroot/app.js b/RutasDBUS/wwwroot/app.js
index 44c87f4..f6e5e64 100644
--- a/RutasDBUS/wwwroot/app.js
+++ b/RutasDBUS/wwwroot/app.js
@@ -161,6 +161,59 @@ window.rt.drawRoute = function (id, coords, options) {
if (elevationSegments.length > 0 && coords && coords.length >= 2) {
const group = window.L.layerGroup();
+ const progressAlongSegment = function (segmentCoords, latlng) {
+ if (!latlng || !Array.isArray(segmentCoords) || segmentCoords.length < 2) return 0.5;
+
+ const start = segmentCoords[0];
+ const end = segmentCoords[segmentCoords.length - 1];
+ const startLat = Number(start && start[0]);
+ const startLon = Number(start && start[1]);
+ const endLat = Number(end && end[0]);
+ const endLon = Number(end && end[1]);
+
+ if (![startLat, startLon, endLat, endLon, latlng.lat, latlng.lng].every(Number.isFinite))
+ return 0.5;
+
+ const lonScale = Math.cos(((startLat + endLat) / 2) * Math.PI / 180);
+ const dx = (endLon - startLon) * lonScale;
+ const dy = endLat - startLat;
+ const px = (latlng.lng - startLon) * lonScale;
+ const py = latlng.lat - startLat;
+ const lengthSquared = dx * dx + dy * dy;
+
+ if (lengthSquared <= Number.EPSILON) return 0.5;
+
+ const progress = (px * dx + py * dy) / lengthSquared;
+ return Math.max(0, Math.min(1, progress));
+ };
+
+ const elevationTooltip = function (segment, progress) {
+ const t = Number.isFinite(progress) ? Math.max(0, Math.min(1, progress)) : 0.5;
+ const slope = segment && typeof segment.slope === "number" ? segment.slope : null;
+ const distance = segment && typeof segment.distance === "number" ? segment.distance : null;
+ const elevationStart = segment && typeof segment.elevationStart === "number" ? segment.elevationStart : null;
+ const elevationEnd = segment && typeof segment.elevationEnd === "number" ? segment.elevationEnd : null;
+ const slopeText = slope !== null && Number.isFinite(slope)
+ ? ((slope > 0 ? "+" : "") + slope.toFixed(1) + " %")
+ : (segment && segment.label ? String(segment.label) : "-");
+ const distanceText = distance !== null && Number.isFinite(distance)
+ ? (distance * t).toFixed(2) + " m"
+ : "-";
+ const estimatedElevation = elevationStart !== null && Number.isFinite(elevationStart) &&
+ elevationEnd !== null && Number.isFinite(elevationEnd)
+ ? elevationStart + (elevationEnd - elevationStart) * t
+ : null;
+ const elevationText = estimatedElevation !== null
+ ? estimatedElevation.toFixed(2) + " m"
+ : "-";
+
+ return [
+ "Pendiente: " + slopeText,
+ "Dist. anterior: " + distanceText,
+ "Altura: " + elevationText
+ ].join("
");
+ };
+
elevationSegments.forEach(function (segment) {
const segmentCoords = segment && segment.coords;
if (!Array.isArray(segmentCoords) || segmentCoords.length < 2) return;
@@ -177,23 +230,7 @@ window.rt.drawRoute = function (id, coords, options) {
if (dashArray) segmentOpts.dashArray = dashArray;
const segmentLine = buildLine(segmentCoords, segmentOpts);
- const slope = segment && typeof segment.slope === "number" ? segment.slope : null;
- const distance = segment && typeof segment.distance === "number" ? segment.distance : null;
- const elevation = segment && typeof segment.elevation === "number" ? segment.elevation : null;
- const slopeText = slope !== null && Number.isFinite(slope)
- ? ((slope > 0 ? "+" : "") + slope.toFixed(1) + " %")
- : (segment && segment.label ? String(segment.label) : "-");
- const distanceText = distance !== null && Number.isFinite(distance)
- ? distance.toFixed(2) + " m"
- : "-";
- const elevationText = elevation !== null && Number.isFinite(elevation)
- ? elevation.toFixed(2) + " m"
- : "-";
- const label = [
- "Pendiente: " + slopeText,
- "Dist. anterior: " + distanceText,
- "Altura: " + elevationText
- ].join("
");
+ const label = elevationTooltip(segment, 0.5);
if (label) {
segmentLine.bindTooltip(label, {
@@ -202,6 +239,12 @@ window.rt.drawRoute = function (id, coords, options) {
opacity: 0.92,
className: "rt-elev-tooltip"
});
+ const updateTooltipAtCursor = function (e) {
+ const progress = progressAlongSegment(segmentCoords, e && e.latlng);
+ segmentLine.setTooltipContent(elevationTooltip(segment, progress));
+ };
+ segmentLine.on("mouseover", updateTooltipAtCursor);
+ segmentLine.on("mousemove", updateTooltipAtCursor);
}
segmentLine.addTo(group);