feat(rover): overlay LOS line + label profile rover→station endpoints
This commit is contained in:
parent
ea502ee9e7
commit
2f3500515a
1 changed files with 22 additions and 6 deletions
|
|
@ -773,12 +773,17 @@ defmodule MicrowavepropWeb.RoverLive do
|
||||||
|
|
||||||
fill = "0,60 " <> line <> " 240,60"
|
fill = "0,60 " <> line <> " 240,60"
|
||||||
|
|
||||||
|
los_y_start = Float.round(60.0 - (first.elev - min_e) / span * 50.0, 2)
|
||||||
|
los_y_end = Float.round(60.0 - (last.elev - min_e) / span * 50.0, 2)
|
||||||
|
|
||||||
%{
|
%{
|
||||||
line: line,
|
line: line,
|
||||||
fill: fill,
|
fill: fill,
|
||||||
start_elev_m: first.elev,
|
start_elev_m: first.elev,
|
||||||
end_elev_m: last.elev,
|
end_elev_m: last.elev,
|
||||||
total_km: total_km
|
total_km: total_km,
|
||||||
|
los_y_start: los_y_start,
|
||||||
|
los_y_end: los_y_end
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -1150,7 +1155,7 @@ defmodule MicrowavepropWeb.RoverLive do
|
||||||
<div class="text-[11px] opacity-60">
|
<div class="text-[11px] opacity-60">
|
||||||
rover {elev_ft(link.rover_elev_m)} · max obstacle {elev_ft(link.max_obstacle_m)}
|
rover {elev_ft(link.rover_elev_m)} · max obstacle {elev_ft(link.max_obstacle_m)}
|
||||||
</div>
|
</div>
|
||||||
<.profile_svg :if={link.profile_svg} svg={link.profile_svg} />
|
<.profile_svg :if={link.profile_svg} svg={link.profile_svg} callsign={link.callsign} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -1158,17 +1163,28 @@ defmodule MicrowavepropWeb.RoverLive do
|
||||||
end
|
end
|
||||||
|
|
||||||
attr :svg, :map, required: true
|
attr :svg, :map, required: true
|
||||||
|
attr :callsign, :string, required: true
|
||||||
|
|
||||||
defp profile_svg(assigns) do
|
defp profile_svg(assigns) do
|
||||||
~H"""
|
~H"""
|
||||||
<svg viewBox="0 0 240 64" class="w-full h-12 mt-1" preserveAspectRatio="none">
|
<svg viewBox="0 0 240 64" class="w-full h-12 mt-1" preserveAspectRatio="none">
|
||||||
<polygon points={@svg.fill} fill="rgb(14 165 233 / 0.25)" />
|
<polygon points={@svg.fill} fill="rgb(14 165 233 / 0.25)" />
|
||||||
<polyline points={@svg.line} fill="none" stroke="#0ea5e9" stroke-width="1.2" />
|
<polyline points={@svg.line} fill="none" stroke="#0ea5e9" stroke-width="1.2" />
|
||||||
|
<line
|
||||||
|
x1="0"
|
||||||
|
y1={@svg.los_y_start}
|
||||||
|
x2="240"
|
||||||
|
y2={@svg.los_y_end}
|
||||||
|
stroke="#f59e0b"
|
||||||
|
stroke-width="1"
|
||||||
|
stroke-dasharray="3 2"
|
||||||
|
opacity="0.85"
|
||||||
|
/>
|
||||||
</svg>
|
</svg>
|
||||||
<div class="flex justify-between text-[10px] opacity-50 font-mono">
|
<div class="flex justify-between text-[10px] opacity-60 font-mono gap-2">
|
||||||
<span>{elev_ft(@svg.start_elev_m)}</span>
|
<span>rover {elev_ft(@svg.start_elev_m)}</span>
|
||||||
<span>{km_to_mi(@svg.total_km)} mi</span>
|
<span class="opacity-70">{km_to_mi(@svg.total_km)} mi</span>
|
||||||
<span>{elev_ft(@svg.end_elev_m)}</span>
|
<span>{@callsign} {elev_ft(@svg.end_elev_m)}</span>
|
||||||
</div>
|
</div>
|
||||||
"""
|
"""
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue