Package slash.navigation.common

Examples of slash.navigation.common.NavigationPosition


        int polylinesCount = ceiling(positions.size(), maximumPolylineSegmentLength, true);
        for (int j = 0; j < polylinesCount; j++) {
            StringBuilder latlngs = new StringBuilder();
            int maximum = min(positions.size(), (j + 1) * maximumPolylineSegmentLength + 1);
            for (int i = j * maximumPolylineSegmentLength; i < maximum; i++) {
                NavigationPosition position = positions.get(i);
                latlngs.append("new google.maps.LatLng(").append(position.getLatitude()).append(",").
                        append(position.getLongitude()).append(")");
                if (i < maximum - 1)
                    latlngs.append(",");
            }
            executeScript("addPolyline([" + latlngs + "],\"#" + color + "\"," + width + ");");
        }
View Full Code Here


        int markersCount = ceiling(positions.size(), maximumMarkerSegmentLength, false);
        for (int j = 0; j < markersCount; j++) {
            StringBuilder buffer = new StringBuilder();
            int maximum = min(positions.size(), (j + 1) * maximumMarkerSegmentLength);
            for (int i = j * maximumMarkerSegmentLength; i < maximum; i++) {
                NavigationPosition position = positions.get(i);
                buffer.append("addMarker(").append(position.getLatitude()).append(",").
                        append(position.getLongitude()).append(",").
                        append("\"").append(escape(position.getDescription())).append("\",").
                        append(showWaypointDescription).append(");\n");
            }
            executeScript(buffer.toString());
        }
        removeOverlays();
View Full Code Here

                    append(boundingBox.getNorthEast().getLongitude()).append(");\n");
            ignoreNextZoomCallback = true;
        }

        if (haveToInitializeMapOnFirstStart) {
            NavigationPosition center;
            // if there are positions right at the start center on them else take the last known center and zoom
            if (positions.size() > 0) {
                center = new BoundingBox(positions).getCenter();
            } else {
                int zoom = getZoom();
                buffer.append("setZoom(").append(zoom).append(");\n");
                center = getLastMapCenter();
            }
            buffer.append("setCenter(").append(center.getLatitude()).append(",").append(center.getLongitude()).append(");\n");
        }
        executeScript(buffer.toString());
        haveToInitializeMapOnFirstStart = false;

        if (fitBoundsToPositions) {
View Full Code Here

    private void selectPositions(List<NavigationPosition> selectedPositions, NavigationPosition center) {
        lastSelectedPositions = new ArrayList<>(selectedPositions);

        StringBuilder buffer = new StringBuilder();
        for (int i = 0; i < selectedPositions.size(); i++) {
            NavigationPosition selectedPosition = selectedPositions.get(i);
            buffer.append("selectPosition(").append(selectedPosition.getLatitude()).append(",").
                    append(selectedPosition.getLongitude()).append(",").
                    append("\"").append(escape(selectedPosition.getDescription())).append("\",").
                    append(i).append(");\n");
        }

        if (center != null && center.hasCoordinates())
            buffer.append("panTo(").append(center.getLatitude()).append(",").append(center.getLongitude()).append(");\n");
View Full Code Here

        return new Wgs84Route(this, characteristics, (List<Wgs84Position>) positions);
    }

    public BaseNavigationPosition getDuplicateFirstPosition(BaseRoute<BaseNavigationPosition, BaseNavigationFormat> route) {
        List<BaseNavigationPosition> positions = route.getPositions();
        NavigationPosition first = positions.get(0);
        return asWgs84Position(first.getLongitude(), first.getLatitude(), "Start:" + first.getDescription());
    }
View Full Code Here

        insertWaypointsExecutor.execute(new Runnable() {
            public void run() {
                for (Integer key : addToQueue.keySet()) {
                    PositionPair pair = addToQueue.get(key);
                    NavigationPosition origin = pair.getFirst();
                    NavigationPosition destination = pair.getSecond();
                    StringBuilder buffer = new StringBuilder();
                    buffer.append(mode).append("({");
                    buffer.append("origin: new google.maps.LatLng(").append(origin.getLatitude()).append(",").append(origin.getLongitude()).append("), ");
                    buffer.append("destination: new google.maps.LatLng(").append(destination.getLatitude()).append(",").append(destination.getLongitude()).append("), ");
                    buffer.append("travelMode: google.maps.DirectionsTravelMode.").append(mapViewCallback.getTravelMode().getName().toUpperCase()).append(", ");
                    buffer.append("avoidFerries: ").append(mapViewCallback.isAvoidFerries()).append(", ");
                    buffer.append("avoidHighways: ").append(mapViewCallback.isAvoidHighways()).append(", ");
                    buffer.append("avoidTolls: ").append(mapViewCallback.isAvoidTolls()).append(", ");
                    buffer.append("region: \"").append(Locale.getDefault().getCountry().toLowerCase()).append("\"}, ");
View Full Code Here

            }

            if (coordinates.size() < 5 || pair == null)
                return true;

            final NavigationPosition before = pair.getFirst();
            NavigationPosition after = pair.getSecond();
            final BaseRoute route = parseRoute(coordinates, before, after);
            synchronized (notificationMutex) {
                int row = positions.indexOf(before) + 1;
                insertPositions(row, route);
            }
View Full Code Here

    private void centerChanged(Double longitude, Double latitude) {
        preferences.putDouble(CENTER_LATITUDE_PREFERENCE, latitude);
        preferences.putDouble(CENTER_LONGITUDE_PREFERENCE, longitude);

        if (positionReducer.hasFilteredVisibleArea()) {
            NavigationPosition mapNorthEast = getNorthEastBounds();
            NavigationPosition mapSouthWest = getSouthWestBounds();

            if (!positionReducer.isWithinVisibleArea(mapNorthEast, mapSouthWest)) {
                synchronized (notificationMutex) {
                    haveToRepaintRouteImmediately = true;
                    routeUpdateReason = "repaint not visible positions";
View Full Code Here

        positionsSelectionModel.setSelectedPositions(rows, true);
        mapViewCallback.complementData(rows, true, true, true);
    }

    private int getAddRow() {
        NavigationPosition position = lastSelectedPositions.size() > 0 ? lastSelectedPositions.get(lastSelectedPositions.size() - 1) : null;
        // quite crude logic to be as robust as possible on failures
        if (position == null && positionsModel.getRowCount() > 0)
            position = positionsModel.getPosition(positionsModel.getRowCount() - 1);
        return position != null ? positionsModel.getIndex(position) + 1 : 0;
    }
View Full Code Here

            position = positionsModel.getPosition(positionsModel.getRowCount() - 1);
        return position != null ? positionsModel.getIndex(position) + 1 : 0;
    }

    private int getMoveRow(int index) {
        NavigationPosition position = lastSelectedPositions.get(index);
        final int row;
        synchronized (notificationMutex) {
            row = positions.indexOf(position);
        }
        return row;
View Full Code Here

TOP

Related Classes of slash.navigation.common.NavigationPosition

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.