Band/Mode filtering

code cleaning
merge-requests/203/head
Tag 2022-09-22 19:02:10 -07:00
rodzic 5f251293e5
commit 610bd78bef
4 zmienionych plików z 52 dodań i 88 usunięć

Wyświetl plik

@ -691,6 +691,7 @@ function gtBandFilterChanged(selector)
removePaths(); removePaths();
redrawGrids(); redrawGrids();
redrawSpots(); redrawSpots();
redrawParks();
} }
function gtModeFilterChanged(selector) function gtModeFilterChanged(selector)
@ -699,6 +700,7 @@ function gtModeFilterChanged(selector)
redrawGrids(); redrawGrids();
redrawSpots(); redrawSpots();
redrawParks();
} }
function gtPropFilterChanged(selector) function gtPropFilterChanged(selector)
@ -715,6 +717,7 @@ function setBandAndModeToAuto()
"auto"; "auto";
redrawGrids(); redrawGrids();
redrawSpots(); redrawSpots();
redrawParks();
} }
function hideLiveGrid(i) function hideLiveGrid(i)
@ -6472,6 +6475,7 @@ function handleWsjtxStatus(newMessage)
goProcessRoster(); goProcessRoster();
redrawGrids(); redrawGrids();
redrawSpots(); redrawSpots();
redrawParks();
redrawPins(); redrawPins();
var msg = ""; var msg = "";
@ -13219,6 +13223,7 @@ function changeMapLayer()
changePathWidth(); changePathWidth();
redrawSpots(); redrawSpots();
redrawParks();
} }
function voiceChangedValue() function voiceChangedValue()

Wyświetl plik

@ -10,13 +10,12 @@ var g_pota = {
parkSchedule: {}, parkSchedule: {},
scheduleTimeout: null, scheduleTimeout: null,
callSpots: {}, callSpots: {},
parkSpots: {},
spotsTimeout: null, spotsTimeout: null,
mapParks: {} mapParks: {}
}; };
var g_defaultPark = { var g_defaultPark = {
scheduled: false,
spotted: false,
feature: null feature: null
} }
@ -60,61 +59,47 @@ function togglePota()
} }
} }
function rebuildParks() function redrawParks()
{ {
g_layerSources.pota.clear(); if (g_potaEnabled == 1)
g_pota.mapParks = {};
for (const park in g_pota.parkSpots)
{ {
let obj = makeParkFeature(park); g_layerSources.pota.clear();
if (obj) g_pota.mapParks = {};
{ makeParkFeatures();
obj.spotted = true;
}
}
for (const park in g_pota.parkSchedule)
{
let obj = makeParkFeature(park);
if (obj)
{
obj.scheduled = true;
}
} }
} }
function makeParkFeature(park) function makeParkFeatures()
{ {
try try
{ {
if (park in g_pota.parks) for (const park in g_pota.parkSpots)
{ {
let parkObj = null; if (park in g_pota.parks)
if (park in g_pota.mapParks)
{ {
parkObj = g_pota.mapParks[park]; let parkObj = Object.assign({}, g_defaultPark);
for (const i in g_pota.parkSpots[park])
{
let report = g_pota.parkSpots[park][i];
if (parkObj.feature == null && (g_appSettings.gtBandFilter.length == 0 || (g_appSettings.gtBandFilter == "auto" ? myBand == report.band : g_appSettings.gtBandFilter == report.band)) && validateMapMode(report.mode))
{
parkObj.feature = iconFeature(ol.proj.fromLonLat([Number(g_pota.parks[park].longitude), Number(g_pota.parks[park].latitude)]), g_gtParkIconActive, 1);
parkObj.feature.key = park;
parkObj.feature.size = 22;
g_pota.mapParks[park] = parkObj;
g_layerSources.pota.addFeature(parkObj.feature);
break;
}
}
} }
else
{
parkObj = Object.assign({}, g_defaultPark);
g_pota.mapParks[park] = parkObj;
}
if (parkObj.feature == null)
{
parkObj.feature = iconFeature(ol.proj.fromLonLat([Number(g_pota.parks[park].longitude), Number(g_pota.parks[park].latitude)]), g_gtParkIconActive, 1);
parkObj.feature.key = park;
parkObj.feature.size = 22;
g_layerSources.pota.addFeature(parkObj.feature);
}
return parkObj;
} }
} }
catch (e) catch (e)
{ {
console.log("exception: makeParkFeature " + park); console.log("exception: makeParkFeature " + park);
console.log(e.message); console.log(e.message);
return null;
} }
} }
@ -203,6 +188,7 @@ function processPotaSpots(buffer)
spots[spot].spotTime = Date.parse(spots[spot].spotTime + "Z"); spots[spot].spotTime = Date.parse(spots[spot].spotTime + "Z");
spots[spot].expire = (spots[spot].expire * 1000) + spots[spot].spotTime; spots[spot].expire = (spots[spot].expire * 1000) + spots[spot].spotTime;
spots[spot].frequency = parseInt(spots[spot].frequency) / 1000; spots[spot].frequency = parseInt(spots[spot].frequency) / 1000;
spots[spot].band = spots[spot].frequency.formatBand();
(g_pota.callSpots[spots[spot].activator] = g_pota.callSpots[spots[spot].activator] || []).push(spots[spot].reference); (g_pota.callSpots[spots[spot].activator] = g_pota.callSpots[spots[spot].activator] || []).push(spots[spot].reference);
(g_pota.parkSpots[spots[spot].reference] = g_pota.parkSpots[spots[spot].reference] || []).push(spots[spot]); (g_pota.parkSpots[spots[spot].reference] = g_pota.parkSpots[spots[spot].reference] || []).push(spots[spot]);
} }
@ -222,7 +208,7 @@ function processPotaSpots(buffer)
g_pota.parkSpots[spot] = uniqueArrayFromArray(g_pota.parkSpots[spot]); g_pota.parkSpots[spot] = uniqueArrayFromArray(g_pota.parkSpots[spot]);
} }
rebuildParks(); redrawParks();
} }
catch (e) catch (e)
{ {
@ -297,8 +283,6 @@ function processPotaSchedule(buffer)
{ {
g_pota.parkSchedule[key] = uniqueArrayFromArray(g_pota.parkSchedule[key]); g_pota.parkSchedule[key] = uniqueArrayFromArray(g_pota.parkSchedule[key]);
} }
rebuildParks();
} }
catch (e) catch (e)
{ {
@ -380,33 +364,24 @@ function createParkTipTable(toolElement)
" (<font color='yellow'>" + g_dxccToAltName[Number(g_pota.parks[key].entityId)] + "</font>)" + " (<font color='yellow'>" + g_dxccToAltName[Number(g_pota.parks[key].entityId)] + "</font>)" +
"</font></br><font color='lightblue'>" + g_pota.parks[key].locationDesc + "</font></div>"; "</font></br><font color='lightblue'>" + g_pota.parks[key].locationDesc + "</font></div>";
if (parkObj.spotted) worker += "<table id='potaSpotsTable' class='darkTable' style='margin: 0 auto;'>";
worker += "<tr><th>Activator</th><th>Spotter</th><th>Freq</th><th>Mode</th><th>Count</th><th>When</th><th>Source</th><th>Comment</th></tr>";
for (const i in g_pota.parkSpots[key])
{ {
worker += "<div style='background-color:#000;color:#fff;font-size:12px;border:1px solid gray;margin:1px' class='roundBorder'>Activators (spots)" worker += "<tr>";
worker += "<td style='color:yellow'>" + g_pota.parkSpots[key][i].activator + "</td>";
worker += "<table id='potaSpotsTable' class='darkTable' style='margin: 0 auto;'>"; worker += "<td style='color:cyan'>" + ((g_pota.parkSpots[key][i].spotter == g_pota.parkSpots[key][i].activator) ? "Self" : g_pota.parkSpots[key][i].spotter) + "</td>";
worker += "<tr><th>Activator</th><th>Spotter</th><th>Freq</th><th>Mode</th><th>Count</th><th>When</th><th>Source</th><th>Comment</th></tr>"; worker += "<td style='color:lightgreen' >" + g_pota.parkSpots[key][i].frequency.formatMhz(3, 3) + " <font color='yellow'>(" + g_pota.parkSpots[key][i].band + ")</font></td>";
for (const i in g_pota.parkSpots[key]) worker += "<td style='color:orange'>" + g_pota.parkSpots[key][i].mode + "</td>";
{ worker += "<td>" + g_pota.parkSpots[key][i].count + "</td>";
worker += "<tr>"; worker += "<td style='color:lightblue' >" + parseInt((now - g_pota.parkSpots[key][i].spotTime) / 1000).toDHMS() + "</td>";
worker += "<td style='color:yellow'>" + g_pota.parkSpots[key][i].activator + "</td>"; worker += "<td>" + g_pota.parkSpots[key][i].source + "</td>";
worker += "<td style='color:cyan'>" + ((g_pota.parkSpots[key][i].spotter == g_pota.parkSpots[key][i].activator) ? "Self" : g_pota.parkSpots[key][i].spotter) + "</td>"; worker += "<td>" + g_pota.parkSpots[key][i].comments + "</td>";
worker += "<td style='color:lightgreen' >" + g_pota.parkSpots[key][i].frequency.formatMhz(3, 3) + " <font color='yellow'>(" + g_pota.parkSpots[key][i].frequency.formatBand() + ")</font></td>"; worker += "</tr>";
worker += "<td style='color:orange'>" + g_pota.parkSpots[key][i].mode + "</td>";
worker += "<td>" + g_pota.parkSpots[key][i].count + "</td>";
worker += "<td style='color:lightblue' >" + parseInt((now - g_pota.parkSpots[key][i].spotTime) / 1000).toDHMS() + "</td>";
worker += "<td>" + g_pota.parkSpots[key][i].source + "</td>";
worker += "<td>" + g_pota.parkSpots[key][i].comments + "</td>";
worker += "</tr>";
}
worker += "</table>";
worker += "</div>";
} }
worker += "</table>";
if (parkObj.scheduled) /*
{
let active = 0;
let buffer = "";
buffer += "<div style='background-color:#000;color:#fff;font-size:12px;border:1px solid gray;margin:1px' class='roundBorder'>Activations (scheduled)" buffer += "<div style='background-color:#000;color:#fff;font-size:12px;border:1px solid gray;margin:1px' class='roundBorder'>Activations (scheduled)"
buffer += "<table id='potaScheduleTable' class='darkTable' style='margin: 0 auto;'>"; buffer += "<table id='potaScheduleTable' class='darkTable' style='margin: 0 auto;'>";
buffer += "<tr><th>Activator</th><th>Start</th><th>End</th><th>Frequencies</th><th>Comment</th></tr>"; buffer += "<tr><th>Activator</th><th>Start</th><th>End</th><th>Frequencies</th><th>Comment</th></tr>";
@ -426,15 +401,7 @@ function createParkTipTable(toolElement)
active++; active++;
} }
} }
buffer += "</table>"; */
buffer += "</div>";
if (active > 0)
{
// Only if we found non-expired schedules
worker += buffer;
}
}
myParktip.innerHTML = worker; myParktip.innerHTML = worker;
return 1; return 1;
} }

Wyświetl plik

@ -45,11 +45,6 @@ function processRosterFiltering(callRoster, rosterSettings)
entry.tx = false; entry.tx = false;
continue; continue;
} }
if (entry.DXcall == "CQ POTA" && huntPOTA.checked == true)
{
entry.tx = true;
continue;
}
if (callObj.ituza in g_blockedITUz) if (callObj.ituza in g_blockedITUz)
{ {
entry.tx = false; entry.tx = false;
@ -141,13 +136,10 @@ function processRosterFiltering(callRoster, rosterSettings)
continue; continue;
} }
} }
else else if (g_rosterSettings.onlyMyDxcc == true)
{ {
if (g_rosterSettings.onlyMyDxcc == true) entry.tx = false;
{ continue;
entry.tx = false;
continue;
}
} }
if (window.opener.g_callsignLookups.lotwUseEnable == true && g_rosterSettings.usesLoTW == true) if (window.opener.g_callsignLookups.lotwUseEnable == true && g_rosterSettings.usesLoTW == true)

Wyświetl plik

@ -496,7 +496,7 @@ function processRosterHunting(callRoster, rosterSettings, awardTracker)
} }
// Hunting for POTAs // Hunting for POTAs
if (huntPOTA.checked == true && callObj.pota != null) if (huntPOTA.checked == true && callObj.pota.length > 0)
{ {
let huntTotal = callObj.pota.length; let huntTotal = callObj.pota.length;
let huntFound = 0, layeredFound = 0, workedFound = 0, layeredWorkedFound = 0; let huntFound = 0, layeredFound = 0, workedFound = 0, layeredWorkedFound = 0;