ricerca città: voce del porto di riferimento con distanza km, apertura diretta se la città è un porto; eventi: layout sequenziale kind→data→altezza senza sovrapposizioni

This commit is contained in:
2026-09-02 11:46:50 +02:00
parent d74f417a67
commit 9e7c97786a
2 changed files with 24 additions and 3 deletions
+17 -1
View File
@@ -146,7 +146,8 @@ Page {
if (f !== "" && p[0].toLowerCase().indexOf(f) === -1)
continue
portModel.append({
name: p[0], country: qsTr("searched city"),
name: p[0],
country: p[1] !== "" ? p[1] : qsTr("searched city"),
range: "±" + (p[4][1][0] + p[4][2][0]).toFixed(2) + " m",
realIndex: -1, customIndex: i, custom: true,
isPreferred: (pref === p[0])
@@ -183,6 +184,12 @@ Page {
}
var port = [name, "", lat, lon, cost, flag]
customPorts.push(port)
// voce del porto di riferimento con la distanza dalla città cercata
if (np.port !== null && np.port[0].toLowerCase() !== name.toLowerCase()) {
customPorts.push([np.port[0],
"(" + Math.round(np.km) + " km da " + name + ")",
np.port[2], np.port[3], np.port[4].slice(), np.port[5] || ""])
}
rebuild()
geoMsg.text = qsTr("Found %1 (via %2)").arg(name).arg(src)
geoMsg.visible = true
@@ -246,6 +253,15 @@ Page {
geoMsg.text = qsTr("Searching…")
geoMsg.visible = true
geoMsg.color = Theme.secondaryColor
// la città cercata è già un porto noto? aprilo direttamente
var ql = q.toLowerCase()
for (var i = 0; i < Tides.PORTS.length; i++) {
if (Tides.PORTS[i][0].toLowerCase() === ql) {
geoMsg.visible = false
page.openDetail(Tides.PORTS[i], i, false)
return
}
}
var loc = Tides.findCityLocal(q)
if (loc) {
geoFound(loc[0], loc[2], loc[3], qsTr("local dataset"))