From f1e32ed443bafc03448f0f3b36c712b9293e71e7 Mon Sep 17 00:00:00 2001 From: Ben Burwell Date: Sun, 20 Nov 2016 01:34:08 -0500 Subject: File cleanup --- .../planes/gui/aircraftmap/AircraftMap.java | 31 +++++++++++++++------- .../gui/aircraftmap/AircraftMapComponent.java | 25 +++++++++-------- .../planes/gui/aircraftmap/Drawable.java | 4 +-- .../planes/gui/aircraftmap/GeoPoint.java | 2 +- .../gui/aircraftmap/symbols/AirportSymbol.java | 4 +-- .../planes/gui/aircraftmap/symbols/NDBSymbol.java | 4 +-- .../gui/aircraftmap/symbols/PlaneSymbol.java | 6 +++-- .../gui/aircraftmap/symbols/VORDMESymbol.java | 3 +-- .../planes/gui/aircraftmap/symbols/VORSymbol.java | 4 +-- .../gui/aircraftmap/symbols/VORTACSymbol.java | 5 ++-- 10 files changed, 49 insertions(+), 39 deletions(-) (limited to 'src/main/java/com/benburwell/planes/gui/aircraftmap') 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 d61618a..72edaaf 100644 --- a/src/main/java/com/benburwell/planes/gui/aircraftmap/AircraftMap.java +++ b/src/main/java/com/benburwell/planes/gui/aircraftmap/AircraftMap.java @@ -4,15 +4,26 @@ import com.benburwell.planes.data.Airport; import com.benburwell.planes.data.NavigationAid; import com.benburwell.planes.data.Position; import com.benburwell.planes.gui.GraphicsTheme; -import com.benburwell.planes.gui.aircraftmap.symbols.*; - -import javax.swing.*; -import java.awt.*; -import java.util.*; +import com.benburwell.planes.gui.aircraftmap.symbols.AirportSymbol; +import com.benburwell.planes.gui.aircraftmap.symbols.NDBSymbol; +import com.benburwell.planes.gui.aircraftmap.symbols.VORDMESymbol; +import com.benburwell.planes.gui.aircraftmap.symbols.VORSymbol; +import com.benburwell.planes.gui.aircraftmap.symbols.VORTACSymbol; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import java.awt.Font; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.RenderingHints; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; import java.util.List; +import java.util.Set; /** - * Created by ben on 11/19/16. + * @author ben */ public class AircraftMap extends JPanel { // geographic constants @@ -131,7 +142,7 @@ public class AircraftMap extends JPanel { this.redraw(); } - public void drawPositionAndScale(Graphics g) { + private void drawPositionAndScale(Graphics g) { Font currentFont = g.getFont(); Font newFont = currentFont.deriveFont(FONT_SIZE); g.setFont(newFont); @@ -141,7 +152,7 @@ public class AircraftMap extends JPanel { g.drawString(String.format("%d nm", this.getRangeRadius()), TEXT_PADDING, (int) FONT_SIZE * 3 + TEXT_PADDING); } - public int getRangeRadius() { + private int getRangeRadius() { double milesHigh = this.getHeight() / this.getPixelsPerNauticalMile(); double milesWide = this.getWidth() / this.getPixelsPerNauticalMile(); double screenMiles = Math.min(milesHigh, milesWide); @@ -149,7 +160,7 @@ public class AircraftMap extends JPanel { return milesPerRing; } - public List getRangeRadii() { + private List getRangeRadii() { int rangeRadius = this.getRangeRadius(); List radii = new ArrayList<>(); for (int ringNumber = 1; ringNumber <= NUMBER_OF_RANGE_RINGS; ringNumber++) { @@ -158,7 +169,7 @@ public class AircraftMap extends JPanel { return radii; } - public void drawRange(Graphics g) { + private void drawRange(Graphics g) { int centerX = this.getWidth() / 2; int centerY = this.getHeight() / 2; g.setColor(GraphicsTheme.Colors.BASE_3); diff --git a/src/main/java/com/benburwell/planes/gui/aircraftmap/AircraftMapComponent.java b/src/main/java/com/benburwell/planes/gui/aircraftmap/AircraftMapComponent.java index ab0315d..48f8cfd 100644 --- a/src/main/java/com/benburwell/planes/gui/aircraftmap/AircraftMapComponent.java +++ b/src/main/java/com/benburwell/planes/gui/aircraftmap/AircraftMapComponent.java @@ -1,43 +1,42 @@ package com.benburwell.planes.gui.aircraftmap; -import com.benburwell.planes.data.*; +import com.benburwell.planes.data.AircraftStore; +import com.benburwell.planes.data.AircraftStoreListener; +import com.benburwell.planes.data.Airport; +import com.benburwell.planes.data.CSVObjectStore; +import com.benburwell.planes.data.NavigationAid; import com.benburwell.planes.gui.Tabbable; import com.benburwell.planes.gui.aircraftmap.symbols.PlaneSymbol; -import java.util.*; +import java.awt.KeyboardFocusManager; +import java.util.ArrayList; +import java.util.Date; import java.util.List; -import javax.swing.*; +import javax.swing.JComponent; import javax.swing.Timer; -import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; import java.awt.event.KeyEvent; /** - * Created by ben on 11/18/16. + * @author ben */ public class AircraftMapComponent implements Tabbable { public final long PLANE_EXPIRY_MILLIS = 60 * 1000; public final int MAX_REFRESH_MILLIS = 5 * 1000; private AircraftStore store; - private CSVObjectStore navaids; - private CSVObjectStore airportStore; private AircraftMap mapPanel; private AircraftStoreListener aircraftStoreListener; public AircraftMapComponent(AircraftStore store, CSVObjectStore navaids, CSVObjectStore airportStore) { this.store = store; - this.navaids = navaids; - this.airportStore = airportStore; this.setupMap(); this.bindKeys(); this.setupListener(); this.store.subscribe(this.aircraftStoreListener); - this.mapPanel.addNavAids(this.navaids.getObjects()); - this.mapPanel.addAirports(this.airportStore.getObjects()); + this.mapPanel.addNavAids(navaids.getObjects()); + this.mapPanel.addAirports(airportStore.getObjects()); final Timer t = new Timer(MAX_REFRESH_MILLIS, e -> { AircraftMapComponent.this.aircraftStoreListener.aircraftStoreChanged(); diff --git a/src/main/java/com/benburwell/planes/gui/aircraftmap/Drawable.java b/src/main/java/com/benburwell/planes/gui/aircraftmap/Drawable.java index 01c16ba..4b3aa5e 100644 --- a/src/main/java/com/benburwell/planes/gui/aircraftmap/Drawable.java +++ b/src/main/java/com/benburwell/planes/gui/aircraftmap/Drawable.java @@ -1,9 +1,9 @@ package com.benburwell.planes.gui.aircraftmap; -import java.awt.*; +import java.awt.Graphics; /** - * Created by ben on 11/19/16. + * @author ben */ public interface Drawable { void drawOn(Graphics graphicsContext, AircraftMap map); diff --git a/src/main/java/com/benburwell/planes/gui/aircraftmap/GeoPoint.java b/src/main/java/com/benburwell/planes/gui/aircraftmap/GeoPoint.java index 2ecbeda..37a3f19 100644 --- a/src/main/java/com/benburwell/planes/gui/aircraftmap/GeoPoint.java +++ b/src/main/java/com/benburwell/planes/gui/aircraftmap/GeoPoint.java @@ -3,7 +3,7 @@ package com.benburwell.planes.gui.aircraftmap; import com.benburwell.planes.data.Position; /** - * Created by ben on 11/19/16. + * @author ben */ public class GeoPoint { private double latitude; diff --git a/src/main/java/com/benburwell/planes/gui/aircraftmap/symbols/AirportSymbol.java b/src/main/java/com/benburwell/planes/gui/aircraftmap/symbols/AirportSymbol.java index 5286f6f..b97a7fa 100644 --- a/src/main/java/com/benburwell/planes/gui/aircraftmap/symbols/AirportSymbol.java +++ b/src/main/java/com/benburwell/planes/gui/aircraftmap/symbols/AirportSymbol.java @@ -6,10 +6,10 @@ import com.benburwell.planes.gui.aircraftmap.AircraftMap; import com.benburwell.planes.gui.aircraftmap.Drawable; import com.benburwell.planes.gui.aircraftmap.GeoPoint; -import java.awt.*; +import java.awt.Graphics; /** - * Created by ben on 11/19/16. + * @author ben */ public class AirportSymbol extends GeoPoint implements Drawable { private String name; diff --git a/src/main/java/com/benburwell/planes/gui/aircraftmap/symbols/NDBSymbol.java b/src/main/java/com/benburwell/planes/gui/aircraftmap/symbols/NDBSymbol.java index 08793ec..74f4441 100644 --- a/src/main/java/com/benburwell/planes/gui/aircraftmap/symbols/NDBSymbol.java +++ b/src/main/java/com/benburwell/planes/gui/aircraftmap/symbols/NDBSymbol.java @@ -6,10 +6,10 @@ import com.benburwell.planes.gui.aircraftmap.AircraftMap; import com.benburwell.planes.gui.aircraftmap.Drawable; import com.benburwell.planes.gui.aircraftmap.GeoPoint; -import java.awt.*; +import java.awt.Graphics; /** - * Created by ben on 11/19/16. + * @author ben */ public class NDBSymbol extends GeoPoint implements Drawable { public static final int INNER_RADIUS = 3; diff --git a/src/main/java/com/benburwell/planes/gui/aircraftmap/symbols/PlaneSymbol.java b/src/main/java/com/benburwell/planes/gui/aircraftmap/symbols/PlaneSymbol.java index 135ed4d..3e6b51c 100644 --- a/src/main/java/com/benburwell/planes/gui/aircraftmap/symbols/PlaneSymbol.java +++ b/src/main/java/com/benburwell/planes/gui/aircraftmap/symbols/PlaneSymbol.java @@ -7,14 +7,16 @@ import com.benburwell.planes.gui.aircraftmap.AircraftMap; import com.benburwell.planes.gui.aircraftmap.Drawable; import com.benburwell.planes.gui.aircraftmap.GeoPoint; +import java.awt.Color; +import java.awt.Graphics; +import java.awt.Graphics2D; import java.util.Date; import java.util.List; import java.util.ArrayList; -import java.awt.*; import java.awt.geom.AffineTransform; /** - * Created by ben on 11/19/16. + * @author ben */ public class PlaneSymbol extends GeoPoint implements Drawable { public final int TRIANGLE_HEIGHT = 6; diff --git a/src/main/java/com/benburwell/planes/gui/aircraftmap/symbols/VORDMESymbol.java b/src/main/java/com/benburwell/planes/gui/aircraftmap/symbols/VORDMESymbol.java index 0b67989..b4edc28 100644 --- a/src/main/java/com/benburwell/planes/gui/aircraftmap/symbols/VORDMESymbol.java +++ b/src/main/java/com/benburwell/planes/gui/aircraftmap/symbols/VORDMESymbol.java @@ -4,12 +4,11 @@ import com.benburwell.planes.data.Position; import com.benburwell.planes.gui.GraphicsTheme; import com.benburwell.planes.gui.aircraftmap.AircraftMap; import com.benburwell.planes.gui.aircraftmap.Drawable; -import com.benburwell.planes.gui.aircraftmap.symbols.VORSymbol; import java.awt.Graphics; /** - * Created by ben on 11/19/16. + * @author ben */ public class VORDMESymbol extends VORSymbol implements Drawable { public VORDMESymbol(String name, Position pos, int frequency) { diff --git a/src/main/java/com/benburwell/planes/gui/aircraftmap/symbols/VORSymbol.java b/src/main/java/com/benburwell/planes/gui/aircraftmap/symbols/VORSymbol.java index e854c2b..5164248 100644 --- a/src/main/java/com/benburwell/planes/gui/aircraftmap/symbols/VORSymbol.java +++ b/src/main/java/com/benburwell/planes/gui/aircraftmap/symbols/VORSymbol.java @@ -6,10 +6,10 @@ import com.benburwell.planes.gui.aircraftmap.AircraftMap; import com.benburwell.planes.gui.aircraftmap.Drawable; import com.benburwell.planes.gui.aircraftmap.GeoPoint; -import java.awt.*; +import java.awt.Graphics; /** - * Created by ben on 11/19/16. + * @author ben */ public class VORSymbol extends GeoPoint implements Drawable { public static final int RADIUS = 11; diff --git a/src/main/java/com/benburwell/planes/gui/aircraftmap/symbols/VORTACSymbol.java b/src/main/java/com/benburwell/planes/gui/aircraftmap/symbols/VORTACSymbol.java index 3b0043f..a8d0bdb 100644 --- a/src/main/java/com/benburwell/planes/gui/aircraftmap/symbols/VORTACSymbol.java +++ b/src/main/java/com/benburwell/planes/gui/aircraftmap/symbols/VORTACSymbol.java @@ -4,12 +4,11 @@ import com.benburwell.planes.data.Position; import com.benburwell.planes.gui.GraphicsTheme; import com.benburwell.planes.gui.aircraftmap.AircraftMap; import com.benburwell.planes.gui.aircraftmap.Drawable; -import com.benburwell.planes.gui.aircraftmap.symbols.VORSymbol; -import java.awt.*; +import java.awt.Graphics; /** - * Created by ben on 11/19/16. + * @author ben */ public class VORTACSymbol extends VORSymbol implements Drawable { public VORTACSymbol(String name, Position pos, int frequency) { -- cgit v1.2.3