Wednesday, March 28, 2018

Maps, Gitlab, and Meson

It's been a couple of weeks now since GNOME 3.28 was realeased. I´ve already written some about the new features in Maps for 3.28. But already now there´s some exiting news looking forward. The first is not related to code or features of Maps itself. But the project has been migrated to GNOME´s Gitlab instance (along with other projects now that mass-migration of the remaining projects from Cgit and Bugzilla is going on). I think this will simplify newcomer contributions and bug reporting quite a bit. Also the code review interface for the merge requests looks pretty nice.

The other big news is that Maps is now built using Meson. Even though the amount of compiled code (the private C library we use for interfacing with things like libxml2 and libfolks, which doesn´t natively support GIR bindings) is quite small, I still think build times are noticeably quicker now. I decided to remove support for building using Autotools right away, since we had some shell:ish magic going with installing our icons where shell sub process ran cut to parse file names into path destinations based on splitting on underscore characters. So I took the opportunity to clean this up and move the icons into suitable directory structures directly in the repo. I didn´t think it was worth the effort to “back-port” this the Autotools build system, so from now on master can now only be built with Meson (ofcourse on the stable “gnome_3_28” branch building is done the old way using Autotools).

Unfortunately we where out of tile access from Mapbox for little over a week recently, but a couple of weeks ago the GNOME Foundation board has voted to set aside a budget for tiles, so things should be good now.

And also since it´s boring writing blog posts without any screenshots, and in three weeks I´m going to San Fransico with work. I loaded transit data from MUNI in my OpenTripPlanner server instance and did some cable car “browsing”, notice the nice little icons (made by Andreas Nilsson):

Thursday, February 8, 2018

Entering the “home stretch” for GNOME 3.28

Earlier this week I´ve released GNOME Maps 3.27.90 (even though I just read an e-mail about the deadline for the release tarballs had been postponed for one week just after uploading the tarball).

This weekend I (like some 8000 others) participated in an exciting FOSDEM with lots of interesting talks and the week before that I gave presentation of GNOME Maps, and in particular the public transit functionality for TrafikLab (the sort of “developer community” driven by the Swedish organization Samtrafiken AB, who coordinates and aggregates data from all public transit operators, both commercial/private and regional/public ones.

One of the larger features landed in 3.27.90, which isnt´t visible on the surface is that Maps now uses some new language features introduced to JS in the ES6 standard, namely classes and ”arrow functions”.

So, when it comes to classes, as known from traditional OO languages such as Java or C++, earlier one would typically use prototypes to model object classes, but as of ES6 the language has support for a more traditional classes and with a method syntax. GJS also gained a new way to declare GObject classes.

So when earlier declaring an extending class would look something like this:

var MyListBoxRow = new Lang.Class({
    Name: 'MyListRow',
    Extends: Gtk.ListBoxRow,
    Template: 'resource:///<app-id>/ui/my-list-box-row.ui',

    ...
    myMethod: function(args) {

    }
});


this now becomes:

 
var MyListBoxRow = GObject.registerClass({
   Template: 'resource:///<app-id>/ui/my-list-box-row.ui'
} ,class MyListBoxRow extends Gtk.ListBoxRow {

  ...
  myMethod(args) {

  }
});

and in cases where we don´t need to inherit from GObject (such as when not declaring any signals, i.e. for utility data-bearing classes) we can skip the registering part and it becomes just a simple ES6 class:

var SomeClass = class {
   ...
   someMethod(args) {

   }
}

We still need the assign using “var” to export those outside the module in question, but when we gain ES7 support in GJS we should be able to utilize the “export” keyword here instead. Another simplication that should arrive with ES7 is that we´d be able to use a decorator pattern in place of GObject.registerClass so that it would become something like:

@GObject.registerClass 
class MyListRow extends Gtk.ListBoxRow

Techinically this could be done today using a transpiler step (using something like Babel) in the build system. These decorators will pretty much be higher-order functions. But I choose not to do this at this point, since we still use GNU Autotools as our build system and eventually we should switch to Meson.

The second change involves using the “arrow operator” to bind this to anonymous functions (in async callbacks). So instead of something like:

asyncFunctionCall(onObject, (function(arg) {
     doStuffWith(arg);
}).bind(this);

this becomes:

asyncFunctionCall(onObject, (arg) => doStuffWith(arg));

These changes results in a reduction of 284 lines of code, which isn´t too bad for a change that doesn´t actually involving removing or really rewriting any code.

Thanks go to Philip Chimento (and Endless) for bringing these improvements for GJS!

Some other changes since the last release is some visual fixes and tooltips for some of the buttons in routing sidebar contributed by Vibhanshu Vaibhav and a fix for a keyboard navigation bug (that I introduces when changing the behavior of the search entry to always activate when starting to type with no other entry active) contributed by Tomasz Miąsko. Thank you!

 

Thursday, December 21, 2017

Christmas Maps

So, we're approaching the end of the year and holidays, so I thought I should share some updates on some going-ons in Maps.

One issue we've had on our table is the way we do attribution. Currently in 3.26 and earlier we have shown the common OSM attribution and a provider logo on the map view. Now we also show attribution to OSM and the tile provider in the About dialog:


The tile provider name and link is included in the service file that is downloaded on start-up, so this can be changed later on without pushing new versions (if needed).

Another nice feature that we've had in mind for a while but didn't make it into 3.26 because we hadn't settled on the exact graphical layout is showing thumbnail images for places in the place info bubbles:


So, now we show a thumbnail picture for a location if it has a Wikipedia article linked to it in the OSM data, and if the Wikipedia API gives us a thumbnail corresponding to the article. This is yet another area where you as a user can add value by adding Wikipedia links, and also by uploading article title images to Wikipedia.

Another thing that has come up lately is an issue with how we overlay some things (like the zoom control buttons) using a GtkOverlay, which unfortunatly doesn't play well with the LibChamplain-based Clutter view used to display the map background when running under a Wayland compositor.
So, as a workaround, we have moved the zoom buttons to the headerbar (similar to the way it works in the EOG image viewer):

I think this is actually pretty nice, and I think I prefer this over the overlayed zoom buttons. So, I think we should probably keep this even if the GtkOverlay problem is solved (or we move away for using Clutter).

Lastly, I've been wanting to fill in some missing spots in our set of icons used for various modes of transit when doing the public transit routing, so I've been pestering Andreas about drawing some additional icons now and then for a while. As a piece of work-in-progress I can show you this nice rendition of a steam locomotive intending for representing tourist/heritage railways:



This example shows routes for the Mornington heritage railway outside of Melbourne in Australia, as the data I usually use for showcasing from the Swedish Samtrafiken organization currently unfortunately doesn't have this classification (I've bugged them about it…).

So, that's that for tonight. And happy hollidays everybody! 🎅🎆

Sunday, November 19, 2017

Maps Towards 3.28

So, it's been a while since my last blog post.

Some work has been done since the release of 3.26 in September. On the visual side we have adapted the routing sidebar to use a similar styling as is used in Files (Nautilus) and the GTK+ filechooser.










I also took the oportunity to improve the looks of the transit route labels when using a dark theme variant:

So that now the labels will get an outline in the lighter text color when the background is dark (the opposite compared to when using the regular light theme variant).

Another small improvement is that we now support the common --version command line option to… well, show the version number :-)
Also, the copyright date in the About dialog has been updated (since it hadn't been since 2013…).

Under the hood, and not immediately visible, I have cleaned out some cruft that generated a lot of run-time warnings about superfluous function arguments  (either the Javascript GIR bindings expected extra error “out parameters” before, or GJS just has gotten more verbose about these things).

I also started playing with some newer ES6 features, namely closures (so avoiding declaring an inline function using the “function” keyword and binding this to the scope, and rather do something like () => { do_suff_here; } when declaring signal callbacks and such. And the other thing being using ES6 classes (and the new GObject syntax in GJS.

And this not only makes the code nicer to read (IMO) it also cuts down on the LoC count a bit:

 
It's not only been hacking lately though, I had a nice video conference with representatives from Mapbox to discuss ways we could give back to them in return for their generousness towards us. I have some ideas about features we could implement in Maps that they were interested in. This is something I will most likely bring up again in a not too distant future.

Thursday, September 7, 2017

Approaching 3.26

So, we're on final stretch towards the GNOME 3.26 release next week, just released the last beta of Maps (3.25.92) earlier in the week. This cycle hasn't seen that any real ground-breaking user-visible changes. But various smaller bugfixes. Nevertheless there's been a few nice improvements on the surface (as seen in earlier blogposts).

A couple of handy keyboard shortcuts:


To switch between the regular map view and aerial view, ctrl+1 and ctrl+2 can be used (instead of having to use the layer menu in the title bar). And to ctrl+o to open a layer file (such as a GPX recorded GPS track).

We have also added some additional details shown in map bubbles, and those are also available for editing objects on OpenStreetMap


Now we have availabilty of toilets as well as relegious affinity (for things like places of worship) available. Also for the edit view, we now show and allow editing of editor notes (these are meant as hints for other contributors on OpenStreetMap).

One feature I talked about earlier, but that hasn't landed yet (and thus will have to wait until 3.28 next spring) is the showing of thumbnail images obtained from Wikipedia in the map bubbles, as we haven't settled the UI and tweaked suitable sizes and such yet.

Another issue I fixed is how we handle entering search text when starting typing, previously we would always focus the main search entry by default when starting the application. This had the downside of always showing the on-screen keyboard on start-up on tablets (when no keyboard is available). Now the search entry is instead automatically focused when typing (and no other text entry is active). This also means you can always start a search by start typing (unless a dialog such as the edit dialog is up, of course). This is also more in-line with how other GNOME apps does it.

Unfortunatly, we still haven't found a solution for hosting an instance of OpenTripPlanner for public transit routing, so when using that feature you'll still need to either run your own server, or point to a third-party one (by using the OTP_BASE_URL environment variable).

Monday, August 7, 2017

Maps on the go

Just when going on vacation I finally decided to replace my aging old E-Machines netbook from 2010 that has been a faithful companion when wanting to travel light but still having a more "full-size" OS. This type of machines have kind of been out of fashion since tables (specifically the iPad) gained popularity. But nowadays there are also some interesting 2-in-1 devices being both a light laptop and tablet if you like. Also it seemed intriguing to finally play with a touch-oriented device in the GNOME / FreeDesktop / GNU/Linux environment.

So, finally I decided to try out this little thing:


So, this device is a Lamina T-1016B.NORD, it's a fairly cheap Cherrytrail-based Intel Atom device. The ironic thing is the image on the box features Windows Maps :-). Also the advertisement read something like “Discover the power of Windows Maps”. But of course I wanted to upgrade the OS. I went with the 4 GB version of Debian's latest stable release, because I didn't want to get stuck trying to get a mininal net installation ISO of latest testing going (with trying to figure out which additional firmware would be needed for WiFi, and I was pretty sure something like that would be nessesary). Installation was pretty pain-less except for one thing: Everything on the screen was rotated 90 degrees counter-clockwise (more on this later). After having read reviews of people installing Linux on similar devices and claiming external USB keyboards and powered USB hubs are essential, this was refreshingly simple, after all.

After installing the firmware for WiFi and sound, WiFi works and sound (but the headphone jack is not recognized correctly). But the most annoying issue for now is the lack of power management support. The battery is not recognized and the screen is stuck on full brighness. Despite this I can still get something like 5 hours of light usage, which is probably still quite OK given the circumstances. Also suspend is not supported (supposedly Cherrytrail doesn't have traditional suspend, but something called “connected standby”, so this limits the usefulness as an “instance on” device. But on the plus side, the flash drive is actually quite quick to boot from. After that, having support for the built-in GPS device would be really nice. Not really sure what kind of device that is, it doesn't seem to show up in either lsusb nor lspci.

For the rotated weirdness it turns out the display is actually natively portrait-oriented, which is evident when the Linux console shows (however the boot logo is rendering suited for landscape mode). The rotation sensor however is mounted in way that indicates “normal” when the device is in landcape mode. Thus out-of-the-box, the desktop is tilted sideways. And rotating the device activates the sensor, but of course still gives an indication that is “off” compared to what the display “expects”.

So, it was time to bring out a trusty old linear algebra book and brush off some matrix skills. Scribbling down the some transformations from what the sensor reports and what would correspond to what the display would expect for it to be right (thanks Bastien Nocera for giving me pointers) I could then translate this into a transformation matrix:


And eventually cooking up a patch for the udev hwdb (within systemd).

Related to the title of this post, though, this is problably what you wanted to see, though


Testing out how Maps works :-)
One slighly annoying thing that showed up is the fact that launching Maps without the keyboard attached will always bring up the on-screen keyboard. The reason for this is that we always explicitly focus the search entry widget to achive being able to just start typing to enter things to search for (which is handy with a keyboard). We should probably re-write this to be more like how some other GNOME apps are wired, where the keypresses are handled by the main window and the search machinery is activated when appropriate. There's some other known issues, such as the lack of pinch-to-zoom support and long-press to get the context menu. I started tagging these bugs with a “touch” keyword. So, hopefully I will get some time to tackle these in the not-to-far distant future. Some like the search issue could probably go in before 3.26 even though we're technically in UI freeze now. Yes, I just released 3.25.90 by the way. While other things like pinch-to-zoom would require support in libchamplain (possibly), and might depend on what we want to do going forward with how we render the map data.

All-in-all it's been a fun little device to play with so far :-)

Wednesday, June 21, 2017

Midsommer Maps

So we just released the third development release of Maps in the 3.25 series (leading up to 3.26.0 in September).

Some new noteworthy new features and fixes made it in. We gained a couple of new keyboard shortcuts


Control and 1 and 2 to switch the view between street (the “ordinary” map) and aerial view (the shortcuts where inspired by Nautilus) and Control+o to open shape layers (we had a bug report suggesting adding this feature, which indicates it might not have been discoverable enough). Using the standard “open a file” shortcut makes sense, since that might be something you may try without thinking too much about it. And ofcourse it will also show up in the help overlay (as pictured above).

Furthermore, we now remember the mode of transport used for routing between runs, so it no longer reverts to car every time you start Maps (and it also uses the currently set mode when routing to a place from a marker bubble in the view).

Another annoying thing we've fixed is that we no longer reset the list of found itineraries when doing a transit route search and you click on “Load later alternatives” (or earlier) and no more results where found, instead we now show a notification and keep the previous results:


as can be seen in this screenshot showing results for a bus route which only runs on limited days.

We now also, thanks to work done by Robery Ancell, show religion information (for places of worship and book store for example) and information on the availability of toylets (when data is provided in OSM ofcourse). These can also be edited for POIs in OSM.

And it didn't stop there, after the release another feature implemented by Elias Entrup and Neha Yadav has landed. And that's that the search popover no longer just disappears when no results where found, but rather show an indication that nothing was found:


I also managed to do a little mess-up with the “remember the mode of transport” feature, so it was a little broken when currenly using transit and clicking the route button in a place “bubble”. So that has been fixed since in master.

And there was certainly some more things I have already forgotten :-)