UPDATE 2-Oct-08: Deep Zoom Tag Cloud example updated for RC0
One of the Deep Zoom Composer team recently posted a Filtering by Tag Sample that takes advantage of the new "Tag" input in the latest Deep Zoom Composer release.
Kirupa says specifically "A major limitation in the current version is that if you have multiple tags separated by commas, the application doesn’t break them up and allow you to filter by them.That means, your images can only have one tag associated with them. Don’t worry – I will fix that shortly"...
Turns out you can enable multiple tags with relatively few changes to the example code (and a bit of inspiration from Kosta's Tag Cloud example).
The result looks like this (click to view larger image; notice the tags are scaled according to frequency), or try it here (beta2) (or RC0. The Metadata.xml shows how the source data looks.
The only changes to Kirupa's sample were in the
xmlClient_DownloadStringCompletedhandler, which is called when the
Metadata.xmlhas been retrieved. To try out the multiple-tag-"cloud" you should follow his instructions to get it running, then update xmlClient_DownloadStringCompleted with this code. Don't forget to seperate your tags with commas or semicolons!
The major changes to enable multiple tags were:
1. split and trim the tag string/s
2. use the
uniqueTags Dictionaryto store the 'count' of tag occurances
3. loop through all the tags to build a unique list, rather than assume just one is attached to the image
4. 'hardcode' the relative font sizes
There are many areas where this code to be improved - the tag handling is case sensitive (so "monastery" and "Monastery" would be listed seperately), the font size could be calculated (logarithmically?) rather than hardcoded , the tag-list could be more 'cloud like' rather than being hosted in a
ListBoxand much more. They may be addressed in future posts... or attempted by the reader.