/** @return the altitude of the last added mission item. */ public double getLastAltitude() { double alt = defaultAlt; try { SpatialCoordItem lastItem = (SpatialCoordItem) items.get(items.size() - 1); if (!(lastItem instanceof RegionOfInterestImpl)) { alt = lastItem.getCoordinate().getAltitude(); } } catch (Exception e) { } return alt; }
public double getDistanceFromLastWaypoint(SpatialCoordItem waypoint) throws IllegalArgumentException { int i = items.indexOf(waypoint); if (i > 0) { MissionItem previous = items.get(i - 1); if (previous instanceof SpatialCoordItem) { return GeoTools.getDistance( waypoint.getCoordinate(), ((SpatialCoordItem) previous).getCoordinate()); } } throw new IllegalArgumentException("Last waypoint doesn't have a coordinate"); }
public double getAltitudeDiffFromPreviousItem(SpatialCoordItem waypoint) throws IllegalArgumentException { int i = items.indexOf(waypoint); if (i > 0) { MissionItem previous = items.get(i - 1); if (previous instanceof SpatialCoordItem) { return waypoint.getCoordinate().getAltitude() - ((SpatialCoordItem) previous).getCoordinate().getAltitude(); } } throw new IllegalArgumentException("Last waypoint doesn't have an altitude"); }