Got the basic functionally done on the flight point editor. Currently will change the vaule although a few bugs in the validation aspects.

main
Liam Beckett 9 years ago
parent f7d1e688fa
commit 5f8e2f2481

@ -1,6 +1,10 @@
package seng202.group9.Controller; package seng202.group9.Controller;
import java.io.*; import java.io.*;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList; import java.util.ArrayList;
import javafx.application.Application; import javafx.application.Application;
@ -14,6 +18,7 @@ import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.BorderPane; import javafx.scene.layout.BorderPane;
import javafx.scene.layout.VBox; import javafx.scene.layout.VBox;
import javafx.stage.Stage; import javafx.stage.Stage;
import seng202.group9.Core.FlightPath;
import seng202.group9.GUI.*; import seng202.group9.GUI.*;
/** /**
@ -61,11 +66,15 @@ public class App extends Application
e.printStackTrace(); e.printStackTrace();
} }
primaryStage.show(); primaryStage.show();
//load all datasets
try{
loadAllDatasets();
} catch (Exception e){
e.printStackTrace();
}
//testing out dataset //testing out dataset
try { try {
currentDataset = new Dataset("test's", Dataset.getExisting); currentDataset = new Dataset("test's", Dataset.getExisting);
datasets.add(currentDataset);
}catch (DataException e){ }catch (DataException e){
e.printStackTrace(); e.printStackTrace();
} }
@ -107,6 +116,32 @@ public class App extends Application
e.printStackTrace(); e.printStackTrace();
} }
} }
/**
* Loads all dataset in the current User Database.
*/
public void loadAllDatasets(){
Connection c = null;
Statement stmt = null;
try {
Class.forName("org.sqlite.JDBC");
c = DriverManager.getConnection("jdbc:sqlite:res/userdb.db");
stmt = c.createStatement();
String loadAllDatasetsQuery = "SELECT * FROM `Datasets`";
ResultSet datasetsLoaded = stmt.executeQuery(loadAllDatasetsQuery);
while (datasetsLoaded.next()){
Dataset newDataset = new Dataset(datasetsLoaded.getString("Dataset_Name"), Dataset.getExisting);
System.out.println("Loaded Dataset "+ datasetsLoaded.getString("Dataset_Name"));
datasets.add(newDataset);
}
datasetsLoaded.close();
stmt.close();
c.close();
} catch ( Exception e ) {
System.err.println( e.getClass().getName() + ": " + e.getMessage() );
}
}
/** /**
* Replace Scene Content with fxml file code from oracle. * Replace Scene Content with fxml file code from oracle.
* @param fxml * @param fxml
@ -132,7 +167,15 @@ public class App extends Application
} }
/** /**
* Returns the Menu COntroller of the App. * Gets the current session.
* @return
*/
public Session getSession() {
return this.session;
}
/**
* Returns the Menu Controller of the App.
* @return * @return
*/ */
public MenuController getMenuController() { public MenuController getMenuController() {
@ -147,6 +190,22 @@ public class App extends Application
return currentDataset; return currentDataset;
} }
/**
* Sets the current Dataset to another Dataset by its index in the datasets arraylist
* @param index
*/
public void setCurrentDataset(int index){
currentDataset = datasets.get(index);
}
/**
* Sets the current Dataset to another Dataset.
* @param dataset
*/
public void setCurrentDataset(Dataset dataset){
currentDataset = dataset;
}
/** /**
* Creates new dataset. * Creates new dataset.
* @param datasetName * @param datasetName

@ -27,11 +27,11 @@ public class Dataset {
private LinkedHashMap<String, Airport> airportDictionary; private LinkedHashMap<String, Airport> airportDictionary;
private LinkedHashMap<String, Route> routeDictionary; private LinkedHashMap<String, Route> routeDictionary;
private LinkedHashMap<Integer, FlightPath> flightPathDictionary; private LinkedHashMap<Integer, FlightPath> flightPathDictionary;
private LinkedHashMap<Integer, FlightPoint> flightPointDictionary;
private LinkedHashMap<String, Country> countryDictionary; private LinkedHashMap<String, Country> countryDictionary;
private LinkedHashMap<String, City> cityDictionary; private LinkedHashMap<String, City> cityDictionary;
/** /**
*
* @param name Name of the database * @param name Name of the database
* @param action either Dataset.getExisting or Dataset.createNew * @param action either Dataset.getExisting or Dataset.createNew
* @throws DataException Throws an exception if there is some error ie databases with the same name * @throws DataException Throws an exception if there is some error ie databases with the same name
@ -45,11 +45,16 @@ public class Dataset {
this.cities = new ArrayList<City>(); this.cities = new ArrayList<City>();
this.countries = new ArrayList<Country>(); this.countries = new ArrayList<Country>();
this.airlineDictionary = new LinkedHashMap<String, Airline>(); this.airlineDictionary = new LinkedHashMap<String, Airline>();
this.airportDictionary = new LinkedHashMap<String, Airport>();; this.airportDictionary = new LinkedHashMap<String, Airport>();
this.routeDictionary = new LinkedHashMap<String, Route>();; ;
this.countryDictionary = new LinkedHashMap<String, Country>();; this.routeDictionary = new LinkedHashMap<String, Route>();
this.cityDictionary = new LinkedHashMap<String, City>();; ;
this.countryDictionary = new LinkedHashMap<String, Country>();
;
this.cityDictionary = new LinkedHashMap<String, City>();
;
this.flightPathDictionary = new LinkedHashMap<Integer, FlightPath>(); this.flightPathDictionary = new LinkedHashMap<Integer, FlightPath>();
this.flightPointDictionary = new LinkedHashMap<Integer, FlightPoint>();
if (action == getExisting) { if (action == getExisting) {
updateDataset(); updateDataset();
//after this make connections. ie filling in the country.cities airports.routes etc //after this make connections. ie filling in the country.cities airports.routes etc
@ -60,6 +65,7 @@ public class Dataset {
/** /**
* Updates Dataset Arrays from Database. * Updates Dataset Arrays from Database.
*
* @throws DataException * @throws DataException
*/ */
public void updateDataset() throws DataException { public void updateDataset() throws DataException {
@ -204,9 +210,11 @@ public class Dataset {
double flightPtTotDist = rs.getDouble("Tot_Dist"); double flightPtTotDist = rs.getDouble("Tot_Dist");
double flightPtLatitude = rs.getDouble("Latitude"); double flightPtLatitude = rs.getDouble("Latitude");
double flightPtLongitude = rs.getDouble("Longitude"); double flightPtLongitude = rs.getDouble("Longitude");
flightPaths.get(i).addFlightPoint(new FlightPoint(flightPtName, flightPtID, flightPtInd FlightPoint flightPoint = new FlightPoint(flightPtName, flightPtID, flightPtInd
, flightPtType, flightPtVia, flightPtheading, flightPtAltitude, flightPtLegDistance, flightPtTotDist, , flightPtType, flightPtVia, flightPtheading, flightPtAltitude, flightPtLegDistance, flightPtTotDist,
flightPtLatitude, flightPtLongitude)); flightPtLatitude, flightPtLongitude);
flightPaths.get(i).addFlightPoint(flightPoint);
flightPointDictionary.put(flightPtID, flightPoint);
} }
rs.close(); rs.close();
stmt.close(); stmt.close();
@ -245,6 +253,7 @@ public class Dataset {
/** /**
* Creates new Dataset with empty data tables etc * Creates new Dataset with empty data tables etc
*
* @throws DataException * @throws DataException
*/ */
public void createTables() throws DataException { public void createTables() throws DataException {
@ -359,6 +368,7 @@ public class Dataset {
/** /**
* Imports Airline files to the dataset * Imports Airline files to the dataset
*
* @param filePath * @param filePath
* @return Success Message * @return Success Message
* @throws DataException * @throws DataException
@ -371,7 +381,7 @@ public class Dataset {
ArrayList<Airline> airlinesToImport = parser.getResult(); ArrayList<Airline> airlinesToImport = parser.getResult();
//check for dup //check for dup
int numOfDuplicates = 0; int numOfDuplicates = 0;
int nextID = -1; int nextID = 1;
//query database. //query database.
Connection c = null; Connection c = null;
Statement stmt = null; Statement stmt = null;
@ -428,8 +438,10 @@ public class Dataset {
createDataLinks(); createDataLinks();
return message; return message;
} }
/** /**
* Imports Airport files to the dataset * Imports Airport files to the dataset
*
* @param filePath * @param filePath
* @return Success Message * @return Success Message
* @throws DataException * @throws DataException
@ -444,7 +456,7 @@ public class Dataset {
ArrayList<Country> countriesToImport = parser.getCountryResult(); ArrayList<Country> countriesToImport = parser.getCountryResult();
//check for dup //check for dup
int numOfDuplicates = 0; int numOfDuplicates = 0;
int nextID = -1; int nextID = 1;
//query database. //query database.
Connection c = null; Connection c = null;
Statement stmt = null; Statement stmt = null;
@ -459,7 +471,6 @@ public class Dataset {
while (IDResult.next()) { while (IDResult.next()) {
nextID = Integer.parseInt(IDResult.getString("seq")) + 1;//for some reason sqlite3 stores incremental values as a string... nextID = Integer.parseInt(IDResult.getString("seq")) + 1;//for some reason sqlite3 stores incremental values as a string...
} }
System.out.println(nextID);
stmt.close(); stmt.close();
stmt = c.createStatement(); stmt = c.createStatement();
String insertAirportQuery = "INSERT INTO `" + this.name + "_Airport` (`Name`, `City`, `Country`, `IATA/FFA`," + String insertAirportQuery = "INSERT INTO `" + this.name + "_Airport` (`Name`, `City`, `Country`, `IATA/FFA`," +
@ -564,6 +575,7 @@ public class Dataset {
/** /**
* Imports Route files to dataset * Imports Route files to dataset
*
* @param filePath * @param filePath
* @return Success Message * @return Success Message
* @throws DataException * @throws DataException
@ -576,7 +588,7 @@ public class Dataset {
ArrayList<Route> routesToImport = parser.getResult(); ArrayList<Route> routesToImport = parser.getResult();
//check for dup //check for dup
int numOfDuplicates = 0; int numOfDuplicates = 0;
int nextID = -1; int nextID = 1;
//query database. //query database.
Connection c = null; Connection c = null;
Statement stmt = null; Statement stmt = null;
@ -639,6 +651,7 @@ public class Dataset {
/** /**
* Imports Flight files to dataset * Imports Flight files to dataset
*
* @param filePath * @param filePath
* @return Success Message * @return Success Message
* @throws DataException * @throws DataException
@ -651,7 +664,7 @@ public class Dataset {
ArrayList<FlightPoint> flightPointsToImport = parser.getResult(); ArrayList<FlightPoint> flightPointsToImport = parser.getResult();
//check for dup //check for dup
int numOfDuplicates = 0; int numOfDuplicates = 0;
int nextID = -1; int nextID = 1;
//query database. //query database.
Connection c = null; Connection c = null;
Statement stmt = null; Statement stmt = null;
@ -667,7 +680,7 @@ public class Dataset {
} }
stmt.close(); stmt.close();
stmt = c.createStatement(); stmt = c.createStatement();
//ADDED
String firstPt = flightPointsToImport.get(0).getName(); String firstPt = flightPointsToImport.get(0).getName();
String lastPt = flightPointsToImport.get(flightPointsToImport.size() - 1).getName(); String lastPt = flightPointsToImport.get(flightPointsToImport.size() - 1).getName();
FlightPath flightPathToAdd = new FlightPath(firstPt, lastPt); FlightPath flightPathToAdd = new FlightPath(firstPt, lastPt);
@ -677,7 +690,7 @@ public class Dataset {
stmt.execute(insertFlightPathQuery); stmt.execute(insertFlightPathQuery);
stmt.close(); stmt.close();
stmt = c.createStatement(); stmt = c.createStatement();
int flightPathId = 0; int flightPathId = 1;
String getLastestIndex = "SELECT * FROM `sqlite_sequence` WHERE `name` = \"" + this.name.replace("\"", "\"\"") + String getLastestIndex = "SELECT * FROM `sqlite_sequence` WHERE `name` = \"" + this.name.replace("\"", "\"\"") +
"_Flight_Path\" LIMIT 1;"; "_Flight_Path\" LIMIT 1;";
ResultSet lastestIdResult = stmt.executeQuery(getLastestIndex); ResultSet lastestIdResult = stmt.executeQuery(getLastestIndex);
@ -688,7 +701,7 @@ public class Dataset {
lastestIdResult.close(); lastestIdResult.close();
stmt = c.createStatement(); stmt = c.createStatement();
flightPathToAdd.setID(flightPathId); flightPathToAdd.setID(flightPathId);
//ADDED
String insertFlightPointQuery = "INSERT INTO `" + this.name + "_Flight_Points` (`Index_ID`, `Name`, `Type`," + String insertFlightPointQuery = "INSERT INTO `" + this.name + "_Flight_Points` (`Index_ID`, `Name`, `Type`," +
" `Altitude`, `Latitude`, `Longitude`) VALUES "; " `Altitude`, `Latitude`, `Longitude`) VALUES ";
int numOfFlights = 0; int numOfFlights = 0;
@ -713,7 +726,7 @@ public class Dataset {
//add data to dataset array. //add data to dataset array.
//this is placed after incase the database messes up //this is placed after incase the database messes up
flightPathToAdd.addFlightPoint(flightPointsToImport.get(i)); flightPathToAdd.addFlightPoint(flightPointsToImport.get(i));
//routeDictionary.put(routeIdentifier, flightsToImport.get(i)); flightPointDictionary.put(flightPointsToImport.get(i).getID(), flightPointsToImport.get(i));
nextID++; nextID++;
numOfFlights++; numOfFlights++;
//} //}
@ -750,7 +763,6 @@ public class Dataset {
//create Airline country link //create Airline country link
for (Airline airline : airlines) { for (Airline airline : airlines) {
airlineByIATA.put(airline.getIATA(), airline); airlineByIATA.put(airline.getIATA(), airline);
//System.out.println(airline.getAlias());
airline.setRoutes(new ArrayList<Route>()); airline.setRoutes(new ArrayList<Route>());
airline.setCountry(countryDictionary.get(airline.getCountryName())); airline.setCountry(countryDictionary.get(airline.getCountryName()));
Country country = countryDictionary.get(airline.getCountryName()); Country country = countryDictionary.get(airline.getCountryName());
@ -762,7 +774,6 @@ public class Dataset {
HashMap<String, Airport> airportsByIATA = new HashMap<String, Airport>(); //this is used later for connecting the routes HashMap<String, Airport> airportsByIATA = new HashMap<String, Airport>(); //this is used later for connecting the routes
HashMap<String, Airport> airportsByICAO = new HashMap<String, Airport>(); //this is used later for connecting the routes HashMap<String, Airport> airportsByICAO = new HashMap<String, Airport>(); //this is used later for connecting the routes
for (Airport airport : airports) { for (Airport airport : airports) {
//System.out.println(airport.getIATA_FFA());
airportsByIATA.put(airport.getIATA_FFA(), airport); airportsByIATA.put(airport.getIATA_FFA(), airport);
airportsByICAO.put(airport.getICAO(), airport); airportsByICAO.put(airport.getICAO(), airport);
airport.setCountry(countryDictionary.get(airport.getCountryName())); airport.setCountry(countryDictionary.get(airport.getCountryName()));
@ -796,6 +807,7 @@ public class Dataset {
/** /**
* Addes Single Airline to Program and Database. * Addes Single Airline to Program and Database.
*
* @param name * @param name
* @param alias * @param alias
* @param IATA * @param IATA
@ -821,6 +833,7 @@ public class Dataset {
/** /**
* Adds a Single Airline from the Program to the Database * Adds a Single Airline from the Program to the Database
*
* @param airlineToAdd * @param airlineToAdd
* @throws DataException * @throws DataException
*/ */
@ -873,6 +886,7 @@ public class Dataset {
/** /**
* Adds a single Airport from the Program to the Database * Adds a single Airport from the Program to the Database
*
* @param name * @param name
* @param city * @param city
* @param country * @param country
@ -914,6 +928,7 @@ public class Dataset {
/** /**
* gets the name of the dataset. * gets the name of the dataset.
*
* @return * @return
*/ */
public String getName() { public String getName() {
@ -922,6 +937,7 @@ public class Dataset {
/** /**
* Adds an Airport to the database and dataset. * Adds an Airport to the database and dataset.
*
* @param airportToAdd * @param airportToAdd
* @throws DataException * @throws DataException
*/ */
@ -976,6 +992,7 @@ public class Dataset {
/** /**
* Adds a city to the dataset and database * Adds a city to the dataset and database
*
* @param city * @param city
*/ */
private void addCity(City city) { private void addCity(City city) {
@ -1006,6 +1023,7 @@ public class Dataset {
/** /**
* Adds a Country to the dataset and database * Adds a Country to the dataset and database
*
* @param country * @param country
*/ */
private void addCountry(Country country) { private void addCountry(Country country) {
@ -1035,6 +1053,7 @@ public class Dataset {
/** /**
* Adds one single route to the program. * Adds one single route to the program.
*
* @param airline * @param airline
* @param sourceAirport * @param sourceAirport
* @param destAirport * @param destAirport
@ -1059,6 +1078,7 @@ public class Dataset {
/** /**
* Adds a single route the dataset and database. * Adds a single route the dataset and database.
*
* @param routeToAdd * @param routeToAdd
* @throws DataException * @throws DataException
*/ */
@ -1119,6 +1139,7 @@ public class Dataset {
/** /**
* Adds a path to the database and to the path dictionary * Adds a path to the database and to the path dictionary
*
* @param sourceAirport * @param sourceAirport
* @param destAirport * @param destAirport
*/ */
@ -1163,6 +1184,7 @@ public class Dataset {
/** /**
* Adds a flight point to a given path woth the given id * Adds a flight point to a given path woth the given id
*
* @param id * @param id
* @param name * @param name
* @param type * @param type
@ -1237,8 +1259,6 @@ public class Dataset {
", \"" + via + "\")"; ", \"" + via + "\")";
stmt.execute(insertFlightPointQuery); stmt.execute(insertFlightPointQuery);
stmt.close(); stmt.close();
} catch (Exception e) { } catch (Exception e) {
System.err.println(e.getClass().getName() + ": " + e.getMessage()); System.err.println(e.getClass().getName() + ": " + e.getMessage());
System.exit(0); System.exit(0);
@ -1246,20 +1266,22 @@ public class Dataset {
FlightPoint pointToAdd = new FlightPoint(name, pointID + 1, id, type, via, headingVal, altitudeVal, legDistVal, FlightPoint pointToAdd = new FlightPoint(name, pointID + 1, id, type, via, headingVal, altitudeVal, legDistVal,
totalDistVal, latitudeVal, longitudeVal); totalDistVal, latitudeVal, longitudeVal);
flightPointDictionary.put(pointID + 1, pointToAdd);
flightPathDictionary.get(Integer.valueOf(id)).addFlightPoint(pointToAdd, index); flightPathDictionary.get(Integer.valueOf(id)).addFlightPoint(pointToAdd, index);
} }
/*** /***
* Adds a single flight Point to an Existing FLight Path. * Adds a single flight Point to an Existing Flight Path.
* @param point * @param point
* @param index * @param index
* @throws DataException * @throws DataException
*/ */
public void addFlightPointToPath(FlightPoint point, int index) throws DataException { public void addFlightPointToPath(FlightPoint point, int index) throws DataException {
addFlightPointToPath(point.getIndex(), point.getName(), point.getType(), point.getVia(), String.valueOf(point.getAltitude()), addFlightPointToPath(point.getIndex(), point.getName(), point.getType(), point.getVia(), String.valueOf(point.getAltitude()),
String.valueOf( point.getLatitude()),String.valueOf(point.getLongitude()), String.valueOf(point.getLatitude()), String.valueOf(point.getLongitude()), String.valueOf(point.getHeading()),
String.valueOf(point.getHeading()), String.valueOf(point.getLegDistance()), String.valueOf(point.getTotalDistance()), index); String.valueOf(point.getLegDistance()), String.valueOf(point.getTotalDistance()), index);
} }
/*** /***
* Adds a single flight Point to an Existing FLight Path appended on the end of the list. * Adds a single flight Point to an Existing FLight Path appended on the end of the list.
* @param point * @param point
@ -1267,12 +1289,13 @@ public class Dataset {
*/ */
public void addFlightPointToPath(FlightPoint point) throws DataException { public void addFlightPointToPath(FlightPoint point) throws DataException {
addFlightPointToPath(point.getIndex(), point.getName(), point.getType(), point.getVia(), String.valueOf(point.getAltitude()), addFlightPointToPath(point.getIndex(), point.getName(), point.getType(), point.getVia(), String.valueOf(point.getAltitude()),
String.valueOf( point.getLatitude()),String.valueOf(point.getLongitude()), String.valueOf(point.getLatitude()), String.valueOf(point.getLongitude()), String.valueOf(point.getHeading()),
String.valueOf(point.getHeading()), String.valueOf(point.getLegDistance()), String.valueOf(point.getTotalDistance()), -1); String.valueOf(point.getLegDistance()), String.valueOf(point.getTotalDistance()), -1);
} }
/** /**
* Adds a single flight Point to an Existing FLight Path appended on the end of the list. * Adds a single flight Point to an Existing FLight Path appended on the end of the list.
*
* @param id * @param id
* @param name * @param name
* @param type * @param type
@ -1290,6 +1313,7 @@ public class Dataset {
String heading, String legDist, String totDist) throws DataException { String heading, String legDist, String totDist) throws DataException {
addFlightPointToPath(id, name, type, via, altitude, latitude, longitude, heading, legDist, totDist, -1); addFlightPointToPath(id, name, type, via, altitude, latitude, longitude, heading, legDist, totDist, -1);
} }
/** /**
* This is called in conjunction to the App deleteDataset DO NOT CALL UNLESS THROUGH APP.DELETEDATASET * This is called in conjunction to the App deleteDataset DO NOT CALL UNLESS THROUGH APP.DELETEDATASET
*/ */
@ -1320,6 +1344,7 @@ public class Dataset {
/** /**
* deletes an airline from the dataset. * deletes an airline from the dataset.
*
* @param airline * @param airline
*/ */
public void deleteAirline(Airline airline) { public void deleteAirline(Airline airline) {
@ -1329,14 +1354,10 @@ public class Dataset {
try { try {
Class.forName("org.sqlite.JDBC"); Class.forName("org.sqlite.JDBC");
c = DriverManager.getConnection("jdbc:sqlite:res/userdb.db"); c = DriverManager.getConnection("jdbc:sqlite:res/userdb.db");
//System.out.println(airline.getID());
String deleteQuery = "DELETE FROM `" + this.name + "_Airline` WHERE `Airline_ID` = " + airline.getID() + ";"; String deleteQuery = "DELETE FROM `" + this.name + "_Airline` WHERE `Airline_ID` = " + airline.getID() + ";";
stmt = c.createStatement(); stmt = c.createStatement();
//System.out.println("Airline deleted");
stmt.execute(deleteQuery); stmt.execute(deleteQuery);
//System.out.println("Airline deleted");
stmt.close(); stmt.close();
//System.out.println("Airline deleted");
stmt = c.createStatement(); stmt = c.createStatement();
//check if number of countries that contain airlines > 0 else delete the country //check if number of countries that contain airlines > 0 else delete the country
String countCountry = "SELECT COUNT(*) FROM `" + this.name + "_Airline` JOIN `" + this.name + "_Country` ON" + String countCountry = "SELECT COUNT(*) FROM `" + this.name + "_Airline` JOIN `" + this.name + "_Country` ON" +
@ -1380,6 +1401,7 @@ public class Dataset {
/** /**
* Deletes an AIrline from the dataset and database based on it index * Deletes an AIrline from the dataset and database based on it index
*
* @param index * @param index
*/ */
public void deleteAirline(int index) { public void deleteAirline(int index) {
@ -1388,6 +1410,7 @@ public class Dataset {
/** /**
* deletes an airport from the dataset. * deletes an airport from the dataset.
*
* @param airport * @param airport
*/ */
public void deleteAirport(Airport airport) { public void deleteAirport(Airport airport) {
@ -1463,13 +1486,16 @@ public class Dataset {
/** /**
* Deletes an Airport from the dataset and database based on it index. * Deletes an Airport from the dataset and database based on it index.
*
* @param index * @param index
*/ */
public void deleteAirport(int index) { public void deleteAirport(int index) {
deleteAirport(airports.get(index)); deleteAirport(airports.get(index));
} }
/** /**
* deletes an route from the dataset. * deletes an route from the dataset.
*
* @param route * @param route
*/ */
public void deleteRoute(Route route) { public void deleteRoute(Route route) {
@ -1496,13 +1522,16 @@ public class Dataset {
/** /**
* Deletes a Route from the dataset and database based on its index * Deletes a Route from the dataset and database based on its index
*
* @param index * @param index
*/ */
public void deleteRoute(int index) { public void deleteRoute(int index) {
deleteRoute(routes.get(index)); deleteRoute(routes.get(index));
} }
/** /**
* deletes an airline from the dataset. * deletes an airline from the dataset.
*
* @param flightPath * @param flightPath
*/ */
public void deleteFlightPath(FlightPath flightPath) { public void deleteFlightPath(FlightPath flightPath) {
@ -1538,6 +1567,7 @@ public class Dataset {
/** /**
* Deletes a flight path from the database based on its index. * Deletes a flight path from the database based on its index.
*
* @param index * @param index
*/ */
public void deleteFlightPath(int index) { public void deleteFlightPath(int index) {
@ -1546,6 +1576,7 @@ public class Dataset {
/** /**
* deletes an airline from the dataset. * deletes an airline from the dataset.
*
* @param flightPoint * @param flightPoint
*/ */
public void deleteFlightPoint(FlightPoint flightPoint, FlightPath flightPath) { public void deleteFlightPoint(FlightPoint flightPoint, FlightPath flightPath) {
@ -1564,10 +1595,16 @@ public class Dataset {
System.exit(0); System.exit(0);
} }
flightPath.getFlightPoints().remove(flightPoint); flightPath.getFlightPoints().remove(flightPoint);
try {
flightPointDictionary.remove(flightPoint.getID());
} catch (DataException e) {
e.printStackTrace();
}
} }
/** /**
* deletes a single flight point from a given path. * deletes a single flight point from a given path.
*
* @param pathIndex * @param pathIndex
* @param pointIndex * @param pointIndex
*/ */
@ -1577,6 +1614,7 @@ public class Dataset {
/** /**
* returns the airlines that are part of this dataset. * returns the airlines that are part of this dataset.
*
* @return * @return
*/ */
public ArrayList<Airline> getAirlines() { public ArrayList<Airline> getAirlines() {
@ -1585,6 +1623,7 @@ public class Dataset {
/** /**
* returns the airports that are associated with this dataset. * returns the airports that are associated with this dataset.
*
* @return * @return
*/ */
public ArrayList<Airport> getAirports() { public ArrayList<Airport> getAirports() {
@ -1593,6 +1632,7 @@ public class Dataset {
/** /**
* returns the routes that are associated with this dataset. * returns the routes that are associated with this dataset.
*
* @return * @return
*/ */
public ArrayList<Route> getRoutes() { public ArrayList<Route> getRoutes() {
@ -1601,6 +1641,7 @@ public class Dataset {
/** /**
* returns the flight paths that are associated with this dataset. * returns the flight paths that are associated with this dataset.
*
* @return * @return
*/ */
public ArrayList<FlightPath> getFlightPaths() { public ArrayList<FlightPath> getFlightPaths() {
@ -1609,6 +1650,7 @@ public class Dataset {
/** /**
* returns the countries that are associated with this dataset. * returns the countries that are associated with this dataset.
*
* @return * @return
*/ */
public ArrayList<Country> getCountries() { public ArrayList<Country> getCountries() {
@ -1617,6 +1659,7 @@ public class Dataset {
/** /**
* returns the cities that are associate wit hthis dataset. * returns the cities that are associate wit hthis dataset.
*
* @return * @return
*/ */
public ArrayList<City> getCities() { public ArrayList<City> getCities() {
@ -1625,6 +1668,7 @@ public class Dataset {
/** /**
* returns a dictionary with the airlines that are associated with this datatset. * returns a dictionary with the airlines that are associated with this datatset.
*
* @return * @return
*/ */
public LinkedHashMap<String, Airline> getAirlineDictionary() { public LinkedHashMap<String, Airline> getAirlineDictionary() {
@ -1633,6 +1677,7 @@ public class Dataset {
/** /**
* returns a dictionary with the airports that are associated with this dataset. * returns a dictionary with the airports that are associated with this dataset.
*
* @return * @return
*/ */
public LinkedHashMap<String, Airport> getAirportDictionary() { public LinkedHashMap<String, Airport> getAirportDictionary() {
@ -1641,6 +1686,7 @@ public class Dataset {
/** /**
* returns a route dictionary with the routes that are associated wit hthis dataset. * returns a route dictionary with the routes that are associated wit hthis dataset.
*
* @return * @return
*/ */
public LinkedHashMap<String, Route> getRouteDictionary() { public LinkedHashMap<String, Route> getRouteDictionary() {
@ -1649,14 +1695,25 @@ public class Dataset {
/** /**
* returns a flightpath dictionary with the flights that are associated with this dataset. * returns a flightpath dictionary with the flights that are associated with this dataset.
*
* @return * @return
*/ */
public LinkedHashMap<Integer, FlightPath> getFlightPathDictionary() { public LinkedHashMap<Integer, FlightPath> getFlightPathDictionary() {
return flightPathDictionary; return flightPathDictionary;
} }
/**
* returns a flightpoint dictionary with the flights that are associated with this dataset.
*
* @return
*/
public LinkedHashMap<Integer, FlightPoint> getFlightPointDictionary() {
return flightPointDictionary;
}
/** /**
* returns a Country Dictionary with the COuntries that are associated with this dataset. * returns a Country Dictionary with the COuntries that are associated with this dataset.
*
* @return * @return
*/ */
public LinkedHashMap<String, Country> getCountryDictionary() { public LinkedHashMap<String, Country> getCountryDictionary() {
@ -1665,6 +1722,7 @@ public class Dataset {
/** /**
* returns a City Dictionary with the Cities that are associated with this datatset. * returns a City Dictionary with the Cities that are associated with this datatset.
*
* @return * @return
*/ */
public LinkedHashMap<String, City> getCityDictionary() { public LinkedHashMap<String, City> getCityDictionary() {
@ -1673,6 +1731,7 @@ public class Dataset {
/** /**
* Edits Airline and commits them to the database. * Edits Airline and commits them to the database.
*
* @param index * @param index
* @param name * @param name
* @param alias * @param alias
@ -1686,8 +1745,10 @@ public class Dataset {
public void editAirline(int index, String name, String alias, String IATA, String ICAO, String callsign, String country, String active) throws DataException { public void editAirline(int index, String name, String alias, String IATA, String ICAO, String callsign, String country, String active) throws DataException {
editAirline(airlines.get(index), name, alias, IATA, ICAO, callsign, country, active); editAirline(airlines.get(index), name, alias, IATA, ICAO, callsign, country, active);
} }
/** /**
* Edits Airline and commits them to the database. * Edits Airline and commits them to the database.
*
* @param airline * @param airline
* @param name * @param name
* @param alias * @param alias
@ -1729,6 +1790,7 @@ public class Dataset {
/** /**
* Edits the Airport in the dataset then commits it to the database. * Edits the Airport in the dataset then commits it to the database.
*
* @param index * @param index
* @param name * @param name
* @param city * @param city
@ -1749,6 +1811,7 @@ public class Dataset {
/** /**
* Edits the Airport in the dataset then commits it to the database. * Edits the Airport in the dataset then commits it to the database.
*
* @param airport * @param airport
* @param name * @param name
* @param city * @param city
@ -1800,6 +1863,7 @@ public class Dataset {
/** /**
* Edits the ROutes in the dataset and commits it to the database. * Edits the ROutes in the dataset and commits it to the database.
*
* @param index * @param index
* @param airline * @param airline
* @param source * @param source
@ -1815,6 +1879,7 @@ public class Dataset {
/** /**
* Edits the ROutes in the dataset and then commits it to the database. * Edits the ROutes in the dataset and then commits it to the database.
*
* @param route * @param route
* @param airline * @param airline
* @param source * @param source
@ -1854,6 +1919,7 @@ public class Dataset {
/** /**
* Edits a flight Point in the dataset then commits it to the database. * Edits a flight Point in the dataset then commits it to the database.
*
* @param flightPath * @param flightPath
* @param index * @param index
* @param name * @param name
@ -1863,13 +1929,13 @@ public class Dataset {
* @param longitude * @param longitude
* @throws DataException * @throws DataException
*/ */
public void editFlightPath(FlightPath flightPath, int index, String name, String type, String altitude, String latitude, public void editFlight(FlightPath flightPath, int index, String name, String type, String altitude, String latitude, String longitude) throws DataException {
String longitude) throws DataException{ editFlight(flightPath.getFlightPoints().get(index), name, type, altitude, latitude, longitude);
editFlightPoint(flightPath.getFlightPoints().get(index), name, type, altitude, latitude, longitude);
} }
/** /**
* Edits a flight Point in the dataset then commits it to the database. * Edits a flight Point in the dataset then commits it to the database.
*
* @param flightPoint * @param flightPoint
* @param name * @param name
* @param type * @param type
@ -1878,8 +1944,7 @@ public class Dataset {
* @param longitude * @param longitude
* @throws DataException * @throws DataException
*/ */
public void editFlightPoint(FlightPoint flightPoint, String name, String type, String altitude, String latitude, public void editFlight(FlightPoint flightPoint, String name, String type, String altitude, String latitude, String longitude) throws DataException {
String longitude) throws DataException{
EntryParser entryParser = new EntryParser(); EntryParser entryParser = new EntryParser();
FlightPoint flightPoint1 = entryParser.parsePoint(name, type, altitude, latitude, longitude); FlightPoint flightPoint1 = entryParser.parsePoint(name, type, altitude, latitude, longitude);
flightPoint.setName(flightPoint1.getName()); flightPoint.setName(flightPoint1.getName());
@ -1905,8 +1970,7 @@ public class Dataset {
} catch (Exception e) { } catch (Exception e) {
System.err.println(e.getClass().getName() + ": " + e.getMessage()); System.err.println(e.getClass().getName() + ": " + e.getMessage());
} }
FlightPath flightPath = flightPathDictionary.get(flightPoint.getIndex());
FlightPath flightPath = flightPathDictionary.get(flightPoint.getIndexID());
int indexOf = flightPath.getFlightPoints().indexOf(flightPoint); int indexOf = flightPath.getFlightPoints().indexOf(flightPoint);
if (indexOf == 0) { if (indexOf == 0) {
@ -1919,6 +1983,7 @@ public class Dataset {
} catch (Exception e) { } catch (Exception e) {
System.err.println(e.getClass().getName() + ": " + e.getMessage()); System.err.println(e.getClass().getName() + ": " + e.getMessage());
} }
flightPath.setDepartureAirport(flightPoint.getName());
} else if (indexOf == flightPath.getFlightPoints().size() - 1) { } else if (indexOf == flightPath.getFlightPoints().size() - 1) {
try { try {
stmt = c.createStatement(); stmt = c.createStatement();
@ -1929,8 +1994,36 @@ public class Dataset {
} catch (Exception e) { } catch (Exception e) {
System.err.println(e.getClass().getName() + ": " + e.getMessage()); System.err.println(e.getClass().getName() + ": " + e.getMessage());
} }
flightPath.setArrivalAirport(flightPoint.getName());
} }
updateFlightPointInfo(flightPath);
createDataLinks(); createDataLinks();
} }
/**
* Updates the Leg Distance, Total Distance and Bearing(Heading) of the Flight points in the flight path.
* @param flightPath
*/
public void updateFlightPointInfo(FlightPath flightPath){
flightPath.updateFlightPointInfo();
Connection c = null;
Statement stmt;
try {
c = DriverManager.getConnection("jdbc:sqlite:res/userdb.db");
//move all the points after this forward
for (FlightPoint flightPoint: flightPath.getFlightPoints()){
stmt = c.createStatement();
String updatePointQuery = "UPDATE `"+this.name+"_Flight_Points` SET `Heading` = "+flightPoint.getHeading()+", " +
"`Tot_Dist` = "+flightPoint.getTotalDistance()+", `Leg_Dist` = "+flightPoint.getLegDistance()+" WHERE `POINT_ID` = " +
"" + flightPoint.getID();
stmt.execute(updatePointQuery);
stmt.close();
}
c.close();
} catch ( Exception e ) {
System.err.println( e.getClass().getName() + ": " + e.getMessage() );
e.printStackTrace();
System.exit(0);
}
}
} }

@ -1,5 +1,7 @@
package seng202.group9.Controller; package seng202.group9.Controller;
import seng202.group9.Core.FlightPoint;
import java.io.Serializable; import java.io.Serializable;
/** /**
@ -8,6 +10,8 @@ import java.io.Serializable;
*/ */
public class Session implements Serializable { public class Session implements Serializable {
private SceneCode sceneDisplayed; private SceneCode sceneDisplayed;
private int currentFlightPointID;
private int currentFlightPathID;
/** /**
* Constructor for a new session * Constructor for a new session
@ -40,4 +44,36 @@ public class Session implements Serializable {
public SceneCode getSceneDisplayed() { public SceneCode getSceneDisplayed() {
return sceneDisplayed; return sceneDisplayed;
} }
/**
* sets the current flight point
* @param currentFlightPointID
*/
public void setCurrentFlightPointID(int currentFlightPointID) {
this.currentFlightPointID = currentFlightPointID;
}
/**
* gets the current flight point
* @return
*/
public int getCurrentFlightPointID() {
return currentFlightPointID;
}
/**
* sets the current flight point
* @param currentFlightPathID
*/
public void setCurrentFlightPathtID(int currentFlightPathID) {
this.currentFlightPathID = currentFlightPathID;
}
/**
* gets the current flight point
* @return
*/
public int getCurrentFlightPathID() {
return currentFlightPathID;
}
} }

@ -183,4 +183,37 @@ public class FlightPath {
} }
return routePath; return routePath;
} }
public void updateFlightPointInfo(){
if (flightPoints.size() == 0){
return;
}
FlightPoint startPoint = flightPoints.get(0);
startPoint.setLegDistance(0);
startPoint.setTotalDistance(0);
startPoint.setHeading(0);
for (int i = 1; i < flightPoints.size(); i ++){
double distance = 0;
double dLong = flightPoints.get(i - 1).getLongitude() - flightPoints.get(i).getLongitude();
double dLat = flightPoints.get(i - 1).getLatitude() - flightPoints.get(i).getLatitude();
dLong = Math.toRadians(dLong);
dLat = Math.toRadians(dLat);
double a = Math.pow((Math.sin(dLat/2)), 2) + Math.cos(Math.toRadians(flightPoints.get(i).getLatitude())) * Math.cos(Math.toRadians(flightPoints.get(i - 1).getLatitude())) * Math.pow(Math.sin(dLong/2), 2);
double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
distance = 6371 * c;
//convert distance from km to nautical mile
distance = distance * 0.53995680345572;
flightPoints.get(i).setLegDistance(distance);
flightPoints.get(i).setTotalDistance(distance + flightPoints.get(i).getTotalDistance());
//calculate bearing
double lat1 = Math.toRadians(flightPoints.get(i - 1).getLatitude());
double lat2 = Math.toRadians(flightPoints.get(i).getLatitude());
double lng1 = Math.toRadians(flightPoints.get(i - 1).getLongitude());
double lng2 = Math.toRadians(flightPoints.get(i).getLongitude());
double y = Math.sin(dLong) * Math.cos(lat2);
double x = Math.cos(lat1) * Math.sin(lat2);
x -= Math.sin(lat1) * Math.cos(lat2) * Math.cos(dLong);
double heading = 360 - Math.toDegrees(Math.atan2(y, x));
flightPoints.get(i).setHeading((int)heading);
}
}
} }

@ -3,8 +3,11 @@ package seng202.group9.GUI;
import javafx.event.ActionEvent; import javafx.event.ActionEvent;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.scene.control.Alert; import javafx.scene.control.Alert;
import javafx.scene.control.Button;
import javafx.scene.control.TextField; import javafx.scene.control.TextField;
import javafx.stage.Stage;
import seng202.group9.Controller.Dataset; import seng202.group9.Controller.Dataset;
import seng202.group9.Controller.Session;
import seng202.group9.Core.FlightPoint; import seng202.group9.Core.FlightPoint;
/** /**
@ -22,7 +25,8 @@ public class FlightEditorController extends Controller{
TextField fLatitudeEdit; TextField fLatitudeEdit;
@FXML @FXML
TextField fLongitudeEdit; TextField fLongitudeEdit;
@FXML
private Button flightEditButton;
//Set an empty Dataset to be assigned later //Set an empty Dataset to be assigned later
private Dataset theDataSet = null; private Dataset theDataSet = null;
@ -32,30 +36,41 @@ public class FlightEditorController extends Controller{
* Takes in values from the GUI the user has typed in. * Takes in values from the GUI the user has typed in.
* @see Dataset * @see Dataset
*/ */
public void editFlight(FlightPoint flightPoint) { public void editFlight() {
//Tries to add a new airport and clears the fields to their initial state if successful. //Tries to add a new airport and clears the fields to their initial state if successful.
//Otherwise an error message will pop up with what is wrong with the manual data. //Otherwise an error message will pop up with what is wrong with the manual data.
try { try {
fNameEdit.setText(flightPoint.getName()); Session session = getParent().getSession();
fTypeEdit.setText(flightPoint.getType()); int flightPointID = session.getCurrentFlightPointID();
fAltitudeEdit.setText(Double.toString(flightPoint.getAltitude())); int flightPathID = session.getCurrentFlightPathID();
fLatitudeEdit.setText(Double.toString(flightPoint.getLatitude()));
fLongitudeEdit.setText(Double.toString(flightPoint.getLongitude()));
theDataSet.editFlightPoint( theDataSet.editFlight(
flightPoint, theDataSet.getFlightPointDictionary().get(flightPointID),
fNameEdit.getText(), fNameEdit.getText(),
fTypeEdit.getText(), fTypeEdit.getText(),
fAltitudeEdit.getText(), fAltitudeEdit.getText(),
fLatitudeEdit.getText(), fLatitudeEdit.getText(),
fLongitudeEdit.getText() fLongitudeEdit.getText()
); );
session.setCurrentFlightPointID(flightPointID);
fNameEdit.clear(); fNameEdit.clear();
fTypeEdit.clear(); fTypeEdit.clear();
fAltitudeEdit.clear(); fAltitudeEdit.clear();
fLatitudeEdit.clear(); fLatitudeEdit.clear();
fLongitudeEdit.clear(); fLongitudeEdit.clear();
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("Flight Path Edit Successful");
alert.setHeaderText("Flight Point Edited!");
alert.setContentText("Your flight point has been updated in the database.");
alert.showAndWait();
Stage stage = (Stage) flightEditButton.getScene().getWindow();
stage.close();
} catch ( Exception e ) { } catch ( Exception e ) {
e.printStackTrace();
Alert alert = new Alert(Alert.AlertType.ERROR); Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle("Flight Data Error"); alert.setTitle("Flight Data Error");
alert.setHeaderText("Error editing a flight point."); alert.setHeaderText("Error editing a flight point.");
@ -64,8 +79,22 @@ public class FlightEditorController extends Controller{
} }
} }
public void loadValues(){
}
public void load() { public void load() {
theDataSet = getParent().getCurrentDataset(); theDataSet = getParent().getCurrentDataset();
Session session = getParent().getSession();
int flightPointID = session.getCurrentFlightPointID();
FlightPoint flightPoint = theDataSet.getFlightPointDictionary().get(flightPointID);
fNameEdit.setText(flightPoint.getName());
fTypeEdit.setText(flightPoint.getType());
fAltitudeEdit.setText(Double.toString(flightPoint.getAltitude()));
fLatitudeEdit.setText(Double.toString(flightPoint.getLatitude()));
fLongitudeEdit.setText(Double.toString(flightPoint.getLongitude()));
} }
} }

@ -10,6 +10,7 @@ import javafx.scene.input.MouseEvent;
import seng202.group9.Controller.DataException; import seng202.group9.Controller.DataException;
import seng202.group9.Controller.Dataset; import seng202.group9.Controller.Dataset;
import seng202.group9.Controller.SceneCode; import seng202.group9.Controller.SceneCode;
import seng202.group9.Controller.Session;
import seng202.group9.Core.FlightPath; import seng202.group9.Core.FlightPath;
import seng202.group9.Core.FlightPoint; import seng202.group9.Core.FlightPoint;
@ -144,8 +145,6 @@ public class FlightRDController extends Controller {
* Will take the inputs from the text fields and adds the point to the current flight path. * Will take the inputs from the text fields and adds the point to the current flight path.
*/ */
public void addFlightPoint() { public void addFlightPoint() {
ArrayList<FlightPath> flightPaths;
flightPaths = theDataSet.getFlightPaths();
try { try {
theDataSet.addFlightPointToPath(currentPathId, theDataSet.addFlightPointToPath(currentPathId,
@ -168,8 +167,7 @@ public class FlightRDController extends Controller {
flightLegDistBox.clear(); flightLegDistBox.clear();
flightTotDistBox.clear(); flightTotDistBox.clear();
ArrayList<FlightPoint> flightPoints = flightPaths.get(currentPathIndex).getFlight(); updateTable(currentPathIndex);
flightTableView.setItems(FXCollections.observableArrayList(flightPoints));
} catch ( Exception e ) { } catch ( Exception e ) {
Alert alert = new Alert(Alert.AlertType.ERROR); Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle("Flight Point Data Error"); alert.setTitle("Flight Point Data Error");
@ -212,25 +210,22 @@ public class FlightRDController extends Controller {
currentPathIndex = theDataSet.getFlightPaths().indexOf(theDataSet.getFlightPathDictionary().get(pathID)); currentPathIndex = theDataSet.getFlightPaths().indexOf(theDataSet.getFlightPathDictionary().get(pathID));
ArrayList<FlightPath> flightPaths; updateTable(currentPathIndex);
flightPaths = theDataSet.getFlightPaths();
ArrayList<FlightPoint> flightPoints = flightPaths.get(currentPathIndex).getFlight();
flightTableView.setItems(FXCollections.observableArrayList(flightPoints));
} }
public void editPoint() { public void editPoint() {
FlightPoint toEdit = flightTableView.getSelectionModel().getSelectedItem(); FlightPoint toEdit = flightTableView.getSelectionModel().getSelectedItem();
int pathID;
try { try {
pathID = toEdit.getIndex(); Session session = getParent().getSession();
session.setCurrentFlightPointID(toEdit.getID());
session.setCurrentFlightPathtID(currentPathId);
} catch (DataException e) { } catch (DataException e) {
e.printStackTrace(); e.printStackTrace();
System.out.println("Point is Uneditable as the Index ID is not set."); System.out.println("Point is Uneditable as the Index ID is not set.");
return; return;
} }
ArrayList<FlightPath> flightPaths = theDataSet.getFlightPaths();
createPopUpStage(SceneCode.FLIGHT_EDITOR, 600, 289); createPopUpStage(SceneCode.FLIGHT_EDITOR, 600, 289);
flightTableView.setItems(FXCollections.observableArrayList(flightPaths.get(currentPathIndex).getFlight())); updateTable(currentPathIndex);
} }
/** /**
@ -249,6 +244,14 @@ public class FlightRDController extends Controller {
flightPathListView(); flightPathListView();
} }
public void updateTable(int currentPathIndex) {
ArrayList<FlightPath> flightPaths;
flightPaths = theDataSet.getFlightPaths();
ArrayList<FlightPoint> flightPoints = flightPaths.get(currentPathIndex).getFlight();
flightTableView.setItems(FXCollections.observableArrayList(flightPoints));
flightTableView.refresh();
}
/** /**
* Will link to the flight analyser when implemented. * Will link to the flight analyser when implemented.
*/ */

@ -57,7 +57,7 @@
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" /> <Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</GridPane.margin> </GridPane.margin>
</Label> </Label>
<Button fx:id="editButton" mnemonicParsing="false" onAction="#editFlight" text="Edit Flight" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="6" /> <Button fx:id="flightEditButton" mnemonicParsing="false" onAction="#editFlight" text="Edit Flight" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="6" />
<TextField fx:id="fNameEdit" prefHeight="31.0" prefWidth="432.0" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="1" /> <TextField fx:id="fNameEdit" prefHeight="31.0" prefWidth="432.0" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="1" />
<TextField fx:id="fTypeEdit" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="2" /> <TextField fx:id="fTypeEdit" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="2" />
<TextField fx:id="fAltitudeEdit" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="3" /> <TextField fx:id="fAltitudeEdit" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="3" />

@ -153,8 +153,8 @@
<contextMenu> <contextMenu>
<ContextMenu> <ContextMenu>
<items> <items>
<MenuItem mnemonicParsing="false" onAction="#deletePoint" text="Delete" />
<MenuItem mnemonicParsing="false" onAction="#editPoint" text="Edit" /> <MenuItem mnemonicParsing="false" onAction="#editPoint" text="Edit" />
<MenuItem mnemonicParsing="false" onAction="#deletePoint" text="Delete" />
</items> </items>
</ContextMenu> </ContextMenu>
</contextMenu> </contextMenu>

Loading…
Cancel
Save