Added javadocs.
This commit is contained in:
@@ -19,9 +19,11 @@ import seng202.group9.Core.RoutePath;
|
||||
import seng202.group9.Map.Map;
|
||||
|
||||
/**
|
||||
* Controller for the Airline summary scene.
|
||||
* Created by michael on 14/09/2016.
|
||||
*/
|
||||
public class AirlineSummaryController extends Controller{
|
||||
//links the fxml to the controller.
|
||||
@FXML
|
||||
private TableView<Airline> tableView;
|
||||
@FXML
|
||||
@@ -37,11 +39,16 @@ public class AirlineSummaryController extends Controller{
|
||||
@FXML
|
||||
private TableColumn<Airline, String> columnIATA;
|
||||
|
||||
//Holds data used for the table.
|
||||
private Dataset currentData = null;
|
||||
|
||||
private Map map;
|
||||
|
||||
/**
|
||||
* Loads initial state of the scene.
|
||||
*/
|
||||
public void load() {
|
||||
//Fills the table.
|
||||
columnName.setCellValueFactory(new PropertyValueFactory<Airline, String>("Name"));
|
||||
columnAlias.setCellValueFactory(new PropertyValueFactory<Airline, String>("Alias"));
|
||||
columnCountry.setCellValueFactory(new PropertyValueFactory<Airline, String>("CountryName"));
|
||||
@@ -49,6 +56,7 @@ public class AirlineSummaryController extends Controller{
|
||||
columnActive.setCellValueFactory(new PropertyValueFactory<Airline, String>("Active"));
|
||||
currentData = getParent().getCurrentDataset();
|
||||
tableView.setItems(FXCollections.observableArrayList(currentData.getAirlines()));
|
||||
//Sets up map.
|
||||
map = new Map(mapView, new RoutePath());
|
||||
tableView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Airline>() {
|
||||
public void changed(ObservableValue<? extends Airline> observable, Airline oldValue, Airline newValue) {
|
||||
@@ -63,15 +71,30 @@ public class AirlineSummaryController extends Controller{
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes the scene to the Airline raw data scene.
|
||||
*/
|
||||
public void airlineRawDataButton() {
|
||||
replaceSceneContent(SceneCode.AIRLINE_RAW_DATA);
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes the scene to the Flight summary scene.
|
||||
*/
|
||||
public void flightSummaryButton() {
|
||||
replaceSceneContent(SceneCode.FLIGHT_SUMMARY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes the scene to the Airport summary scene.
|
||||
*/
|
||||
public void airportSummaryButton() {
|
||||
replaceSceneContent(SceneCode.AIRPORT_SUMMARY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes the scene to the Route summary scene.
|
||||
*/
|
||||
public void routeSummaryButton() {
|
||||
replaceSceneContent(SceneCode.ROUTE_SUMMARY);
|
||||
}
|
||||
|
||||
@@ -14,32 +14,48 @@ import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.scene.chart.*;
|
||||
import javafx.scene.Group;
|
||||
import seng202.group9.Core.Airport;
|
||||
|
||||
/**
|
||||
* Gui controller class currently for creating the bar graph of routes arriving and departing from airports.
|
||||
* Extend the class. {@link Controller}
|
||||
* Created by michael on 17/09/2016.
|
||||
*/
|
||||
public class AirportAnalyser extends Controller {
|
||||
//links fxml parts to the controller.
|
||||
@FXML
|
||||
PieChart pieGraph;
|
||||
|
||||
//Used to store the data needed for making the graph.
|
||||
private Dataset currentdata = null;
|
||||
private HashMap<String, Integer> useddata = new HashMap<String, Integer>();
|
||||
private ArrayList<Airport> current_routes;
|
||||
|
||||
private ArrayList<Airline> current_routes;
|
||||
/**
|
||||
* Takes data from the current dataset and places it into the displayed pie graph.
|
||||
*/
|
||||
public void build_graph(){
|
||||
current_routes = currentdata.getAirlines();
|
||||
//Takes Airports from the full dataset.
|
||||
current_routes = currentdata.getAirports();
|
||||
datasetup(current_routes);
|
||||
//Turns the data into a usable list.
|
||||
ObservableList<PieChart.Data> pieChartData = FXCollections.observableArrayList();
|
||||
System.out.println(useddata.keySet().size());
|
||||
for (String airport : useddata.keySet()){
|
||||
Integer temp = useddata.get(airport);
|
||||
pieChartData.add(new PieChart.Data(airport,temp));
|
||||
}
|
||||
//Gives the data to the graph.
|
||||
pieGraph.setData(pieChartData);
|
||||
}
|
||||
|
||||
private void datasetup(ArrayList<Airline> current_routes){
|
||||
for (Airline entry : current_routes){
|
||||
/**
|
||||
* Takes the raw list of routes and fills the used data dictionary with the appropriate data to be displayed
|
||||
* @param current_air_ports
|
||||
*/
|
||||
private void datasetup(ArrayList<Airport> current_air_ports){
|
||||
//Takes out the specified field then adds to the used data dict.
|
||||
for (Airport entry : current_air_ports){
|
||||
String name = entry.getCountryName();
|
||||
if (useddata.containsKey(name)){
|
||||
int temp = useddata.get(name);
|
||||
@@ -51,6 +67,9 @@ public class AirportAnalyser extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes the current dataset then loads the data to the graph using build graph.
|
||||
*/
|
||||
public void load() {
|
||||
currentdata = getParent().getCurrentDataset();
|
||||
build_graph();
|
||||
|
||||
@@ -17,9 +17,11 @@ import seng202.group9.Core.RoutePath;
|
||||
import seng202.group9.Map.Map;
|
||||
|
||||
/**
|
||||
* Controller for the Airport summary scene.
|
||||
* Created by michael on 14/09/2016.
|
||||
*/
|
||||
public class AirportSummaryController extends Controller{
|
||||
//links controller to fxml.
|
||||
@FXML
|
||||
private TableView<Airport> tableView;
|
||||
@FXML
|
||||
@@ -35,23 +37,41 @@ public class AirportSummaryController extends Controller{
|
||||
@FXML
|
||||
private TableColumn<Airport, String> columnIATA;
|
||||
|
||||
//Stores required data.
|
||||
private Dataset currentData = null;
|
||||
|
||||
private Map map;
|
||||
|
||||
/**
|
||||
* Changes the scene to the Airport raw data scene.
|
||||
*/
|
||||
public void airportRawDataButton() {
|
||||
replaceSceneContent(SceneCode.AIRPORT_RAW_DATA);
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes the scene to the flight summary scene.
|
||||
*/
|
||||
public void flightSummaryButton() {
|
||||
replaceSceneContent(SceneCode.FLIGHT_SUMMARY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes the scene to the Route summary scene.
|
||||
*/
|
||||
public void routeSummaryButton() {
|
||||
replaceSceneContent(SceneCode.ROUTE_SUMMARY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes the scene to the airline summary scene.
|
||||
*/
|
||||
public void airlineSummaryButton() {
|
||||
replaceSceneContent(SceneCode.AIRLINE_SUMMARY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads initial state of the scene.
|
||||
*/
|
||||
public void load() {
|
||||
currentData = getParent().getCurrentDataset();
|
||||
columnName.setCellValueFactory(new PropertyValueFactory<Airport, String>("Name"));
|
||||
|
||||
@@ -21,9 +21,11 @@ import javafx.scene.chart.*;
|
||||
import javafx.scene.Group;
|
||||
|
||||
/**
|
||||
* Controls the calculate airport distance scene and extends {@link Controller}
|
||||
* Created by michael on 17/09/2016.
|
||||
*/
|
||||
public class DistCalcController extends Controller {
|
||||
//Connects controller to fxml.
|
||||
@FXML
|
||||
ListView<String> airportOne;
|
||||
@FXML
|
||||
@@ -31,10 +33,14 @@ public class DistCalcController extends Controller {
|
||||
@FXML
|
||||
Label answerBox;
|
||||
|
||||
//Stores requsite data for calulating and populating tables.
|
||||
Dataset currentData = null;
|
||||
HashMap<String, Airport> current_Airports;
|
||||
SimpleStringProperty bound = new SimpleStringProperty("Answer");
|
||||
|
||||
/**
|
||||
* Fills the list views with the current airports.
|
||||
*/
|
||||
private void fill_boxes(){
|
||||
HashMap<String, Airport> current_Airports = currentData.getAirportDictionary();
|
||||
ArrayList<String> names = new ArrayList<String>();
|
||||
@@ -46,6 +52,9 @@ public class DistCalcController extends Controller {
|
||||
airportTwo.setItems(usablenames);
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes thetwo selected airports from the list views and calculated the distance between.
|
||||
*/
|
||||
public void calculateButton(){
|
||||
Airport airport1 = currentData.getAirports().get((airportOne.getSelectionModel().getSelectedIndices().get(0)));
|
||||
Airport airport2 = currentData.getAirports().get((airportTwo.getSelectionModel().getSelectedIndices().get(0)));
|
||||
@@ -54,6 +63,9 @@ public class DistCalcController extends Controller {
|
||||
System.out.println(bound);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the initial state of the scene.
|
||||
*/
|
||||
public void load(){
|
||||
currentData = getParent().getCurrentDataset();
|
||||
answerBox.textProperty().bind(bound);
|
||||
|
||||
@@ -12,20 +12,28 @@ import java.util.HashMap;
|
||||
|
||||
|
||||
/**
|
||||
* Gui controller class currently for creating the bar graph of routes arriving and departing from airports.
|
||||
* Extend the class. {@link Controller}
|
||||
* Created by michael on 16/09/2016.
|
||||
*/
|
||||
public class RouteAnalyser extends Controller {
|
||||
//Links fxml to the controller.
|
||||
@FXML
|
||||
private BarChart analyserGraph;
|
||||
|
||||
//Used to store the data needed for making the tables.
|
||||
private ArrayList<Route> current_routes;
|
||||
|
||||
private Dataset currentdata = null;
|
||||
private HashMap<String, ArrayList> useddata = new HashMap<String, ArrayList>();
|
||||
|
||||
/**
|
||||
* Takes data from the current dataset and places it into the displayed bar graph.
|
||||
*/
|
||||
public void build_graph(){
|
||||
//Takes routes from the full dataset.
|
||||
current_routes = currentdata.getRoutes();
|
||||
datasetup(current_routes);
|
||||
//Builds series needed for the graph.
|
||||
XYChart.Series seriesArivals = new XYChart.Series();
|
||||
XYChart.Series seriesDeparts = new XYChart.Series();
|
||||
seriesArivals.setName("Arriving routes");
|
||||
@@ -36,10 +44,17 @@ public class RouteAnalyser extends Controller {
|
||||
seriesArivals.getData().add(new XYChart.Data(airport,temp.get(0)));
|
||||
seriesDeparts.getData().add(new XYChart.Data(airport,temp.get(1)));
|
||||
}
|
||||
//Gives the formatted data to the graph.
|
||||
analyserGraph.getData().addAll(seriesArivals,seriesDeparts);
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes the raw list of routes and fills the used data dictionary with the appropriate data to be displayed
|
||||
* @param current_routes
|
||||
*/
|
||||
|
||||
private void datasetup(ArrayList<Route> current_routes){
|
||||
//Takes out the specified field (Currently departure airport and arrival airport) then adds to the used data dict.
|
||||
for (Route entry : current_routes){
|
||||
String departs = entry.getDepartureAirport();
|
||||
String arives = entry.getArrivalAirport();
|
||||
@@ -66,6 +81,9 @@ public class RouteAnalyser extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes the current dataset then loads the data to the graph using build graph.
|
||||
*/
|
||||
public void load() {
|
||||
currentdata = getParent().getCurrentDataset();
|
||||
build_graph();
|
||||
|
||||
@@ -39,6 +39,9 @@ public class RouteSummaryController extends Controller{
|
||||
|
||||
private Dataset currentData = null;
|
||||
|
||||
/**
|
||||
* Loads initial state of the scene.
|
||||
*/
|
||||
public void load() {
|
||||
columnAirline.setCellValueFactory(new PropertyValueFactory<Route, String>("AirlineName"));
|
||||
columnDepart.setCellValueFactory(new PropertyValueFactory<Route, String>("DepartureAirport"));
|
||||
@@ -69,15 +72,31 @@ public class RouteSummaryController extends Controller{
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes the scene to the route raw data scene.
|
||||
*/
|
||||
public void routeRawDataButton() {
|
||||
replaceSceneContent(SceneCode.ROUTE_RAW_DATA);
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes the scene to the flight summary scene.
|
||||
*/
|
||||
public void flightSummaryButton() {
|
||||
replaceSceneContent(SceneCode.FLIGHT_SUMMARY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes the scene to the airport summary scene.
|
||||
*/
|
||||
public void airportSummaryButton() {
|
||||
replaceSceneContent(SceneCode.AIRPORT_SUMMARY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes the scene to the airline summary scene.
|
||||
*/
|
||||
public void airlineSummaryButton() {
|
||||
replaceSceneContent(SceneCode.AIRLINE_SUMMARY);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user