removed IATA/FFA column and added Number of ROutes column

main
YaFedImYaEatIm 9 years ago
parent ca12ff4202
commit 12601287b2

@ -51,6 +51,14 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ma
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins> </plugins>
</build> </build>
</project> </project>

@ -787,13 +787,25 @@ public class Dataset {
for (Route route: routes){ for (Route route: routes){
if (route.getDepartureAirport().length() > 3){ if (route.getDepartureAirport().length() > 3){
route.setSourceAirport(airportsByICAO.get(route.getDepartureAirport())); route.setSourceAirport(airportsByICAO.get(route.getDepartureAirport()));
if (airportsByICAO.get(route.getDepartureAirport()) != null) {
airportsByICAO.get(route.getDepartureAirport()).addDepartureRoutes(route);
}
}else{ }else{
route.setSourceAirport(airportsByIATA.get(route.getDepartureAirport())); route.setSourceAirport(airportsByIATA.get(route.getDepartureAirport()));
if (airportsByIATA.get(route.getDepartureAirport()) != null){
airportsByIATA.get(route.getDepartureAirport()).addDepartureRoutes(route);
}
} }
if (route.getArrivalAirport().length() > 3){ if (route.getArrivalAirport().length() > 3){
route.setDestinationAirport(airportsByICAO.get(route.getArrivalAirport())); route.setDestinationAirport(airportsByICAO.get(route.getArrivalAirport()));
if (airportsByICAO.get(route.getArrivalAirport()) != null) {
airportsByICAO.get(route.getArrivalAirport()).addArrivalRoutes(route);
}
}else{ }else{
route.setDestinationAirport(airportsByIATA.get(route.getArrivalAirport())); route.setDestinationAirport(airportsByIATA.get(route.getArrivalAirport()));
if (airportsByIATA.get(route.getArrivalAirport()) != null) {
airportsByIATA.get(route.getArrivalAirport()).addArrivalRoutes(route);
}
} }
route.setAirline(airlineByIATA.get(route.getAirlineName())); route.setAirline(airlineByIATA.get(route.getAirlineName()));
Airline airline = airlineByIATA.get(route.getAirlineName()); Airline airline = airlineByIATA.get(route.getAirlineName());
@ -2039,6 +2051,10 @@ public class Dataset {
createDataLinks(); createDataLinks();
} }
/**
* Updates the flight path to the first Point and the last point
* @param flightPath
*/
private void updateFlightPath(FlightPath flightPath){ private void updateFlightPath(FlightPath flightPath){
Connection c = null; Connection c = null;
Statement stmt = null; Statement stmt = null;

@ -426,6 +426,9 @@ public class Airport {
throw new DataException("Airport ICAO already Exists, Please Choose Another."); 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. * Information of the airport returned in String format.
*/ */

@ -1,5 +1,6 @@
package seng202.group9.GUI; package seng202.group9.GUI;
import javafx.application.Platform;
import javafx.beans.value.ChangeListener; import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue; import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
@ -33,9 +34,7 @@ public class AirportSummaryController extends Controller{
@FXML @FXML
private TableColumn<Airport, String> columnCountry; private TableColumn<Airport, String> columnCountry;
@FXML @FXML
private TableColumn<Airport, String> columnAltitude; private TableColumn<Airport, String> columnTotalRoutes;
@FXML
private TableColumn<Airport, String> columnIATA;
//Stores required data. //Stores required data.
private Dataset currentData = null; private Dataset currentData = null;
@ -77,8 +76,7 @@ public class AirportSummaryController extends Controller{
columnName.setCellValueFactory(new PropertyValueFactory<Airport, String>("Name")); columnName.setCellValueFactory(new PropertyValueFactory<Airport, String>("Name"));
columnCity.setCellValueFactory(new PropertyValueFactory<Airport, String>("CityName")); columnCity.setCellValueFactory(new PropertyValueFactory<Airport, String>("CityName"));
columnCountry.setCellValueFactory(new PropertyValueFactory<Airport, String>("CountryName")); columnCountry.setCellValueFactory(new PropertyValueFactory<Airport, String>("CountryName"));
columnIATA.setCellValueFactory(new PropertyValueFactory<Airport, String>("IATA_FFA")); columnTotalRoutes.setCellValueFactory(new PropertyValueFactory<Airport, String>("TotalRoutes"));
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()); 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()))); map.displayAirport(new RoutePath( new Position(selectedAirport.getLatitude(), selectedAirport.getLongitude())));
} }
}); });
} }
} }

@ -1,5 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?> <?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.geometry.Insets?>
<?import javafx.scene.control.Button?> <?import javafx.scene.control.Button?>
<?import javafx.scene.control.TableColumn?> <?import javafx.scene.control.TableColumn?>
@ -11,7 +17,7 @@
<?import javafx.scene.text.Text?> <?import javafx.scene.text.Text?>
<?import javafx.scene.web.WebView?> <?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>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" /> <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" /> <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
@ -57,11 +63,10 @@
</Button> </Button>
<TableView fx:id="tableView" prefHeight="200.0" prefWidth="378.0" GridPane.rowIndex="1" GridPane.rowSpan="2"> <TableView fx:id="tableView" prefHeight="200.0" prefWidth="378.0" GridPane.rowIndex="1" GridPane.rowSpan="2">
<columns> <columns>
<TableColumn fx:id="columnName" maxWidth="150.0" prefWidth="75.0" text="Name" /> <TableColumn fx:id="columnName" minWidth="100.0" prefWidth="133.0" text="Name" />
<TableColumn fx:id="columnCity" prefWidth="63.0" text="City" /> <TableColumn fx:id="columnCity" minWidth="50.0" prefWidth="65.0" text="City" />
<TableColumn fx:id="columnCountry" prefWidth="70.0" text="Country" /> <TableColumn fx:id="columnCountry" minWidth="45.0" prefWidth="99.0" text="Country" />
<TableColumn fx:id="columnAltitude" prefWidth="70.0" text="Altitude" /> <TableColumn fx:id="columnTotalRoutes" minWidth="18.0" prefWidth="70.0" text="Routes" />
<TableColumn fx:id="columnIATA" prefWidth="85.0" text="IATA/FAA" />
</columns> </columns>
<GridPane.margin> <GridPane.margin>
<Insets bottom="15.0" left="15.0" /> <Insets bottom="15.0" left="15.0" />

Loading…
Cancel
Save