protected static ArrayList<Position> readReferencePositions(String filePath) throws FileNotFoundException { ArrayList<Position> positions = new ArrayList<Position>(); Scanner scanner = new Scanner(new File(filePath)); while (scanner.hasNextDouble()) { double lat = scanner.nextDouble(); double lon = scanner.nextDouble(); double elevation = scanner.nextDouble(); positions.add(Position.fromDegrees(lat, lon, elevation)); } return positions; }
protected static ArrayList<Position> generateReferenceLocations( Sector sector, int numLats, int numLons) { ArrayList<Position> locations = new ArrayList<Position>(); double dLat = (sector.getMaxLatitude().degrees - sector.getMinLatitude().degrees) / (numLats - 1); double dLon = (sector.getMaxLongitude().degrees - sector.getMinLongitude().degrees) / (numLons - 1); for (int j = 0; j < numLats; j++) { double lat = sector.getMinLatitude().degrees + j * dLat; for (int i = 0; i < numLons; i++) { double lon = sector.getMinLongitude().degrees + i * dLon; // Specify angles to five decimal places. locations.add( Position.fromDegrees( Math.round(lat * 100000.0) / 100000.0, Math.round(lon * 100000.0) / 100000.0, 0)); } } return locations; }
protected Position getPosition(int index) { int latlonIndex = 2 * index; return Position.fromDegrees(latlonArray[latlonIndex], latlonArray[latlonIndex + 1], 0); }