Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introducing engineMode for future use #549

Merged
merged 9 commits into from
May 21, 2023

Conversation

afischerdev
Copy link
Collaborator

To build a base for future an engine mode is added.
This is related to #460 or #222 or other things that will not working with 'normal' routing mode.

@afischerdev afischerdev temporarily deployed to BRouter May 9, 2023 10:34 — with GitHub Actions Inactive
@afischerdev afischerdev added this to the Version 1.8.0 milestone May 9, 2023
Copy link
Collaborator

@zod zod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not really sure how this PR is related to the linked issues, because the modes are called "seed" and "other" but the issues request automatic route suggestion and map matching.

As with your last huge PR I would suggest first adding the feature and afterwards exposing the API because it allows you to freely change the implementation without modifying a public API.

Comment on lines 5 to 11
### New last version

Android

- Add parameter dialog for profile

Library
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated to this PR. I think we should stick to a common format like keepachangelog which suggests a unreleased section instead of "new last version" (which should be "new since last version"?)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you are right, bad wording.


Library

- Add engineMode for future use
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if that would be helpful to anyone. People would care about the new feature, not some API extension

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me, users also include developers who want to adapt their app accordingly.

@afischerdev
Copy link
Collaborator Author

I'm not really sure how this PR is related to the linked issues, because the modes are called "seed" and "other" but the issues request automatic route suggestion and map matching.

The idea is to open the engine to more functionality than standard routing.
The linked issues are samples to let you know what I'm thinking off. The predefined modes have to change when we have a real new feature. "seed" already exists, but I think it needs changing - anyway we should not ignore it.

As with your last huge PR I would suggest first adding the feature and afterwards exposing the API because it allows you to freely change the implementation without modifying a public API.

May be. For me, this way is the better way. This offers you and others the chance to place new features on these terms. Otherwise we develop nice new features and when the first one comes out with it, the others notice that the api implementation is different.

@afischerdev afischerdev temporarily deployed to BRouter May 10, 2023 09:46 — with GitHub Actions Inactive
@afischerdev
Copy link
Collaborator Author

Here a first new function that uses this new entry:

get elevation for one point

Returns a wpt gpx with elevation when found.

@afischerdev afischerdev temporarily deployed to BRouter May 14, 2023 15:07 — with GitHub Actions Inactive
@afischerdev afischerdev requested a review from zod May 14, 2023 15:11
@zod
Copy link
Collaborator

zod commented May 15, 2023

I think it's not sensible to extend the getTrackFromParams to provide elevation data using this method. It's rather complicated and the function would not return a track but just a single waypoint in a GPX structure, but the API should just return the elevation.

Shouldn't we just extend the AIDL with a new method to retrieve elevation?

@afischerdev
Copy link
Collaborator Author

@zod
Yes, I was thinking of this as well.
We already have a hell of parameter. An extra aidl definition is a smart way but would not work for server or command line situation.
So I would like to stay with engineMode.
For the parameter hell, I'm planning a small rework to get one entry point for everyone

@zod
Copy link
Collaborator

zod commented May 15, 2023

We could also add an API endpoint for the server to provide elevation which could be used e.g. by brouter-web to show elevation at POIs. I think brouter-web would rather consume a simple JSON instead of parsing a GPX file with waypoints just for elevation.

For the CLI it should be possible to provide a different command.

I just skimmed through the code and if we would pursue the engineMode way it requires a bit of work (e.g. parameter order in RoutingEngine constructor)

@afischerdev
Copy link
Collaborator Author

@zod

I just skimmed through the code and if we would pursue the engineMode way it requires a bit of work (e.g. parameter order in RoutingEngine constructor)

What do you mean be that?

And yes, for the server I also thought on json export as well. As usual initialized by parameter.
You wanted me to publish smaller pieces.
So next, let me introduce the server and the command line variant along with a first parameter merge

Comment on lines 82 to 89
public RoutingEngine(String outfileBase, String logfileBase, File segmentDir,
List<OsmNodeNamed> waypoints, RoutingContext rc) {
this(0, outfileBase, logfileBase, segmentDir,
waypoints, rc);
}

public RoutingEngine(int engineMode, String outfileBase, String logfileBase, File segmentDir,
List<OsmNodeNamed> waypoints, RoutingContext rc) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the first parameters of the constructors should be the same and engineMode should be appended.

@afischerdev afischerdev temporarily deployed to BRouter May 21, 2023 09:23 — with GitHub Actions Inactive
@afischerdev afischerdev merged commit 781661e into abrensch:master May 21, 2023
@zod
Copy link
Collaborator

zod commented May 22, 2023

I'm quite surprised that it was merged. I still fail to understand why it's a good idea to add reading points elevation data to RoutingEngine. This class already does way to much.

What's your reason to not provide a new API endpoint & Android service which provides just elevation data without the GPX stuff?

@afischerdev
Copy link
Collaborator Author

@zod

What's your reason to not provide a new API endpoint & Android service which provides just elevation data without the GPX stuff?

As discussed before the server also could use this call.
You wanted me not to add an api call without feature. So I added a small function.
This is a sample for engineMode but main intentions are others.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants