Package slash.navigation.common

Examples of slash.navigation.common.NavigationPosition


        return POSITION + " " + (index + 1);
    }

    public static void commentPositions(List<? extends NavigationPosition> positions) {
        for (int i = 0; i < positions.size(); i++) {
            NavigationPosition position = positions.get(i);
            String original = position.getDescription();
            String modified = getPositionComment(position, i);
            if (original == null || !original.equals(modified))
                position.setDescription(modified);
        }
    }
View Full Code Here


        assertNotNull(result);
        assertEquals(GoogleMapsUrlFormat.class, result.getFormat().getClass());
        assertEquals(1, result.getAllRoutes().size());
        BaseRoute<BaseNavigationPosition, BaseNavigationFormat> route = result.getTheRoute();
        assertEquals(9, route.getPositionCount());
        NavigationPosition position = route.getPositions().get(route.getPositionCount() - 1);
        assertEquals("W Irlo Bronson Mem Hwy/US-192 W", position.getDescription());
        assertNotNull(position.getLongitude());
        assertNotNull(position.getLatitude());
    }
View Full Code Here

        return new NmnRoute(this, characteristics, null, (List<NmnPosition>) positions);
    }

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

        assertEquals(null, service.getLocationFor(90.0, 90.0));
    }

    @Test
    public void getPositionFor() throws IOException {
        NavigationPosition expected = new SimpleNavigationPosition(10.2004684, 50.0010183, 0.0, "B\u00fchlstra\u00dfe, 97506 Grafenrheinfeld, Germany");
        NavigationPosition actual = service.getPositionFor("B\u00fchlstra\u00dfe, 97506 Grafenrheinfeld, Germany");
        assertEquals(expected, actual);
    }
View Full Code Here

        assertEquals(expected, actual);
    }

    @Test
    public void getPositionsFor() throws IOException {
        NavigationPosition expected = new SimpleNavigationPosition(10.2004684, 50.0010183, 0.0, "B\u00fchlstra\u00dfe, 97506 Grafenrheinfeld, Germany");
        List<NavigationPosition> actual = service.getPositionsFor("B\u00fchlstra\u00dfe, 97506 Grafenrheinfeld, Germany");
        assertEquals(asList(expected), actual);
    }
View Full Code Here

    List<NavigationPosition> filterVisiblePositions(List<NavigationPosition> positions,
                                                    double threshold, boolean includeFirstAndLastPosition) {
        long start = currentTimeMillis();

        NavigationPosition northEast = callback.getNorthEastBounds();
        NavigationPosition southWest = callback.getSouthWestBounds();
        if (northEast == null || southWest == null)
            return positions;

        double width = abs(northEast.getLongitude() - southWest.getLongitude()) * threshold;
        double height = abs(southWest.getLatitude() - northEast.getLatitude()) * threshold;
        northEast.setLongitude(northEast.getLongitude() + width);
        northEast.setLatitude(northEast.getLatitude() + height);
        southWest.setLongitude(southWest.getLongitude() - width);
        southWest.setLatitude(southWest.getLatitude() - height);
        BoundingBox boundingBox = new BoundingBox(northEast, southWest);

        List<NavigationPosition> result = new ArrayList<NavigationPosition>();

        if (includeFirstAndLastPosition)
            result.add(positions.get(0));

        int firstIndex = includeFirstAndLastPosition ? 1 : 0;
        int lastIndex = includeFirstAndLastPosition ? positions.size() - 1 : positions.size();

        NavigationPosition previousPosition = positions.get(firstIndex);
        boolean previousPositionVisible = boundingBox.contains(previousPosition);

        for (int i = firstIndex; i < lastIndex; i += 1) {
            NavigationPosition position = positions.get(i);
            boolean visible = boundingBox.contains(position);
            if (visible) {
                // if the previous position was not visible but the current position is visible:
                // add the previous position to render transition from non-visible to visible area
                if (!previousPositionVisible && previousPosition != null)
View Full Code Here

        // Top. Karte 1:50.000 Nieders.
        // Top. Karte 1:50000 Sh/HH
        writeMissingAttribute(route.getMapLage(), writer, "MapName", "Bundesrepublik 1:1 Mio");
        writeMissingAttribute(route.getMapLage(), writer, "DimmFc", "100");
        writeMissingAttribute(route.getMapLage(), writer, "ZoomFc", "100");
        NavigationPosition center = new BoundingBox(route.getPositions()).getCenter();
        writeMissingAttribute(route.getMapLage(), writer, "CenterLat", formatPositionAsString(center.getLatitude()));
        writeMissingAttribute(route.getMapLage(), writer, "CenterLong", formatPositionAsString(center.getLongitude()));
        writer.println(CREATOR + NAME_VALUE_SEPARATOR + GENERATED_BY);
    }
View Full Code Here

                Wgs84Route track = createRoute(Track, null, trackPoints);
                result.add(track);
                trackPointNo = 1;

                // trackname = time of first point
                NavigationPosition newPoint = createWaypoint(time, latitude, longitude, altitude, 0, true);
                track.setName(createDateFormat(TRACK_NAME_DATE_FORMAT).format(newPoint.getTime().getTime()));
            }

            if ((trackFlag & 2) == 2) {
                // track pushpoint
                if (pushPoints == null) {
View Full Code Here

                        } else
                            continue;
                    }

                    List<NavigationPosition> render = positionReducer.reduceSelectedPositions(copiedPositions, copiedSelectedPositionIndices);
                    NavigationPosition centerPosition = render.size() > 0 ? new BoundingBox(render).getCenter() : null;
                    selectPositions(render, recenter ? centerPosition : null);
                    log.info("Selected positions updated for " + render.size() + " positions, recentering: " + recenter + " to: " + centerPosition);
                    lastTime = currentTimeMillis();
                }
            }
View Full Code Here

        for (int j = 0; j < directionsCount; j++) {
            StringBuilder waypoints = new StringBuilder();
            int start = max(0, j * maximumRouteSegmentLength - 1);
            int end = min(positions.size(), (j + 1) * maximumRouteSegmentLength) - 1;
            for (int i = start + 1; i < end; i++) {
                NavigationPosition position = positions.get(i);
                waypoints.append("{location: new google.maps.LatLng(").append(position.getLatitude()).append(",").
                        append(position.getLongitude()).append(")}");
                if (i < end - 1)
                    waypoints.append(",");
            }
            NavigationPosition origin = positions.get(start);
            NavigationPosition destination = positions.get(end);
            StringBuilder buffer = new StringBuilder();
            buffer.append("renderDirections({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("waypoints: [").append(waypoints).append("], ").
                    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(", ");
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.