Package org.openstreetmap.josm.tools.date

Examples of org.openstreetmap.josm.tools.date.PrimaryDateParser


                    }
                }
            }
            if (dateStr != null) {
                dateStr = dateStr.replace('/', ':'); // workaround for HTC Sensation bug, see #7228
                return new PrimaryDateParser().parse(dateStr);
            }
        } catch (ParseException e) {
            throw e;
        } catch (Exception e) {
            Main.error(e);
View Full Code Here


            if (gpxW == null)
                return;
            GpxData gpx = gpxW.data;

            List<ImageEntry> imgs = getSortedImgList();
            PrimaryDateParser dateParser = new PrimaryDateParser();

            // no images found, exit
            if(imgs.size() <= 0) {
                JOptionPane.showMessageDialog(Main.parent,
                        tr("The selected photos do not contain time information."),
                        tr("Photos do not contain time information"), JOptionPane.WARNING_MESSAGE);
                return;
            }

            // Init variables
            long firstExifDate = imgs.get(0).getExifTime().getTime()/1000;

            long firstGPXDate = -1;
            // Finds first GPX point
            outer: for (GpxTrack trk : gpx.tracks) {
                for (GpxTrackSegment segment : trk.getSegments()) {
                    for (WayPoint curWp : segment.getWayPoints()) {
                        String curDateWpStr = (String) curWp.attr.get("time");
                        if (curDateWpStr == null) {
                            continue;
                        }

                        try {
                            firstGPXDate = dateParser.parse(curDateWpStr).getTime()/1000;
                            break outer;
                        } catch(Exception e) {
                            Main.warn(e);
                        }
                    }
View Full Code Here

     * All images need a exifTime attribute and the List must be sorted according to these times.
     */
    private int matchGpxTrack(List<ImageEntry> images, GpxData selectedGpx, long offset) {
        int ret = 0;

        PrimaryDateParser dateParser = new PrimaryDateParser();

        for (GpxTrack trk : selectedGpx.tracks) {
            for (GpxTrackSegment segment : trk.getSegments()) {

                long prevWpTime = 0;
                WayPoint prevWp = null;

                for (WayPoint curWp : segment.getWayPoints()) {

                    String curWpTimeStr = (String) curWp.attr.get("time");
                    if (curWpTimeStr != null) {

                        try {
                            long curWpTime = dateParser.parse(curWpTimeStr).getTime() + offset;
                            ret += matchPoints(images, prevWp, prevWpTime, curWp, curWpTime, offset);

                            prevWp = curWp;
                            prevWpTime = curWpTime;

View Full Code Here

TOP

Related Classes of org.openstreetmap.josm.tools.date.PrimaryDateParser

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.