import java.io.IOException; import java.sql.SQLException; import java.text.ParseException; import DataStructure.GSMMap; import DataStructure.GoogleOut; import Parse.NMEAParse; import Parse.sqlreader; public class GSMMapping { // private double[] CoordsNS; // private double[] CoordsEW; // private double[][] bla; // Constructor public GSMMapping() { // TODO Auto-generated constructor stub } /** * @param args * @throws ClassNotFoundException * @throws SQLException * @throws IOException * @throws ParseException */ public static void main(String[] args) throws SQLException, ClassNotFoundException, IOException, ParseException { String file = null; file = "varianz3-4.log"; // ask for file // BufferedReader in = new BufferedReader(new // InputStreamReader(System.in)); System.out.println("GPS-File?"); // long IMSI = 262230000000010l; /* * if (file == null) { try { file = in.readLine(); } catch (Exception e) * { System.out.println("Cannot read input"); System.exit(-1); } } */ // parse NMEA log NMEAParse gpslog = new NMEAParse(file); // testing: sqlreader testing = new sqlreader(gpslog, 262230000000010L, 3000l); GSMMap testingmap = new GSMMap(testing, 0.00004); GoogleOut testingoogle = new GoogleOut(testingmap, "testing.kml"); testingoogle.write(); // search in SQL long[] IMSIs = { 262012430041708L, 262026003662195L, 262026550055616L, 262073958646614L, 262123456789177L, 262230000000010L }; // sqlreader sql = new sqlreader(gpslog, IMSI, 3000l); int count = 0; for (long l : IMSIs) { sqlreader current = new sqlreader(new NMEAParse(file), l, 3000l); try { GSMMap map = new GSMMap(current, 0.00008); System.out.println("Average"); map.average(); System.out.println("Outlier"); map.removeOutlier(); System.out.println("Gnuplot Signal"); map.gnuPlotSignalStrength(877, count); System.out.println("Gnuplot Delta"); map.gnuPlotDeltaBTS(877, 880); GoogleOut google = new GoogleOut(map, "varianz/GSM-" + l + "-varianz.kml"); google.write(); count++; } catch (Exception e) { } } // do the Google Magic WITHOUT INTERPOLATION! // GSMMapInterpolatorOld testmap = new GSMMapInterpolatorOld(sql, // 0.00004);// // 0.00004d // testmap.average(); // GoogleOut testfile = new GoogleOut(testmap, "varianz/GSM-" + IMSI // + "-varianz.kml"); /* * get Variance! * * Timestamp start = new Timestamp(new SimpleDateFormat( * "yyyy-MM-dd HH:mm:ss.S").parse("2011-04-05 14:22:45.0") .getTime()); * Timestamp end = new Timestamp(new SimpleDateFormat( * "yyyy-MM-dd HH:mm:ss.S").parse("2011-04-05 14:22:54.0") .getTime()); * CalcVariance.Calc(sql, start, end, 877, 6); */ // do GoogleOut WITH interpolation! // GoogleOut testfile2 = new GoogleOut(testmap, "GSMMap.kml"); // save GSM Map // File outfile = new File("GSMout.obj"); // try { // ObjectOutputStream oos = new ObjectOutputStream( // new FileOutputStream(outfile)); // oos.writeObject(testmap); // } catch (FileNotFoundException e) { // // TODO Auto-generated catch block // e.printStackTrace(); // } catch (IOException e) { // // TODO Auto-generated catch block // e.printStackTrace(); // } // try to load /* * try { ObjectInputStream ois = new ObjectInputStream(new * FileInputStream( outfile)); GSMMapInterpolatorOld openedGSMmap = * (GSMMapInterpolatorOld) ois .readObject(); // GoogleOut * openedGSMmapout = new GoogleOut(openedGSMmap, // "readout.kml"); * * } catch (FileNotFoundException e) { // TODO Auto-generated catch * block e.printStackTrace(); } catch (IOException e) { // TODO * Auto-generated catch block e.printStackTrace(); } */ } }