Examples of Wpt


Examples of net.sourceforge.gpstools.gpx.Wpt

        }
    }

    /** Sets the location Wpt properties from a raw XMP tag key-value-pair.*/
    private void setGPSProperty(String key, String value) throws ParseException{
        Wpt location = xmp.location;
        if(key.equals("GPSAltitude")){
            BigDecimal val = parseRational(key, value);
            if (location.getEle() != null){
                val = location.getEle().multiply(val);
            }
            location.setEle(val);
        } else if (key.equals("GPSAltitudeRef")){
            int val = Integer.parseInt(value);
            switch(val){
                case 0: //above sea level: nothing to do
                    break;
                case 1: //below sea level
                    BigDecimal dval = new BigDecimal(-1);
                    if(location.getEle() == null){
                        location.setEle(dval);
                    } else {
                        location.setEle(dval.multiply(location.getEle()));
                    }
                    break;
                default:
                    throw new ParseException("Illegal value " + value + " for GPSAltitudeRef.",0);
            }
        } else if (key.equals("GPSLatitude")){
            location.setLat(parseCoordinate(key, value));
        } else if (key.equals("GPSLongitude")){
            location.setLon(parseCoordinate(key, value));
        } else if (key.equals("GPSMapDatum")){
            if(value == null || value.equals("")){
                System.err.println("Warning: GPS datum missing. Assuming WGS84.");
            } else if(!value.toUpperCase().replaceAll("[^0-9A-Z]", "").equals("WGS84")){
                throw new ParseException("Unsupported map datum: " + value.toString() +
                ". Currently only the WGS84 map datum is supported.", 0);
            }
        } else if (key.equals("GPSVersionID")){
            if(!"2.0.0.0".equals(value)){
                throw new ParseException("Unsupported GPSVersionID: " + value,0);
            }
        } else if (key.equals("GPSTimeStamp")){
            location.setTime(parseDate(value).getTime());
        }
    }
View Full Code Here

Examples of net.sourceforge.gpstools.gpx.Wpt

        all files handed as arguments. **/
    public static void main(String[] argv) throws Exception{
        IIOXMPReader me = new IIOXMPReader();
        TrackInterpolator tp = new TrackInterpolator();
        for(String f: argv){
            Wpt pt = me.readGPSTag(new File(f));
            if(pt != null){
                tp.printWpt(System.out,pt);
            }
        }
        me.releaseResources();
View Full Code Here

Examples of net.sourceforge.gpstools.gpx.Wpt

     * least latitude and longitude
     * information was found, <code>null</code> otherwise
     **/
    @Override
    public Wpt readGPSTag(File jpeg) throws IOException{
        Wpt gps = null;
        XMPProperties xmp = null;
        try{
            xmp = readXMP(jpeg);
        } catch (XMPReadException xrx){
            throw xrx.toIOException();
        }
        if(xmp != null){
            gps = xmp.getWpt();
            //System.out.println(gps.getLat());
            //System.out.println(gps.getLon());
            if (
                gps != null &&
                (gps.getLat() == null || gps.getLon() == null)
            ){
               gps = null;
            }
        }
        if(gps == null){
View Full Code Here

Examples of net.sourceforge.gpstools.gpx.Wpt

        TrackInterpolator tp = new TrackInterpolator();
        for(String f: argv){
            File ff = new File(f);
            System.out.println(f);
            System.out.println(me.readJPEGDimension(ff));
            Wpt pt = me.readGPSTag(ff);
            if(pt != null){
                tp.printWpt(System.out,pt);
            }
        }
    }
View Full Code Here

Examples of net.sourceforge.gpstools.gpx.Wpt

        return d;
    }

    @Override
    public Wpt readGPSTag(File jpeg) throws IOException, ParseException{
        Wpt result = delegate.readGPSTag(jpeg);
        if(result != null && result.getTime() == null){
           try{
               result.setTime(readOriginalUTCTime(jpeg));
           } catch (Exception ex){
               throw new Error(ex);
           }
        }
        return result;
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.