Merge remote-tracking branch 'origin/master'

# Conflicts:
#	res/userdb.db
main
Liam Beckett 9 years ago
commit 0c98916c04

Binary file not shown.

@ -83,7 +83,7 @@ public class AirportFilter extends Filter{
} }
public void filterLatitude(String latitude){ public void filterLatitude(String latitude){
String regexCode = "(?i).*"+latitude+".*"; String regexCode = ".*"+latitude+".*";
int index = 0; int index = 0;
while(index < filteredList.size()){ while(index < filteredList.size()){
if (!String.valueOf(filteredList.get(index).getLatitude()).matches(regexCode)){ if (!String.valueOf(filteredList.get(index).getLatitude()).matches(regexCode)){
@ -95,7 +95,7 @@ public class AirportFilter extends Filter{
} }
public void filterLongitude(String longitude){ public void filterLongitude(String longitude){
String regexCode = "(?i).*"+longitude+".*"; String regexCode = ".*"+longitude+".*";
int index = 0; int index = 0;
while(index < filteredList.size()){ while(index < filteredList.size()){
if (!String.valueOf(filteredList.get(index).getLongitude()).matches(regexCode)){ if (!String.valueOf(filteredList.get(index).getLongitude()).matches(regexCode)){
@ -107,7 +107,7 @@ public class AirportFilter extends Filter{
} }
public void filterAltitude(String altitude){ public void filterAltitude(String altitude){
String regexCode = "(?i).*"+altitude+".*"; String regexCode = ".*"+altitude+".*";
int index = 0; int index = 0;
while(index < filteredList.size()){ while(index < filteredList.size()){
if (!String.valueOf(filteredList.get(index).getAltitude()).matches(regexCode)){ if (!String.valueOf(filteredList.get(index).getAltitude()).matches(regexCode)){
@ -146,7 +146,7 @@ public class AirportFilter extends Filter{
String regexCode = "(?i).*"+DST+".*"; String regexCode = "(?i).*"+DST+".*";
int index = 0; int index = 0;
while(index < filteredList.size()){ while(index < filteredList.size()){
if (!filteredList.get(index).getCountry().getDST().matches(regexCode)){ if (!filteredList.get(index).getDST().matches(regexCode)){
filteredList.remove(index); filteredList.remove(index);
}else{ }else{
index++; index++;

@ -50,6 +50,7 @@ public class App extends Application
InputStream in = getClass().getClassLoader().getResourceAsStream("menu.fxml"); InputStream in = getClass().getClassLoader().getResourceAsStream("menu.fxml");
mainContainer = (VBox) loader.load(in); mainContainer = (VBox) loader.load(in);
Scene scene = new Scene(mainContainer, 800, 600); Scene scene = new Scene(mainContainer, 800, 600);
primaryStage.setResizable(false);
primaryStage.setScene(scene); primaryStage.setScene(scene);
primaryStage.sizeToScene(); primaryStage.sizeToScene();
MenuController menuController = (MenuController) loader.getController(); MenuController menuController = (MenuController) loader.getController();
@ -135,6 +136,7 @@ public class App extends Application
System.out.println("Missing Session Class"); System.out.println("Missing Session Class");
System.exit(1); System.exit(1);
} catch (Exception e) { } catch (Exception e) {
session = new Session();
e.printStackTrace(); e.printStackTrace();
} }
} }

@ -1,6 +1,7 @@
package seng202.group9.Controller; package seng202.group9.Controller;
import javafx.scene.chart.PieChart;
import seng202.group9.Core.*; import seng202.group9.Core.*;
import java.sql.Connection; import java.sql.Connection;
@ -740,7 +741,7 @@ public class Dataset {
HashMap<String, Airline> airlineByIATA= new HashMap<String, Airline>(); HashMap<String, Airline> airlineByIATA= new HashMap<String, Airline>();
//create Airline country link //create Airline country link
for (Airline airline: airlines){ for (Airline airline: airlines){
airlineByIATA.put(airline.getAlias(), airline); airlineByIATA.put(airline.getIATA(), airline);
//System.out.println(airline.getAlias()); //System.out.println(airline.getAlias());
airline.setCountry(countryDictionary.get(airline.getCountryName())); airline.setCountry(countryDictionary.get(airline.getCountryName()));
} }
@ -752,6 +753,7 @@ public class Dataset {
airportsByIATA.put(airport.getIATA_FFA(), airport); airportsByIATA.put(airport.getIATA_FFA(), airport);
airportsByICAO.put(airport.getICAO(), airport); airportsByICAO.put(airport.getICAO(), airport);
airport.setCountry(countryDictionary.get(airport.getCountryName())); airport.setCountry(countryDictionary.get(airport.getCountryName()));
//airport.getCountry().setPosition(new Position(airport.getLatitude(), airport.getLongitude()));
//TODO Add City in country (This is extra work). //TODO Add City in country (This is extra work).
airport.setCity(cityDictionary.get(airport.getCityName())); airport.setCity(cityDictionary.get(airport.getCityName()));
airport.getCity().addAirport(airport); airport.getCity().addAirport(airport);
@ -786,6 +788,15 @@ public class Dataset {
*/ */
public void addAirline(String name, String alias, String IATA, String ICAO, String callsign, String country, String active) throws DataException{ public void addAirline(String name, String alias, String IATA, String ICAO, String callsign, String country, String active) throws DataException{
Airline airlineToAdd = new Airline(name, alias, IATA, ICAO, callsign, country, active); Airline airlineToAdd = new Airline(name, alias, IATA, ICAO, callsign, country, active);
if (name.equals("")) {
throw new DataException("You cannot have a blank airline name.");
}
if (alias.length() <= 0) {
throw new DataException("Please insert '\\N' if the airline has no alias.");
}
if (country.equals("")) {
throw new DataException("You cannot have a blank country of origin field.");
}
addAirline(airlineToAdd); addAirline(airlineToAdd);
} }
@ -827,37 +838,51 @@ public class Dataset {
airlineToAdd.setID(airlineID); airlineToAdd.setID(airlineID);
airlines.add(airlineToAdd); airlines.add(airlineToAdd);
airlineDictionary.put(airlineToAdd.getName(), airlineToAdd); airlineDictionary.put(airlineToAdd.getName(), airlineToAdd);
stmt.close();
c.close();
} catch ( Exception e ) { } catch ( Exception e ) {
System.err.println( e.getClass().getName() + ": " + e.getMessage() ); System.err.println( e.getClass().getName() + ": " + e.getMessage() );
System.exit(0); System.exit(0);
} }
createDataLinks();
} }
public void addAirport(String name, String city, String country, String IATA_FFA, String ICAO, String latitude, String longitude, public void addAirport(String name, String city, String country, String IATA_FFA, String ICAO, String latitude, String longitude,
String altitude, String timezone, String DST, String olsonTz) throws DataException{ String altitude, String timezone, String DST, String olsonTz) throws DataException{
try{ try{
//System.out.print(name + city + country + IATA_FFA + ICAO + latitude + longitude + altitude + timezone + DST + olsonTz);
double latitudeVal = Double.parseDouble(latitude); double latitudeVal = Double.parseDouble(latitude);
double longitudeVal = Double.parseDouble(longitude); double longitudeVal = Double.parseDouble(longitude);
double altitudeVal = Double.parseDouble(altitude); double altitudeVal = Double.parseDouble(altitude);
double timezoneVal = Double.parseDouble(timezone); double timezoneVal = Double.parseDouble(timezone);
if (city.equals("")) {
throw new DataException("You cannot have a blank city name.");
}
if (country.equals("")) {
throw new DataException("You cannot have a blank country name.");
}
Airport airportToAdd = new Airport(name, city, country, IATA_FFA, ICAO, latitudeVal, longitudeVal, altitudeVal); Airport airportToAdd = new Airport(name, city, country, IATA_FFA, ICAO, latitudeVal, longitudeVal, altitudeVal);
City cityToAdd = new City(city, country, timezoneVal, olsonTz); City cityToAdd = new City(city, country, timezoneVal, olsonTz);
Country countryToAdd = new Country(DST, country); Country countryToAdd = new Country(DST, country);
addAirport(airportToAdd); addAirport(airportToAdd);
addCity(cityToAdd); addCity(cityToAdd);
addCountry(countryToAdd); addCountry(countryToAdd);
createDataLinks();
}catch (NumberFormatException e){ }catch (NumberFormatException e){
throw new DataException("Latitude, Longitude, Altitude and Timezone must be numbers"); throw new DataException("Latitude, Longitude, Altitude and Timezone must be numbers");
} }
} }
public void addAirport(Airport airportToAdd) throws DataException{ public void addAirport(Airport airportToAdd) throws DataException{
if (airportToAdd.getIATA_FFA() != "" && airportToAdd.getIATA_FFA().length() != 3){ if (airportToAdd.getIATA_FFA().length() != 0 && airportToAdd.getIATA_FFA().length() != 3){
throw new DataException("IATA/FFA either empty or 3 letters"); throw new DataException("IATA/FFA either empty or 3 letters");
} }
if (airportToAdd.getICAO() != "" && airportToAdd.getICAO().length() != 4){ if (airportToAdd.getICAO().length() != 0 && airportToAdd.getICAO().length() != 4){
throw new DataException("ICAO either empty or 4 letters"); throw new DataException("ICAO either empty or 4 letters");
} }
if (airportToAdd.getName().equals("")) {
throw new DataException("You cannot have an airport without a name.");
}
for (String key : airportDictionary.keySet()){ for (String key : airportDictionary.keySet()){
airportDictionary.get(key).hasDuplicate(airportToAdd); airportDictionary.get(key).hasDuplicate(airportToAdd);
} }
@ -875,6 +900,7 @@ public class Dataset {
"\""+airportToAdd.getCountryName()+"\", \""+airportToAdd.getIATA_FFA()+"\", \""+airportToAdd.getICAO()+"\", " + "\""+airportToAdd.getCountryName()+"\", \""+airportToAdd.getIATA_FFA()+"\", \""+airportToAdd.getICAO()+"\", " +
""+airportToAdd.getLatitude()+", "+airportToAdd.getLongitude()+", "+airportToAdd.getAltitude()+");"; ""+airportToAdd.getLatitude()+", "+airportToAdd.getLongitude()+", "+airportToAdd.getAltitude()+");";
stmt.execute(insertAirportQuery); stmt.execute(insertAirportQuery);
stmt.close();
//get the airport id //get the airport id
stmt = c.createStatement(); stmt = c.createStatement();
String airportIDQuery = "SELECT * FROM `sqlite_sequence` WHERE `name` = \""+this.name+"_Airport\" LIMIT 1;"; String airportIDQuery = "SELECT * FROM `sqlite_sequence` WHERE `name` = \""+this.name+"_Airport\" LIMIT 1;";
@ -886,6 +912,9 @@ public class Dataset {
airportToAdd.setID(airportID); airportToAdd.setID(airportID);
airports.add(airportToAdd); airports.add(airportToAdd);
airportDictionary.put(airportToAdd.getName(), airportToAdd); airportDictionary.put(airportToAdd.getName(), airportToAdd);
airportIDRes.close();
stmt.close();
c.close();
} catch ( Exception e ) { } catch ( Exception e ) {
System.err.println( e.getClass().getName() + ": " + e.getMessage() ); System.err.println( e.getClass().getName() + ": " + e.getMessage() );
System.exit(0); System.exit(0);
@ -910,6 +939,7 @@ public class Dataset {
stmt.close(); stmt.close();
cityDictionary.put(city.getName(), city); cityDictionary.put(city.getName(), city);
cities.add(city); cities.add(city);
c.close();
} catch ( Exception e ) { } catch ( Exception e ) {
System.err.println( e.getClass().getName() + ": " + e.getMessage() ); System.err.println( e.getClass().getName() + ": " + e.getMessage() );
System.exit(0); System.exit(0);
@ -934,6 +964,7 @@ public class Dataset {
stmt.close(); stmt.close();
countryDictionary.put(country.getName(), country); countryDictionary.put(country.getName(), country);
countries.add(country); countries.add(country);
c.close();
} catch ( Exception e ) { } catch ( Exception e ) {
System.err.println( e.getClass().getName() + ": " + e.getMessage() ); System.err.println( e.getClass().getName() + ": " + e.getMessage() );
System.exit(0); System.exit(0);
@ -1011,10 +1042,13 @@ public class Dataset {
//routeAirline + routeSourceAirport + routeArrvAirport + routeCodeShare + routeStops + routeEquip //routeAirline + routeSourceAirport + routeArrvAirport + routeCodeShare + routeStops + routeEquip
String routeKey = routeToAdd.getAirline() + routeToAdd.getDepartureAirport() + routeToAdd.getArrivalAirport() + routeToAdd.getCode() + routeToAdd.getStops() + routeToAdd.getEquipment(); String routeKey = routeToAdd.getAirline() + routeToAdd.getDepartureAirport() + routeToAdd.getArrivalAirport() + routeToAdd.getCode() + routeToAdd.getStops() + routeToAdd.getEquipment();
routeDictionary.put(routeKey, routeToAdd); routeDictionary.put(routeKey, routeToAdd);
stmt.close();
c.close();
} catch ( Exception e ) { } catch ( Exception e ) {
System.err.println( e.getClass().getName() + ": " + e.getMessage() ); System.err.println( e.getClass().getName() + ": " + e.getMessage() );
System.exit(0); System.exit(0);
} }
createDataLinks();
} }
/** /**
@ -1180,26 +1214,31 @@ public class Dataset {
try { try {
Class.forName("org.sqlite.JDBC"); Class.forName("org.sqlite.JDBC");
c = DriverManager.getConnection("jdbc:sqlite:res/userdb.db"); c = DriverManager.getConnection("jdbc:sqlite:res/userdb.db");
//System.out.println(airline.getID());
String deleteQuery = "DELETE FROM `"+this.name+"_Airline` WHERE `Airline_ID` = " + airline.getID() + ";"; String deleteQuery = "DELETE FROM `"+this.name+"_Airline` WHERE `Airline_ID` = " + airline.getID() + ";";
stmt = c.createStatement(); stmt = c.createStatement();
//System.out.println("Airline deleted");
stmt.execute(deleteQuery); stmt.execute(deleteQuery);
//System.out.println("Airline deleted");
stmt.close(); stmt.close();
//System.out.println("Airline deleted");
stmt = c.createStatement(); stmt = c.createStatement();
//check if number of countries that contain airlines > 0 else delete the country //check if number of countries that contain airlines > 0 else delete the country
String countCountry = "SELECT COUNT(*) FROM `"+this.name+"_Airline` JOIN `"+this.name+"_Country` ON" + String countCountry = "SELECT COUNT(*) FROM `"+this.name+"_Airline` JOIN `"+this.name+"_Country` ON" +
" `"+this.name+"_Country`.`Country_Name` = `"+this.name+"_Airline`.`Country`" + " `"+this.name+"_Country`.`Country_Name` = `"+this.name+"_Airline`.`Country`" +
" WHERE `"+this.name+"_Airline`.`Country` = \""+airline.getCountry().getName().replace("\"", "\"\"")+"\""; " WHERE `"+this.name+"_Airline`.`Country` = \""+airline.getCountryName().replace("\"", "\"\"")+"\"";
ResultSet countCountryRes = stmt.executeQuery(countCountry); ResultSet countCountryRes = stmt.executeQuery(countCountry);
int countryCount = 0; int countryCount = 0;
while (countCountryRes.next()){ while (countCountryRes.next()) {
countryCount += countCountryRes.getInt("COUNT(*)"); countryCount += countCountryRes.getInt("COUNT(*)");
} }
countCountryRes.close(); countCountryRes.close();
stmt.close(); stmt.close();
stmt = c.createStatement();
//check if number of counties that contain airports > 0 else delete the country //check if number of counties that contain airports > 0 else delete the country
String countCountryA = "SELECT COUNT(*) FROM `"+this.name+"_Airport` JOIN `"+this.name+"_Country` ON" + String countCountryA = "SELECT COUNT(*) FROM `"+this.name+"_Airport` JOIN `"+this.name+"_Country` ON" +
" `"+this.name+"_Country`.`Country_Name` = `"+this.name+"_Airport`.`Country`" + " `"+this.name+"_Country`.`Country_Name` = `"+this.name+"_Airport`.`Country`" +
" WHERE `"+this.name+"_Airport`.`Country` = \""+airline.getCountry().getName().replace("\"", "\"\"")+"\""; " WHERE `"+this.name+"_Airport`.`Country` = \""+airline.getCountryName().replace("\"", "\"\"")+"\"";
countCountryRes = stmt.executeQuery(countCountryA); countCountryRes = stmt.executeQuery(countCountryA);
while (countCountryRes.next()){ while (countCountryRes.next()){
countryCount += countCountryRes.getInt("COUNT(*)"); countryCount += countCountryRes.getInt("COUNT(*)");
@ -1209,14 +1248,15 @@ public class Dataset {
//delete country if there are no matches //delete country if there are no matches
if (countryCount == 0){ if (countryCount == 0){
stmt = c.createStatement(); stmt = c.createStatement();
String deleteCountry = "DELETE FROM `"+this.name+"_Country` WHERE `Country_Name` = \""+airline.getCountry().getName()+"\""; String deleteCountry = "DELETE FROM `"+this.name+"_Country` WHERE `Country_Name` = \""+airline.getCountryName()+"\"";
stmt.execute(deleteCountry); stmt.execute(deleteCountry);
stmt.close(); stmt.close();
} }
c.close(); c.close();
} catch ( Exception e ) { } catch ( Exception e ) {
e.printStackTrace();
System.err.println( e.getClass().getName() + ": " + e.getMessage() ); System.err.println( e.getClass().getName() + ": " + e.getMessage() );
System.exit(0); //System.exit(0);
} }
airlines.remove(airline); airlines.remove(airline);
} }

@ -73,7 +73,7 @@ public class RouteFilter extends Filter{
String regexCode = "(?i).*"+stops+".*"; String regexCode = "(?i).*"+stops+".*";
int index = 0; int index = 0;
while(index < filteredList.size()){ while(index < filteredList.size()){
if (!filteredList.get(index).getArrivalAirport().matches(regexCode)){ if (!String.valueOf(filteredList.get(index).getStops()).matches(regexCode)){
filteredList.remove(index); filteredList.remove(index);
}else{ }else{
index++; index++;

@ -7,7 +7,8 @@ public enum SceneCode {
INITIAL(""), AIRLINE_SUMMARY("airline_summary.fxml"), AIRLINE_RAW_DATA("airline_raw_data.fxml"), INITIAL(""), AIRLINE_SUMMARY("airline_summary.fxml"), AIRLINE_RAW_DATA("airline_raw_data.fxml"),
AIRPORT_SUMMARY("airport_summary.fxml"), AIRPORT_RAW_DATA("airport_raw_data.fxml"), AIRPORT_SUMMARY("airport_summary.fxml"), AIRPORT_RAW_DATA("airport_raw_data.fxml"),
ROUTE_SUMMARY("routes_summary.fxml"), ROUTE_RAW_DATA("route_raw_data.fxml"), FLIGHT_SUMMARY("flight_data_summary.fxml"), ROUTE_SUMMARY("routes_summary.fxml"), ROUTE_RAW_DATA("route_raw_data.fxml"), FLIGHT_SUMMARY("flight_data_summary.fxml"),
FLIGHT_RAW_DATA("flight_raw_data.fxml"), AIRPORT_ANALYSER("airport_analyser.fxml"), ROUTE_ANALYSER("route_analyser.fxml");; FLIGHT_RAW_DATA("flight_raw_data.fxml"), AIRPORT_ANALYSER("airport_analyser.fxml"), ROUTE_ANALYSER("route_analyser.fxml"),
AIRPORT_DIST_CALC("airport_dist_calc.fxml");
private String filePath; private String filePath;

@ -22,7 +22,7 @@ public class Airline{
private Country country = null; private Country country = null;
/** /**
* Constructor * Constructor for Airline when pulled from the database.
* *
* @param ID * @param ID
* @param name * @param name
@ -45,7 +45,16 @@ public class Airline{
this.routes = new ArrayList<Route>(); this.routes = new ArrayList<Route>();
} }
/**
* Constructor for Airline without ID this will be set later by the dataset from the dataset.
* @param name
* @param alias
* @param IATA
* @param ICAO
* @param callSign
* @param countryName
* @param active
*/
public Airline(String name, String alias, String IATA, String ICAO, String callSign, String countryName, String active){ public Airline(String name, String alias, String IATA, String ICAO, String callSign, String countryName, String active){
this.ID = -1; this.ID = -1;
this.IATA = IATA; this.IATA = IATA;
@ -255,6 +264,9 @@ public class Airline{
if (this.name.equals(airline.getName())){ if (this.name.equals(airline.getName())){
throw new DataException("This Airline Name already Exists, Please Choose Another."); throw new DataException("This Airline Name already Exists, Please Choose Another.");
} }
if (this.name.equals("")){
throw new DataException("This Airline Name cannot be Empty");
}
if (!this.IATA.equals("") && this.IATA.equals(airline.getIATA())){ if (!this.IATA.equals("") && this.IATA.equals(airline.getIATA())){
throw new DataException("This IATA Code already Exists, Please Choose Another."); throw new DataException("This IATA Code already Exists, Please Choose Another.");
} }
@ -273,7 +285,7 @@ public class Airline{
*/ */
@Override @Override
public String toString(){ public String toString(){
return name; return name + ", IATA:" + IATA + ", ICAO: " + ICAO;
} }
} }

@ -89,6 +89,11 @@ public class Airport {
public void setID(int iD) { public void setID(int iD) {
this.ID = iD; this.ID = iD;
} }
/**
* Sets the Name of the Airport.
* @param name
*/
public void setName(String name){ public void setName(String name){
this.name = name; this.name = name;
} }
@ -148,10 +153,18 @@ public class Airport {
} }
} }
/**
* gets the country name
* @return
*/
public String getCountryName() { public String getCountryName() {
return countryName; return countryName;
} }
/**
* sets the country name
* @param countryName
*/
public void setCountryName(String countryName) { public void setCountryName(String countryName) {
this.countryName = countryName; this.countryName = countryName;
} }
@ -194,13 +207,6 @@ public class Airport {
public String getICAO(){ public String getICAO(){
return ICAO; return ICAO;
} }
/**
* gets the IATA/FFA of the airport
* @return IATA/FFA Code
*/
// public String IATA_FFA(){
// return IATA_FFA;
// }
/** /**
* gets the altitude of the airport * gets the altitude of the airport
* @return Altitude of Airport * @return Altitude of Airport
@ -254,7 +260,10 @@ public class Airport {
return country; return country;
} }
//JavaDoc needed /**
* gets the timezone of the Airport
* @return
*/
public Double getTimezone() { public Double getTimezone() {
if (this.city != null) { if (this.city != null) {
return this.city.getTimezone(); return this.city.getTimezone();
@ -262,7 +271,11 @@ public class Airport {
return 0.0; return 0.0;
} }
} }
//JavaDoc needed
/**
* gets the DST of the Country the Airport is in.
* @return
*/
public String getDST() { public String getDST() {
if (this.country != null) { if (this.country != null) {
return this.country.getDST(); return this.country.getDST();
@ -270,7 +283,11 @@ public class Airport {
return ""; return "";
} }
} }
//JavaDoc needed
/**
* gets the timezone in Olson format of the country the airport is in
* @return
*/
public String getTz() { public String getTz() {
if (this.city != null) { if (this.city != null) {
return this.city.getTimeOlson(); return this.city.getTimeOlson();
@ -357,15 +374,21 @@ public class Airport {
*/ */
public double calculateDistance(Airport airport){ public double calculateDistance(Airport airport){
double distance = 0; double distance = 0;
double dLong = this.longitude - airport.getLatitude(); double dLong = this.longitude - airport.getLongitude();
double dLat = this.latitude - airport.getLatitude(); double dLat = this.latitude - airport.getLatitude();
double a = Math.pow((Math.sin(dLat/2)), 2) + Math.cos(this.latitude) * Math.cos(airport.getLatitude()) * Math.pow(Math.sin(dLong/2), 2); double a = Math.pow((Math.sin(dLat/2)), 2) + Math.cos(this.latitude) * Math.cos(airport.getLatitude()) * Math.pow(Math.sin(dLong/2), 2);
double c = a * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); double c = a * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
distance = 6371 * c; distance = 6371 * c;
return distance; return distance;
} }
/**
* Checks if the airport is a semi duplicate of this class. Used to see if it passes to enter into the Database.
* @param airport
* @throws DataException
*/
public void hasDuplicate(Airport airport) throws DataException{ public void hasDuplicate(Airport airport) throws DataException{
if (!airport.getName().equals("") && airport.getName().equals(this.name)){ if (airport.getName().equals("") || airport.getName().equals(this.name)){
throw new DataException("Airport Name already Exists, Please Choose Another."); throw new DataException("Airport Name already Exists, Please Choose Another.");
} }
if (!airport.getIATA_FFA().equals("") && airport.getIATA_FFA().equals(this.name)){ if (!airport.getIATA_FFA().equals("") && airport.getIATA_FFA().equals(this.name)){
@ -378,7 +401,6 @@ public class Airport {
/** /**
* Information of the airport returned in String format. * Information of the airport returned in String format.
*/ */
@Override @Override
public String toString(){ public String toString(){
return this.cityName +" Airport has ICAO: "+this.ICAO+", IATA/FFA: "+this.IATA_FFA+" and is located at ("+this.latitude+", "+this.longitude return this.cityName +" Airport has ICAO: "+this.ICAO+", IATA/FFA: "+this.IATA_FFA+" and is located at ("+this.latitude+", "+this.longitude

@ -9,6 +9,13 @@ public class City {
private String timeOlson; private String timeOlson;
private ArrayList<Airport> airports; private ArrayList<Airport> airports;
/**
* City Constructor
* @param name
* @param country
* @param timezone
* @param timeOlson
*/
public City(String name, String country, double timezone, String timeOlson){ public City(String name, String country, double timezone, String timeOlson){
this.name = name; this.name = name;
this.country = country; this.country = country;
@ -17,22 +24,42 @@ public class City {
this.airports = new ArrayList<Airport>(); this.airports = new ArrayList<Airport>();
} }
/**
* Sets Name of the City
* @param name
*/
public void setName(String name) { public void setName(String name) {
this.name = name; this.name = name;
} }
/**
* Sets Country that the city is in.
* @param country
*/
public void setCountry(String country){ public void setCountry(String country){
this.country = country; this.country = country;
} }
/**
* Set Timezone that the City is in.
* @param timezone
*/
public void setTimezone(double timezone) { public void setTimezone(double timezone) {
this.timezone = timezone; this.timezone = timezone;
} }
/**
* Sets the time olson the city is in.
* @param timeOlson
*/
public void setTimeOlson(String timeOlson) { public void setTimeOlson(String timeOlson) {
this.timeOlson = timeOlson; this.timeOlson = timeOlson;
} }
/**
* Sets the airports the are in the city
* @param airports
*/
public void setAirports(ArrayList<Airport> airports) { public void setAirports(ArrayList<Airport> airports) {
this.airports = new ArrayList<Airport>(); this.airports = new ArrayList<Airport>();
for (int i = 0; i < airports.size(); i ++) { for (int i = 0; i < airports.size(); i ++) {
@ -40,46 +67,81 @@ public class City {
} }
} }
/**
* Gets the name of the city.
* @return
*/
public String getName(){ public String getName(){
return name; return name;
} }
/**
* Gets the Country that the city is in.
* @return
*/
public String getCountry(){ public String getCountry(){
return country; return country;
} }
/**
* gets the Timezone that the City is in.
* @return
*/
public double getTimezone(){ public double getTimezone(){
return timezone; return timezone;
} }
/**
* Gets the Timezone in Olson format the City is in.
* @return
*/
public String getTimeOlson(){ public String getTimeOlson(){
return timeOlson; return timeOlson;
} }
/**
* gets the Airports that are in this city.
* @return
*/
public ArrayList<Airport> getAirports(){ public ArrayList<Airport> getAirports(){
return airports; return airports;
} }
/**
* adds an airport that is in this city.
* @param airport
*/
public void addAirport(Airport airport){ public void addAirport(Airport airport){
airports.add(airport); airports.add(airport);
} }
/**
* adds multiple airports to this city.
* @param airports
*/
public void addAirport(ArrayList<Airport> airports){ public void addAirport(ArrayList<Airport> airports){
for (int i = 0; i < airports.size(); i++){ for (int i = 0; i < airports.size(); i++){
addAirport(airports.get(i)); addAirport(airports.get(i));
} }
} }
/**
* Deletes an Airport from this City.
* @param airport
*/
public void delAirport(Airport airport){ public void delAirport(Airport airport){
airports.remove(airport); airports.remove(airport);
} }
/**
* Deletes an Airport by Index from this City.
* @param index
*/
public void delAirport(int index) { public void delAirport(int index) {
airports.remove(index); airports.remove(index);
} }
@Override @Override
public String toString(){ public String toString(){
return this.name; return this.name + " has " + airports.size() + " Airports and is in "+timeOlson;
} }
} }

@ -6,20 +6,38 @@ public class Country {
private String DST, name; private String DST, name;
private ArrayList<City> cities = new ArrayList<City>(); private ArrayList<City> cities = new ArrayList<City>();
private ArrayList<Airline> airlines = new ArrayList<Airline>(); private ArrayList<Airline> airlines = new ArrayList<Airline>();
private Position position;
/**
* Contructor for Country.
* @param DST
* @param name
*/
public Country(String DST, String name){ public Country(String DST, String name){
this.DST = DST; this.DST = DST;
this.name = name; this.name = name;
} }
/**
* Sets the DST of the country.
* @param dST
*/
public void setDST(String dST) { public void setDST(String dST) {
DST = dST; DST = dST;
} }
/**
* Sets the name of the country.
* @param name
*/
public void setName(String name) { public void setName(String name) {
this.name = name; this.name = name;
} }
/**
* Set Airlines that are based in this country.
* @param airlines
*/
public void setAirlines(ArrayList<Airline> airlines) { public void setAirlines(ArrayList<Airline> airlines) {
this.airlines = new ArrayList<Airline>(); this.airlines = new ArrayList<Airline>();
for (int i = 0; i < airlines.size(); i ++) { for (int i = 0; i < airlines.size(); i ++) {
@ -27,36 +45,68 @@ public class Country {
} }
} }
/**
* Gets the DST of the Country.
* @return
*/
public String getDST(){ public String getDST(){
return this.DST; return this.DST;
} }
/**
* Gets the Name of the Country.
* @return
*/
public String getName(){ public String getName(){
return this.name; return this.name;
} }
/**
* gets the Airlines that belong in this Country.
* @return
*/
public ArrayList<Airline> getAirlines(){ public ArrayList<Airline> getAirlines(){
return airlines; return airlines;
} }
/**
* Adds an Airline that is based in this country.
* @param airline
*/
public void addAirline(Airline airline){ public void addAirline(Airline airline){
this.airlines.add(airline); this.airlines.add(airline);
} }
/**
* Adds multiple Airlines to this Country.
* @param airlines
*/
public void addAirline(ArrayList<Airline> airlines){ public void addAirline(ArrayList<Airline> airlines){
for (int i = 0; i < airlines.size(); i++){ for (int i = 0; i < airlines.size(); i++){
addAirline(airlines.get(i)); addAirline(airlines.get(i));
} }
} }
/**
* deletes an Airline based in this country.
* @param airline
*/
public void delAirline(Airline airline){ public void delAirline(Airline airline){
airlines.remove(airline); airlines.remove(airline);
} }
/**
* deletes an Airline in this country.
* @param index
*/
public void delAirline(int index){ public void delAirline(int index){
airlines.remove(index); airlines.remove(index);
} }
/**
* sets the cities of this country
* @param cities
*/
public void setCities(ArrayList<City> cities){ public void setCities(ArrayList<City> cities){
this.cities = new ArrayList<City>(); this.cities = new ArrayList<City>();
for (int i = 0; i < cities.size(); i++){ for (int i = 0; i < cities.size(); i++){
@ -64,21 +114,61 @@ public class Country {
} }
} }
/**
* adds a City to this country.
* @param city
*/
public void addCities(City city){ public void addCities(City city){
this.cities.add(city); this.cities.add(city);
} }
/**
* Add multiple Cities to this Country.
* @param cities
*/
public void addCities(ArrayList<City> cities){ public void addCities(ArrayList<City> cities){
for (int i = 0; i < cities.size(); i++){ for (int i = 0; i < cities.size(); i++){
this.cities.add(cities.get(i)); this.cities.add(cities.get(i));
} }
} }
/**
* Deletes a city for this country.
* @param city
*/
public void delCities(City city){ public void delCities(City city){
this.cities.remove(city); this.cities.remove(city);
} }
/**
* Deletes Cities in this Country
* @param index
*/
public void delCities(int index){ public void delCities(int index){
this.cities.remove(index); this.cities.remove(index);
} }
/**
* Gets the CIties in this Country.
* @return
*/
public ArrayList<City> getCities() {
return cities;
}
/**
* gets the {@link Position}(double Latitude, double Longitude) of this Country.
* @return
*/
public Position getPosition() {
return position;
}
/**
* sets the {@link Position} of the Country.
* @param position
*/
public void setPosition(Position position) {
this.position = position;
}
} }

@ -10,7 +10,7 @@ public class FlightPath {
final private RoutePath routePath = new RoutePath(); final private RoutePath routePath = new RoutePath();
/** /**
* * Constructor for this FLight Path from database
* @param ID id of the the flight path in the database * @param ID id of the the flight path in the database
* @param departureAirport Iata/FFA of the airport * @param departureAirport Iata/FFA of the airport
* @param arrivalAirport IATA/FFA of the airport * @param arrivalAirport IATA/FFA of the airport
@ -22,6 +22,11 @@ public class FlightPath {
this.flightPoints = new ArrayList<FlightPoint>(); this.flightPoints = new ArrayList<FlightPoint>();
} }
/**
* COnstructor for FlightPath from dataset add later the ID needs to be set from database.
* @param departureAirport
* @param arrivalAirport
*/
public FlightPath(String departureAirport, String arrivalAirport){ public FlightPath(String departureAirport, String arrivalAirport){
this.ID = -1; this.ID = -1;
this.departureAirport = departureAirport; this.departureAirport = departureAirport;
@ -29,10 +34,18 @@ public class FlightPath {
this.flightPoints = new ArrayList<FlightPoint>(); this.flightPoints = new ArrayList<FlightPoint>();
} }
/**
* Gets the {@link FlightPoint} of this flight Path.
* @return
*/
public ArrayList<FlightPoint> getFlightPoints() { public ArrayList<FlightPoint> getFlightPoints() {
return flightPoints; return flightPoints;
} }
/**
* Sets the {@link FlightPoint} of this Flight Path.
* @param flightPoints
*/
public void setFlightPoints(ArrayList<FlightPoint> flightPoints) { public void setFlightPoints(ArrayList<FlightPoint> flightPoints) {
this.flightPoints = new ArrayList<FlightPoint>(); this.flightPoints = new ArrayList<FlightPoint>();
for (int i = 0; i < flightPoints.size(); i ++) { for (int i = 0; i < flightPoints.size(); i ++) {
@ -40,56 +53,112 @@ public class FlightPath {
} }
} }
/**
* Sets the {@link Airport} that the Flight Path leaves from.
* @param departureAirport
*/
public void setDepartureAirport(String departureAirport) { public void setDepartureAirport(String departureAirport) {
this.departureAirport = departureAirport; this.departureAirport = departureAirport;
} }
/**
* Sets the {@link Airport} that the Flight Path arrives at.
* @param arrivalAirport
*/
public void setArrivalAirport(String arrivalAirport) { public void setArrivalAirport(String arrivalAirport) {
this.arrivalAirport = arrivalAirport; this.arrivalAirport = arrivalAirport;
} }
/**
* Sets the ID that corresponds to the database for this flight path.
* Also the ID that corresponds to {@see FlightPoint} IndexID
* @param iD
*/
public void setID(int iD) { public void setID(int iD) {
ID = iD; ID = iD;
} }
/**
* gets the ID of the Flight Path.
* @return
*/
public int getID(){ public int getID(){
return ID; return ID;
} }
/**
* gets the {@link Airport} that the FLight Departs from.
* @return
*/
public String departsFrom(){ public String departsFrom(){
return departureAirport; return departureAirport;
} }
/**
* gets the {@link Airport} that the flight arrives at.
* @return
*/
public String arrivesAt(){ public String arrivesAt(){
return arrivalAirport; return arrivalAirport;
} }
/**
* Gets all the Points that the FLight passes
* {@link FlightPoint}
* @return
*/
public ArrayList<FlightPoint> getFlight(){ public ArrayList<FlightPoint> getFlight(){
return flightPoints; return flightPoints;
} }
/**
* Adds a {@link FlightPoint} to the Flight Path.
* @param flightPoint
*/
public void addFlightPoint(FlightPoint flightPoint){ public void addFlightPoint(FlightPoint flightPoint){
flightPoints.add(flightPoint); flightPoints.add(flightPoint);
} }
/**
* Adds a {@link FlightPoint} to the Flight Path at a specific point of the flight.
* @param flightPoint
* @param index
*/
public void addFlightPoint(FlightPoint flightPoint, int index){ public void addFlightPoint(FlightPoint flightPoint, int index){
flightPoints.add(index, flightPoint); flightPoints.add(index, flightPoint);
} }
/**
* deletes a point from the flight.
* @param flightPoint
*/
public void delFlightPoint(FlightPoint flightPoint){ public void delFlightPoint(FlightPoint flightPoint){
flightPoints.remove(flightPoint); flightPoints.remove(flightPoint);
} }
/**
* delets a point from the flight at a specific index.
* @param index
*/
public void delFlightPoint(int index){ public void delFlightPoint(int index){
flightPoints.remove(index); flightPoints.remove(index);
} }
/**
* Adds multiple {@link FlightPoint} to the FlightPath.
* @param flightPoints
*/
public void addFlightPoint(ArrayList<FlightPoint> flightPoints){ public void addFlightPoint(ArrayList<FlightPoint> flightPoints){
for (int i = 0; i < flightPoints.size(); i ++){ for (int i = 0; i < flightPoints.size(); i ++){
this.flightPoints.add(flightPoints.get(i)); this.flightPoints.add(flightPoints.get(i));
} }
} }
/**
* Gets the {@link RoutePath} that the FlightPath traverses.
* Also see {@see seng202.group9.Map.Map}
* @return
*/
public RoutePath getRoutePath(){ public RoutePath getRoutePath(){
if (routePath.getRoute().size() == 0){ if (routePath.getRoute().size() == 0){
for (FlightPoint point: flightPoints){ for (FlightPoint point: flightPoints){

@ -15,6 +15,14 @@ public class FlightPoint {
private double latitude; private double latitude;
private double longitude; private double longitude;
/**
* Constructor for FLight POint before set by the database.
* @param type
* @param name
* @param altitude
* @param latitude
* @param longitude
*/
public FlightPoint(String type, String name, double altitude, double latitude, double longitude){ public FlightPoint(String type, String name, double altitude, double latitude, double longitude){
//extra calculations will have to be used to find heading, legdistance and total distance. If necessary //extra calculations will have to be used to find heading, legdistance and total distance. If necessary
//Type 1 file the file the lecturers gave us //Type 1 file the file the lecturers gave us
@ -33,6 +41,20 @@ public class FlightPoint {
this.longitude = longitude; this.longitude = longitude;
} }
/**
* Constructor when getting points from the database.
* @param name Name for the point.
* @param ID Unique ID from Database.
* @param indexID FOreighn key for {@link FlightPath}.
* @param type
* @param via
* @param heading
* @param altitude
* @param legDistance
* @param totalDistance
* @param latitude
* @param longitude
*/
public FlightPoint(String name, int ID, int indexID, String type, String via, public FlightPoint(String name, int ID, int indexID, String type, String via,
int heading, double altitude, double legDistance, double totalDistance, int heading, double altitude, double legDistance, double totalDistance,
double latitude, double longitude){ double latitude, double longitude){
@ -49,6 +71,11 @@ public class FlightPoint {
this.longitude = longitude; this.longitude = longitude;
} }
/**
* get the Path ID
* @return
* @throws DataException
*/
public int getIndexID() throws DataException { public int getIndexID() throws DataException {
if (this.ID == -1){ if (this.ID == -1){
throw new DataException("ID not set."); throw new DataException("ID not set.");
@ -57,54 +84,107 @@ public class FlightPoint {
} }
} }
/**
* sets the Path ID
* @param indexID
*/
public void setIndexID(int indexID) { public void setIndexID(int indexID) {
this.indexID = indexID; this.indexID = indexID;
} }
/**
* sets the name of the path.
* @param name
*/
public void setName(String name) { public void setName(String name) {
this.name = name; this.name = name;
} }
/**
* sets the Unique Database ID of the Path
* @param iD
*/
public void setID(int iD) { public void setID(int iD) {
ID = iD; ID = iD;
} }
/**
* Sets the type of the Point.
* @param type
*/
public void setType(String type) { public void setType(String type) {
this.type = type; this.type = type;
} }
/**
* set the VIA of the Point.
* @param via
*/
public void setVia(String via) { public void setVia(String via) {
this.via = via; this.via = via;
} }
/**
* Sets bearing the flight is heading.
* @param heading
*/
public void setHeading(int heading) { public void setHeading(int heading) {
this.heading = heading; this.heading = heading;
} }
/**
* sets the altitude of the flight at this point.
* @param altitude
*/
public void setAltitude(double altitude) { public void setAltitude(double altitude) {
this.altitude = altitude; this.altitude = altitude;
} }
/**
* sets the distance this flight takes before the next point.
* @param legDistance
*/
public void setLegDistance(double legDistance) { public void setLegDistance(double legDistance) {
this.legDistance = legDistance; this.legDistance = legDistance;
} }
/**
* sets total distance travelled at this point.
* @param totalDistance
*/
public void setTotalDistance(double totalDistance) { public void setTotalDistance(double totalDistance) {
this.totalDistance = totalDistance; this.totalDistance = totalDistance;
} }
/**
* sets the latitude at this point.
* @param latitude
*/
public void setLatitude(double latitude) { public void setLatitude(double latitude) {
this.latitude = latitude; this.latitude = latitude;
} }
/**
* Sets the Longitude at this point.
* @param longitude
*/
public void setLongitude(double longitude) { public void setLongitude(double longitude) {
this.longitude = longitude; this.longitude = longitude;
} }
/**
* gets the name of this point.
* @return
*/
public String getName(){ public String getName(){
return name; return name;
} }
/**
* gets the UNIQUE ID at this point.
* @return
* @throws DataException
*/
public int getID() throws DataException { public int getID() throws DataException {
if (this.ID == -1){ if (this.ID == -1){
throw new DataException("ID not set."); throw new DataException("ID not set.");
@ -113,38 +193,74 @@ public class FlightPoint {
} }
} }
/**
* gets the Path Index ID at this point.
* @return
*/
public int getIndex(){ public int getIndex(){
return indexID; return indexID;
} }
/**
* gets the type of this point.
* @return
*/
public String getType(){ public String getType(){
return type; return type;
} }
/**
* gets where the plane is via at this point.
* @return
*/
public String getVia(){ public String getVia(){
return via; return via;
} }
/**
* gets the Heading bearing at this point
* @return
*/
public int getHeading(){ public int getHeading(){
return heading; return heading;
} }
/**
* gets the altitude at this poitn.
* @return
*/
public double getAltitude(){ public double getAltitude(){
return altitude; return altitude;
} }
/**
* gets the leg distance at this point.
* @return
*/
public double getLegDistance(){ public double getLegDistance(){
return legDistance; return legDistance;
} }
/**
* gets total distance travelled by this flight so far.
* @return
*/
public double getTotalDistance(){ public double getTotalDistance(){
return totalDistance; return totalDistance;
} }
/**
* gets longitude of this point.
* @return
*/
public double getLongitude(){ public double getLongitude(){
return longitude; return longitude;
} }
/**
* gets the latitude of this point.
* @return
*/
public double getLatitude(){ public double getLatitude(){
return latitude; return latitude;
} }

@ -121,15 +121,25 @@ public class Route {
return ID; return ID;
} }
} }
//JavaDoc needed
/**
* Gets this ID of the Airline.
* @return
* @throws DataException
*/
public int getAirlineID() throws DataException { public int getAirlineID() throws DataException {
if (this.airline != null) { if (this.getAirline() != null) {
return this.getAirline().getID(); return this.getAirline().getID();
}else { }else {
return 0; return 0;
} }
} }
/**
* Gets the ID of the Airport that the Route leaves from.
* @return
* @throws DataException
*/
public int getSourceID() throws DataException { public int getSourceID() throws DataException {
if (this.getSourceAirport() != null) { if (this.getSourceAirport() != null) {
return this.getSourceAirport().getID(); return this.getSourceAirport().getID();
@ -138,6 +148,11 @@ public class Route {
} }
} }
/**
* gets the destination ID of the Airport the Route is arriving at.
* @return
* @throws DataException
*/
public int getDestID() throws DataException { public int getDestID() throws DataException {
if (this.getDestinationAirport() != null) { if (this.getDestinationAirport() != null) {
return this.getDestinationAirport().getID(); return this.getDestinationAirport().getID();
@ -241,13 +256,17 @@ public class Route {
*/ */
public void hasDuplicate(Route route) throws DataException{ public void hasDuplicate(Route route) throws DataException{
//routeAirline + routeSourceAirport + routeArrvAirport + routeCodeShare + routeStops + routeEquip //routeAirline + routeSourceAirport + routeArrvAirport + routeCodeShare + routeStops + routeEquip
if (route.getAirline().equals(this.airline) && route.getDepartureAirport().equals(this.departureAirport) if (route.getAirlineName().equals(this.airlineName) && route.getDepartureAirport().equals(this.departureAirport)
&& route.getArrivalAirport().equals(this.arrivalAirport) && route.getCode().equals(this.codeShare) && route.getArrivalAirport().equals(this.arrivalAirport) && route.getCode().equals(this.codeShare)
&& route.getStops() == this.stops && route.getEquipment().equals(this.equipment)){ && route.getStops() == this.stops && route.getEquipment().equals(this.equipment)){
throw new DataException("This Route already exists."); throw new DataException("This Route already exists.");
} }
} }
/**
* gets the RoutePath to be passed into {@link seng202.group9.Map.Map}.
* @return
*/
public RoutePath getRoutePath(){ public RoutePath getRoutePath(){
if (routePath == null) { if (routePath == null) {
routePath = new RoutePath( routePath = new RoutePath(
@ -258,6 +277,10 @@ public class Route {
return routePath; return routePath;
} }
/**
* What to print if printed as a string.
* @return
*/
@Override @Override
public String toString(){ public String toString(){

@ -10,22 +10,41 @@ import java.util.Collections;
public class RoutePath { public class RoutePath {
private ArrayList<Position> route = new ArrayList<Position>(); private ArrayList<Position> route = new ArrayList<Position>();
/**
* Route Path constructor when the user knows the points.
* @param points
*/
public RoutePath(Position ...points) { public RoutePath(Position ...points) {
Collections.addAll(route, points); Collections.addAll(route, points);
} }
/**
* Route Path constructor when the user doesn't know the points.
*/
public RoutePath(){ public RoutePath(){
} }
/**
* adds a {@link Position} to the RoutePath.
* @param position
*/
public void addPosition(Position position){ public void addPosition(Position position){
route.add(position); route.add(position);
} }
/**
* Gets the RoutePath positions.
* @return
*/
public ArrayList<Position> getRoute() { public ArrayList<Position> getRoute() {
return route; return route;
} }
/**
* Converts the RoutePath to an Array in JSON which can then be passed to the Map to display.
* @return
*/
public String toJSONArray() { public String toJSONArray() {
StringBuilder stringBuilder = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("["); stringBuilder.append("[");

@ -1,25 +1,22 @@
package seng202.group9.GUI; package seng202.group9.GUI;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.*; import javafx.scene.control.*;
import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.control.cell.PropertyValueFactory;
import seng202.group9.Controller.App; import seng202.group9.Controller.AirlineFilter;
import seng202.group9.Controller.Dataset; import seng202.group9.Controller.Dataset;
import seng202.group9.Core.Airline; import seng202.group9.Core.Airline;
import java.net.URL;
import java.util.ResourceBundle;
/** /**
* The GUI controller class for airline_raw_data.fxml.
* Extends from the abstract class {@link Controller}.
* Created by Sunguin on 2016/09/13. * Created by Sunguin on 2016/09/13.
*/ */
public class AirlineRDController extends Controller { public class AirlineRDController extends Controller {
@FXML @FXML
private TableView<Airline> tableView; private TableView<Airline> tableViewAirlineRD;
@FXML @FXML
private TableColumn<Airline, String> airlIDcol; private TableColumn<Airline, String> airlIDcol;
@FXML @FXML
@ -36,6 +33,7 @@ public class AirlineRDController extends Controller {
private TableColumn<Airline, String> airlCountrycol; private TableColumn<Airline, String> airlCountrycol;
@FXML @FXML
private TableColumn<Airline, String> airlActivecol; private TableColumn<Airline, String> airlActivecol;
@FXML @FXML
private TextField airlNameBox; private TextField airlNameBox;
@FXML @FXML
@ -49,13 +47,51 @@ public class AirlineRDController extends Controller {
@FXML @FXML
private TextField airlCountryBox; private TextField airlCountryBox;
@FXML @FXML
//private TextField airlActiveBox;
private ComboBox<String> airlActiveCBox; private ComboBox<String> airlActiveCBox;
@FXML
private TextField airlNameFilter;
@FXML
private TextField airlAliasFilter;
@FXML
private TextField airlIATAFilter;
@FXML
private TextField airlICAOFilter;
@FXML
private TextField airlCallsignFilter;
@FXML
private TextField airlCountryFilter;
@FXML
private TextField airlActiveFilter;
private Dataset theDataSet = null; private Dataset theDataSet = null;
//Dummy function to test the add button. /**
//Will edit when ID is added automatically. * Loads the initial airline data to the GUI table.
* Also sets up the dropdown menu options.
*/
public void load() {
airlIDcol.setCellValueFactory(new PropertyValueFactory<Airline, String>("ID"));
airlNamecol.setCellValueFactory(new PropertyValueFactory<Airline, String>("Name"));
airlAliascol.setCellValueFactory(new PropertyValueFactory<Airline, String>("Alias"));
airlIATAcol.setCellValueFactory(new PropertyValueFactory<Airline, String>("IATA"));
airlICAOcol.setCellValueFactory(new PropertyValueFactory<Airline, String>("ICAO"));
airlCallsigncol.setCellValueFactory(new PropertyValueFactory<Airline, String>("CallSign"));
airlCountrycol.setCellValueFactory(new PropertyValueFactory<Airline, String>("CountryName"));
airlActivecol.setCellValueFactory(new PropertyValueFactory<Airline, String>("Active"));
theDataSet = getParent().getCurrentDataset();
tableViewAirlineRD.setItems(FXCollections.observableArrayList(theDataSet.getAirlines()));
airlActiveCBox.setValue("Y");
airlActiveCBox.getItems().addAll("Y", "N");
}
/**
* Adds a single airline entry to the database.
* Takes in values from the GUI the user has typed in.
* @see Dataset
*/
public void addAirlineSingle() { public void addAirlineSingle() {
try { try {
theDataSet.addAirline( theDataSet.addAirline(
@ -73,7 +109,8 @@ public class AirlineRDController extends Controller {
airlCallsignBox.clear(); airlCallsignBox.clear();
airlCountryBox.clear(); airlCountryBox.clear();
airlActiveCBox.getSelectionModel().clearSelection(); airlActiveCBox.getSelectionModel().clearSelection();
tableView.setItems(FXCollections.observableArrayList(theDataSet.getAirlines())); airlActiveCBox.setValue("Y");
tableViewAirlineRD.setItems(FXCollections.observableArrayList(theDataSet.getAirlines()));
} catch ( Exception e ) { } catch ( Exception e ) {
Alert alert = new Alert(Alert.AlertType.ERROR); Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle("Airline Data Error"); alert.setTitle("Airline Data Error");
@ -83,21 +120,46 @@ public class AirlineRDController extends Controller {
} }
} }
public void load() { /**
airlIDcol.setCellValueFactory(new PropertyValueFactory<Airline, String>("ID")); * Deletes a single selected airline entry from the database.
airlNamecol.setCellValueFactory(new PropertyValueFactory<Airline, String>("Name")); * Updates the GUI accordingly.
airlAliascol.setCellValueFactory(new PropertyValueFactory<Airline, String>("Alias")); * @see Dataset
//Need to check IATA and ICAO */
airlIATAcol.setCellValueFactory(new PropertyValueFactory<Airline, String>("IATA")); public void deleteAirline() {
airlICAOcol.setCellValueFactory(new PropertyValueFactory<Airline, String>("ICAO")); Airline toDelete = tableViewAirlineRD.getSelectionModel().getSelectedItem();
airlCallsigncol.setCellValueFactory(new PropertyValueFactory<Airline, String>("CallSign")); theDataSet.deleteAirline(toDelete);
airlCountrycol.setCellValueFactory(new PropertyValueFactory<Airline, String>("CountryName")); tableViewAirlineRD.setItems(FXCollections.observableArrayList(theDataSet.getAirlines()));
airlActivecol.setCellValueFactory(new PropertyValueFactory<Airline, String>("Active"));
theDataSet = getParent().getCurrentDataset();
tableView.setItems(FXCollections.observableArrayList(theDataSet.getAirlines()));
//ObservableList<String> activeOptions= FXCollections.observableArrayList("Y", "N");
airlActiveCBox.getItems().addAll("Y", "N");
} }
/**
* Filters airlines by any field.
* These are specified by what the user has typed in the filter boxes.
* Updates the GUI accordingly.
* @see AirlineFilter
*/
public void filterAirlines() {
AirlineFilter filter = new AirlineFilter(theDataSet.getAirlines());
if (airlNameFilter.getText() != null) {
filter.filterName(airlNameFilter.getText());
}
if (airlAliasFilter.getText() != null) {
filter.filterAlias(airlAliasFilter.getText());
}
if (airlIATAFilter.getText() != null) {
filter.filterIATA(airlIATAFilter.getText());
}
if (airlICAOFilter.getText() != null) {
filter.filterICAO(airlICAOFilter.getText());
}
if (airlCallsignFilter.getText() != null) {
filter.filterCallsign(airlCallsignFilter.getText());
}
if (airlCountryFilter.getText() != null) {
filter.filterCountry(airlCountryFilter.getText());
}
if (airlActiveFilter.getText() != null) {
filter.filterActive(airlActiveFilter.getText());
}
tableViewAirlineRD.setItems(FXCollections.<Airline>observableArrayList(filter.getFilteredData()));
}
} }

@ -1,15 +1,22 @@
package seng202.group9.GUI; package seng202.group9.GUI;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.scene.Scene; import javafx.scene.Scene;
import javafx.scene.control.TableColumn; import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView; import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.web.WebView;
import seng202.group9.Controller.App; import seng202.group9.Controller.App;
import seng202.group9.Controller.Dataset; import seng202.group9.Controller.Dataset;
import seng202.group9.Controller.SceneCode; import seng202.group9.Controller.SceneCode;
import seng202.group9.Core.Airline; import seng202.group9.Core.Airline;
import seng202.group9.Core.Airport;
import seng202.group9.Core.Position;
import seng202.group9.Core.RoutePath;
import seng202.group9.Map.Map;
/** /**
* Created by michael on 14/09/2016. * Created by michael on 14/09/2016.
@ -18,6 +25,8 @@ public class AirlineSummaryController extends Controller{
@FXML @FXML
private TableView<Airline> tableView; private TableView<Airline> tableView;
@FXML @FXML
private WebView mapView;
@FXML
private TableColumn<Airline, String> columnName; private TableColumn<Airline, String> columnName;
@FXML @FXML
private TableColumn<Airline, String> columnAlias; private TableColumn<Airline, String> columnAlias;
@ -30,14 +39,28 @@ public class AirlineSummaryController extends Controller{
private Dataset currentData = null; private Dataset currentData = null;
private Map map;
public void load() { public void load() {
columnName.setCellValueFactory(new PropertyValueFactory<Airline, String>("Name")); columnName.setCellValueFactory(new PropertyValueFactory<Airline, String>("Name"));
columnAlias.setCellValueFactory(new PropertyValueFactory<Airline, String>("Alias")); columnAlias.setCellValueFactory(new PropertyValueFactory<Airline, String>("Alias"));
columnCountry.setCellValueFactory(new PropertyValueFactory<Airline, String>("Country")); columnCountry.setCellValueFactory(new PropertyValueFactory<Airline, String>("CountryName"));
columnIATA.setCellValueFactory(new PropertyValueFactory<Airline, String>("IATA")); columnIATA.setCellValueFactory(new PropertyValueFactory<Airline, String>("IATA"));
columnActive.setCellValueFactory(new PropertyValueFactory<Airline, String>("Active")); columnActive.setCellValueFactory(new PropertyValueFactory<Airline, String>("Active"));
currentData = getParent().getCurrentDataset(); currentData = getParent().getCurrentDataset();
tableView.setItems(FXCollections.observableArrayList(currentData.getAirlines())); tableView.setItems(FXCollections.observableArrayList(currentData.getAirlines()));
map = new Map(mapView, new RoutePath());
tableView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Airline>() {
public void changed(ObservableValue<? extends Airline> observable, Airline oldValue, Airline newValue) {
Airline selectedAirline= currentData.getAirlines().get(tableView.getSelectionModel().getSelectedIndices().get(0));
for (int i = 0 ; i < currentData.getAirports().size(); i ++){
if (currentData.getAirports().get(i).getCountryName().equals(selectedAirline.getCountryName())){
map.displayAirport(new RoutePath(new Position(currentData.getAirports().get(i).getLatitude(), currentData.getAirports().get(i).getLongitude())));
break;
}
}
}
});
} }
public void airlineRawDataButton() { public void airlineRawDataButton() {

@ -1,26 +1,19 @@
package seng202.group9.GUI; package seng202.group9.GUI;
import com.sun.javafx.collections.ObservableListWrapper;
import javafx.beans.InvalidationListener;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.value.ObservableStringValue;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
import javafx.collections.ListChangeListener;
import javafx.collections.ObservableList;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.scene.control.*; import javafx.scene.control.*;
import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.control.cell.PropertyValueFactory;
import javafx.util.Callback; import seng202.group9.Controller.AirportFilter;
import seng202.group9.Controller.App;
import seng202.group9.Controller.Dataset; import seng202.group9.Controller.Dataset;
import seng202.group9.Controller.SceneCode; import seng202.group9.Controller.SceneCode;
import seng202.group9.Core.Airport; import seng202.group9.Core.Airport;
import seng202.group9.Core.City;
import seng202.group9.Core.Country;
import static javafx.collections.FXCollections.observableArrayList;
/** /**
* The GUI controller class for airport_raw_data.fxml.
* Extends from the abstract class {@link Controller}.
* Created by Sunguin on 2016/09/13. * Created by Sunguin on 2016/09/13.
*/ */
public class AirportRDController extends Controller{ public class AirportRDController extends Controller{
@ -75,8 +68,35 @@ public class AirportRDController extends Controller{
@FXML @FXML
private TextField airpTzBox; private TextField airpTzBox;
@FXML
private TextField airpNameFilter;
@FXML
private TextField airpCityFilter;
@FXML
private TextField airpCountryFilter;
@FXML
private TextField airpIATAFFAFilter;
@FXML
private TextField airpICAOFilter;
@FXML
private TextField airpLatitudeFilter;
@FXML
private TextField airpLongitudeFilter;
@FXML
private TextField airpAltitudeFilter;
@FXML
private TextField airpTimezoneFilter;
@FXML
private TextField airpDSTFilter;
@FXML
private TextField airpTzFilter;
private Dataset theDataSet = null; private Dataset theDataSet = null;
/**
* Loads the initial airport data to the GUI table.
* Also sets up the dropdown menu options.
*/
public void load() { public void load() {
airpIDcol.setCellValueFactory(new PropertyValueFactory<Airport, String>("ID")); airpIDcol.setCellValueFactory(new PropertyValueFactory<Airport, String>("ID"));
airpNamecol.setCellValueFactory(new PropertyValueFactory<Airport, String>("Name")); airpNamecol.setCellValueFactory(new PropertyValueFactory<Airport, String>("Name"));
@ -91,29 +111,18 @@ public class AirportRDController extends Controller{
airpDSTcol.setCellValueFactory(new PropertyValueFactory<Airport, String>("DST")); airpDSTcol.setCellValueFactory(new PropertyValueFactory<Airport, String>("DST"));
airpTzcol.setCellValueFactory(new PropertyValueFactory<Airport, String>("Tz")); airpTzcol.setCellValueFactory(new PropertyValueFactory<Airport, String>("Tz"));
// airpTimezonecol.setCellFactory(new Callback<TableColumn<Airport, String>, TableCell<Airport, String>>() {
//
// @Override
// public TableCell<Airport, City> call(TableColumn<Airport, City> param) {
// TableCell<Airport, City> timeZoneCell = new TableCell<Airport, City>() {
// @Override
// protected void updateItem(City timezone, boolean empty) {
// if (timezone != null) {
// Label timeZoneLabel = new Label(timezone.getTimeOlson());
// setGraphic(timeZoneLabel);
// }
// }
// };
//
// return timeZoneCell;
// }
// });
theDataSet = getParent().getCurrentDataset(); theDataSet = getParent().getCurrentDataset();
tableViewAirportRD.setItems(FXCollections.observableArrayList(theDataSet.getAirports())); tableViewAirportRD.setItems(observableArrayList(theDataSet.getAirports()));
airpDSTCBox.setValue("E");
airpDSTCBox.getItems().addAll("E", "A", "S", "O", "Z", "N", "U"); airpDSTCBox.getItems().addAll("E", "A", "S", "O", "Z", "N", "U");
} }
/**
* Adds a single airport entry in the database.
* Takes in values from the GUI the user has typed in.
* @see Dataset
*/
public void addAirportSingle() { public void addAirportSingle() {
try { try {
theDataSet.addAirport( theDataSet.addAirport(
@ -137,6 +146,7 @@ public class AirportRDController extends Controller{
airpAltitudeBox.clear(); airpAltitudeBox.clear();
airpTimezoneBox.clear(); airpTimezoneBox.clear();
airpDSTCBox.getSelectionModel().clearSelection(); airpDSTCBox.getSelectionModel().clearSelection();
airpDSTCBox.setValue("E");
airpTzBox.clear(); airpTzBox.clear();
tableViewAirportRD.setItems(FXCollections.observableArrayList(theDataSet.getAirports())); tableViewAirportRD.setItems(FXCollections.observableArrayList(theDataSet.getAirports()));
} catch ( Exception e ) { } catch ( Exception e ) {
@ -147,7 +157,63 @@ public class AirportRDController extends Controller{
alert.showAndWait(); alert.showAndWait();
} }
} }
public void airportAnalyserButton(){
public void airportAnalyserButton() {
replaceSceneContent(SceneCode.AIRPORT_ANALYSER); replaceSceneContent(SceneCode.AIRPORT_ANALYSER);
} }
/**
* Deletes a single selected airport entry from the database.
* Updates the GUI accordingly.
* @see Dataset
*/
public void deleteAirport(){
Airport toDelete = tableViewAirportRD.getSelectionModel().getSelectedItem();
theDataSet.deleteAirport(toDelete);
tableViewAirportRD.setItems(observableArrayList(theDataSet.getAirports()));
}
/**
* Filters the airports table by any field.
* These are specified by what the user has typed in the filter boxes.
* Updates the GUI accordingly.
* @see AirportFilter
*/
public void filterAirports() {
AirportFilter filter = new AirportFilter(theDataSet.getAirports());
if (airpNameFilter.getText() != null) {
filter.filterName(airpNameFilter.getText());
}
if (airpCityFilter.getText() != null) {
filter.filterCity(airpCityFilter.getText());
}
if (airpCountryFilter.getText() != null) {
filter.filterCountry(airpCountryFilter.getText());
}
if (airpIATAFFAFilter.getText() != null) {
filter.filterIATA_FFA(airpIATAFFAFilter.getText());
}
if (airpICAOFilter.getText() != null) {
filter.filterICAO(airpICAOFilter.getText());
}
if (airpLatitudeFilter.getText() != null) {
filter.filterLatitude(airpLatitudeFilter.getText());
}
if (airpLongitudeFilter.getText() != null) {
filter.filterLongitude(airpLongitudeFilter.getText());
}
if (airpAltitudeFilter.getText() != null) {
filter.filterAltitude(airpAltitudeFilter.getText());
}
if (airpTimezoneFilter.getText() != null) {
filter.filterTimezone(airpTimezoneFilter.getText());
}
if (airpDSTFilter.getText() != null) {
filter.filterDST(airpDSTFilter.getText());
}
if (airpTzFilter.getText() != null) {
filter.filterOlson(airpTzFilter.getText());
}
tableViewAirportRD.setItems(FXCollections.<Airport>observableArrayList(filter.getFilteredData()));
}
} }

@ -1,14 +1,20 @@
package seng202.group9.GUI; package seng202.group9.GUI;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.scene.control.TableColumn; import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView; import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.web.WebView;
import seng202.group9.Controller.App; import seng202.group9.Controller.App;
import seng202.group9.Controller.Dataset; import seng202.group9.Controller.Dataset;
import seng202.group9.Controller.SceneCode; import seng202.group9.Controller.SceneCode;
import seng202.group9.Core.Airport; import seng202.group9.Core.Airport;
import seng202.group9.Core.Position;
import seng202.group9.Core.RoutePath;
import seng202.group9.Map.Map;
/** /**
* Created by michael on 14/09/2016. * Created by michael on 14/09/2016.
@ -17,6 +23,8 @@ public class AirportSummaryController extends Controller{
@FXML @FXML
private TableView<Airport> tableView; private TableView<Airport> tableView;
@FXML @FXML
private WebView mapView;
@FXML
private TableColumn<Airport, String> columnName; private TableColumn<Airport, String> columnName;
@FXML @FXML
private TableColumn<Airport, String> columnCity; private TableColumn<Airport, String> columnCity;
@ -29,6 +37,8 @@ public class AirportSummaryController extends Controller{
private Dataset currentData = null; private Dataset currentData = null;
private Map map;
public void airportRawDataButton() { public void airportRawDataButton() {
replaceSceneContent(SceneCode.AIRLINE_RAW_DATA); replaceSceneContent(SceneCode.AIRLINE_RAW_DATA);
} }
@ -51,5 +61,13 @@ public class AirportSummaryController extends Controller{
columnAltitude.setCellValueFactory(new PropertyValueFactory<Airport, String>("Altitude")); columnAltitude.setCellValueFactory(new PropertyValueFactory<Airport, String>("Altitude"));
currentData = getParent().getCurrentDataset(); currentData = getParent().getCurrentDataset();
tableView.setItems(FXCollections.observableArrayList(currentData.getAirports())); tableView.setItems(FXCollections.observableArrayList(currentData.getAirports()));
map = new Map(mapView, new RoutePath());
tableView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Airport>() {
public void changed(ObservableValue<? extends Airport> observable, Airport oldValue, Airport newValue) {
System.out.println("loading");
Airport selectedAirport= currentData.getAirports().get(tableView.getSelectionModel().getSelectedIndices().get(0));
map.displayAirport(new RoutePath( new Position(selectedAirport.getLatitude(), selectedAirport.getLongitude())));
}
});
} }
} }

@ -0,0 +1,63 @@
package seng202.group9.GUI;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.fxml.FXML;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.Label;
import javafx.scene.control.ListView;
import javafx.scene.text.Text;
import seng202.group9.Controller.Dataset;
import seng202.group9.Core.Airport;
import seng202.group9.Controller.App;
import seng202.group9.Controller.Dataset;
import seng202.group9.Core.Airline;
import java.util.ArrayList;
import java.util.HashMap;
import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.chart.*;
import javafx.scene.Group;
/**
* Created by michael on 17/09/2016.
*/
public class DistCalcController extends Controller {
@FXML
ListView<String> airportOne;
@FXML
ListView<String> airportTwo;
@FXML
Label answerBox;
Dataset currentData = null;
HashMap<String, Airport> current_Airports;
SimpleStringProperty bound = new SimpleStringProperty("Answer");
private void fill_boxes(){
HashMap<String, Airport> current_Airports = currentData.getAirportDictionary();
ArrayList<String> names = new ArrayList<String>();
for(String name : current_Airports.keySet()){
names.add(name);
}
ObservableList<String> usablenames = FXCollections.observableArrayList(names);
airportOne.setItems(usablenames);
airportTwo.setItems(usablenames);
}
public void calculateButton(){
Airport airport1 = currentData.getAirports().get((airportOne.getSelectionModel().getSelectedIndices().get(0)));
Airport airport2 = currentData.getAirports().get((airportTwo.getSelectionModel().getSelectedIndices().get(0)));
double distance = airport1.calculateDistance(airport2);
bound.setValue(String.valueOf(Math.round(distance)) + "km");
System.out.println(bound);
}
public void load(){
currentData = getParent().getCurrentDataset();
answerBox.textProperty().bind(bound);
fill_boxes();
}
}

@ -116,7 +116,7 @@ public class FlightSummaryController extends Controller {
} }
flightPathListView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<String>() { flightPathListView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<String>() {
public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) { public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
map.displayRoute(theDataSet.getFlightPaths().get(flightPathListView.getSelectionModel().getSelectedIndices().get(0)).getRoutePath()); //map.displayRoute(theDataSet.getFlightPaths().get(flightPathListView.getSelectionModel().getSelectedIndices().get(0)).getRoutePath());
} }
}); });
} }

@ -9,6 +9,7 @@ import javafx.fxml.Initializable;
import javafx.scene.control.Alert; import javafx.scene.control.Alert;
import seng202.group9.Controller.App; import seng202.group9.Controller.App;
import seng202.group9.Controller.Dataset;
import seng202.group9.Controller.SceneCode; import seng202.group9.Controller.SceneCode;
public class MenuController extends Controller{ public class MenuController extends Controller{
@ -74,6 +75,8 @@ public class MenuController extends Controller{
//nothing to load //nothing to load
} }
public void veiwDistCalc(){replaceSceneContent(SceneCode.AIRPORT_DIST_CALC);}
public void initialize(URL arg0, ResourceBundle arg1) { public void initialize(URL arg0, ResourceBundle arg1) {
// TODO Auto-generated method stub // TODO Auto-generated method stub

@ -4,12 +4,14 @@ import javafx.collections.FXCollections;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.scene.control.*; import javafx.scene.control.*;
import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.control.cell.PropertyValueFactory;
import seng202.group9.Controller.App;
import seng202.group9.Controller.Dataset; import seng202.group9.Controller.Dataset;
import seng202.group9.Controller.SceneCode; import seng202.group9.Controller.SceneCode;
import seng202.group9.Controller.RouteFilter;
import seng202.group9.Core.Route; import seng202.group9.Core.Route;
/** /**
* The GUI controller class for route_raw_data.fxml.
* Extends from the abstract class {@link Controller}.
* Created by Sunguin on 2016/09/14. * Created by Sunguin on 2016/09/14.
*/ */
public class RouteRDController extends Controller { public class RouteRDController extends Controller {
@ -48,8 +50,48 @@ public class RouteRDController extends Controller {
@FXML @FXML
private TextField rEquipmentBox; private TextField rEquipmentBox;
@FXML
private TextField rAirlineFilter;
@FXML
private TextField rSourceFilter;
@FXML
private TextField rDestFilter;
@FXML
private TextField rCodeshareFilter;
@FXML
private TextField rStopsFilter;
@FXML
private TextField rEquipmentFilter;
private Dataset theDataSet = null; private Dataset theDataSet = null;
/**
* Loads the initial route data to the GUI table.
* Also sets up the dropdown menu options.
*/
public void load() {
rAirlineCol.setCellValueFactory(new PropertyValueFactory<Route, String>("AirlineName"));
rAirlineIDCol.setCellValueFactory(new PropertyValueFactory<Route, String>("AirlineID"));
rSourceCol.setCellValueFactory(new PropertyValueFactory<Route, String>("DepartureAirport"));
rSourceIDCol.setCellValueFactory(new PropertyValueFactory<Route, String>("SourceID"));
rDestCol.setCellValueFactory(new PropertyValueFactory<Route, String>("ArrivalAirport"));
rDestIDCol.setCellValueFactory(new PropertyValueFactory<Route, String>("DestID"));
rCodeshareCol.setCellValueFactory(new PropertyValueFactory<Route, String>("Code"));
rStopsCol.setCellValueFactory(new PropertyValueFactory<Route, String>("Stops"));
rEquipmentCol.setCellValueFactory(new PropertyValueFactory<Route, String>("Equipment"));
theDataSet = getParent().getCurrentDataset();
tableViewRouteRD.setItems(FXCollections.observableArrayList(theDataSet.getRoutes()));
rCodeshareCBox.setValue("");
rCodeshareCBox.getItems().addAll("Y", "");
}
/**
* Adds a single route entry in the database.
* Takes in values from the GUI the user has typed in.
* @see Dataset
*/
public void addRouteSingle() { public void addRouteSingle() {
try { try {
theDataSet.addRoute( theDataSet.addRoute(
@ -64,6 +106,7 @@ public class RouteRDController extends Controller {
rSourceBox.clear(); rSourceBox.clear();
rDestBox.clear(); rDestBox.clear();
rCodeshareCBox.getSelectionModel().clearSelection(); rCodeshareCBox.getSelectionModel().clearSelection();
rCodeshareCBox.setValue("");
rStopsBox.clear(); rStopsBox.clear();
rEquipmentBox.clear(); rEquipmentBox.clear();
tableViewRouteRD.setItems(FXCollections.observableArrayList(theDataSet.getRoutes())); tableViewRouteRD.setItems(FXCollections.observableArrayList(theDataSet.getRoutes()));
@ -76,21 +119,44 @@ public class RouteRDController extends Controller {
} }
} }
public void load() { /**
rAirlineCol.setCellValueFactory(new PropertyValueFactory<Route, String>("AirlineName")); * Deletes a single selected route entry from the database.
rAirlineIDCol.setCellValueFactory(new PropertyValueFactory<Route, String>("AirlineID")); * Updates the GUI accordingly.
rSourceCol.setCellValueFactory(new PropertyValueFactory<Route, String>("DepartureAirport")); * @see Dataset
rSourceIDCol.setCellValueFactory(new PropertyValueFactory<Route, String>("SourceID")); */
rDestCol.setCellValueFactory(new PropertyValueFactory<Route, String>("ArrivalAirport")); public void deleteRoute(){
rDestIDCol.setCellValueFactory(new PropertyValueFactory<Route, String>("DestID")); Route toDelete = tableViewRouteRD.getSelectionModel().getSelectedItem();
rCodeshareCol.setCellValueFactory(new PropertyValueFactory<Route, String>("Code")); theDataSet.deleteRoute(toDelete);
rStopsCol.setCellValueFactory(new PropertyValueFactory<Route, String>("Stops"));
rEquipmentCol.setCellValueFactory(new PropertyValueFactory<Route, String>("Equipment"));
theDataSet = getParent().getCurrentDataset();
tableViewRouteRD.setItems(FXCollections.observableArrayList(theDataSet.getRoutes())); tableViewRouteRD.setItems(FXCollections.observableArrayList(theDataSet.getRoutes()));
}
rCodeshareCBox.getItems().addAll("Y", ""); /**
* Filters the routes table by any field.
* These are specified by what the user has typed in the filter boxes.
* Updates the GUI accordingly.
* @see RouteFilter
*/
public void filterRoutes(){
RouteFilter filter = new RouteFilter(theDataSet.getRoutes());
if (rAirlineFilter.getText() != null) {
filter.filterAirline(rAirlineFilter.getText());
}
if (rSourceFilter.getText() != null) {
filter.filterSourceAirport(rSourceFilter.getText());
}
if (rDestFilter.getText() != null) {
filter.filterDestinationAirport(rDestFilter.getText());
}
if (rCodeshareFilter.getText() != null) {
filter.filterCodeshare(rCodeshareFilter.getText());
}
if (rStopsFilter.getText() != null) {
filter.filterDestinationStops(rStopsFilter.getText());
}
if (rEquipmentFilter.getText() != null) {
filter.filterEquipment(rEquipmentFilter.getText());
}
tableViewRouteRD.setItems(FXCollections.<Route>observableArrayList(filter.getFilteredData()));
} }
public void analyse_Button() { public void analyse_Button() {

@ -1,14 +1,20 @@
package seng202.group9.GUI; package seng202.group9.GUI;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.scene.control.TableColumn; import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView; import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.web.WebView;
import seng202.group9.Controller.App; import seng202.group9.Controller.App;
import seng202.group9.Controller.Dataset; import seng202.group9.Controller.Dataset;
import seng202.group9.Controller.SceneCode; import seng202.group9.Controller.SceneCode;
import seng202.group9.Core.Position;
import seng202.group9.Core.Route; import seng202.group9.Core.Route;
import seng202.group9.Core.RoutePath;
import seng202.group9.Map.Map;
/** /**
* Created by michael on 14/09/2016. * Created by michael on 14/09/2016.
@ -17,6 +23,8 @@ public class RouteSummaryController extends Controller{
@FXML @FXML
private TableView<Route> tableView; private TableView<Route> tableView;
@FXML @FXML
private WebView mapView;
@FXML
private TableColumn<Route, String> columnAirline; private TableColumn<Route, String> columnAirline;
@FXML @FXML
private TableColumn<Route, String> columnDepart; private TableColumn<Route, String> columnDepart;
@ -27,16 +35,39 @@ public class RouteSummaryController extends Controller{
@FXML @FXML
private TableColumn<Route, String> columnEquipment; private TableColumn<Route, String> columnEquipment;
private Map map;
private Dataset currentData = null; private Dataset currentData = null;
public void load() { public void load() {
columnAirline.setCellValueFactory(new PropertyValueFactory<Route, String>("Airline")); columnAirline.setCellValueFactory(new PropertyValueFactory<Route, String>("AirlineName"));
columnDepart.setCellValueFactory(new PropertyValueFactory<Route, String>("DepartureAirport")); columnDepart.setCellValueFactory(new PropertyValueFactory<Route, String>("DepartureAirport"));
columnArrive.setCellValueFactory(new PropertyValueFactory<Route, String>("ArrivalAirport")); columnArrive.setCellValueFactory(new PropertyValueFactory<Route, String>("ArrivalAirport"));
columnStops.setCellValueFactory(new PropertyValueFactory<Route, String>("Stops")); columnStops.setCellValueFactory(new PropertyValueFactory<Route, String>("Stops"));
columnEquipment.setCellValueFactory(new PropertyValueFactory<Route, String>("Equipment")); columnEquipment.setCellValueFactory(new PropertyValueFactory<Route, String>("Equipment"));
currentData = getParent().getCurrentDataset(); currentData = getParent().getCurrentDataset();
tableView.setItems(FXCollections.observableArrayList(currentData.getRoutes())); tableView.setItems(FXCollections.observableArrayList(currentData.getRoutes()));
map = new Map(mapView, new RoutePath());
tableView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Route>() {
public void changed(ObservableValue<? extends Route> observable, Route oldValue, Route newValue) {
System.out.println("loading");
Route selectedRoute= currentData.getRoutes().get(tableView.getSelectionModel().getSelectedIndices().get(0));
if (selectedRoute.getSourceAirport() != null && selectedRoute.getDestinationAirport() != null) {
map.displayRoute(new RoutePath(
new Position(selectedRoute.getSourceAirport().getLatitude(), selectedRoute.getSourceAirport().getLongitude()),
new Position(selectedRoute.getDestinationAirport().getLatitude(), selectedRoute.getDestinationAirport().getLongitude())
));
}else if (selectedRoute.getSourceAirport() == null && selectedRoute.getDestinationAirport() != null){
map.displayAirport(new RoutePath(
new Position(selectedRoute.getDestinationAirport().getLatitude(), selectedRoute.getDestinationAirport().getLongitude())
));
}else if (selectedRoute.getSourceAirport() != null && selectedRoute.getDestinationAirport() == null){
map.displayAirport(new RoutePath(
new Position(selectedRoute.getSourceAirport().getLatitude(), selectedRoute.getSourceAirport().getLongitude())
));
}
}
});
} }
public void routeRawDataButton() { public void routeRawDataButton() {
replaceSceneContent(SceneCode.ROUTE_RAW_DATA); replaceSceneContent(SceneCode.ROUTE_RAW_DATA);

@ -35,6 +35,11 @@ public class Map {
webEngine.load(getClass().getClassLoader().getResource("map.html").toExternalForm()); webEngine.load(getClass().getClassLoader().getResource("map.html").toExternalForm());
} }
public void displayAirport(RoutePath newRoute) {
String scriptToExecute = "displayAirport(" + newRoute.toJSONArray() + ");";
webEngine.executeScript(scriptToExecute);
}
public void displayRoute(RoutePath newRoute) { public void displayRoute(RoutePath newRoute) {
String scriptToExecute = "displayRoute(" + newRoute.toJSONArray() + ");"; String scriptToExecute = "displayRoute(" + newRoute.toJSONArray() + ");";
webEngine.executeScript(scriptToExecute); webEngine.executeScript(scriptToExecute);

@ -3,7 +3,10 @@
<?import javafx.geometry.Insets?> <?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?> <?import javafx.scene.control.Button?>
<?import javafx.scene.control.ComboBox?> <?import javafx.scene.control.ComboBox?>
<?import javafx.scene.control.ContextMenu?>
<?import javafx.scene.control.Label?> <?import javafx.scene.control.Label?>
<?import javafx.scene.control.MenuItem?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.control.TableColumn?> <?import javafx.scene.control.TableColumn?>
<?import javafx.scene.control.TableView?> <?import javafx.scene.control.TableView?>
<?import javafx.scene.control.TextField?> <?import javafx.scene.control.TextField?>
@ -32,9 +35,9 @@
</Label> </Label>
<Button layoutX="14.0" layoutY="526.0" mnemonicParsing="false" prefHeight="25.0" prefWidth="125.0" text="Analyse" /> <Button layoutX="14.0" layoutY="526.0" mnemonicParsing="false" prefHeight="25.0" prefWidth="125.0" text="Analyse" />
<Button layoutX="654.0" layoutY="526.0" mnemonicParsing="false" onAction="#addAirlineSingle" prefHeight="25.0" prefWidth="125.0" text="Add" /> <Button layoutX="654.0" layoutY="526.0" mnemonicParsing="false" onAction="#addAirlineSingle" prefHeight="25.0" prefWidth="125.0" text="Add" />
<Pane layoutX="14.0" layoutY="57.0" prefHeight="403.0" prefWidth="765.0"> <Pane layoutX="14.0" layoutY="57.0" prefHeight="340.0" prefWidth="765.0">
<children> <children>
<TableView fx:id="tableView" layoutX="1.0" prefHeight="403.0" prefWidth="765.0"> <TableView fx:id="tableViewAirlineRD" layoutX="1.0" prefHeight="340.0" prefWidth="765.0">
<columns> <columns>
<TableColumn fx:id="airlIDcol" prefWidth="83.0" text="Airline ID" /> <TableColumn fx:id="airlIDcol" prefWidth="83.0" text="Airline ID" />
<TableColumn fx:id="airlNamecol" prefWidth="450.0" text="Name" /> <TableColumn fx:id="airlNamecol" prefWidth="450.0" text="Name" />
@ -45,45 +48,101 @@
<TableColumn fx:id="airlCountrycol" minWidth="0.0" prefWidth="200.0" text="Country" /> <TableColumn fx:id="airlCountrycol" minWidth="0.0" prefWidth="200.0" text="Country" />
<TableColumn fx:id="airlActivecol" minWidth="8.0" prefWidth="66.0" text="Active" /> <TableColumn fx:id="airlActivecol" minWidth="8.0" prefWidth="66.0" text="Active" />
</columns> </columns>
<contextMenu>
<ContextMenu>
<items>
<MenuItem mnemonicParsing="false" onAction="#deleteAirline" text="Delete" />
</items>
</ContextMenu>
</contextMenu>
</TableView> </TableView>
</children> </children>
</Pane> </Pane>
<Pane layoutX="14.0" layoutY="483.0" prefHeight="31.0" prefWidth="765.0"> <ScrollPane layoutX="14.0" layoutY="467.0" prefHeight="56.0" prefWidth="765.0">
<content>
<Pane prefHeight="37.0" prefWidth="1436.0">
<children> <children>
<TextField fx:id="airlNameBox" layoutX="97.0" layoutY="-1.0" prefHeight="31.0" prefWidth="137.0" promptText="Name"> <TextField fx:id="airlNameBox" layoutX="97.0" layoutY="3.0" prefHeight="31.0" prefWidth="450.0" promptText="Name">
<padding> <padding>
<Insets left="2.0" right="2.0" /> <Insets left="2.0" right="2.0" />
</padding> </padding>
</TextField> </TextField>
<TextField fx:id="airlAliasBox" layoutX="234.0" layoutY="-1.0" prefHeight="31.0" prefWidth="69.0" promptText="Alias"> <TextField fx:id="airlAliasBox" layoutX="547.0" layoutY="3.0" prefHeight="31.0" prefWidth="56.0" promptText="Alias">
<padding> <padding>
<Insets left="2.0" right="2.0" /> <Insets left="2.0" right="2.0" />
</padding> </padding>
</TextField> </TextField>
<TextField fx:id="airlIATABox" layoutX="303.0" layoutY="-1.0" prefHeight="31.0" prefWidth="69.0" promptText="IATA"> <TextField fx:id="airlIATABox" layoutX="603.0" layoutY="3.0" prefHeight="31.0" prefWidth="59.0" promptText="IATA">
<padding> <padding>
<Insets left="2.0" right="2.0" /> <Insets left="2.0" right="2.0" />
</padding> </padding>
</TextField> </TextField>
<TextField fx:id="airlICAOBox" layoutX="372.0" layoutY="-1.0" prefHeight="31.0" prefWidth="69.0" promptText="ICAO"> <TextField fx:id="airlICAOBox" layoutX="662.0" layoutY="3.0" prefHeight="31.0" prefWidth="68.0" promptText="ICAO">
<padding> <padding>
<Insets left="2.0" right="2.0" /> <Insets left="2.0" right="2.0" />
</padding> </padding>
</TextField> </TextField>
<TextField fx:id="airlCallsignBox" layoutX="441.0" layoutY="-1.0" prefHeight="31.0" prefWidth="84.0" promptText="Callsign"> <TextField fx:id="airlCallsignBox" layoutX="730.0" layoutY="3.0" prefHeight="31.0" prefWidth="400.0" promptText="Callsign">
<padding> <padding>
<Insets left="2.0" right="2.0" /> <Insets left="2.0" right="2.0" />
</padding> </padding>
</TextField> </TextField>
<TextField fx:id="airlCountryBox" layoutX="525.0" layoutY="-1.0" prefHeight="31.0" prefWidth="137.0" promptText="Country"> <TextField fx:id="airlCountryBox" layoutX="1130.0" layoutY="3.0" prefHeight="31.0" prefWidth="200.0" promptText="Country">
<padding> <padding>
<Insets left="2.0" right="2.0" /> <Insets left="2.0" right="2.0" />
</padding> </padding>
</TextField> </TextField>
<Label layoutY="2.0" prefHeight="25.0" prefWidth="93.0" text="Enter Values:" /> <Label layoutX="14.0" layoutY="6.0" prefHeight="25.0" prefWidth="84.0" text="Add Airline:" />
<ComboBox fx:id="airlActiveCBox" layoutX="662.0" layoutY="-1.0" prefHeight="31.0" prefWidth="102.0" promptText="Active" /> <ComboBox fx:id="airlActiveCBox" layoutX="1330.0" layoutY="3.0" prefHeight="31.0" prefWidth="102.0" promptText="Active" />
</children> </children>
</Pane> </Pane>
</content>
</ScrollPane>
<ScrollPane layoutX="14.0" layoutY="406.0" prefHeight="56.0" prefWidth="713.0">
<content>
<Pane prefHeight="37.0" prefWidth="1315.0">
<children>
<TextField fx:id="airlNameFilter" layoutX="57.0" layoutY="3.0" prefHeight="31.0" prefWidth="400.0" promptText="Name">
<padding>
<Insets left="2.0" right="2.0" />
</padding>
</TextField>
<TextField fx:id="airlAliasFilter" layoutX="457.0" layoutY="3.0" prefHeight="31.0" prefWidth="56.0" promptText="Alias">
<padding>
<Insets left="2.0" right="2.0" />
</padding>
</TextField>
<TextField fx:id="airlIATAFilter" layoutX="513.0" layoutY="3.0" prefHeight="31.0" prefWidth="59.0" promptText="IATA">
<padding>
<Insets left="2.0" right="2.0" />
</padding>
</TextField>
<TextField fx:id="airlICAOFilter" layoutX="572.0" layoutY="3.0" prefHeight="31.0" prefWidth="68.0" promptText="ICAO">
<padding>
<Insets left="2.0" right="2.0" />
</padding>
</TextField>
<TextField fx:id="airlCallsignFilter" layoutX="640.0" layoutY="3.0" prefHeight="31.0" prefWidth="400.0" promptText="Callsign">
<padding>
<Insets left="2.0" right="2.0" />
</padding>
</TextField>
<TextField fx:id="airlCountryFilter" layoutX="1040.0" layoutY="3.0" prefHeight="31.0" prefWidth="200.0" promptText="Country">
<padding>
<Insets left="2.0" right="2.0" />
</padding>
</TextField>
<Label layoutX="10.0" layoutY="6.0" prefHeight="25.0" prefWidth="47.0" text="Filter :" />
<TextField fx:id="airlActiveFilter" layoutX="1240.0" layoutY="3.0" prefHeight="31.0" prefWidth="66.0" promptText="Active">
<padding>
<Insets left="2.0" right="2.0" />
</padding>
</TextField>
</children>
</Pane>
</content>
</ScrollPane>
<Button layoutX="733.0" layoutY="416.0" mnemonicParsing="false" onAction="#filterAirlines" prefHeight="31.0" prefWidth="40.0" text="Go" />
</children> </children>
</Pane> </Pane>
</children> </children>

@ -0,0 +1,84 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.ListView?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>
<?import javafx.scene.text.Text?>
<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="800.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8.0.45" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng202.group9.GUI.DistCalcController">
<children>
<ScrollPane hbarPolicy="NEVER" prefHeight="800.0" prefWidth="800.0" vbarPolicy="NEVER">
<content>
<AnchorPane prefHeight="600.0" prefWidth="800.0">
<children>
<GridPane prefHeight="600.0" prefWidth="800.0">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="493.0" minWidth="10.0" prefWidth="484.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="393.0" minWidth="10.0" prefWidth="316.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="261.0" minHeight="0.0" prefHeight="48.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="711.0" minHeight="10.0" prefHeight="542.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<GridPane GridPane.rowIndex="1">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="237.0" minWidth="10.0" prefWidth="168.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="316.0" minWidth="10.0" prefWidth="316.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="172.0" minHeight="0.0" prefHeight="44.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="461.0" minHeight="10.0" prefHeight="454.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Pane prefHeight="461.0" prefWidth="175.0" GridPane.rowIndex="1">
<children>
<ListView fx:id="airportOne" layoutX="20.0" layoutY="27.0" prefHeight="404.0" prefWidth="125.0" />
<Label layoutX="26.0" layoutY="4.0" text="Start Airport">
<font>
<Font size="15.0" />
</font>
</Label>
</children>
</Pane>
<Pane prefHeight="60.0" prefWidth="330.0">
<children>
<Text layoutX="21.0" layoutY="40.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Airport Distance Calculator">
<font>
<Font size="48.0" />
</font>
</Text>
</children>
</Pane>
<Pane prefHeight="461.0" prefWidth="175.0" GridPane.columnIndex="1" GridPane.rowIndex="1">
<children>
<ListView fx:id="airportTwo" layoutX="20.0" layoutY="27.0" prefHeight="404.0" prefWidth="125.0" />
<Label layoutX="26.0" layoutY="4.0" text="End airport">
<font>
<Font size="15.0" />
</font>
</Label>
<Label fx:id="answerBox" layoutX="211.0" layoutY="184.0" prefHeight="19.0" prefWidth="101.0" text="Label" />
</children>
</Pane>
</children>
</GridPane>
<Button mnemonicParsing="false" onAction="#calculateButton" prefHeight="25.0" prefWidth="184.0" text="Calculate" GridPane.columnIndex="1" GridPane.rowIndex="1" />
</children>
</GridPane>
</children>
</AnchorPane>
</content>
</ScrollPane>
</children>
</VBox>

@ -3,7 +3,9 @@
<?import javafx.geometry.Insets?> <?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?> <?import javafx.scene.control.Button?>
<?import javafx.scene.control.ComboBox?> <?import javafx.scene.control.ComboBox?>
<?import javafx.scene.control.ContextMenu?>
<?import javafx.scene.control.Label?> <?import javafx.scene.control.Label?>
<?import javafx.scene.control.MenuItem?>
<?import javafx.scene.control.ScrollPane?> <?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.control.TableColumn?> <?import javafx.scene.control.TableColumn?>
<?import javafx.scene.control.TableView?> <?import javafx.scene.control.TableView?>
@ -31,7 +33,7 @@
<Font size="29.0" /> <Font size="29.0" />
</font> </font>
</Label> </Label>
<ScrollPane hbarPolicy="ALWAYS" layoutX="14.0" layoutY="469.0" prefHeight="54.0" prefViewportHeight="29.0" prefViewportWidth="1095.0" prefWidth="772.0" vbarPolicy="NEVER"> <ScrollPane hbarPolicy="ALWAYS" layoutX="14.0" layoutY="469.0" prefHeight="54.0" prefViewportHeight="29.0" prefViewportWidth="1095.0" prefWidth="764.0" vbarPolicy="NEVER">
<content> <content>
<Pane prefHeight="39.0" prefWidth="1633.0"> <Pane prefHeight="39.0" prefWidth="1633.0">
<children> <children>
@ -50,17 +52,17 @@
<Insets left="2.0" right="2.0" /> <Insets left="2.0" right="2.0" />
</padding> </padding>
</TextField> </TextField>
<TextField fx:id="airpIATAFFABox" layoutX="839.0" layoutY="4.0" prefHeight="31.0" prefWidth="87.0" promptText="IATA/FAA"> <TextField fx:id="airpIATAFFABox" layoutX="839.0" layoutY="4.0" prefHeight="31.0" prefWidth="75.0" promptText="IATA/FAA">
<padding> <padding>
<Insets left="2.0" right="2.0" /> <Insets left="2.0" right="2.0" />
</padding> </padding>
</TextField> </TextField>
<TextField fx:id="airpICAOBox" layoutX="926.0" layoutY="4.0" prefHeight="31.0" prefWidth="48.0" promptText="ICAO"> <TextField fx:id="airpICAOBox" layoutX="914.0" layoutY="3.0" prefHeight="31.0" prefWidth="61.0" promptText="ICAO">
<padding> <padding>
<Insets left="2.0" right="2.0" /> <Insets left="2.0" right="2.0" />
</padding> </padding>
</TextField> </TextField>
<TextField fx:id="airpLatitudeBox" layoutX="974.0" layoutY="4.0" prefHeight="31.0" prefWidth="100.0" promptText="Latitude"> <TextField fx:id="airpLatitudeBox" layoutX="975.0" layoutY="3.0" prefHeight="31.0" prefWidth="100.0" promptText="Latitude">
<padding> <padding>
<Insets left="2.0" right="2.0" /> <Insets left="2.0" right="2.0" />
</padding> </padding>
@ -85,17 +87,17 @@
<Insets left="2.0" right="2.0" /> <Insets left="2.0" right="2.0" />
</padding> </padding>
</TextField> </TextField>
<Label layoutX="2.0" layoutY="7.0" prefHeight="25.0" prefWidth="87.0" text="Enter Values:" /> <Label layoutX="2.0" layoutY="7.0" prefHeight="25.0" prefWidth="87.0" text="Add Airport:" />
<ComboBox fx:id="airpDSTCBox" layoutX="1349.0" layoutY="3.0" prefHeight="31.0" prefWidth="83.0" promptText="DST" /> <ComboBox fx:id="airpDSTCBox" layoutX="1349.0" layoutY="3.0" prefHeight="31.0" prefWidth="83.0" promptText="DST" />
</children> </children>
</Pane> </Pane>
</content> </content>
</ScrollPane> </ScrollPane>
<Button layoutX="14.0" layoutY="526.0" mnemonicParsing="false" onAction="#airportAnalyserButton" prefHeight="25.0" prefWidth="125.0" text="Analyse" /> <Button layoutX="14.0" layoutY="526.0" mnemonicParsing="false" prefHeight="25.0" prefWidth="125.0" text="Analyse" />
<Button layoutX="662.0" layoutY="526.0" mnemonicParsing="false" onAction="#addAirportSingle" prefHeight="25.0" prefWidth="125.0" text="Add" /> <Button layoutX="653.0" layoutY="526.0" mnemonicParsing="false" onAction="#addAirportSingle" prefHeight="25.0" prefWidth="125.0" text="Add" />
<Pane layoutX="15.0" layoutY="60.0" prefHeight="403.0" prefWidth="772.0"> <Pane layoutX="15.0" layoutY="60.0" prefHeight="342.0" prefWidth="764.0">
<children> <children>
<TableView fx:id="tableViewAirportRD" prefHeight="403.0" prefWidth="772.0"> <TableView fx:id="tableViewAirportRD" prefHeight="340.0" prefWidth="765.0">
<columns> <columns>
<TableColumn fx:id="airpIDcol" prefWidth="81.00003051757812" text="Airport ID" /> <TableColumn fx:id="airpIDcol" prefWidth="81.00003051757812" text="Airport ID" />
<TableColumn fx:id="airpNamecol" prefWidth="350.0" text="Name" /> <TableColumn fx:id="airpNamecol" prefWidth="350.0" text="Name" />
@ -110,8 +112,80 @@
<TableColumn fx:id="airpDSTcol" prefWidth="55.0" text="DST" /> <TableColumn fx:id="airpDSTcol" prefWidth="55.0" text="DST" />
<TableColumn fx:id="airpTzcol" minWidth="0.0" prefWidth="200.0" text="Tz database time zone" /> <TableColumn fx:id="airpTzcol" minWidth="0.0" prefWidth="200.0" text="Tz database time zone" />
</columns> </columns>
<contextMenu>
<ContextMenu>
<items>
<MenuItem mnemonicParsing="false" onAction="#deleteAirport" text="Delete" />
</items>
</ContextMenu>
</contextMenu>
</TableView> </TableView>
</children></Pane> </children></Pane>
<ScrollPane layoutX="15.0" layoutY="408.0" prefHeight="54.0" prefWidth="713.0">
<content>
<Pane prefHeight="32.0" prefWidth="1596.0">
<children>
<Label layoutX="14.0" layoutY="6.0" text="Filter :" />
<TextField fx:id="airpNameFilter" layoutX="64.0" layoutY="3.0" prefHeight="31.0" prefWidth="350.0" promptText="Name">
<padding>
<Insets left="2.0" right="2.0" />
</padding>
</TextField>
<TextField fx:id="airpCityFilter" layoutX="414.0" layoutY="3.0" prefHeight="31.0" prefWidth="200.0" promptText="City">
<padding>
<Insets left="2.0" right="2.0" />
</padding>
</TextField>
<TextField fx:id="airpCountryFilter" layoutX="614.0" layoutY="3.0" prefHeight="31.0" prefWidth="200.0" promptText="Country">
<padding>
<Insets left="2.0" right="2.0" />
</padding>
</TextField>
<TextField fx:id="airpIATAFFAFilter" layoutX="814.0" layoutY="3.0" prefHeight="31.0" prefWidth="87.0" promptText="IATA/FAA">
<padding>
<Insets left="2.0" right="2.0" />
</padding>
</TextField>
<TextField fx:id="airpICAOFilter" layoutX="901.0" layoutY="3.0" prefHeight="31.0" prefWidth="61.0" promptText="ICAO">
<padding>
<Insets left="2.0" right="2.0" />
</padding>
</TextField>
<TextField fx:id="airpLatitudeFilter" layoutX="962.0" layoutY="3.0" prefHeight="31.0" prefWidth="100.0" promptText="Latitude">
<padding>
<Insets left="2.0" right="2.0" />
</padding>
</TextField>
<TextField fx:id="airpLongitudeFilter" layoutX="1062.0" layoutY="3.0" prefHeight="31.0" prefWidth="100.0" promptText="Longitude">
<padding>
<Insets left="2.0" right="2.0" />
</padding>
</TextField>
<TextField fx:id="airpAltitudeFilter" layoutX="1162.0" layoutY="3.0" prefHeight="31.0" prefWidth="75.0" promptText="Altitude">
<padding>
<Insets left="2.0" right="2.0" />
</padding>
</TextField>
<TextField fx:id="airpTimezoneFilter" layoutX="1237.0" layoutY="3.0" prefHeight="31.0" prefWidth="100.0" promptText="Timezone">
<padding>
<Insets left="2.0" right="2.0" />
</padding>
</TextField>
<TextField fx:id="airpTzFilter" layoutX="1395.0" layoutY="3.0" prefHeight="31.0" prefWidth="200.0" promptText="Tz database time zone">
<padding>
<Insets left="2.0" right="2.0" />
</padding>
</TextField>
<TextField fx:id="airpDSTFilter" layoutX="1337.0" layoutY="3.0" prefHeight="31.0" prefWidth="58.0" promptText="DST">
<padding>
<Insets left="2.0" right="2.0" />
</padding>
</TextField>
</children>
</Pane>
</content>
</ScrollPane>
<Button layoutX="735.0" layoutY="420.0" mnemonicParsing="false" onAction="#filterAirports" prefHeight="31.0" prefWidth="40.0" text="Go" />
</children> </children>
</Pane> </Pane>
</children> </children>

@ -26,7 +26,7 @@
function initMap() { function initMap() {
map = new google.maps.Map(document.getElementById('map'), { map = new google.maps.Map(document.getElementById('map'), {
center: {lat: 39.144684, lng: -84.510079}, center: {lat: 39.144684, lng: -84.510079},
zoom: 15 zoom: 5
}); });
new google.maps.Marker({ new google.maps.Marker({
@ -39,7 +39,7 @@
function displayAirport(position){ function displayAirport(position){
map = new google.maps.Map(document.getElementById('map'), { map = new google.maps.Map(document.getElementById('map'), {
center: position[0], center: position[0],
zoom: 15 zoom: 5
}); });
new google.maps.Marker({ new google.maps.Marker({
@ -50,6 +50,10 @@
} }
function displayRoute(flightPath) { function displayRoute(flightPath) {
map = new google.maps.Map(document.getElementById('map'), {
center: {lat: 39.144684, lng: -84.510079},
zoom: 15
});
// CLEAR EXISTING MARKERS // CLEAR EXISTING MARKERS
if (marker1 !== undefined && marker2 !== undefined && path !== undefined) { if (marker1 !== undefined && marker2 !== undefined && path !== undefined) {
marker1.setMap(null); marker1.setMap(null);

@ -53,7 +53,10 @@
</items> </items>
</Menu> </Menu>
</items></Menu> </items></Menu>
<Menu mnemonicParsing="false" text="Analysis" /> <Menu mnemonicParsing="false" text="Analysis">
<items>
<MenuItem mnemonicParsing="false" onAction="#veiwDistCalc" text="Calculate distance between Airports" />
</items></Menu>
<Menu mnemonicParsing="false" text="Help"> <Menu mnemonicParsing="false" text="Help">
<items> <items>
<MenuItem mnemonicParsing="false" text="Getting Started" /> <MenuItem mnemonicParsing="false" text="Getting Started" />

@ -3,7 +3,10 @@
<?import javafx.geometry.Insets?> <?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?> <?import javafx.scene.control.Button?>
<?import javafx.scene.control.ComboBox?> <?import javafx.scene.control.ComboBox?>
<?import javafx.scene.control.ContextMenu?>
<?import javafx.scene.control.Label?> <?import javafx.scene.control.Label?>
<?import javafx.scene.control.MenuItem?>
<?import javafx.scene.control.Separator?>
<?import javafx.scene.control.TableColumn?> <?import javafx.scene.control.TableColumn?>
<?import javafx.scene.control.TableView?> <?import javafx.scene.control.TableView?>
<?import javafx.scene.control.TextField?> <?import javafx.scene.control.TextField?>
@ -32,9 +35,9 @@
</Label> </Label>
<Button layoutX="14.0" layoutY="524.0" mnemonicParsing="false" onAction="#analyse_Button" prefHeight="25.0" prefWidth="125.0" text="Analyse" /> <Button layoutX="14.0" layoutY="524.0" mnemonicParsing="false" onAction="#analyse_Button" prefHeight="25.0" prefWidth="125.0" text="Analyse" />
<Button layoutX="656.0" layoutY="524.0" mnemonicParsing="false" onAction="#addRouteSingle" prefHeight="25.0" prefWidth="125.0" text="Add" /> <Button layoutX="656.0" layoutY="524.0" mnemonicParsing="false" onAction="#addRouteSingle" prefHeight="25.0" prefWidth="125.0" text="Add" />
<Pane layoutX="16.0" layoutY="53.0" prefHeight="403.0" prefWidth="765.0"> <Pane layoutX="16.0" layoutY="53.0" prefHeight="340.0" prefWidth="765.0">
<children> <children>
<TableView fx:id="tableViewRouteRD" layoutX="-1.0" prefHeight="403.0" prefWidth="765.0"> <TableView fx:id="tableViewRouteRD" layoutX="-1.0" prefHeight="340.0" prefWidth="765.0">
<columns> <columns>
<TableColumn fx:id="rAirlineCol" prefWidth="67.0" text="Airline" /> <TableColumn fx:id="rAirlineCol" prefWidth="67.0" text="Airline" />
<TableColumn fx:id="rAirlineIDCol" prefWidth="86.0" text="Airline ID" /> <TableColumn fx:id="rAirlineIDCol" prefWidth="86.0" text="Airline ID" />
@ -46,10 +49,17 @@
<TableColumn fx:id="rStopsCol" minWidth="0.0" prefWidth="69.0" text="Stops" /> <TableColumn fx:id="rStopsCol" minWidth="0.0" prefWidth="69.0" text="Stops" />
<TableColumn fx:id="rEquipmentCol" prefWidth="98.0" text="Equipment" /> <TableColumn fx:id="rEquipmentCol" prefWidth="98.0" text="Equipment" />
</columns> </columns>
<contextMenu>
<ContextMenu>
<items>
<MenuItem mnemonicParsing="false" onAction="#deleteRoute" text="Delete" />
</items>
</ContextMenu>
</contextMenu>
</TableView> </TableView>
</children> </children>
</Pane> </Pane>
<Pane layoutX="16.0" layoutY="479.0" prefHeight="32.0" prefWidth="765.0"> <Pane layoutX="14.0" layoutY="484.0" prefHeight="32.0" prefWidth="765.0">
<children> <children>
<TextField fx:id="rAirlineBox" layoutX="90.0" layoutY="-1.0" prefHeight="31.0" prefWidth="100.0" promptText="Airline"> <TextField fx:id="rAirlineBox" layoutX="90.0" layoutY="-1.0" prefHeight="31.0" prefWidth="100.0" promptText="Airline">
<padding> <padding>
@ -76,10 +86,23 @@
<Insets left="2.0" right="2.0" /> <Insets left="2.0" right="2.0" />
</padding> </padding>
</TextField> </TextField>
<Label layoutY="4.0" text="Enter Values:" /> <Label layoutX="14.0" layoutY="4.0" text="Add Route:" />
<ComboBox fx:id="rCodeshareCBox" layoutX="490.0" layoutY="-1.0" prefHeight="31.0" prefWidth="100.0" promptText="Codeshare" /> <ComboBox fx:id="rCodeshareCBox" layoutX="490.0" layoutY="-1.0" prefHeight="31.0" prefWidth="100.0" promptText="Codeshare" />
</children> </children>
</Pane> </Pane>
<Pane layoutX="14.0" layoutY="405.0" prefHeight="45.0" prefWidth="724.0">
<children>
<Label layoutX="7.0" layoutY="12.0" text="Filter :" />
<TextField fx:id="rAirlineFilter" layoutX="55.0" layoutY="7.0" prefHeight="31.0" prefWidth="100.0" promptText="Airline" />
<TextField fx:id="rSourceFilter" layoutX="155.0" layoutY="7.0" prefHeight="31.0" prefWidth="150.0" promptText="Source airport" />
<TextField fx:id="rDestFilter" layoutX="305.0" layoutY="7.0" prefHeight="31.0" prefWidth="150.0" promptText="Destination airport" />
<TextField fx:id="rCodeshareFilter" layoutX="455.0" layoutY="7.0" prefHeight="31.0" prefWidth="89.0" promptText="Codeshare" />
<TextField fx:id="rStopsFilter" layoutX="544.0" layoutY="7.0" prefHeight="31.0" prefWidth="75.0" promptText="Stops" />
<TextField fx:id="rEquipmentFilter" layoutX="619.0" layoutY="7.0" prefHeight="31.0" prefWidth="100.0" promptText="Equipment" />
</children>
</Pane>
<Separator layoutY="464.0" prefHeight="6.0" prefWidth="800.0" />
<Button layoutX="738.0" layoutY="412.0" mnemonicParsing="false" onAction="#filterRoutes" prefHeight="31.0" prefWidth="40.0" text="Go" />
</children> </children>
</Pane> </Pane>
</children> </children>

Loading…
Cancel
Save