Package slash.navigation.base

Examples of slash.navigation.base.BaseNavigationPosition


    protected boolean checkFormatDescriptor(ByteBuffer buffer) throws IOException {
        buffer.order(LITTLE_ENDIAN);
        buffer.position(0);

        // read first positions and validate the data
        BaseNavigationPosition previousPosition = null;
        while ((buffer.position() + 16) < buffer.capacity()) { //16: one Record
            /*short trackFlag*/
            buffer.getShort();
            int time = buffer.getInt();
            int latitude = buffer.getInt();
            int longitude = buffer.getInt();
            short altitude = buffer.getShort();
            BaseNavigationPosition position = createWaypoint(time, latitude, longitude, altitude, 1, false);

            boolean valid = position.getLatitude() < 90.0 && position.getLatitude() > -90.0 &&
                    position.getLongitude() < 180.0 && position.getLongitude() > -180.0 &&
                    position.getElevation() < 15000.0 &&
                    abs(position.getLatitude()) > 0.00001 &&
                    abs(position.getLongitude()) > 0.00001 &&
                    position.getTime().getCalendar().get(YEAR) > 1990;

            if (valid && previousPosition != null) {
                Double speed = position.calculateSpeed(previousPosition);
                valid = speed != null && speed < 1500.0 &&
                        previousPosition.getTime().getTimeInMillis() < position.getTime().getTimeInMillis();
            }

            if (!valid)
                return false;

View Full Code Here


                calendar.add(SECOND, -seconds.intValue());
                time = fromCalendar(calendar);
            }
            int positionNumber = positionsModel.getRowCount() + (positionInsertionCount - route.getPositionCount()) - 1;
            String description = instructions != null ? instructions : mapViewCallback.createDescription(positionNumber, null);
            BaseNavigationPosition position = route.createPosition(longitude, latitude, null, null, seconds != null ? time : null, description);
            if (!isDuplicate(before, position) && !isDuplicate(after, position)) {
                route.add(0, position);
            }
        }
        return route;
View Full Code Here

        }
        return null;
    }

    public void add(int rowIndex, Double longitude, Double latitude, Double elevation, Double speed, CompactCalendar time, String description) {
        BaseNavigationPosition position = getRoute().createPosition(longitude, latitude, elevation, speed, time, description);
        add(rowIndex, asList(position));
    }
View Full Code Here

    }

    @SuppressWarnings({"unchecked"})
    public void add(int rowIndex, List<BaseNavigationPosition> positions) {
        for (int i = positions.size() - 1; i >= 0; i--) {
            BaseNavigationPosition position = positions.get(i);
            getRoute().add(rowIndex, position);
        }
        fireTableRowsInserted(rowIndex, rowIndex - 1 + positions.size());
    }
View Full Code Here

    }

    // Undoable operations

    public void add(int rowIndex, Double longitude, Double latitude, Double elevation, Double speed, CompactCalendar time, String description) {
        BaseNavigationPosition position = getRoute().createPosition(longitude, latitude, elevation, speed, time, description);
        add(rowIndex, asList(position));

    }
View Full Code Here

TOP

Related Classes of slash.navigation.base.BaseNavigationPosition

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.