Skip to content

Commit

Permalink
Merge pull request #21059 from osmandapp/chumva_fixes
Browse files Browse the repository at this point in the history
Add ability to hide direction arrows
  • Loading branch information
Chumva authored Oct 16, 2024
2 parents af26cf6 + 29735a4 commit 1a393ff
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ private void drawRouteLinePreview(Canvas canvas,
points.add(new GeometryWayPoint(points.size(), endX, endY));

previewLineGeometry.setRouteStyleParams(getRouteLineColor(), getRouteLineWidth(tileBox),
true, getDirectionArrowsColor(), routeColoringType, routeInfoAttribute, routeGradientPalette);
shouldShowDirectionArrows(), getDirectionArrowsColor(), routeColoringType, routeInfoAttribute, routeGradientPalette);
fillPreviewLineArrays(points);
canvas.rotate(+tileBox.getRotate(), tileBox.getCenterPixelX(), tileBox.getCenterPixelY());
previewLineGeometry.drawRouteSegment(tileBox, canvas, points, 0);
Expand Down
5 changes: 2 additions & 3 deletions OsmAnd/src/net/osmand/plus/views/layers/RouteLayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -446,8 +446,7 @@ public void drawLocations(@NonNull RotatedTileBox tb, @Nullable Canvas canvas,
routeColoringType : ColoringType.DEFAULT;
int routeLineColor = getRouteLineColor();
float routeLineWidth = getRouteLineWidth(tb);
boolean shouldShowDirectionArrows = previewRouteLineInfo == null
|| previewRouteLineInfo.shouldShowDirectionArrows();
boolean shouldShowDirectionArrows = shouldShowDirectionArrows();
routeGeometry.setRouteStyleParams(routeLineColor, routeLineWidth, shouldShowDirectionArrows,
getDirectionArrowsColor(), actualColoringType, routeInfoAttribute, routeGradientPalette);
boolean routeUpdated = routeGeometry.updateRoute(tb, route);
Expand Down Expand Up @@ -643,7 +642,7 @@ private List<ActionPoint> calculateActionPoints(double topLatitude, double leftL
DISTANCE_ACTION = 110;
}
double actionDist = 0;
Location previousAction = null;
Location previousAction = null;
List<ActionPoint> actionPoints = new ArrayList<>();
int prevFinishPoint = -1;
for (int routePoint = 0; routePoint < routeNodes.size(); routePoint++) {
Expand Down
11 changes: 11 additions & 0 deletions OsmAnd/src/net/osmand/plus/views/layers/base/BaseRouteLayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public abstract class BaseRouteLayer extends OsmandMapLayer {

protected Paint paintIconAction;
private Bitmap actionArrow;
private Boolean shouldShowDirectionArrows;

//OpenGL
//kOutlineColor 150, 0, 0, 0
Expand Down Expand Up @@ -150,6 +151,7 @@ protected void updateRouteColoringType() {
routeInfoAttribute = settings.ROUTE_INFO_ATTRIBUTE.getModeValue(mode);
routeGradientPalette = settings.ROUTE_GRADIENT_PALETTE.getModeValue(mode);
}

}

@Override
Expand Down Expand Up @@ -184,6 +186,15 @@ public void setDirectionArrowsColor(@Nullable Integer directionArrowsColor) {
this.directionArrowsColor = directionArrowsColor;
}

public boolean shouldShowDirectionArrows() {
return shouldShowDirectionArrows != null ? shouldShowDirectionArrows :
previewRouteLineInfo == null || previewRouteLineInfo.shouldShowDirectionArrows();
}

public void setShouldShowDirectionArrows(@Nullable Boolean shouldShowDirectionArrows) {
this.shouldShowDirectionArrows = shouldShowDirectionArrows;
}

protected float getRouteLineWidth(@NonNull RotatedTileBox tileBox) {
String widthKey;
if (previewRouteLineInfo != null) {
Expand Down

0 comments on commit 1a393ff

Please sign in to comment.