/** * Get NMEA Satellite. The satellite list is retrieved from the almanac data. Satellites are * ordered by their elevation: highest elevation (index 0) -> lowest elevation. * * @param index the satellite index * @return the NMEASaltellite object for the selected satellite */ public Satellite getSatellite(int index) { Satellite s = gsvSentence.getSatellite(index); // Compare getPRN() with this satellite, fill in setTracked(): // TODO: This fails because most satellites are set to 0 when this is called. Not synced yet. boolean tracked = false; int[] prns = getPRN(); for (int i = 0; i < prns.length; i++) { if (prns[i] == s.getPRN()) tracked = true; break; } s.setTracked(tracked); return s; }
public boolean buildSatsFromKeps(Vector fileList) { Enumeration filelist = fileList.elements(); while (filelist.hasMoreElements()) { String file = (String) filelist.nextElement(); FileInputStream fis = null; DataInputStream dis = null; String lineRead = null; try { if (dir != null) { fis = new FileInputStream(this.dir + file); } else { fis = new FileInputStream(file); } dis = new DataInputStream(fis); System.out.println("Found file '" + dir + file + "': Loading keps"); while (dis.available() > 0) { lineRead = dis.readLine().trim(); if (lineRead.length() > 0) { if (lineRead.length() > 20) lineRead = lineRead.substring(0, 19); Satellite sat = new Satellite(lineRead); String firstLine = dis.readLine().trim(); if (firstLine.length() < 69) { sat = null; } else { String secondLine = dis.readLine().trim(); if (secondLine.length() < 69) { sat = null; } else { sat.setKeps(firstLine, secondLine); satVector.addElement(sat); } } } } } catch (IOException _ex) { System.out.println("Sat data file '" + dir + file + "' not found"); _ex.printStackTrace(); return false; } } mapper.myData.allSats = satVector; return true; }