Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Planes on ground indicator #67

Open
wants to merge 7 commits into
base: features/airport-ground-indicators
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
jobs:
build-windows:
runs-on: windows-latest
if: ${{ !contains(github.event.head_commit.message, '#docs-only') }}
if: ${{ !contains(github.event.head_commit.message, '#no-build') }}
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down Expand Up @@ -76,7 +76,7 @@ jobs:
build-osx:
runs-on: macos-latest
needs: build-windows
if: ${{ !contains(github.event.head_commit.message, '#docs-only') }}
if: ${{ !contains(github.event.head_commit.message, '#no-build') }}
steps:
- name: Download Vars
uses: actions/download-artifact@v2
Expand Down Expand Up @@ -110,7 +110,7 @@ jobs:
path: target-installer/*
release:
runs-on: windows-latest
if: ${{ !contains(github.event.head_commit.message, '#docs-only') }}
if: ${{ !contains(github.event.head_commit.message, '#no-build') }}
needs: [ build-windows, build-osx ]
steps:
- name: Download Windows Artifacts
Expand Down
16 changes: 14 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## [0.3.0](https://github.com/marvk/vatprism/compare/v0.2.0...v0.3.0) - Unreleased

### Added

- Ability to turn off Labels on uncontrolled Airports and uncontrolled Airports with arrivals and/or departures

### Fixed

- VAT-Spy color scheme delivery and ground colors swapped ([#57](https://github.com/marvk/vatprism/issues/57))

## [0.2.0](https://github.com/marvk/vatprism/compare/v0.1.0...v0.2.0) - 2021-09-17

### Added
Expand All @@ -15,8 +25,10 @@
### Fixed

- Map now updates automatically when updating filter settings
- Background can't be disabled anymore and is now always painted at maximum opacity (#48)
- "No Controllers" no longer being squished on high traffic volume airports (#42)
- Background can't be disabled anymore and is now always painted at maximum
opacity ([#48](https://github.com/marvk/vatprism/issues/48))
- "No Controllers" no longer being squished on high traffic volume
airports ([#42](https://github.com/marvk/vatprism/issues/42))

## [0.1.0](https://github.com/marvk/vatprism/releases/tag/v0.1.0) - 2021-09-13

Expand Down
10 changes: 10 additions & 0 deletions src/main/java/net/marvk/fs/vatsim/map/data/Airport.java
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,16 @@ public ReadOnlyListProperty<FlightPlan> alternativesProperty() {
return getAlternativesWritable().getReadOnlyProperty();
}

public int getDeparturesOnGround() {
return this.getDeparting()
.filtered(d -> d.getPilot().getEta().is(Eta.Status.DEPARTING)).size();
}

public int getArrivalsOnGround() {
return this.getArriving()
.filtered(d -> d.getPilot().getEta().is(Eta.Status.ARRIVING)).size();
}

@Override
public void setFromModel(final AirportRepository.VatsimAirportWrapper model) {
Objects.requireNonNull(model);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ public String mapData() throws VatsimApiException {
return dataSource.mapData();
}

@Override
public String events() throws VatsimApiException {
throw new UnsupportedOperationException();
}

private String tryLoadProxy(final String fileName, final Callable<String> fallbackSupplier) throws VatsimApiException {
final Path path = configPath.resolve(fileName);
log.info("Trying to load proxy file for %s".formatted(fileName));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,15 @@ public class AirportPainter extends MapPainter<Airport> {
@Parameter("Paint Uncontrolled Airports")
private boolean paintAll = false;

@Parameter("Paint Labels of Uncontrolled Airports")
private boolean paintAllLabels = true;

@Parameter("Paint Uncontrolled Airports with Destinations or Arrivals")
private boolean paintUncontrolledButDestinationsOrArrivals = false;

@Parameter("Paint Labels of Uncontrolled Airports with Destinations or Arrivals")
private boolean paintUncontrolledButDestinationsOrArrivalLabels = true;

@Parameter("Airport Color")
private Color airportColor = Color.WHITE;

Expand Down Expand Up @@ -112,6 +118,8 @@ private void draw(final GraphicsContext c, final Airport airport, final double x
c.setLineWidth(1);

final String icao = airport.getIcao();
final int departuresOnGround = airport.getDeparturesOnGround();
final int arrivalsOnGround = airport.getArrivalsOnGround();

final double textScale = c.getFont().getSize() / 12.0;
final boolean paintApproachCircle = mapVariables.getScale() > (40 / approachRadius) * textScale;
Expand Down Expand Up @@ -180,18 +188,38 @@ private void draw(final GraphicsContext c, final Airport airport, final double x
}
}

final int typesWidth = (int) Math.ceil(textScale * TYPES_WIDTH);
if (departuresOnGround > 0) {
c.setFill(Color.GREEN);
c.setTextBaseline(VPos.TOP);
final double xCur = typeLabelX(x, 6, 6, typesWidth);
final double yCur = y - 25;
painterHelper.fillText(c, "⬈" + departuresOnGround, xCur, yCur);
}

if (arrivalsOnGround > 0) {
c.setFill(Color.RED);
c.setTextBaseline(VPos.TOP);
final double xCur = typeLabelX(x, 6, 6, typesWidth);
final double yCur = y - 15;
painterHelper.fillText(c, "⬊" + arrivalsOnGround, xCur, yCur);
}

if (text) {
painterHelper.fillTextWithBackground(
c,
x,
labelY(y),
icao,
paintBackground,
TextAlignment.CENTER,
VPos.BOTTOM,
textColor,
backgroundColor
);
final boolean uncontrolledButDestinationOriginEnabled = (airport.hasDepartures() || airport.hasArrivals()) && paintUncontrolledButDestinationsOrArrivalLabels;
if (paintAllLabels || airport.hasControllers() || uncontrolledButDestinationOriginEnabled) {
painterHelper.fillTextWithBackground(
c,
x,
labelY(y),
icao,
paintBackground,
TextAlignment.CENTER,
VPos.BOTTOM,
textColor,
backgroundColor
);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"airports.background_color": "0xeeeeeeff",
"airports.controller_border_color": "0x000000ff",
"airports.controller_label_color": "0xffffffff",
"airports.delivery_color": "0x007f00ff",
"airports.ground_color": "0x0000ffff",
"airports.delivery_color": "0x0000ffff",
"airports.ground_color": "0x007f00ff",
"airports.label_color": "0x7f7f7fff",
"airports.tower_color": "0x7f0000ff",
"background.color": "0xb7b7b7ff",
Expand All @@ -40,13 +40,12 @@
"search_items.airport.airport_color": "0x00bfffff",
"search_items.airport.approach_color": "0x007f7fff",
"search_items.airport.approach_placeholder_color": "0x000000ff",
"search_items.airport.approach_placeholdercolor": "0x17130aff",
"search_items.airport.atis_color": "0x7f4000ff",
"search_items.airport.background_color": "0x006080ff",
"search_items.airport.controller_border_color": "0x000000ff",
"search_items.airport.controller_label_color": "0xffffffff",
"search_items.airport.delivery_color": "0x007f00ff",
"search_items.airport.ground_color": "0x0000ffff",
"search_items.airport.delivery_color": "0x0000ffff",
"search_items.airport.ground_color": "0x007f00ff",
"search_items.airport.label_color": "0x00bfffff",
"search_items.airport.tower_color": "0x7f0000ff",
"search_items.fir.fill_color": "0x00bfff0d",
Expand All @@ -57,13 +56,12 @@
"selected_item.airport.airport_color": "0xff0000ff",
"selected_item.airport.approach_color": "0x007f7fff",
"selected_item.airport.approach_placeholder_color": "0x000000ff",
"selected_item.airport.approach_placeholdercolor": "0x17130aff",
"selected_item.airport.atis_color": "0x7f4000ff",
"selected_item.airport.background_color": "0x800000ff",
"selected_item.airport.controller_border_color": "0x000000ff",
"selected_item.airport.controller_label_color": "0xffffffff",
"selected_item.airport.delivery_color": "0x007f00ff",
"selected_item.airport.ground_color": "0x0000ffff",
"selected_item.airport.delivery_color": "0x0000ffff",
"selected_item.airport.ground_color": "0x007f00ff",
"selected_item.airport.label_color": "0xff0000ff",
"selected_item.airport.tower_color": "0x7f0000ff",
"selected_item.fir.fill_color": "0xff00000d",
Expand Down