Package net.sourceforge.gpstools.gpx

Examples of net.sourceforge.gpstools.gpx.Gpx


    public void addElevations(File[] input) throws IOException, DEMException {
        for (File f : input) {
            try {
                InputStream in = new FileInputStream(f);
                try {
                    Gpx gpx = GPSDings.readGPX(in);
                    this.addElevations(gpx);
                    File outFile = new File(this.getOutputDirectory(),
                            f.getName());
                    OutputStream out = new FileOutputStream(outFile);
                    try {
View Full Code Here


            }
        }
    }

    public static Gpx readGPX(InputStream in) throws IOException {
        Gpx gpx = null;
        final InputStream bin = (in instanceof BufferedInputStream) ? in
                : new BufferedInputStream(in);
        // Does not have the desired effect.
        DateFieldHandler.setDefaultTimeZone(UTC);
        try {
View Full Code Here

    private int c = 0;
    private boolean appendZ = false;

    public GpxHandler() {
        this.unmarshaller = new Unmarshaller(Gpx.class);
        this.gpx = new Gpx();
        unmarshaller.setObject(gpx);
        super.setContentHandler(unmarshaller.createHandler());
    }
View Full Code Here

  public GpxType generaGPX(List<HistoricoGPS> historico) throws IOException {

    Metadata metadata = new Metadata();
    metadata.setDesc("Recorrido de " + recurso);
    metadata.setTime(new Date());
    GpxType gpx = new Gpx();
    gpx.setCreator(CREATOR);
    gpx.setMetadata(metadata);

    Trk track = new Trk();
    track.setName(recurso);
    Trkseg segmento = new Trkseg();
    for (HistoricoGPS hist : historico) {
      Geometry geom = hist.getGeom();
      if (geom != null && geom.getCentroid().getX() != 0.0d
          && geom.getCentroid().getY() != 0.0d) {

        Trkpt punto = new Trkpt();
        punto.setLon(BigDecimal.valueOf(geom.getCentroid().getX()));
        punto.setLat(BigDecimal.valueOf(geom.getCentroid().getY()));
        punto.setTime(hist.getMarcaTemporal());
        punto.setName(recurso
            + " "
            + DateFormat.getDateInstance(DateFormat.SHORT, LOCALE)
                .format(new Date(hist.getMarcaTemporal()
                    .getTime()))
            + " "
            + DateFormat.getTimeInstance(DateFormat.MEDIUM, LOCALE)
                .format(new Date(hist.getMarcaTemporal()
                    .getTime())));

        segmento.addTrkpt(punto);
      }

    }
    track.addTrkseg(segmento);
    gpx.addTrk(track);
    return gpx;

  }
View Full Code Here

    // Import the data from a GPX file. Boolean indicates whether data has been imported before
    public void addData(File file, boolean firsttime) throws IOException, FunctionEvaluationException {

        // Start by reading the file and analyzing it contents
        Gpx gpx = GPSDings.readGPX(new FileInputStream(file));
        TrackAnalyzer analyzer = new TrackAnalyzer();
        analyzer.addAllTracks(gpx);
        // The garmin GPX running data contains only one track containing one segment
        Trkseg track = gpx.getTrk(0).getTrkseg(0);

        // Start a new transaction
        Transaction tx = graphDb.beginTx();
        // Contains the record that was added previously (in order to create a relation between the new and the previous node)
        SpatialDatabaseRecord fromrecord = null;
View Full Code Here

TOP

Related Classes of net.sourceforge.gpstools.gpx.Gpx

Copyright © 2018 www.massapicom. 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.