Merge pull request #2838 from phl0/nullDistance

Show 0km instead of blank (same as QSO view)
This commit is contained in:
Florian (DF2ET)
2026-01-27 22:09:34 +01:00
committed by GitHub
5 changed files with 83 additions and 61 deletions

View File

@@ -772,13 +772,13 @@ function spawnQrbCalculator(locator1, locator2) {
nl2br: false,
message: html,
onshown: function(dialog) {
if (locator1 !== undefined) {
$("#qrbcalc_locator1").val(locator1);
}
if (locator2 !== undefined) {
$("#qrbcalc_locator2").val(locator2);
calculateQrb();
}
if (locator1 !== undefined) {
$("#qrbcalc_locator1").val(locator1);
}
if (locator2 !== undefined) {
$("#qrbcalc_locator2").val(locator2);
calculateQrb();
}
},
buttons: [{
label: lang_admin_close,
@@ -1245,55 +1245,76 @@ function newpath(latlng1, latlng2, locator1, locator2) {
},
}).setView([30, 0], 1.5);
// Need to fix so that marker is placed at same place as end of line, but this only needs to be done when longitude is < -170
if (latlng2[1] < -170) {
latlng2[1] = parseFloat(latlng2[1])+360;
if (locator1.toUpperCase() != locator2.toUpperCase()) {
// Need to fix so that marker is placed at same place as end of line, but this only needs to be done when longitude is < -170
if (latlng2[1] < -170) {
latlng2[1] = parseFloat(latlng2[1])+360;
}
if (latlng1[1] < -170) {
latlng1[1] = parseFloat(latlng1[1])+360;
}
if ((latlng1[1] - latlng2[1]) < -180) {
latlng2[1] = parseFloat(latlng2[1]) -360;
} else if ((latlng1[1] - latlng2[1]) > 180) {
latlng2[1] = parseFloat(latlng2[1]) +360;
}
map.fitBounds([
[latlng1[0], latlng1[1]],
[latlng2[0], latlng2[1]]
]);
var maidenhead = L.maidenheadqrb().addTo(map);
var osmUrl = option_map_tile_server;
var osmAttrib= option_map_tile_server_copyright;
var osm = new L.TileLayer(osmUrl, {minZoom: 1, maxZoom: 12, attribution: osmAttrib});
var redIcon = L.icon({
iconUrl: icon_dot_url,
iconSize: [10, 10], // size of the icon
});
map.addLayer(osm);
var marker = L.marker([latlng1[0], latlng1[1]], {closeOnClick: false, autoClose: false}).addTo(map).bindPopup(locator1);
var marker2 = L.marker([latlng2[0], latlng2[1]], {closeOnClick: false, autoClose: false}).addTo(map).bindPopup(locator2);
const multiplelines = [];
multiplelines.push(
new L.LatLng(latlng1[0], latlng1[1]),
new L.LatLng(latlng2[0], latlng2[1])
)
const geodesic = L.geodesic(multiplelines, {
weight: 3,
opacity: 1,
color: 'red',
wrap: false,
steps: 100
}).addTo(map);
} else {
// Need to fix so that marker is placed at same place as end of line, but this only needs to be done when longitude is < -170
if (latlng1[1] < -170) {
latlng1[1] = parseFloat(latlng1[1])+360;
}
var maidenhead = L.maidenheadqrb().addTo(map);
map.setView([latlng1[0], latlng1[1]], 13);
var osmUrl = option_map_tile_server;
var osmAttrib= option_map_tile_server_copyright;
var osm = new L.TileLayer(osmUrl, {minZoom: 1, maxZoom: 12, attribution: osmAttrib});
var redIcon = L.icon({
iconUrl: icon_dot_url,
iconSize: [10, 10], // size of the icon
});
map.addLayer(osm);
var marker = L.marker([latlng1[0], latlng1[1]], {closeOnClick: false, autoClose: false}).addTo(map).bindPopup(locator1);
}
if (latlng1[1] < -170) {
latlng1[1] = parseFloat(latlng1[1])+360;
}
if ((latlng1[1] - latlng2[1]) < -180) {
latlng2[1] = parseFloat(latlng2[1]) -360;
} else if ((latlng1[1] - latlng2[1]) > 180) {
latlng2[1] = parseFloat(latlng2[1]) +360;
}
map.fitBounds([
[latlng1[0], latlng1[1]],
[latlng2[0], latlng2[1]]
]);
var maidenhead = L.maidenheadqrb().addTo(map);
var osmUrl = option_map_tile_server;
var osmAttrib= option_map_tile_server_copyright;
var osm = new L.TileLayer(osmUrl, {minZoom: 1, maxZoom: 12, attribution: osmAttrib});
var redIcon = L.icon({
iconUrl: icon_dot_url,
iconSize: [10, 10], // size of the icon
});
map.addLayer(osm);
var marker = L.marker([latlng1[0], latlng1[1]], {closeOnClick: false, autoClose: false}).addTo(map).bindPopup(locator1);
var marker2 = L.marker([latlng2[0], latlng2[1]], {closeOnClick: false, autoClose: false}).addTo(map).bindPopup(locator2);
const multiplelines = [];
multiplelines.push(
new L.LatLng(latlng1[0], latlng1[1]),
new L.LatLng(latlng2[0], latlng2[1])
)
const geodesic = L.geodesic(multiplelines, {
weight: 3,
opacity: 1,
color: 'red',
wrap: false,
steps: 100
}).addTo(map);
}
function disableMap() {