Friday, July 3, 2015

GSoC 2015 midterm update

I'm working on the project Improve Marble's OSM vector rendering and printing support. The first part of the project is to polish and improve the rendering of the OSM vector tiles in Marble. In my previous post you could see what it looks like without the improvements I have in my mind and now I want to share some pics and videos about the progress and results so far.

Adding outlines for OSM ways

One of the most outstanding issue was the lack of the outlines for streets and highways. My first task was to somehow overcome this problem. These lines are drawn as a QPainter line and thus they don't have style settings for outlines, so the best that I could do is to draw these lines twice: first draw a bit thicker (with 2 pixels) line with the outline color, then a second over top of it with the fill color. This approach of course is not enough, because the streets are not rendered in the order in which we want them. This results in something like this (which I showed you in my previous blogpost):

The solution is to sort the lines (and every object) depending on their z-value, so they are rendered in the correct order. As this sorting is a little bit resource-hungry, the outlines (and further on the decorations) are not rendered below Normal quality setings.
I even changed the style of almost every OSM item and added some new, unimplemented items to the list(like cycle ways or pedestrian ways), so they would match even better the standard color theme of the openstreetmap website. The end result looks good I think.

After the improvements

Before the improvements

Decoration and "Fake3D"

Implementing this feature led us to the idea to create a more robust API for creating such decorations for the GeoGraphicsItem classes which are used in the rendering process (e.g. the class used to describe the streets is the GeoLineStringGraphicsItem class). With overriding a simple virtual function, one can create custom decorations for every GeoGraphicsItem-derived class. To demonstarte this functionality, the outlines are implemented this way and I added a simple 3D effect (shadow) for the buildings. This takes almost the same approach as the outline rendering, but now this shadow is rendered with a little offset, based on the focuspoint of the map (the little cross at the center). I think this is a pretty good example to demonstrate the capability of such a decoration system.

Struggle with the street labels

As you can see on the first pictures, the street labels aren't aligned to the streets at all, even if this is a crucial point of urban maps. I thought that this would be an easier task than the decorations, but I was wrong. The proper alignment of the street labels with the right color, right size, right font, right direction etc. it's more like an art, than a simple task. One of the problem is that the program needs this to be done in realtime, so I can't use a "complex algorithm" to calculate these properties. And on top of that, Qt doesn't provide a proper way to draw a text along a (curved) path. The best thing I could do is to try to avoid the curvatures of the streets when drawing the labels, so they will be rendered properly most of the times. A quick demonstration of what I achived this far:


Due to my exams, I couldn't give a 100% priority to GSoC, but the progress this far meets my expectations and from now on, I can even double the time spent working, programming, experimenting.
I'll post a smaller status-update when I start working on the printing support improvement, until then I'm going to polish the work I had done this far.

In the end, here is a video demonstrating these improvements:

No comments:

Post a Comment