mirror of
https://github.com/praktimarc/kst4contest.git
synced 2026-09-17 06:27:28 +02:00
Add selected-band marker to main station table
This commit is contained in:
@@ -64,6 +64,8 @@ import javafx.scene.shape.Polygon;
|
|||||||
import javafx.stage.Screen;
|
import javafx.stage.Screen;
|
||||||
|
|
||||||
import kst4contest.utils.ApplicationFileUtils;
|
import kst4contest.utils.ApplicationFileUtils;
|
||||||
|
import kst4contest.view.map.MapCallsignRawSnapshot;
|
||||||
|
import kst4contest.view.map.MapCallsignRawSnapshotBuilder;
|
||||||
import kst4contest.view.map.StationMapBridge;
|
import kst4contest.view.map.StationMapBridge;
|
||||||
import kst4contest.view.map.StationMapView;
|
import kst4contest.view.map.StationMapView;
|
||||||
import kst4contest.view.map.OfflineDemImportService;
|
import kst4contest.view.map.OfflineDemImportService;
|
||||||
@@ -94,6 +96,8 @@ public class Kst4ContestApplication extends Application implements StatusUpdateL
|
|||||||
private final Tooltip tipSkedWarnIndicator = new Tooltip();
|
private final Tooltip tipSkedWarnIndicator = new Tooltip();
|
||||||
private Timeline skedWarnBlinkTimeline;
|
private Timeline skedWarnBlinkTimeline;
|
||||||
|
|
||||||
|
private final MapCallsignRawSnapshotBuilder mainViewBandMarkerSnapshotBuilder = new MapCallsignRawSnapshotBuilder();
|
||||||
|
|
||||||
|
|
||||||
// Timeline: show at most N priority markers per minute bucket (minute 0/1 often has many planes)
|
// Timeline: show at most N priority markers per minute bucket (minute 0/1 often has many planes)
|
||||||
private static final int TIMELINE_PRIORITY_MARKERS_PER_MINUTE = 2;
|
private static final int TIMELINE_PRIORITY_MARKERS_PER_MINUTE = 2;
|
||||||
@@ -384,6 +388,45 @@ public class Kst4ContestApplication extends Application implements StatusUpdateL
|
|||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isSelectedBandOfferForMainView(ChatMember chatMember) {
|
||||||
|
if (chatMember == null
|
||||||
|
|| chatcontroller == null
|
||||||
|
|| chatcontroller.getReachabilityService() == null
|
||||||
|
|| chatMember.getCallSignRaw() == null
|
||||||
|
|| chatMember.getCallSignRaw().isBlank()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
EnumSet<Band> enabledBands = chatcontroller.getReachabilityService().getEnabledStationBands();
|
||||||
|
if (enabledBands == null || enabledBands.isEmpty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<ChatMember> variants = new ArrayList<>();
|
||||||
|
synchronized (chatcontroller.getLst_chatMemberList()) {
|
||||||
|
for (ChatMember variant : chatcontroller.getLst_chatMemberList()) {
|
||||||
|
if (variant == null || variant.getCallSignRaw() == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (variant.getCallSignRaw().equalsIgnoreCase(chatMember.getCallSignRaw())) {
|
||||||
|
variants.add(variant);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (variants.isEmpty()) {
|
||||||
|
variants = List.of(chatMember);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<MapCallsignRawSnapshot> snapshots = mainViewBandMarkerSnapshotBuilder.buildSnapshots(
|
||||||
|
variants,
|
||||||
|
null,
|
||||||
|
enabledBands
|
||||||
|
);
|
||||||
|
|
||||||
|
return snapshots.stream().anyMatch(MapCallsignRawSnapshot::offersSelectedBand);
|
||||||
|
}
|
||||||
|
|
||||||
private String bandToHumanLabel(kst4contest.model.Band b) {
|
private String bandToHumanLabel(kst4contest.model.Band b) {
|
||||||
// Human-friendly labels for VHF/UHF/microwave contesting
|
// Human-friendly labels for VHF/UHF/microwave contesting
|
||||||
return switch (b) {
|
return switch (b) {
|
||||||
@@ -1135,14 +1178,22 @@ public class Kst4ContestApplication extends Application implements StatusUpdateL
|
|||||||
public ObservableValue<String> call(CellDataFeatures<ChatMember, String> cellDataFeatures) {
|
public ObservableValue<String> call(CellDataFeatures<ChatMember, String> cellDataFeatures) {
|
||||||
SimpleStringProperty callsgn = new SimpleStringProperty();
|
SimpleStringProperty callsgn = new SimpleStringProperty();
|
||||||
|
|
||||||
if (cellDataFeatures.getValue().getState() == 1) {
|
ChatMember member = cellDataFeatures.getValue();
|
||||||
callsgn.setValue("(" + cellDataFeatures.getValue().getCallSign() + ")"); //away user
|
String baseCallsign;
|
||||||
} else {
|
|
||||||
|
|
||||||
callsgn.setValue(cellDataFeatures.getValue().getCallSign());
|
if (member.getState() == 1) {
|
||||||
|
baseCallsign = "(" + member.getCallSign() + ")"; //away user
|
||||||
|
} else {
|
||||||
|
baseCallsign = member.getCallSign();
|
||||||
}
|
}
|
||||||
|
|
||||||
// System.out.println(cellDataFeatures.getValue().getCallSign() + " / " + cellDataFeatures.getValue().getState()+ " <<<<<<<<<<<<<<<<<< state ");
|
if (isSelectedBandOfferForMainView(member)) {
|
||||||
|
baseCallsign += " ★";
|
||||||
|
}
|
||||||
|
|
||||||
|
callsgn.setValue(baseCallsign);
|
||||||
|
|
||||||
|
// System.out.println(member.getCallSign() + " / " + member.getState()+ " <<<<<<<<<<<<<<<<<< state ");
|
||||||
|
|
||||||
return callsgn;
|
return callsgn;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user