Package slash.navigation.itn

Examples of slash.navigation.itn.TomTomPosition


    public GpxPosition asTcxPosition() {
        return asGpxPosition();
    }

    public TomTomPosition asTomTomRoutePosition() {
        return new TomTomPosition(getLongitude(), getLatitude(), getElevation(), getSpeed(), getTime(), getDescription());
    }
View Full Code Here


    public NmeaPosition asNmeaPosition() {
        return this;
    }

    public TomTomPosition asTomTomRoutePosition() {
        TomTomPosition position = super.asTomTomRoutePosition();
        position.setHeading(getHeading());
        return position;
    }
View Full Code Here

    }

    protected TomTomRoute asTomTomRouteFormat(TomTomRouteFormat format) {
        List<TomTomPosition> tomTomPositions = new ArrayList<TomTomPosition>();
        for (BcrPosition bcrPosition : positions) {
            TomTomPosition tomTomPosition = bcrPosition.asTomTomRoutePosition();
            // shortens description to better fit to Tom Tom Rider display
            String city = bcrPosition.getCity();
            String street = bcrPosition.getStreet();
            if (city != null)
                tomTomPosition.setDescription(city + (street != null && !BcrPosition.STREET_DEFINES_CENTER_SYMBOL.equals(street) ? "," + street : ""));
            tomTomPositions.add(tomTomPosition);
        }
        return new TomTomRoute(format, getCharacteristics(), getName(), tomTomPositions);
    }
View Full Code Here

        if (matcher.matches()) {
            position.setTime(parseTripmaster14Time(matcher.group(2)));
            position.setElevation(parseDouble(matcher.group(3)));

            if (position instanceof TomTomPosition) {
                TomTomPosition tomTomPosition = (TomTomPosition) position;
                String reason = trim(matcher.group(1));
                tomTomPosition.setReason(reason);
                tomTomPosition.setHeading(parseTripmasterHeading(reason));
                tomTomPosition.setCity(trim(matcher.group(4)));
            }

            if  (position instanceof Wgs84Position) {
                Wgs84Position wgs84Position = (Wgs84Position) position;
                String reason = trim(matcher.group(1));
                wgs84Position.setHeading(parseTripmasterHeading(reason));
            }
        }

        matcher = TRIPMASTER_18_SHORT_STARTEND_PATTERN.matcher(comment);
        if (matcher.matches()) {
            String dateStr = trim(matcher.group(4));
            String timeStr = trim(matcher.group(5));
            position.setTime(parseTripmaster18Date(dateStr + " " + timeStr));
            if (!position.hasTime())
                position.setTime(parseTripmaster14Time(timeStr));
            position.setElevation(parseDouble(matcher.group(6)));

            if (position instanceof TomTomPosition) {
                TomTomPosition tomTomPosition = (TomTomPosition) position;
                String city = trim(matcher.group(3));
                if (city == null) {
                    city = dateStr;
                    dateStr = null;
                }
                tomTomPosition.setReason(trim(matcher.group(1)) + " : " + (dateStr != null ? dateStr + " - " : "") + timeStr);
                tomTomPosition.setCity(city);
            }
        }

        matcher = TRIPMASTER_18_SHORT_WAYPOINT_PATTERN.matcher(comment);
        if (matcher.matches()) {
            position.setTime(parseTripmaster14Time(matcher.group(1)));
            position.setElevation(parseDouble(matcher.group(2)));

            if (position instanceof TomTomPosition) {
                TomTomPosition tomTomPosition = (TomTomPosition) position;
                tomTomPosition.setReason("Waypoint");
                tomTomPosition.setCity(null);
            }

        }

        matcher = TRIPMASTER_25_SHORT_WAYPOINT_PATTERN.matcher(comment);
        if (matcher.matches()) {
            position.setTime(parseTripmaster14Time(trim(matcher.group(1))));
            position.setElevation(parseDouble(matcher.group(3)));

            if (position instanceof TomTomPosition) {
                TomTomPosition tomTomPosition = (TomTomPosition) position;
                String reason = trim(matcher.group(2));
                tomTomPosition.setReason(reason);
                tomTomPosition.setHeading(parseTripmasterHeading(reason));
                tomTomPosition.setCity(null);
            }

            if  (position instanceof Wgs84Position) {
                Wgs84Position wgs84Position = (Wgs84Position) position;
                String reason = trim(matcher.group(2));
                wgs84Position.setHeading(parseTripmasterHeading(reason));
            }
        }

        matcher = TRIPMASTER_25_SHORT_STARTEND_PATTERN.matcher(comment);
        if (matcher.matches()) {
            String dateStr = trim(matcher.group(4));
            String timeStr = trim(matcher.group(5));
            position.setTime(parseTripmaster18Date(dateStr + " " + timeStr));
            position.setElevation(parseDouble(matcher.group(6)));

            if (position instanceof TomTomPosition) {
                TomTomPosition tomTomPosition = (TomTomPosition) position;
                String reason = trim(matcher.group(2));
                tomTomPosition.setReason(reason);
                tomTomPosition.setCity(null);
            }
        }

        matcher = TRIPMASTER_31_SHORT_STARTEND_PATTERN.matcher(comment);
        if (matcher.matches()) {
            String dateStr = trim(matcher.group(4));
            String timeStr = trim(matcher.group(5));
            position.setTime(parseTripmaster18Date(dateStr + " " + timeStr));
            position.setElevation(parseDouble(matcher.group(6)));

            if (position instanceof TomTomPosition) {
                TomTomPosition tomTomPosition = (TomTomPosition) position;
                String reason = trim(matcher.group(2));
                tomTomPosition.setReason(reason);
                tomTomPosition.setCity(null);
            }
        }

        matcher = TRIPMASTER_MIDDLE_PATTERN.matcher(comment);
        if (matcher.matches()) {
            position.setTime(parseTripmaster14Time(trim(matcher.group(1))));
            position.setElevation(parseDouble(matcher.group(4)));

            if (position instanceof TomTomPosition) {
                TomTomPosition tomTomPosition = (TomTomPosition) position;
                String city = trim(matcher.group(3));
                if (city != null && city.startsWith(": "))
                    city = trim(city.substring(2, city.length()));
                String reason = trim(matcher.group(2));
                if (reason == null)
                    reason = city;
                tomTomPosition.setCity(city);
                tomTomPosition.setReason(reason);
            }
        }

        matcher = TRIPMASTER_LONG_NO_REASON_PATTERN.matcher(comment);
        if (matcher.matches()) {
            position.setTime(parseTripmaster14Time(trim(matcher.group(1))));
            position.setSpeed(parseDouble(matcher.group(6)));
            position.setElevation(parseDouble(matcher.group(3)));

            if (position instanceof TomTomPosition) {
                TomTomPosition tomTomPosition = (TomTomPosition) position;
                String city = trim(matcher.group(2));
                if (city != null && city.startsWith(": "))
                    city = trim(city.substring(2, city.length()));
                tomTomPosition.setCity(city);
                tomTomPosition.setReason(city);
            }
        }

        matcher = TRIPMASTER_LONG_PATTERN.matcher(comment);
        if (matcher.matches()) {
            position.setTime(parseTripmaster18Date(matcher.group(3)));
            if (!position.hasTime())
                position.setTime(parseTripmaster14Time(matcher.group(1)));
            position.setSpeed(parseDouble(matcher.group(9)));
            position.setElevation(parseDouble(matcher.group(6)));

            if (position instanceof TomTomPosition) {
                TomTomPosition tomTomPosition = (TomTomPosition) position;
                String city = trim(matcher.group(5));
                if (city != null && city.startsWith(": "))
                    city = trim(city.substring(2, city.length()));
                String reason = trim(matcher.group(2));
                if (city == null)
                    city = reason;
                tomTomPosition.setCity(city);
                tomTomPosition.setReason(reason);
            }
        }

        matcher = LOGPOS_2_PATTERN.matcher(comment);
        if (matcher.matches()) {
            position.setTime(parseLogposDate(matcher.group(1)));
            position.setSpeed(parseDouble(matcher.group(5)));

            if (position instanceof TomTomPosition) {
                TomTomPosition tomTomPosition = (TomTomPosition) position;
                tomTomPosition.setReason(trim(matcher.group(4)));
                tomTomPosition.setCity(trim(matcher.group(3)));
                tomTomPosition.setHeading(parseDouble(matcher.group(6)));
            }
        }

        matcher = LOGPOS_1_PATTERN.matcher(comment);
        if (matcher.matches()) {
            position.setTime(parseLogposDate(matcher.group(1)));
            Double elevation;
            try {
                elevation = parseDouble(matcher.group(4));
            } catch (NumberFormatException e) {
                elevation = null;
            }
            position.setElevation(elevation);
            position.setSpeed(parseDouble(matcher.group(7)));

            if (position instanceof TomTomPosition) {
                TomTomPosition tomTomPosition = (TomTomPosition) position;
                tomTomPosition.setReason(trim(matcher.group(5)));
                tomTomPosition.setCity(trim(matcher.group(3)));
                tomTomPosition.setHeading(parseDouble(matcher.group(8)));
            }
        }

        matcher = TTTRACKLOG_PATTERN.matcher(comment);
        if (matcher.matches()) {
            position.setTime(parseTTTracklogTime(matcher.group(1)));
            position.setSpeed(parseDouble(matcher.group(5)));
            Double elevation = parseDouble(matcher.group(6));
            if(elevation == null)
                elevation = parseDouble(matcher.group(4)); // pause with elevation
            position.setElevation(elevation);
            if (position instanceof TomTomPosition) {
                TomTomPosition tomTomPosition = (TomTomPosition) position;
                tomTomPosition.setReason(trim(matcher.group(2)));
            }
        }

        matcher = ROUTECONVERTER_STARTEND_PATTERN.matcher(comment);
        if (matcher.matches()) {
            String dateStr = trim(matcher.group(4));
            String timeStr = trim(matcher.group(5));
            position.setTime(parseTripmaster18Date(dateStr + " " + timeStr));
            position.setElevation(parseDouble(matcher.group(6)));
            position.setSpeed(parseDouble(matcher.group(7)));

            if (position instanceof TomTomPosition) {
                TomTomPosition tomTomPosition = (TomTomPosition) position;
                String reason = trim(matcher.group(2));
                tomTomPosition.setReason(reason);
                String city = trim(matcher.group(3));
                tomTomPosition.setCity(city);
                tomTomPosition.setHeading(parseDouble(matcher.group(9)));
            }
        }

        matcher = ROUTECONVERTER_INTERMEDIATE_PATTERN.matcher(comment);
        if (matcher.matches()) {
            String timeStr = trim(matcher.group(2));
            position.setTime(parseTripmaster14Time(timeStr));
            position.setElevation(parseDouble(matcher.group(3)));
            position.setSpeed(parseDouble(matcher.group(4)));

            if (position instanceof TomTomPosition) {
                TomTomPosition tomTomPosition = (TomTomPosition) position;
                String city = trim(matcher.group(1));
                tomTomPosition.setCity(city);
                tomTomPosition.setHeading(parseDouble(matcher.group(6)));
            }
        }
    }
View Full Code Here

        position.setSatellites(getSatellites());
        return position;
    }

    public TomTomPosition asTomTomRoutePosition() {
        TomTomPosition position = super.asTomTomRoutePosition();
        position.setHeading(getHeading());
        return position;
    }
View Full Code Here

        if (sourcePosition instanceof Wgs84Position) {
            Wgs84Position wgs84Position = (Wgs84Position) sourcePosition;
            sourceHeading = wgs84Position.getHeading();
        }
        if (sourcePosition instanceof TomTomPosition) {
            TomTomPosition tomTomPosition = (TomTomPosition) sourcePosition;
            sourceHeading = tomTomPosition.getHeading();
        }
        if (sourcePosition instanceof NmeaPosition) {
            NmeaPosition nmeaPosition = (NmeaPosition) sourcePosition;
            sourceHeading = nmeaPosition.getHeading();
        }

        Double targetHeading = null;
        if (targetPosition instanceof Wgs84Position) {
            Wgs84Position wgs84TargetPosition = (Wgs84Position) targetPosition;
            targetHeading = wgs84TargetPosition.getHeading();
        }
        if (targetPosition instanceof TomTomPosition) {
            TomTomPosition tomTomPosition = (TomTomPosition) targetPosition;
            targetHeading = tomTomPosition.getHeading();
        }
        if (targetPosition instanceof NmeaPosition) {
            NmeaPosition nmeaPosition = (NmeaPosition) targetPosition;
            targetHeading = nmeaPosition.getHeading();
        }
View Full Code Here

TOP

Related Classes of slash.navigation.itn.TomTomPosition

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.