use of com.mapbox.geojson.Point in project mapbox-navigation-android by mapbox.
the class NavigationView method initMapPadding.
/**
* Create a top map padding value that pushes the focal point
* of the map to the bottom of the screen (above the bottom sheet).
*/
private void initMapPadding() {
int mapViewHeight = mapView.getHeight();
int bottomSheetHeight = summaryBottomSheet.getHeight();
int topPadding = mapViewHeight - (bottomSheetHeight * 4);
map.setPadding(0, topPadding, 0, 0);
}
use of com.mapbox.geojson.Point in project mapbox-plugins-android by mapbox.
the class LocationLayer method onNewLatLngValue.
@Override
public void onNewLatLngValue(LatLng latLng) {
Point point = Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude());
setLocationPoint(point);
}
use of com.mapbox.geojson.Point in project mapbox-navigation-android by mapbox.
the class MeasurementUtilsTest method userTrueDistanceFromStep_onePointStepGeometryWithDifferentRawPoint.
@Test
public void userTrueDistanceFromStep_onePointStepGeometryWithDifferentRawPoint() {
Point futurePoint = Point.fromLngLat(-95.3676974, 29.7589382);
List<Point> geometryPoints = new ArrayList<>();
geometryPoints.add(Point.fromLngLat(-95.8427, 29.7757));
geometryPoints.add(futurePoint);
double[] rawLocation = { 0, 0 };
LegStep step = getLegStep(rawLocation, geometryPoints);
double distance = MeasurementUtils.userTrueDistanceFromStep(futurePoint, step);
assertEquals(0.04457271773629306d, distance, DELTA);
}
use of com.mapbox.geojson.Point in project mapbox-navigation-android by mapbox.
the class ToleranceUtilsTest method dynamicRerouteDistanceTolerance_userJustPastTheIntersection.
@Test
public void dynamicRerouteDistanceTolerance_userJustPastTheIntersection() throws Exception {
RouteProgress routeProgress = RouteProgress.builder().directionsRoute(response.routes().get(0)).legDistanceRemaining(0).distanceRemaining(0).stepIndex(0).legIndex(0).build();
double distanceToIntersection = response.routes().get(0).distance();
LineString lineString = LineString.fromPolyline(response.routes().get(0).geometry(), Constants.PRECISION_6);
Point closePoint = TurfMeasurement.along(lineString, distanceToIntersection, TurfConstants.UNIT_METERS);
double tolerance = ToleranceUtils.dynamicRerouteDistanceTolerance(closePoint, routeProgress);
assertEquals(25.0, tolerance, DELTA);
}
use of com.mapbox.geojson.Point in project mapbox-navigation-android by mapbox.
the class ToleranceUtilsTest method dynamicRerouteDistanceTolerance_userFarAwayFromIntersection.
@Test
public void dynamicRerouteDistanceTolerance_userFarAwayFromIntersection() throws Exception {
RouteProgress routeProgress = RouteProgress.builder().directionsRoute(response.routes().get(0)).legDistanceRemaining(0).distanceRemaining(0).stepIndex(0).legIndex(0).build();
// Get a point on the route step which isn't close to an intersection.
List<Point> stepPoints = PolylineUtils.decode(response.routes().get(0).geometry(), PRECISION_6);
Point midPoint = TurfMeasurement.midpoint(stepPoints.get(0), stepPoints.get(1));
double tolerance = ToleranceUtils.dynamicRerouteDistanceTolerance(midPoint, routeProgress);
assertEquals(50.0, tolerance, DELTA);
}
Aggregations