From d5fddf794c2fdc0ebad0f9625ed413158d3adc4b Mon Sep 17 00:00:00 2001 From: Ben Burwell Date: Sat, 19 Nov 2016 23:23:34 -0500 Subject: Only show large and medium airports --- .../com/benburwell/planes/gui/aircraftmap/AircraftMap.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/benburwell/planes/gui/aircraftmap/AircraftMap.java b/src/main/java/com/benburwell/planes/gui/aircraftmap/AircraftMap.java index 09663fe..d61618a 100644 --- a/src/main/java/com/benburwell/planes/gui/aircraftmap/AircraftMap.java +++ b/src/main/java/com/benburwell/planes/gui/aircraftmap/AircraftMap.java @@ -8,7 +8,7 @@ import com.benburwell.planes.gui.aircraftmap.symbols.*; import javax.swing.*; import java.awt.*; -import java.util.ArrayList; +import java.util.*; import java.util.List; /** @@ -32,6 +32,12 @@ public class AircraftMap extends JPanel { public final int MAX_ZOOM_PIXELS_PER_MILE = 2000; public final double PAN_INTERVAL_MILES = 1.0; + // airports + public final Set VALID_AIRPORT_TYPES = new HashSet<>(Arrays.asList(new String[]{ + "large_airport", + "medium_airport" + })); + // instance fields private List planes = new ArrayList<>(); private List navaids = new ArrayList<>(); @@ -86,9 +92,11 @@ public class AircraftMap extends JPanel { } public void addAirports(List airports) { - for (Airport airport : airports) { + airports.stream().filter(airport -> { + return VALID_AIRPORT_TYPES.contains(airport.getType()); + }).forEach(airport -> { this.airports.add(new AirportSymbol(airport)); - } + }); } /** -- cgit v1.2.3