[KPhotoAlbum] Marble map and clustering

Tobias Leupold tobias.leupold at gmx.de
Thu Feb 27 12:17:43 GMT 2020


Can we steal the clustering from libkgeomap?! Thinking about how I would
implement it, it doesn't seem to be really trivial ;-)

I would do it something like this:

We have to know the on-screen pixel distance between two coordinates. I think
I searched for this some time ago, but either, I didn't found/get it or marble
doesn't support this directly (but the Marble API is also not my favorite one
to be honest). Anyway, via the real distance calculation, the map viewport,
the zoom factor or whatever, we should be able to calculate it some way.

We take the first image. We know the thumbnail size. We calculate the on-
screen coordinates of the thumbnail (on-screen position +/- half the width/
height of the thumbnail). Then, we add the next one and check if it's
thumbnail will overlap with an existing one. If so, we merge them to a cluster
which extension is the maximum of the two thumbnails and don't add the
thumbnail but the cluster. Then, we add the next image and check if it's
thumbnail will collide with any other thumbnail or an existing cluster. If so,
extend the cluster by the thumbnail, increase the image counter and don't
display the thumbnail.

And so on ... this way, we would have to iterate through all images only once,
but we would have to check each image against each one and all clusters of
course.

This way, we only get single thumbnails or clusters with the exact extension
of a frame around all not displayed (because overlapping) thumbnails.
Something like this is what I would expect ...

Just some thoughts ... :-)

Am Mittwoch, 26. Februar 2020, 23:19:20 CET schrieb Johannes Zarl-Zierl:
> Hi Tobias,
>
> Thanks for the report - I guess I'll need to redo the clustering algorithm
> ;-)
>
> Cheers,
>   Johannes





More information about the Kphotoalbum mailing list