[PyQt] LightMaps example
Hans-Peter Jansen
hpj at urpla.net
Tue Oct 5 09:42:43 BST 2010
Hi Phil, hi PyQtnistas,
here's another nice example for the collection.
LightMaps is intended for demonstrating, how to display OpenStreetMap maps
on mobile devices. It uses interesting tricks including caching for the
networking part, shows, how to deal with tiled images, and has a funny
magnifier. Is is lacking one feature: a flexible way to specify the map
location, since the world is slightly bigger then Oslo, Berlin, and
Jakarta.. (and centering on Invalidenstraße in Berlin is plain wrong
anyway, no matter where the Qt office is finally located ;-))
I refrained from doing any extensions for the time being, hence resembling a
1:1 translation where possible and sensible.
The only appreciable deviation is, that I'm using a python dict for a QPoint
to pixmap mapping. Unfortunately, the in operator doesn't work then, hence,
I reimplemented a QPoint with a __hash__ method in order to not be forced
with QPoint <-> tuple(.x(), .y()) conversions all over..
Phil: it might be a good idea to consider adding __hash__ to assorted Qt
classes in order to improve their pythonic appearance, e,g, QPoint, QRect,
QColor. What do you think?
Cheers,
Pete
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lightmaps.py
Type: application/x-python
Size: 16253 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20101005/40419c22/attachment-0001.bin>
More information about the PyQt
mailing list