dcaliste / maep-qt

A map viewer for Jolla Sailfish OS
29 stars 14 forks source link

Option for changing color and thickness of the track #22

Closed armorica closed 7 years ago

armorica commented 8 years ago

I love maep-qt and use it a lot for navigating on my bike. I compiled and tested it on my Jolla Tablet and it's great on that device too!

I've been searching through the code but unfortunately have not yet found where to set the color and thickness of tracks being shown. Having it as an option would be very nice, but compiling it with tailored setting will do for me. Reason to want this is: 1) the track shown on the screen of my Jolla is rather thin and hard to use while "navigating" on my bike. 2) the track color is red which is a color used on maps as well, so sometime it's hard to tell whether the directions when crossing a rad with the same color. In OSMand the default track color on my android phone is a blue that is uncommon for map material, so it's easy to tell where the track goes. Also the the line in OSMand is quite wide.

I'm willing to give a small modification (incl. it as a configurable option) for this a try. I'm not so much of a coder, but willing to get my toe into the water. Otherwise, I'm definitely willing to do some testing.

dcaliste commented 8 years ago

Thank you for the proposition. If you're eager to try to implement this, feel free to propose a PR, otherwise I may do it later.

Some clues to help you:

I understand it's quite a complicated story, especially because the code is initially based on GObject and then, I wraped it for Qt to access it finally from QML !

Don't hesitate to ask any questions, or ask me to implement some parts if you don't feel confident enough.

armorica commented 8 years ago

Hi Damien,

thanks for your quick and clear reply. You are right, it's (at least) sounds a bit more than I expected, but it doesn't look undo-able (for me). I will first go for the lazy way and try to get it done hard coded as that's something I would like to have very soon. After that I will sure give the configurable option a try.

I already forked; If I consider my mod good enough I'll do a PR.

Regards,

Paul Tap

On 08/30/2016 04:30 PM, Damien Caliste wrote:

Thank you for the proposition. Yes you're eager to try to implement this feel free to propose a PR, otherwise I may do it later.

Some clues to help you:

  • the rendering of tracks on the cairo surface is done in |osm-gps-map/osm-gps-map.c:1230| in function |osm_gps_map_print_track()|.
  • You can see that the color is hard coded there. You'll have to put it in a GObject property if you want to access it from Qt part. If you're not fluent with GObject machinery, I can do this for you.
  • You can see there also that the line with is already stored as a GObject property called "gps-track-width", so good.
  • If you want these two properties to be stored by dconf and persistent between restart, you should give a look at |osm-gps-map/osm-gps-map-qt.cpp:190| in the GpsMap constructor. You'll see that values are retrieved from disk and passed to the GObject constructor. Don't forget to dump on disk while quiting, see around line 360.
  • You can make these two properties accessible from QML by declaring them as properties in the header file |osm-gps-map-qt.h| and create accessors from them. You can get inspired by the "double-pixel" property for instance.
  • Finally, you can play with the Settings.qml file to add your UI there.

I understand it's quite a complicated story, especially because the code is initially based on GObject and then, I wraped it for Qt to access it finally from QML !

Don't hesitate to ask any questions, or ask me to implement some parts if you don't feel confident enough.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dcaliste/maep-qt/issues/22#issuecomment-243458072, or mute the thread https://github.com/notifications/unsubscribe-auth/AHjoQkowtFYN_GzdyvynR3EUYd9D6F5sks5qlD5zgaJpZM4Jwh0X.

armorica commented 8 years ago

Well, the hard coded mod is done. Looks good (3x the width and a clear blue line) on both the tablet and the phone. Sure will be a 'life saver' tomorrow, riding over 100+ km by bike :) Thanx so much for your help! I'll dive into configurable stuff when I'm back. Regards, Paul

dcaliste commented 8 years ago

Have a nice trip and don't hesitate to ask questions.

dcaliste commented 8 years ago

So, finally, I've done the low level parts already, see the last three commits. The track color and width can be changed. There is no UI yet for these two settings. They can be changed only from the command-line with: dconf write /apps/harbour-maep-qt/track_color "(0., 0., 0.9155413138, 0.6)" and for the width with: dconf write /apps/harbour-maep-qt/track_width 6

I'll add some UI for this later.

armorica commented 7 years ago

Hi Damien,

due to personal stuff I didn't find time to reply to you regarding these changes.

Today I finally had the guts (and time) to start with track width/color changes we discussed a month ago, only to find that you've already made them ALL. Great job. I appreciate the idea of making them track based (and not a global setting as my initial idea was).

Regards, Paul Tap

dcaliste commented 7 years ago

Released in 1.4.4-2 in Harbour.