removed IATA/FFA column and added Number of ROutes column
This commit is contained in:
@@ -787,13 +787,25 @@ public class Dataset {
|
||||
for (Route route: routes){
|
||||
if (route.getDepartureAirport().length() > 3){
|
||||
route.setSourceAirport(airportsByICAO.get(route.getDepartureAirport()));
|
||||
if (airportsByICAO.get(route.getDepartureAirport()) != null) {
|
||||
airportsByICAO.get(route.getDepartureAirport()).addDepartureRoutes(route);
|
||||
}
|
||||
}else{
|
||||
route.setSourceAirport(airportsByIATA.get(route.getDepartureAirport()));
|
||||
if (airportsByIATA.get(route.getDepartureAirport()) != null){
|
||||
airportsByIATA.get(route.getDepartureAirport()).addDepartureRoutes(route);
|
||||
}
|
||||
}
|
||||
if (route.getArrivalAirport().length() > 3){
|
||||
route.setDestinationAirport(airportsByICAO.get(route.getArrivalAirport()));
|
||||
if (airportsByICAO.get(route.getArrivalAirport()) != null) {
|
||||
airportsByICAO.get(route.getArrivalAirport()).addArrivalRoutes(route);
|
||||
}
|
||||
}else{
|
||||
route.setDestinationAirport(airportsByIATA.get(route.getArrivalAirport()));
|
||||
if (airportsByIATA.get(route.getArrivalAirport()) != null) {
|
||||
airportsByIATA.get(route.getArrivalAirport()).addArrivalRoutes(route);
|
||||
}
|
||||
}
|
||||
route.setAirline(airlineByIATA.get(route.getAirlineName()));
|
||||
Airline airline = airlineByIATA.get(route.getAirlineName());
|
||||
@@ -2039,6 +2051,10 @@ public class Dataset {
|
||||
createDataLinks();
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the flight path to the first Point and the last point
|
||||
* @param flightPath
|
||||
*/
|
||||
private void updateFlightPath(FlightPath flightPath){
|
||||
Connection c = null;
|
||||
Statement stmt = null;
|
||||
|
||||
@@ -426,6 +426,9 @@ public class Airport {
|
||||
throw new DataException("Airport ICAO already Exists, Please Choose Another.");
|
||||
}
|
||||
}
|
||||
public int getTotalRoutes(){
|
||||
return departureRoutes.size() + arrivalRoutes.size();
|
||||
}
|
||||
/**
|
||||
* Information of the airport returned in String format.
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package seng202.group9.GUI;
|
||||
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.collections.FXCollections;
|
||||
@@ -33,9 +34,7 @@ public class AirportSummaryController extends Controller{
|
||||
@FXML
|
||||
private TableColumn<Airport, String> columnCountry;
|
||||
@FXML
|
||||
private TableColumn<Airport, String> columnAltitude;
|
||||
@FXML
|
||||
private TableColumn<Airport, String> columnIATA;
|
||||
private TableColumn<Airport, String> columnTotalRoutes;
|
||||
|
||||
//Stores required data.
|
||||
private Dataset currentData = null;
|
||||
@@ -77,8 +76,7 @@ public class AirportSummaryController extends Controller{
|
||||
columnName.setCellValueFactory(new PropertyValueFactory<Airport, String>("Name"));
|
||||
columnCity.setCellValueFactory(new PropertyValueFactory<Airport, String>("CityName"));
|
||||
columnCountry.setCellValueFactory(new PropertyValueFactory<Airport, String>("CountryName"));
|
||||
columnIATA.setCellValueFactory(new PropertyValueFactory<Airport, String>("IATA_FFA"));
|
||||
columnAltitude.setCellValueFactory(new PropertyValueFactory<Airport, String>("Altitude"));
|
||||
columnTotalRoutes.setCellValueFactory(new PropertyValueFactory<Airport, String>("TotalRoutes"));
|
||||
currentData = getParent().getCurrentDataset();
|
||||
tableView.setItems(FXCollections.observableArrayList(currentData.getAirports()));
|
||||
map = new Map(mapView, new RoutePath());
|
||||
@@ -89,5 +87,7 @@ public class AirportSummaryController extends Controller{
|
||||
map.displayAirport(new RoutePath( new Position(selectedAirport.getLatitude(), selectedAirport.getLongitude())));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import java.lang.*?>
|
||||
<?import javafx.geometry.*?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<?import javafx.scene.text.*?>
|
||||
<?import javafx.scene.web.*?>
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.TableColumn?>
|
||||
@@ -11,7 +17,7 @@
|
||||
<?import javafx.scene.text.Text?>
|
||||
<?import javafx.scene.web.WebView?>
|
||||
|
||||
<GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="568.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng202.group9.GUI.AirportSummaryController">
|
||||
<GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="568.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seng202.group9.GUI.AirportSummaryController">
|
||||
<columnConstraints>
|
||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
||||
@@ -57,11 +63,10 @@
|
||||
</Button>
|
||||
<TableView fx:id="tableView" prefHeight="200.0" prefWidth="378.0" GridPane.rowIndex="1" GridPane.rowSpan="2">
|
||||
<columns>
|
||||
<TableColumn fx:id="columnName" maxWidth="150.0" prefWidth="75.0" text="Name" />
|
||||
<TableColumn fx:id="columnCity" prefWidth="63.0" text="City" />
|
||||
<TableColumn fx:id="columnCountry" prefWidth="70.0" text="Country" />
|
||||
<TableColumn fx:id="columnAltitude" prefWidth="70.0" text="Altitude" />
|
||||
<TableColumn fx:id="columnIATA" prefWidth="85.0" text="IATA/FAA" />
|
||||
<TableColumn fx:id="columnName" minWidth="100.0" prefWidth="133.0" text="Name" />
|
||||
<TableColumn fx:id="columnCity" minWidth="50.0" prefWidth="65.0" text="City" />
|
||||
<TableColumn fx:id="columnCountry" minWidth="45.0" prefWidth="99.0" text="Country" />
|
||||
<TableColumn fx:id="columnTotalRoutes" minWidth="18.0" prefWidth="70.0" text="Routes" />
|
||||
</columns>
|
||||
<GridPane.margin>
|
||||
<Insets bottom="15.0" left="15.0" />
|
||||
|
||||
Reference in New Issue
Block a user