Skip to content

Commit

Permalink
[WIP] fix not removing arrows in some situations - off route and afte…
Browse files Browse the repository at this point in the history
…r ending navigation
  • Loading branch information
Guardiola31337 committed May 21, 2018
1 parent 9a21ff6 commit 47e273c
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ private void drawRoutes() {

private void clearRoutes() {
removeLayerIds();
updateArrowLayersVisibilityTo(false);
clearRouteListData();
}

Expand All @@ -383,7 +384,7 @@ private void generateFeatureCollectionList(List<DirectionsRoute> directionsRoute
/**
* The routes also display an icon for each waypoint in the route, we use symbol layers for this.
*/
private static FeatureCollection waypointFeatureCollection(DirectionsRoute route) {
private FeatureCollection waypointFeatureCollection(DirectionsRoute route) {
final List<Feature> waypointFeatures = new ArrayList<>();
for (RouteLeg leg : route.legs()) {
waypointFeatures.add(getPointFromLineString(leg, 0));
Expand Down Expand Up @@ -417,8 +418,8 @@ private void addUpcomingManeuverArrow(RouteProgress routeProgress) {
private void updateArrowLayersVisibilityTo(boolean visible) {
for (Layer layer : arrowLayers) {
String targetVisibility = visible ? VISIBLE : NONE;
if (!layer.getVisibility().value.equals(targetVisibility)) {
layer.setProperties(visibility(visible ? VISIBLE : NONE));
if (!targetVisibility.equals(layer.getVisibility().getValue())) {
layer.setProperties(visibility(targetVisibility));
}
}
}
Expand Down Expand Up @@ -556,7 +557,7 @@ private SymbolLayer createArrowCasingLayer() {

private void initializeArrowLayers(LineLayer shaftLayer, LineLayer shaftCasingLayer, SymbolLayer arrowLayer,
SymbolLayer arrowCasingLayer) {
arrowLayers = new ArrayList<>(4);
arrowLayers = new ArrayList<>();
arrowLayers.add(shaftCasingLayer);
arrowLayers.add(shaftLayer);
arrowLayers.add(arrowCasingLayer);
Expand Down Expand Up @@ -771,7 +772,7 @@ private void drawWaypointMarkers(@NonNull MapboxMap mapboxMap, @Nullable Drawabl
}
}

private static Feature getPointFromLineString(RouteLeg leg, int index) {
private Feature getPointFromLineString(RouteLeg leg, int index) {
Feature feature = Feature.fromGeometry(Point.fromLngLat(
leg.steps().get(index).maneuver().location().longitude(),
leg.steps().get(index).maneuver().location().latitude()
Expand Down

0 comments on commit 47e273c

Please sign in to comment.