4 January 2010

Can you spot what’s new?

Yes! Libchamplain now has a scale! It was long overdue. In fact, I first started to work on it way before libchamplain 0.2.2 was even released (1.25 year ago). It got impeded by more important features and bug fixes. Two or three months ago Tollef Fog Heen took over the branch and added the magic required maths to compute the scale. I then took over his work (as he was quite busy and I wanted this too) to provide the final result.

Since all the changes are backward compatible, I’ll soon release a libchamplain 0.4.3 with the scale disabled by default (to ensure the same visual behaviour as before upgrade). To display a scale, an application just has to change the show-scale property to TRUE.

#if CHAMPLAIN_CHECK_VERSION (0, 4, 3)
g_object_set (champlain_view, "show-scale", TRUE, NULL);
#endif

The scale also supports other exotic units than the SI/metric ones. It can display miles and feet, if you’re into that. :) By the way, the scale will automatically switch from kilometres to metres when it makes more sense. That was quite more complex to do with miles and feet as they are not simply a power of 10. Set the scale-unit property to CHAMPLAIN_UNIT_MILES to get miles.

You can limit the width (in pixels) of the scale with the max-scale-width property.  If you watch closely, the scale will adjust itself right away when you move the map.

Comments (5)

  1. 4 January 2010
    hb said...

    Awesome, thanks!

  2. 4 January 2010
    Leif said...

    This is looking better every day. Keep it up!

  3. 10 January 2010

    [...] a scale with the current unit size on the map. Pierre-Luc Beaudoin wrote about this new feature in Can you spot what’s new? on his [...]

  4. 24 January 2010

    Hi,

    Is there working python bindings for libchamplain that are already packaged in extras-* ?

    I’m working on a python app that would need such mapping stuff, and I don’t want to rewrite everything, especially if there are already some projects out there :)

    Jon

  5. 24 January 2010
    Pierre-Luc Beaudoin said...

    Hi,

    there are no packaged bindings yet and the ones shipped in the 0.4.3 tarball are missing files to be working. I’ll see to package them.