From 7411558abf4aba7d600bb9fc713d36032e4a6df3 Mon Sep 17 00:00:00 2001 From: Ben Burwell Date: Sun, 20 Nov 2016 02:38:23 -0500 Subject: Show routes --- src/main/java/com/benburwell/planes/gui/Main1090.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'src/main/java/com/benburwell/planes/gui/Main1090.java') diff --git a/src/main/java/com/benburwell/planes/gui/Main1090.java b/src/main/java/com/benburwell/planes/gui/Main1090.java index a48fb93..ac75d03 100644 --- a/src/main/java/com/benburwell/planes/gui/Main1090.java +++ b/src/main/java/com/benburwell/planes/gui/Main1090.java @@ -4,10 +4,8 @@ package com.benburwell.planes.gui; -import com.benburwell.planes.data.AircraftStore; -import com.benburwell.planes.data.Airport; -import com.benburwell.planes.data.CSVObjectStore; -import com.benburwell.planes.data.NavigationAid; +import com.benburwell.planes.data.*; +import com.benburwell.planes.graph.RouteGraph; import com.benburwell.planes.gui.aircraftmap.AircraftMapComponent; import com.benburwell.planes.gui.aircrafttable.AircraftTableComponent; import com.benburwell.planes.gui.airportstable.AirportsComponent; @@ -31,6 +29,7 @@ public class Main1090 extends JFrame { private AircraftStore aircraft = new AircraftStore(); private CSVObjectStore navaids = new CSVObjectStore<>(); private CSVObjectStore airports = new CSVObjectStore<>(); + private RouteGraph routeGraph = new RouteGraph(); private int currentTcpConnection = 0; private JTabbedPane tabbedPane = new JTabbedPane(); @@ -60,12 +59,20 @@ public class Main1090 extends JFrame { System.out.println("Could not read airport file: " + e.getMessage()); } + try { + CSVObjectStore intersections = new CSVObjectStore<>(); + intersections.readFromResource("/airways_db.csv", Intersection.class); + intersections.getObjects().forEach(intersection -> this.routeGraph.addIntersection(intersection)); + } catch (IOException | InstantiationException | IllegalAccessException e) { + System.out.println("Could not read route intersection file: " + e.getMessage()); + } + this.createTabs(); } private void createTabs() { List tabs = new ArrayList<>(); - tabs.add(new AircraftMapComponent(this.aircraft, this.navaids, this.airports)); + tabs.add(new AircraftMapComponent(this.aircraft, this.navaids, this.airports, this.routeGraph)); tabs.add(new AircraftTableComponent(this.aircraft)); tabs.add(new NavigationAidComponent(this.navaids)); tabs.add(new AirportsComponent(this.airports)); -- cgit v1.2.3