Saturday, January 19, 2019

Starting on a new map rendering library

Currently in Maps, we use the libchamplain library to display the bitmap map titles (based on OpenStreetMap data and aerial photography) that we get from our tile provider, currently MapBox. This library is based on Clutter and used via the GTK+ embed support within libchamplain, which in turn makes use of the Clutter GTK embed support. Since this will not be supported when moving along to GTK+ 4.x and the Clutter library is not maintained anymore (besides the copy of it that is included in the GNOME Shell window manager/Wayland compositor, Mutter) eventually Maps will have to find a replacement. There's also some wonky bugs especially with regards to the mixing of event handling on the Clutter side vs. the GTK+ side.

So to at least get the ball rolling a bit, I recently decided to see how hard it would be to take the code from libchamplain and keep the grotty deep-down internals dealing with tile downloading and caching and such and refocus the top-level parts onto new GTK+ 4 technologies such as the Snapshot, GSK (scene graph), and render node APIs.

Picture under Public Domainfrom Wikipedia
I decided to call the new library “libshumate” in honor of Jessamine Shumate who was an artist, historian, and cartographer.















The code currently lives in this personal repo https://gitlab.gnome.org/mlundblad/libshumate
So far it's not so exciting as I've only done some cleanups, based off the Meson build system port for libchamplain, removed support for the GNU Autotools build system, removed support for the unmaintained Memphis renderer library and the GTK+ Champlain widget, as the plan is to re-work the library to use GTK+ facilities directly. I've gone through all the files and renamed the API to use the new name. And rather than using something like sed, I went through all source and header files in GNOME Builder and use search and replace, this way I got to get a quick glance at the internals 😎.

The next step will probably be to change the “top” class into a GTK+ widget and try getting first to just display the initially downloaded tiles using the GSK and leave out all the other functionallity at first (handling input and the overlay layers and so on).

Let's see how it goes…

5 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Wow!.. That's cool, but don't you think building a new library requires too much effort? It doesn't seem that Maps has many developers interested in.
    I want to help, but I'm mostly use JS and Python and does not touch any C code in... eight years, maybe and don't know how my skills can be useful in this work

    ReplyDelete
    Replies
    1. Yes, it will be a lot of effort. And I'm not sure I will be successful. But I felt like Clutter is holding Maps back more and more, and eventually it will break. So I thought I might as well take a little first step to at least get some momentum, so to speak.

      Delete
  3. Exciting. I am sure that a lot of people had been looking for a Clutter-free map rendering library for GTK - all those little map widgets in image viewers and addressbooks.

    ReplyDelete