Examples of 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

Examples of net.sourceforge.gpstools.gpx.Gpx

            }
        }
    }

    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

Examples of net.sourceforge.gpstools.gpx.Gpx

    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

Examples of net.sourceforge.gpstools.gpx.Gpx

  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

Examples of net.sourceforge.gpstools.gpx.Gpx

    // 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

Examples of slash.navigation.gpx.binding10.Gpx

public class GpxFormatIT {

    @Test
    public void testReader() throws FileNotFoundException, JAXBException {
        Reader reader = new FileReader(TEST_PATH + "from10.gpx");
        Gpx gpx = (Gpx) GpxUtil.newUnmarshaller10().unmarshal(reader);
        assertNotNull(gpx);
        assertNotNull(gpx.getWpt());
        assertEquals(3, gpx.getWpt().size());
        assertNotNull(gpx.getRte());
        assertEquals(3, gpx.getRte().size());
        assertNotNull(gpx.getTrk());
        assertEquals(3, gpx.getRte().size());
    }
View Full Code Here

Examples of slash.navigation.gpx.binding10.Gpx

        return gpx;
    }

    private Gpx createGpx(List<GpxRoute> routes) {
        ObjectFactory objectFactory = new ObjectFactory();
        Gpx gpx = null;
        for(GpxRoute route : routes) {
            gpx = recycleGpx(route);
            if(gpx != null)
                break;
        }
        if (gpx == null || !reuseReadObjectsForWriting)
            gpx = objectFactory.createGpx();
        gpx.setCreator(GENERATED_BY);
        gpx.setVersion(VERSION);

        for (GpxRoute route : routes) {
            switch (route.getCharacteristics()) {
                case Waypoints:
                    createMetaData(route, gpx);
                    gpx.getWpt().addAll(createWayPoints(route, 0, route.getPositionCount()));
                    break;
                case Route:
                    gpx.getRte().addAll(createRoute(route, 0, route.getPositionCount()));
                    break;
                case Track:
                    gpx.getTrk().addAll(createTrack(route, 0, route.getPositionCount()));
                    break;
                default:
                    throw new IllegalArgumentException("Unknown RouteCharacteristics " + route.getCharacteristics());
            }
        }
View Full Code Here

Examples of slash.navigation.gpx.binding10.Gpx

    }

    public void read(InputStream source, CompactCalendar startDate, ParserContext<GpxRoute> context) throws Exception {
        InputStreamReader reader = new InputStreamReader(source);
        try {
            Gpx gpx = unmarshal10(reader);
            process(gpx, context);
        }
        finally {
            reader.close();
        }
View Full Code Here

Examples of slash.navigation.gpx.binding10.Gpx

        context.appendRoutes(extractRoutes(gpx, hasSpeedInKiloMeterPerHourInsteadOfMeterPerSecond));
        context.appendRoutes(extractTracks(gpx, hasSpeedInKiloMeterPerHourInsteadOfMeterPerSecond));
    }

    public void read(InputStream source, CompactCalendar startDate, ParserContext<GpxRoute> context) throws Exception {
        Gpx gpx = unmarshal10(source);
        process(gpx, context);
    }
View Full Code Here

Examples of slash.navigation.gpx.binding10.Gpx

        trk.getTrkseg().add(trkseg);
        return trks;
    }

    private Gpx recycleGpx(GpxRoute route) {
        Gpx gpx = route.getOrigin(Gpx.class);
        if (gpx != null) {
            gpx.getRte().clear();
            gpx.getTrk().clear();
            gpx.getWpt().clear();
        }
        return gpx;
    }
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.