Fixed Conflicts when merging ConnectMaps
This commit is contained in:
@@ -1,15 +1,22 @@
|
||||
package seng202.group9.GUI;
|
||||
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.web.WebView;
|
||||
import seng202.group9.Controller.App;
|
||||
import seng202.group9.Controller.Dataset;
|
||||
import seng202.group9.Controller.SceneCode;
|
||||
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.
|
||||
@@ -18,6 +25,8 @@ public class AirlineSummaryController extends Controller{
|
||||
@FXML
|
||||
private TableView<Airline> tableView;
|
||||
@FXML
|
||||
private WebView mapView;
|
||||
@FXML
|
||||
private TableColumn<Airline, String> columnName;
|
||||
@FXML
|
||||
private TableColumn<Airline, String> columnAlias;
|
||||
@@ -30,14 +39,28 @@ public class AirlineSummaryController extends Controller{
|
||||
|
||||
private Dataset currentData = null;
|
||||
|
||||
private Map map;
|
||||
|
||||
public void load() {
|
||||
columnName.setCellValueFactory(new PropertyValueFactory<Airline, String>("Name"));
|
||||
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"));
|
||||
columnActive.setCellValueFactory(new PropertyValueFactory<Airline, String>("Active"));
|
||||
currentData = getParent().getCurrentDataset();
|
||||
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() {
|
||||
|
||||
@@ -1,14 +1,20 @@
|
||||
package seng202.group9.GUI;
|
||||
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.web.WebView;
|
||||
import seng202.group9.Controller.App;
|
||||
import seng202.group9.Controller.Dataset;
|
||||
import seng202.group9.Controller.SceneCode;
|
||||
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.
|
||||
@@ -17,6 +23,8 @@ public class AirportSummaryController extends Controller{
|
||||
@FXML
|
||||
private TableView<Airport> tableView;
|
||||
@FXML
|
||||
private WebView mapView;
|
||||
@FXML
|
||||
private TableColumn<Airport, String> columnName;
|
||||
@FXML
|
||||
private TableColumn<Airport, String> columnCity;
|
||||
@@ -29,6 +37,8 @@ public class AirportSummaryController extends Controller{
|
||||
|
||||
private Dataset currentData = null;
|
||||
|
||||
private Map map;
|
||||
|
||||
public void airportRawDataButton() {
|
||||
replaceSceneContent(SceneCode.AIRLINE_RAW_DATA);
|
||||
}
|
||||
@@ -51,5 +61,13 @@ public class AirportSummaryController extends Controller{
|
||||
columnAltitude.setCellValueFactory(new PropertyValueFactory<Airport, String>("Altitude"));
|
||||
currentData = getParent().getCurrentDataset();
|
||||
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())));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -116,7 +116,7 @@ public class FlightSummaryController extends Controller {
|
||||
}
|
||||
flightPathListView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<String>() {
|
||||
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());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,14 +1,20 @@
|
||||
package seng202.group9.GUI;
|
||||
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.web.WebView;
|
||||
import seng202.group9.Controller.App;
|
||||
import seng202.group9.Controller.Dataset;
|
||||
import seng202.group9.Controller.SceneCode;
|
||||
import seng202.group9.Core.Position;
|
||||
import seng202.group9.Core.Route;
|
||||
import seng202.group9.Core.RoutePath;
|
||||
import seng202.group9.Map.Map;
|
||||
|
||||
/**
|
||||
* Created by michael on 14/09/2016.
|
||||
@@ -17,6 +23,8 @@ public class RouteSummaryController extends Controller{
|
||||
@FXML
|
||||
private TableView<Route> tableView;
|
||||
@FXML
|
||||
private WebView mapView;
|
||||
@FXML
|
||||
private TableColumn<Route, String> columnAirline;
|
||||
@FXML
|
||||
private TableColumn<Route, String> columnDepart;
|
||||
@@ -27,16 +35,39 @@ public class RouteSummaryController extends Controller{
|
||||
@FXML
|
||||
private TableColumn<Route, String> columnEquipment;
|
||||
|
||||
private Map map;
|
||||
|
||||
private Dataset currentData = null;
|
||||
|
||||
public void load() {
|
||||
columnAirline.setCellValueFactory(new PropertyValueFactory<Route, String>("Airline"));
|
||||
columnAirline.setCellValueFactory(new PropertyValueFactory<Route, String>("AirlineName"));
|
||||
columnDepart.setCellValueFactory(new PropertyValueFactory<Route, String>("DepartureAirport"));
|
||||
columnArrive.setCellValueFactory(new PropertyValueFactory<Route, String>("ArrivalAirport"));
|
||||
columnStops.setCellValueFactory(new PropertyValueFactory<Route, String>("Stops"));
|
||||
columnEquipment.setCellValueFactory(new PropertyValueFactory<Route, String>("Equipment"));
|
||||
currentData = getParent().getCurrentDataset();
|
||||
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() {
|
||||
replaceSceneContent(SceneCode.ROUTE_RAW_DATA);
|
||||
|
||||
Reference in New Issue
Block a user