»
S
I
D
E
B
A
R
«
Can you spot what’s new?
January 4th, 2010 by Pierre-Luc Beaudoin

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.


5 Responses

hb writes:
January 4th, 2010 at 14:47

Awesome, thanks!

Leif writes:
January 4th, 2010 at 15:07

This is looking better every day. Keep it up!

GNOME Commit-Digest » Blog Archive » Issue 66 writes:
January 10th, 2010 at 7:39

[...] 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 [...]

Jonathan Schemoul writes:
January 24th, 2010 at 7:13

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

Pierre-Luc Beaudoin writes:
January 24th, 2010 at 12:00

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.

Leave a Reply

You must be logged in to post a comment.

»  Substance: WordPress   »  Style: Ahren Ahimsa