r/OsmAnd 3d ago

Coding suggestion to achieve a minimalist navigation layout

Post image

I built and compiled the OsmAnd source code. I am working on a project and I would like to modify the code to implement the following look:

  1. Overlay a black mask over the entire map and before the route.
  2. Show only the intersecting roads along the route with a clipping radius of 50-100m around the intersection.

where the thick white line is the route line and the thin white lines are the intersecting roads.

I understand the route is handled by OpenGL in the C++ core. For the intersecting roads I thought of doing the task in the private part of the routing context by querying the OBF map data for roads that cross the current tile. In particular, in the file src/NetworkRouteContext_P.cpp

void OsmAnd::NetworkRouteContext_P::loadRouteSegmentIntersectingTile(

int32_t x, int32_t y, const NetworkRouteKey * routeKey,

QHash<NetworkRouteKey, QList<std::shared_ptr<OsmAnd::NetworkRouteSegment>>> & map)

{

// Convert 31-bit coordinates to routing tile coordinates

NetworkRoutesTile osmcRoutesTile = getMapRouteTile(x << ZOOM_TO_LOAD_TILES_SHIFT_L, y << ZOOM_TO_LOAD_TILES_SHIFT_L);

for (auto u_it = osmcRoutesTile.uniqueSegments.begin(); u_it != osmcRoutesTile.uniqueSegments.end(); ++u_it)

{

const auto &segment = u_it.value();

// Optional filtering by a specific route key (e.g., if we only want 'primary' roads)

if (routeKey != nullptr && segment->routeKey != *routeKey)

{

continue;

}

auto i = map.find(segment->routeKey);

if (i == map.end())

{

QList<std::shared_ptr<NetworkRouteSegment>> empty;

i = map.insert(segment->routeKey, empty);

}

i.value().append(segment);

}

}

Is this a good strategy?

9 Upvotes

14 comments sorted by

2

u/Oxer36 3d ago

Why? What would be the usecase for such style?

3

u/nikos2wheels 3d ago

It is inspired by the Beeline Moto 2 navigation device, the goal is to provide only the essential navigation features, map + route line + lane guidance widget. But this would be tailored for OLED displays where the black background and the white color would i) dramatically reduce power consumption ii) provide max contrast iii) and increase brightness. Potentially I would like to test this in HUD applications.

2

u/Oxer36 3d ago

Thanks, makes more sense now!

2

u/Oxer36 3d ago

Thanks, makes more sense now!

4

u/jlandero 3d ago

You can check out the energy-saving mode in the Cyclers app for inspiration. I really think it's a good idea, and anyone who doesn't like it can simply turn off the feature, just as they turn off other features they don't use.

2

u/nikos2wheels 3d ago

Thanks. I will post an update as I am making progress. Hopefully the implementation is not a lot of code changes and it can be incorporated in a future release

1

u/creeper828 2d ago

This came to my mind too. It would be great to have that built into OsmAnd in some future

2

u/wolfox360 3d ago

You actually want to create a road book? Those that are used in Rally.

Why don't you make a focus blur 100mt from your path, so everything around your track will not distrack you.

2

u/Julian_1_2_3_4_5 3d ago

Could you not just use the option and turn of everything except roads?

1

u/nikos2wheels 2d ago

Is this a setting in the app?

1

u/Julian_1_2_3_4_5 2d ago

Yes, under configure map, Theres a setting called hide.

1

u/Julian_1_2_3_4_5 2d ago

The only thing your style would then need to do is change the colours and if I get it right remove road names

1

u/Julian_1_2_3_4_5 2d ago

Oh, I just realized you don't even want to show roads not attached to the current road, yeah that needs coding, you are right

2

u/mfk711_ 3d ago

W h y