Giter Club home page Giter Club logo

Comments (19)

SachsenspieltCoding avatar SachsenspieltCoding commented on July 18, 2024 1

grafik

OK, so now only those profiles without an icon will be counted.
You can now also set an icon using the "icon" field in the config.

I will probably open a PR today, until then you can see the changes here
SachsenspieltCoding@5b4cab4

from graphhopper-maps.

SachsenspieltCoding avatar SachsenspieltCoding commented on July 18, 2024 1

Well, yes, but that's not exactly what I meant. The issue is how we handle both custom icons and icons based on a profile's prefix.
Maybe we can talk about this in more detail in person on Tuesday?

from graphhopper-maps.

SachsenspieltCoding avatar SachsenspieltCoding commented on July 18, 2024

@easbar Yes, I see your point. I actually thought of that when I added it, which is why I mentioned it in the PR.

How do you think it could be handled better? Just replace the icon with something more meaningful, or can you think of a completely different approach?

from graphhopper-maps.

easbar avatar easbar commented on July 18, 2024

Maybe some icon that is 1) less confused-looking and 2) something that allows the profiles to be distinguished from each other. For example we could just use icons showing numbers 1, 2, 3, ... ? Or a car icon with a little number next to it? Then again they aren't necessarily cars so maybe something more generic? But honestly I don't have a good suggestion atm, so maybe just numbers will do for now?

from graphhopper-maps.

SachsenspieltCoding avatar SachsenspieltCoding commented on July 18, 2024

It would be an idea. But aren't numbers even more confusing? I mean, when there are a bunch of contextless numbers in the profiles area, it may lead to even more confusion what a "3" or a "5" means for instance.

The best option I can think of is to allow some sort of custom icons respectively the general option to set icons for custom profiles.

from graphhopper-maps.

easbar avatar easbar commented on July 18, 2024

Maybe it is just me, but I think numbers 1,2,3,... would be less confusing (and seem less buggy) for me than three question marks. To figure out which one is which we still need to hover the icon of course.

from graphhopper-maps.

SachsenspieltCoding avatar SachsenspieltCoding commented on July 18, 2024

Perhaps @karussell could give his opinion on this?

While I'm still not 100% sure about the number icons, I have no problem implementing this in a PR.
Also, I would prefer an option to set an icon manually, but this would require a new field in the RoutingProfile interface, which is implemented by the graphhopper.d.ts file.

https://github.com/graphhopper/graphhopper-maps/blob/master/src/api/graphhopper.d.ts#L59-L61

Is it possible to add it there, or should I then add a second .d.ts file that implements this interface?

from graphhopper-maps.

easbar avatar easbar commented on July 18, 2024

Also, I would prefer an option to set an icon manually, but this would require a new field in the RoutingProfile interface,

Can we not just do this using the config file?

from graphhopper-maps.

SachsenspieltCoding avatar SachsenspieltCoding commented on July 18, 2024

Yes, that is the plan. But since the config is more or less typed through the TypeScript interfaces, this would also require a change in the type files. There may be a way around this, I haven't fully analysed it yet.

from graphhopper-maps.

easbar avatar easbar commented on July 18, 2024

The config is typed in custom.d.ts and sure you can modify it accordingly when you are adding the icon option

from graphhopper-maps.

SachsenspieltCoding avatar SachsenspieltCoding commented on July 18, 2024

Oh yes, thanks for the hint!

from graphhopper-maps.

SachsenspieltCoding avatar SachsenspieltCoding commented on July 18, 2024

grafik

This is what you thought of, right?

from graphhopper-maps.

easbar avatar easbar commented on July 18, 2024

Yes, that looks good?! Definitely better than the question marks if you ask me. Maybe just start counting the first unknown profile as "1"(?)

from graphhopper-maps.

SachsenspieltCoding avatar SachsenspieltCoding commented on July 18, 2024

Yeah, I also thought of this. It would require more code, so I just decided for the easier option first.
I'll try my best.

from graphhopper-maps.

karussell avatar karussell commented on July 18, 2024

Sounds good. Maybe as a base icon we could check if an existing profile name is "contained" and then show the number at top right like for mtb_hello it would be the "mtb" icon as base:

image

from graphhopper-maps.

SachsenspieltCoding avatar SachsenspieltCoding commented on July 18, 2024

Sounds possible. I'll look into this tomorrow

from graphhopper-maps.

SachsenspieltCoding avatar SachsenspieltCoding commented on July 18, 2024

What do you think? I've loaded the default profiles from the GraphHopper API to test it out. The styling is work in progress.

grafik


There is one edge case I came across that I would like to discuss here. Let's say I have the profiles
car, car_veryfast, slowvehicle.
By default it would look like this:
grafik
But what if I manually change the slowvehicle icon to a car icon? Well, we can do two things

  1. Ignore counting and set the icon normally
  2. Behave as if it were named car_slowvehicle, so that it also has the number in the top right corner.

The current implementation is 1), which I think has the most potential for customisation.
grafik

from graphhopper-maps.

karussell avatar karussell commented on July 18, 2024

Really nice, thanks!

For the slowvehicle: not 100% sure if I understood the case but for a profile name without an icon we could fallback to the current question mark plus a number if there is more than one unknown profile.

from graphhopper-maps.

SachsenspieltCoding avatar SachsenspieltCoding commented on July 18, 2024

For the protocol: The option to set icons via an attribute in the profile config will not be supported. Instead, the focus is on the prefixes, which technically allow custom profiles in a way that is enough for the most users.

from graphhopper-maps.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.