Examples of TrackPoint


Examples of jaron.gps.Trackpoint

      try {
        // check if there is a client connected to our server
        if (client != null) {
          BufferedReader is = new BufferedReader(new InputStreamReader(client.getInputStream()));
          String s = new String();
          Trackpoint trackpoint = new Trackpoint();
          HashMap<String, String> nmea = new HashMap<String, String>();

          // FlightGear sends a stream of $GPRMC, $GPGGA and $GPGSA NMEA data (in that order)
          // this data is parsed and converted to a Trackpoint object
          // after that the Trackpoint object is sent to the EventListeners
          while ((s = is.readLine()) != null) {
            String[] params = s.split(",");
            if(params[0].equals("$GPRMC")) {
              nmea = new HashMap<String, String>();
              nmea.put("GPRMC", s);
              trackpoint.setLatitude(new Latitude(params[3], Direction.fromValue( params[4])));
              trackpoint.setLongitude(new Longitude(params[5], Direction.fromValue( params[6])));
              String time = params[1];
              String date = params[9];
              Calendar cal = GregorianCalendar.getInstance();
              cal.set(Calendar.HOUR, Integer.parseInt(time.substring(0, 2)));
              cal.set(Calendar.MINUTE, Integer.parseInt(time.substring(2, 4)));
              cal.set(Calendar.SECOND, Integer.parseInt(time.substring(4, 6)));
              cal.set(Calendar.DAY_OF_MONTH, Integer.parseInt(date.substring(0, 2)));
              cal.set(Calendar.MONTH, Integer.parseInt(date.substring(2, 4)));
              cal.set(Calendar.YEAR, Integer.parseInt(date.substring(4, 6)));
              trackpoint.setTimestamp(cal.getTime());
              trackpoint.setGroundSpeedKnots(Double.parseDouble(params[7]));
            }
            else if(params[0].equals("$GPGGA")) {
              nmea.put("GPGGA", s);
              trackpoint.setSatellites(Integer.parseInt(params[7]));
              trackpoint.setAltitude(Double.parseDouble(params[9]));
            }
            // $GPGSA implies the end of the NMEA data sequence
            else if(params[0].equals("$GPGSA")) {
              nmea.put("GPGSA", s);
              break;
            }
          }
          // FlightGear sends junk data at initialization and this is filtered out here
          if (trackpoint.getLatitude().getDegrees() != 0) {
            latitude.setValue(trackpoint.getLatitude().getDecimal());
            longitude.setValue(trackpoint.getLongitude().getDecimal());
            if (pastLatitude != 0 && pastLongitude != 0) {
              courseOverGround.setValue(Navigation.getCourseInDegrees(pastLatitude, pastLongitude, latitude.getValue(), longitude.getValue()));
            }
            speedOverGround.setValue(trackpoint.getGroundSpeed());
            altitudeAbsolute.setValue(trackpoint.getAltitude());
            satellites.setValue(trackpoint.getSatellites());
            notifyTrackpointListeners(trackpoint);
            pastLatitude = latitude.getValue();
            pastLongitude = longitude.getValue();
          }
        }
View Full Code Here

Examples of jaron.gps.Trackpoint

        // check if there is a client connected to our server
        if (client != null) {
          if (debug) System.out.println("FlightGearNMEAReceiver::run(): Connection to client established, waiting for data");
          BufferedReader is = new BufferedReader(new InputStreamReader(client.getInputStream()));
          String s = new String();
          Trackpoint trackpoint = new Trackpoint();
          HashMap<String, String> nmea = new HashMap<String, String>();

          // FlightGear sends a stream of $GPRMC, $GPGGA and $GPGSA NMEA data (in that order)
          // this data is parsed and converted to a Trackpoint object
          // after that the Trackpoint object is sent to the EventListeners
          while ((s = is.readLine()) != null) {
            String[] params = s.split(",");
            if(params[0].equals("$GPRMC")) {
              nmea = new HashMap<String, String>();
              nmea.put("GPRMC", s);
              trackpoint.setLatitude(new Latitude(params[3], Direction.fromValue( params[4])));
              trackpoint.setLongitude(new Longitude(params[5], Direction.fromValue( params[6])));
              String time = params[1];
              String date = params[9];
              Calendar cal = GregorianCalendar.getInstance();
              cal.set(Calendar.HOUR, Integer.parseInt(time.substring(0, 2)));
              cal.set(Calendar.MINUTE, Integer.parseInt(time.substring(2, 4)));
              cal.set(Calendar.SECOND, Integer.parseInt(time.substring(4, 6)));
              cal.set(Calendar.DAY_OF_MONTH, Integer.parseInt(date.substring(0, 2)));
              cal.set(Calendar.MONTH, Integer.parseInt(date.substring(2, 4)));
              cal.set(Calendar.YEAR, Integer.parseInt(date.substring(4, 6)));
              trackpoint.setTimestamp(cal.getTime());
              trackpoint.setGroundSpeedKnots(Double.parseDouble(params[7]));
            }
            else if(params[0].equals("$GPGGA")) {
              nmea.put("GPGGA", s);
              trackpoint.setSatellites(Integer.parseInt(params[7]));
              trackpoint.setAltitude(Double.parseDouble(params[9]));
            }
            // $GPGSA implies the end of the NMEA data sequence
            else if(params[0].equals("$GPGSA")) {
              nmea.put("GPGSA", s);
              break;
            }
          }
          // FlightGear sends junk data at initialization and this is filtered out here
          if (trackpoint.getLatitude().getDegrees() != 0) {
            notifyTrackpointListeners(trackpoint);
            notifyNMEAListeners(nmea);
          }
          if (debug) System.out.println("FlightGearNMEAReceiver::run(): Data received");
        }
View Full Code Here

Examples of org.objectweb.speedo.pobjects.odis.Trackpoint

  private void createCompetition(){
    //create the competition
    Competition competition = new Competition(competitionId++);
    //create trackpoints
    Trackpoint trackpoint1 = new Trackpoint(trackpointId++);
    Trackpoint trackpoint2 = new Trackpoint(trackpointId++);
    Trackpoint trackpoint3 = new Trackpoint(trackpointId++);
    Trackpoint trackpoint4 = new Trackpoint(trackpointId++);
   
    competition.addTrackpoint(trackpoint1);
    competition.addTrackpoint(trackpoint2);
    competition.addTrackpoint(trackpoint3);
    competition.addTrackpoint(trackpoint4);
View Full Code Here

Examples of org.objectweb.speedo.pobjects.odis.Trackpoint

  public void testGetTrackpoints() {
    logger.log(BasicLevel.DEBUG, "**************testGetTrackpoints***********");
    //create the competition
    Competition competition = new Competition(1);
    //create trackpoints
    Trackpoint trackpoint1 = new Trackpoint(1);
    Trackpoint trackpoint2 = new Trackpoint(2);
    Trackpoint trackpoint3 = new Trackpoint(3);
    Trackpoint trackpoint4 = new Trackpoint(4);
   
    competition.addTrackpoint(trackpoint1);
    competition.addTrackpoint(trackpoint2);
    competition.addTrackpoint(trackpoint3);
    competition.addTrackpoint(trackpoint4);
   
    PersistenceManager pm = pmf.getPersistenceManager();
    //store the graph defined above in the datastore
    pm.currentTransaction().begin();
    //make persistent the competition
    // all the references reachable from this object will be made persistent
        pm.makePersistent(competition);
        pm.currentTransaction().commit();
       
        //get the id of competition
        Object idCompetition = pm.getObjectId(competition);
       
        Competition copyCompetition = (Competition) pm.getObjectById(idCompetition, true);
        //print the trackpoints
        Collection collection = copyCompetition.getTrackpoints();
        Iterator it = collection.iterator();
        logger.log(BasicLevel.DEBUG, "Collection length=" + collection.size());
        while(it.hasNext()){
          Trackpoint tp = (Trackpoint) it.next();
          logger.log(BasicLevel.DEBUG, "Trackpoint[id_order=" + tp.getId_order() + ",id_competition=" + tp.getId_competition() + "]");
        }
       
        //get the id of trackpoint1
        Object idTrackpoint = pm.getObjectId(trackpoint1);
        Trackpoint copyTrackpoint = (Trackpoint) pm.getObjectById(idTrackpoint, true);
        logger.log(BasicLevel.DEBUG, "competition: " + copyTrackpoint.getCompetition().getId());
       
        pm.close();       
  }
View Full Code Here

Examples of org.objectweb.speedo.pobjects.odis.Trackpoint

    while(itExtent.hasNext()) {
      comp =  (Competition)itExtent.next();
      logger.log(BasicLevel.DEBUG, "Competition: id=" + comp.getId() + ", tps=" + comp.getTrackpoints().toString());
      itTp = comp.getTrackpoints().iterator();
      while(itTp.hasNext()){
        Trackpoint tp = (Trackpoint) itTp.next();
        logger.log(BasicLevel.DEBUG, "Trackpoint: id_order=" + tp.getId_order() + ", id_competition=" + tp.getId_competition() );
      }
     
    }
    extent.closeAll();
   
View Full Code Here

Examples of org.tastefuljava.hiketools.geo.TrackPoint

            + 3.238272*y
            - 0.270978*y2
            - 0.002528*x2
            - 0.0447*y2*y
            - 0.0140*x3;
        return new TrackPoint(lat/0.3600, lon/0.3600, h, time);
    }
View Full Code Here

Examples of org.tastefuljava.hiketools.geo.TrackPoint

    }

    private static void processFile(File file, boolean gpx, boolean xol,
            boolean ele, double epsilon, File baseDir) throws Exception {
        File dir = file.getParentFile();
        TrackPoint trk[];
        String name = file.getName();
        if (name.toLowerCase().endsWith(".xol")) {
            trk = XolReader.readTrack(file);
        } else {
            trk = GpxReader.readTrack(file);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.