Compare commits
11
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f07fc76a6d | ||
|
|
809d272556 | ||
|
|
f7e6c2429d | ||
|
|
d93944fb76 | ||
|
|
3374dd5da3 | ||
|
|
54f3d71a2b | ||
|
|
e3c523a9a5 | ||
|
|
8074bc3352 | ||
|
|
b24b7dc5e4 | ||
|
|
3c8e4aaa1d | ||
|
|
56b215fb9d |
Binary file not shown.
@@ -87,7 +87,7 @@ public class App extends Application
|
|||||||
if (datasets.get(i).getName().equals(session.getCurrentDataset())) {
|
if (datasets.get(i).getName().equals(session.getCurrentDataset())) {
|
||||||
currentDataset = datasets.get(i);
|
currentDataset = datasets.get(i);
|
||||||
|
|
||||||
if (session.getFilteredAirlines().size() == 0) {
|
if (session.getFilteredAirlines().size() == 0 || session.getFilteredAirlines() == null) {
|
||||||
HashMap<Integer, String> airlinesHM = new HashMap<Integer, String>();
|
HashMap<Integer, String> airlinesHM = new HashMap<Integer, String>();
|
||||||
ArrayList<Airline> airlines = currentDataset.getAirlines();
|
ArrayList<Airline> airlines = currentDataset.getAirlines();
|
||||||
for (int index = 0; index < airlines.size(); index++) {
|
for (int index = 0; index < airlines.size(); index++) {
|
||||||
@@ -96,7 +96,7 @@ public class App extends Application
|
|||||||
session.setFilteredAirlines(airlinesHM);
|
session.setFilteredAirlines(airlinesHM);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (session.getFilteredAirports().size() == 0) {
|
if (session.getFilteredAirports().size() == 0 || session.getFilteredAirports() == null) {
|
||||||
HashMap<Integer, String> airportsHM = new HashMap<Integer, String>();
|
HashMap<Integer, String> airportsHM = new HashMap<Integer, String>();
|
||||||
ArrayList<Airport> airports = currentDataset.getAirports();
|
ArrayList<Airport> airports = currentDataset.getAirports();
|
||||||
for (int index = 0; index < airports.size(); index++) {
|
for (int index = 0; index < airports.size(); index++) {
|
||||||
@@ -105,15 +105,14 @@ public class App extends Application
|
|||||||
session.setFilteredAirports(airportsHM);
|
session.setFilteredAirports(airportsHM);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (session.getFilteredRoutes().size() == 0) {
|
if (session.getFilteredRoutes().size() == 0 || session.getFilteredRoutes() == null) {
|
||||||
HashMap<Integer, String> routesHM = new HashMap<Integer, String>();
|
HashMap<Integer, String> routesHM = new HashMap<Integer, String>();
|
||||||
ArrayList<Route> routes = currentDataset.getRoutes();
|
ArrayList<Route> routes = currentDataset.getRoutes();
|
||||||
for (int index = 0; index < routes.size(); index++) {
|
for (int index = 0; index < routes.size(); index++) {
|
||||||
routesHM.put(index, routes.get(index).getUniqueKey());
|
routesHM.put(index, routes.get(index).getUniqueKey());
|
||||||
}
|
}
|
||||||
session.setFilteredAirports(routesHM);
|
session.setFilteredRoutes(routesHM);
|
||||||
}
|
}
|
||||||
//session.setFilteredRoutes();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -255,6 +254,27 @@ public class App extends Application
|
|||||||
public void setCurrentDataset(Dataset dataset){
|
public void setCurrentDataset(Dataset dataset){
|
||||||
currentDataset = dataset;
|
currentDataset = dataset;
|
||||||
session.setCurrentDataset(currentDataset.getName());
|
session.setCurrentDataset(currentDataset.getName());
|
||||||
|
|
||||||
|
HashMap<Integer, String> airlinesHM = new HashMap<Integer, String>();
|
||||||
|
ArrayList<Airline> airlines = currentDataset.getAirlines();
|
||||||
|
for (int index = 0; index < airlines.size(); index++) {
|
||||||
|
airlinesHM.put(index, airlines.get(index).getName());
|
||||||
|
}
|
||||||
|
session.setFilteredAirlines(airlinesHM);
|
||||||
|
|
||||||
|
HashMap<Integer, String> airportsHM = new HashMap<Integer, String>();
|
||||||
|
ArrayList<Airport> airports = currentDataset.getAirports();
|
||||||
|
for (int index = 0; index < airports.size(); index++) {
|
||||||
|
airportsHM.put(index, airports.get(index).getName());
|
||||||
|
}
|
||||||
|
session.setFilteredAirports(airportsHM);
|
||||||
|
|
||||||
|
HashMap<Integer, String> routesHM = new HashMap<Integer, String>();
|
||||||
|
ArrayList<Route> routes = currentDataset.getRoutes();
|
||||||
|
for (int index = 0; index < routes.size(); index++) {
|
||||||
|
routesHM.put(index, routes.get(index).getUniqueKey());
|
||||||
|
}
|
||||||
|
session.setFilteredRoutes(routesHM);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -113,11 +113,11 @@ public class AirlineGraphController extends Controller{
|
|||||||
countries.put(airline.getCountryName(), 1);
|
countries.put(airline.getCountryName(), 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int length = 10;
|
int length = 10;
|
||||||
if (airlinesFiltered.length < 10){
|
if (countries.size() < 10){
|
||||||
length = airlinesFiltered.length;
|
length = countries.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0 ; i < length; i ++) {
|
for (int i = 0 ; i < length; i ++) {
|
||||||
int max = 0;
|
int max = 0;
|
||||||
String maxCountry = null;
|
String maxCountry = null;
|
||||||
@@ -130,7 +130,6 @@ public class AirlineGraphController extends Controller{
|
|||||||
series.getData().add(new XYChart.Data<String, Integer>(maxCountry, max));
|
series.getData().add(new XYChart.Data<String, Integer>(maxCountry, max));
|
||||||
countries.remove(maxCountry);
|
countries.remove(maxCountry);
|
||||||
}
|
}
|
||||||
|
|
||||||
countryGraph.getData().add(series);
|
countryGraph.getData().add(series);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -90,8 +90,8 @@ public class AirportGraphController extends Controller{
|
|||||||
}
|
}
|
||||||
|
|
||||||
int length = 10;
|
int length = 10;
|
||||||
if (airportsFiltered.length < 10){
|
if (countries.size() < 10){
|
||||||
length = airportsFiltered.length;
|
length = countries.size();
|
||||||
}
|
}
|
||||||
for (int i = 0 ; i < length; i ++) {
|
for (int i = 0 ; i < length; i ++) {
|
||||||
int max = 0;
|
int max = 0;
|
||||||
|
|||||||
@@ -131,9 +131,9 @@ public class AirportRDController extends Controller{
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Analyses the current data and creates a graph based on the data.
|
* Analyses the current data and creates a graph based on the data.
|
||||||
* @see PieGraphController
|
*
|
||||||
*/
|
*/
|
||||||
public void analyse_Button(){ replaceSceneContent(SceneCode.AIRPORT_ANALYSER);}
|
public void analyse_Button(){ replaceSceneContent(SceneCode.AIRPORT_GRAPHS);}
|
||||||
|
|
||||||
public void airportSummaryButton() {
|
public void airportSummaryButton() {
|
||||||
replaceSceneContent(SceneCode.AIRPORT_SUMMARY);
|
replaceSceneContent(SceneCode.AIRPORT_SUMMARY);
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import javafx.collections.FXCollections;
|
|||||||
import javafx.collections.ListChangeListener;
|
import javafx.collections.ListChangeListener;
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.scene.control.Alert;
|
||||||
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;
|
||||||
@@ -38,6 +39,14 @@ public class AirportRouteMapController extends Controller{
|
|||||||
if (!checkDataset()){
|
if (!checkDataset()){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
//check if there is internet connectivity
|
||||||
|
if (!getParent().testInet("maps.google.com")){
|
||||||
|
Alert alert = new Alert(Alert.AlertType.WARNING);
|
||||||
|
alert.setTitle("No Internet Connection.");
|
||||||
|
alert.setHeaderText("Unable to Connect to Google Maps");
|
||||||
|
alert.setContentText("As we are unable to connect to Google Maps all applications which are supposed to display maps may not work as intended.");
|
||||||
|
alert.showAndWait();
|
||||||
|
}
|
||||||
currentDataset = getParent().getCurrentDataset();
|
currentDataset = getParent().getCurrentDataset();
|
||||||
//Sets up map.
|
//Sets up map.
|
||||||
map = new Map(mapView, new RoutePath(), airportsTable);
|
map = new Map(mapView, new RoutePath(), airportsTable);
|
||||||
|
|||||||
@@ -72,9 +72,11 @@ public class DatasetController extends Controller{
|
|||||||
|
|
||||||
public void openDataset(){
|
public void openDataset(){
|
||||||
Dataset datasetToOpen = (Dataset) datasetView.getSelectionModel().getSelectedItem();
|
Dataset datasetToOpen = (Dataset) datasetView.getSelectionModel().getSelectedItem();
|
||||||
|
if (datasetToOpen != null) {
|
||||||
getParent().setCurrentDataset(datasetToOpen);
|
getParent().setCurrentDataset(datasetToOpen);
|
||||||
loadTable();
|
loadTable();
|
||||||
getParent().getMenuController().replaceSceneContent(getParent().getSession().getSceneDisplayed());
|
getParent().getMenuController().replaceSceneContent(getParent().getSession().getSceneDisplayed());
|
||||||
((Stage) openDataset.getScene().getWindow()).close();
|
((Stage) openDataset.getScene().getWindow()).close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import javafx.beans.value.ObservableValue;
|
|||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.scene.control.Alert;
|
||||||
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;
|
||||||
@@ -41,6 +42,14 @@ public class EquipByRouteController extends Controller{
|
|||||||
if (!checkDataset()){
|
if (!checkDataset()){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
//check if there is internet connectivity
|
||||||
|
if (!getParent().testInet("maps.google.com")){
|
||||||
|
Alert alert = new Alert(Alert.AlertType.WARNING);
|
||||||
|
alert.setTitle("No Internet Connection.");
|
||||||
|
alert.setHeaderText("Unable to Connect to Google Maps");
|
||||||
|
alert.setContentText("As we are unable to connect to Google Maps all applications which are supposed to display maps may not work as intended.");
|
||||||
|
alert.showAndWait();
|
||||||
|
}
|
||||||
currentDataset = getParent().getCurrentDataset();
|
currentDataset = getParent().getCurrentDataset();
|
||||||
//Sets up map.
|
//Sets up map.
|
||||||
map = new Map(mapView, new RoutePath(), equipTable);
|
map = new Map(mapView, new RoutePath(), equipTable);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package seng202.group9.GUI;
|
package seng202.group9.GUI;
|
||||||
|
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.scene.control.Alert;
|
||||||
import javafx.scene.control.TableView;
|
import javafx.scene.control.TableView;
|
||||||
import javafx.scene.web.WebView;
|
import javafx.scene.web.WebView;
|
||||||
import seng202.group9.Controller.Dataset;
|
import seng202.group9.Controller.Dataset;
|
||||||
@@ -24,6 +25,14 @@ public class PopUpAirportMapController extends Controller {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void load() {
|
public void load() {
|
||||||
|
//check if there is internet connectivity
|
||||||
|
if (!getParent().testInet("maps.google.com")){
|
||||||
|
Alert alert = new Alert(Alert.AlertType.WARNING);
|
||||||
|
alert.setTitle("No Internet Connection.");
|
||||||
|
alert.setHeaderText("Unable to Connect to Google Maps");
|
||||||
|
alert.setContentText("As we are unable to connect to Google Maps all applications which are supposed to display maps may not work as intended.");
|
||||||
|
alert.showAndWait();
|
||||||
|
}
|
||||||
dataset = getParent().getCurrentDataset();
|
dataset = getParent().getCurrentDataset();
|
||||||
loadAirports();
|
loadAirports();
|
||||||
}
|
}
|
||||||
@@ -36,12 +45,4 @@ public class PopUpAirportMapController extends Controller {
|
|||||||
}
|
}
|
||||||
map = new Map(mapView, routePaths, Map.loadAirports);
|
map = new Map(mapView, routePaths, Map.loadAirports);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadRoutes(ArrayList<Route> routes){
|
|
||||||
ArrayList<RoutePath> routePaths = new ArrayList<>();
|
|
||||||
for (Route route: routes){
|
|
||||||
routePaths.add(route.getRoutePath());
|
|
||||||
}
|
|
||||||
map.displayRoutes(routePaths);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package seng202.group9.GUI;
|
package seng202.group9.GUI;
|
||||||
|
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.scene.control.Alert;
|
||||||
import javafx.scene.web.WebView;
|
import javafx.scene.web.WebView;
|
||||||
import seng202.group9.Controller.Dataset;
|
import seng202.group9.Controller.Dataset;
|
||||||
import seng202.group9.Core.Route;
|
import seng202.group9.Core.Route;
|
||||||
@@ -21,6 +22,14 @@ public class PopUpRouteMapController extends Controller{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void load() {
|
public void load() {
|
||||||
|
//check if there is internet connectivity
|
||||||
|
if (!getParent().testInet("maps.google.com")){
|
||||||
|
Alert alert = new Alert(Alert.AlertType.WARNING);
|
||||||
|
alert.setTitle("No Internet Connection.");
|
||||||
|
alert.setHeaderText("Unable to Connect to Google Maps");
|
||||||
|
alert.setContentText("As we are unable to connect to Google Maps all applications which are supposed to display maps may not work as intended.");
|
||||||
|
alert.showAndWait();
|
||||||
|
}
|
||||||
dataset = getParent().getCurrentDataset();
|
dataset = getParent().getCurrentDataset();
|
||||||
loadRoutes();
|
loadRoutes();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package seng202.group9.GUI;
|
package seng202.group9.GUI;
|
||||||
|
|
||||||
|
import javafx.collections.FXCollections;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.chart.BarChart;
|
import javafx.scene.chart.BarChart;
|
||||||
import javafx.scene.chart.CategoryAxis;
|
import javafx.scene.chart.CategoryAxis;
|
||||||
@@ -15,10 +16,7 @@ import seng202.group9.Core.Airline;
|
|||||||
import seng202.group9.Core.Airport;
|
import seng202.group9.Core.Airport;
|
||||||
import seng202.group9.Core.Route;
|
import seng202.group9.Core.Route;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by fwy13 on 2/10/2016.
|
* Created by fwy13 on 2/10/2016.
|
||||||
@@ -60,9 +58,9 @@ public class RouteGraphController extends Controller{
|
|||||||
@FXML
|
@FXML
|
||||||
private PieChart stopsGraph;
|
private PieChart stopsGraph;
|
||||||
@FXML
|
@FXML
|
||||||
private BarChart contienentGraph;
|
private BarChart zoneGraph;
|
||||||
@FXML
|
@FXML
|
||||||
private CategoryAxis contienentXAxis;
|
private CategoryAxis zoneXAxis;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void load() {
|
public void load() {
|
||||||
@@ -95,6 +93,8 @@ public class RouteGraphController extends Controller{
|
|||||||
loadOutCountryGraph();
|
loadOutCountryGraph();
|
||||||
loadEquipGraph();
|
loadEquipGraph();
|
||||||
loadSimilarGraph();
|
loadSimilarGraph();
|
||||||
|
loadStopsGraph();
|
||||||
|
loadZoneGraph();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadAirlineGraph(){
|
public void loadAirlineGraph(){
|
||||||
@@ -328,7 +328,6 @@ public class RouteGraphController extends Controller{
|
|||||||
equipGraph.getData().add(series);
|
equipGraph.getData().add(series);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void loadSimilarGraph(){
|
public void loadSimilarGraph(){
|
||||||
similarGraph.setTitle("Top 10 Most Similar Routes");
|
similarGraph.setTitle("Top 10 Most Similar Routes");
|
||||||
similarXAxis.setLabel("Routes");
|
similarXAxis.setLabel("Routes");
|
||||||
@@ -364,41 +363,66 @@ public class RouteGraphController extends Controller{
|
|||||||
similarGraph.getData().add(series);
|
similarGraph.getData().add(series);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*public void loadStopsGraph(){
|
public void loadStopsGraph(){
|
||||||
stopsGraph.setTitle("Top 10 Equipment used by Routes");
|
stopsGraph.setTitle("Top 10 Most Common Amount of Stops by Routes");
|
||||||
XYChart.Series<String,Integer> series = new XYChart.Series<>();
|
ArrayList<PieChart.Data> data = new ArrayList<>();
|
||||||
series.setName("Number of Equipment");
|
HashMap<Integer, Integer> stops = new HashMap<>();//equipment, count
|
||||||
HashMap<String, Integer> equipmentList = new HashMap<>();//equipment, count
|
|
||||||
for (Route route: routesFiltered){
|
for (Route route: routesFiltered){
|
||||||
String equipment[] = route.getEquipment().split(" ");
|
if (stops.containsKey(route.getStops())){
|
||||||
for (String equip : equipment){
|
stops.put(route.getStops(), stops.get(route.getStops()) + 1);
|
||||||
if (equipmentList.containsKey(equip)){
|
|
||||||
equipmentList.put(equip, equipmentList.get(equip) + 1);
|
|
||||||
}else{
|
}else{
|
||||||
equipmentList.put(equip, 1);
|
stops.put(route.getStops(), 1);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int stop: stops.keySet()){
|
||||||
|
stopsGraph.getData().add(new PieChart.Data(String.valueOf(stop), stops.get(stop)));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loadZoneGraph(){
|
||||||
|
zoneGraph.setTitle("Top Zones With Flights.");
|
||||||
|
zoneXAxis.setLabel("Zones");
|
||||||
|
XYChart.Series<String,Integer> series = new XYChart.Series<>();
|
||||||
|
series.setName("Number of Zones");
|
||||||
|
LinkedHashMap<String, Integer> zones = new LinkedHashMap<>();
|
||||||
|
for (Route route: routesFiltered) {
|
||||||
|
Airport source = route.getSourceAirport();
|
||||||
|
if (source != null){
|
||||||
|
if (zones.containsKey(source.getTz())) {
|
||||||
|
zones.put(source.getTz(), zones.get(source.getTz()) + 1);
|
||||||
|
} else {
|
||||||
|
zones.put(source.getTz(), 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Airport dest = route.getDestinationAirport();
|
||||||
|
if (dest != null){
|
||||||
|
if (zones.containsKey(dest.getTz())) {
|
||||||
|
zones.put(dest.getTz(), zones.get(dest.getTz()) + 1);
|
||||||
|
} else {
|
||||||
|
zones.put(dest.getTz(), 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
int length = 10;
|
int length = 10;
|
||||||
if (equipmentList.size() < 10){
|
if (zones.size() < 10){
|
||||||
length = equipmentList.size();
|
length = zones.size();
|
||||||
}
|
}
|
||||||
for (int i = 0 ; i < length; i ++) {
|
for (int i = 0 ; i < length; i ++) {
|
||||||
int max = 0;
|
int max = 0;
|
||||||
String maxEquip = "";
|
String maxZone = null;
|
||||||
for (String equip: equipmentList.keySet()){
|
for (String zone: zones.keySet()){
|
||||||
if (equipmentList.get(equip) > max){
|
if (zones.get(zone) > max){
|
||||||
max = equipmentList.get(equip);
|
maxZone = zone;
|
||||||
maxEquip = equip;
|
max = zones.get(zone);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
series.getData().add(new XYChart.Data<String, Integer>(maxEquip, max));
|
series.getData().add(new XYChart.Data<String, Integer>(maxZone, max));
|
||||||
equipmentList.remove(maxEquip);
|
zones.remove(maxZone);
|
||||||
|
}
|
||||||
|
zoneGraph.getData().add(series);
|
||||||
}
|
}
|
||||||
|
|
||||||
equipGraph.getData().add(series);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
public void goToRawData(){
|
public void goToRawData(){
|
||||||
replaceSceneContent(SceneCode.ROUTE_RAW_DATA);
|
replaceSceneContent(SceneCode.ROUTE_RAW_DATA);
|
||||||
|
|||||||
@@ -127,10 +127,10 @@ public class RouteRDController extends Controller {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Analyses the current data and creates a graph based on the data.
|
* Analyses the current data and creates a graph based on the data.
|
||||||
* @see BarGraphController
|
*
|
||||||
*/
|
*/
|
||||||
public void analyse_Button() {
|
public void analyse_Button() {
|
||||||
replaceSceneContent(SceneCode.ROUTE_ANALYSER);
|
replaceSceneContent(SceneCode.ROUTE_GRAPHS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void routeSummaryButton() {
|
public void routeSummaryButton() {
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ public class Map {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map(WebView webView, final ArrayList<RoutePath> newRoute, final int type){
|
public Map(WebView webView, final ArrayList<RoutePath> newRoute, final int type){
|
||||||
|
|||||||
@@ -28,6 +28,10 @@
|
|||||||
center: {lat: 39.144684, lng: -84.510079},
|
center: {lat: 39.144684, lng: -84.510079},
|
||||||
zoom: 5
|
zoom: 5
|
||||||
});
|
});
|
||||||
|
google.maps.event.addListener(map, 'center_changed', function() {
|
||||||
|
checkBounds(map);
|
||||||
|
});
|
||||||
|
map.setOptions({ minZoom: 2, maxZoom: 18});
|
||||||
|
|
||||||
new google.maps.Marker({
|
new google.maps.Marker({
|
||||||
position: {lat: 39.144684, lng: -84.510079},
|
position: {lat: 39.144684, lng: -84.510079},
|
||||||
@@ -42,6 +46,12 @@
|
|||||||
zoom: 5
|
zoom: 5
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
google.maps.event.addListener(map, 'center_changed', function() {
|
||||||
|
checkBounds(map);
|
||||||
|
});
|
||||||
|
map.setOptions({ minZoom: 2, maxZoom: 18});
|
||||||
|
|
||||||
new google.maps.Marker({
|
new google.maps.Marker({
|
||||||
position: position[0],
|
position: position[0],
|
||||||
map: map,
|
map: map,
|
||||||
@@ -54,6 +64,11 @@
|
|||||||
center: positions[0],
|
center: positions[0],
|
||||||
zoom: 5
|
zoom: 5
|
||||||
});
|
});
|
||||||
|
|
||||||
|
google.maps.event.addListener(map, 'center_changed', function() {
|
||||||
|
checkBounds(map);
|
||||||
|
});
|
||||||
|
map.setOptions({ minZoom: 2, maxZoom: 18});
|
||||||
for (var i = 0; i < positions.length; i ++) {
|
for (var i = 0; i < positions.length; i ++) {
|
||||||
new google.maps.Marker({
|
new google.maps.Marker({
|
||||||
position: positions[i][0],
|
position: positions[i][0],
|
||||||
@@ -69,6 +84,11 @@
|
|||||||
center: {lat: 39.144684, lng: -84.510079},
|
center: {lat: 39.144684, lng: -84.510079},
|
||||||
zoom: 15
|
zoom: 15
|
||||||
});
|
});
|
||||||
|
|
||||||
|
google.maps.event.addListener(map, 'center_changed', function() {
|
||||||
|
checkBounds(map);
|
||||||
|
});
|
||||||
|
map.setOptions({ minZoom: 2, maxZoom: 18});
|
||||||
// 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);
|
||||||
@@ -110,6 +130,11 @@
|
|||||||
center: {lat: 0, lng: 0},
|
center: {lat: 0, lng: 0},
|
||||||
zoom: 5
|
zoom: 5
|
||||||
});
|
});
|
||||||
|
|
||||||
|
google.maps.event.addListener(map, 'center_changed', function() {
|
||||||
|
checkBounds(map);
|
||||||
|
});
|
||||||
|
map.setOptions({ minZoom: 2, maxZoom: 18});
|
||||||
for (var i = 0; i < flightPaths.length; i++) {
|
for (var i = 0; i < flightPaths.length; i++) {
|
||||||
var tempMarker1 = null;
|
var tempMarker1 = null;
|
||||||
var tempMarker2 = null;
|
var tempMarker2 = null;
|
||||||
@@ -165,6 +190,31 @@
|
|||||||
|
|
||||||
map.fitBounds(bounds);
|
map.fitBounds(bounds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function checkBounds(map) {
|
||||||
|
|
||||||
|
var latNorth = map.getBounds().getNorthEast().lat();
|
||||||
|
var latSouth = map.getBounds().getSouthWest().lat();
|
||||||
|
var newLat;
|
||||||
|
|
||||||
|
if(latNorth<85 && latSouth>-85) /* in both side -> it's ok */
|
||||||
|
return;
|
||||||
|
else {
|
||||||
|
if(latNorth>85 && latSouth<-85) /* out both side -> it's ok */
|
||||||
|
return;
|
||||||
|
else {
|
||||||
|
if(latNorth>85)
|
||||||
|
newLat = map.getCenter().lat() - (latNorth-85); /* too north, centering */
|
||||||
|
if(latSouth<-85)
|
||||||
|
newLat = map.getCenter().lat() - (latSouth+85); /* too south, centering */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//re-centre the map
|
||||||
|
if(newLat) {
|
||||||
|
var newCenter= new google.maps.LatLng( newLat ,map.getCenter().lng() );
|
||||||
|
map.setCenter(newCenter);
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBnt2PJyKZsh-qrsTkbZwSGuUNWPromlLg&callback=initMap" defer></script>
|
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBnt2PJyKZsh-qrsTkbZwSGuUNWPromlLg&callback=initMap" defer></script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -164,13 +164,13 @@
|
|||||||
</AnchorPane>
|
</AnchorPane>
|
||||||
</content>
|
</content>
|
||||||
</Tab>
|
</Tab>
|
||||||
<Tab text="Routes to Continent">
|
<Tab text="Zones Graph">
|
||||||
<content>
|
<content>
|
||||||
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0">
|
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0">
|
||||||
<children>
|
<children>
|
||||||
<BarChart fx:id="contienentGraph" layoutX="224.0" layoutY="18.0" prefHeight="436.0" prefWidth="800.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
<BarChart fx:id="zoneGraph" layoutX="224.0" layoutY="18.0" prefHeight="436.0" prefWidth="800.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||||
<xAxis>
|
<xAxis>
|
||||||
<CategoryAxis fx:id="contienentXAxis" side="BOTTOM" />
|
<CategoryAxis fx:id="zoneXAxis" side="BOTTOM" />
|
||||||
</xAxis>
|
</xAxis>
|
||||||
<yAxis>
|
<yAxis>
|
||||||
<NumberAxis side="LEFT" />
|
<NumberAxis side="LEFT" />
|
||||||
|
|||||||
Reference in New Issue
Block a user