[Biojava-l] ANN: Imagemap rendering

Keith James kdj@sanger.ac.uk
15 Apr 2002 14:27:50 +0100


Hi,

I was asked to create imagemaps corresponding to the output of the
SequenceRenderers so I've added some code for generating the image map
coordinates concurrently with the image. This takes the form of a
decorator on a FeatureRenderer which calculates the coodinates of the
useful areas of the image and encapsulates them (each with a URL and
an optional user object) into a HotSpot object which gets added to an
ImageMap object.

Implementations are:

 RectangularImapRenderer which wraps a RectangularBeadRenderer and
 creates an image map with clickable rectangles for each Feature.

 ZiggyImapRenderer which wraps ZiggyFeatureRenderer and creates an
 image map with clickable rectangles for each sub-location (the
 "elbows" are not clickable.

The associated URLs must come from a user-supplied implementation of
org.biojava.utils.net.URLFactory which has one method:

 URL createURL(Object o)

This is passed Features during the rendering process so a suitable URL
may be created from any Feature property (see AnnotationType)

The hotspots created also contain the originating Feature as their
user object so that when they are used to build a document they can be
queried for extra data used to set things like actions (mouseover et
al.)

Several ImageMapRenderers can be directed to one ImageMap so you can
get a clickable image of an entire MultiLineRenderer.

Note that there is no HTML written by these classes. That is left to
the surrounding implementation (sometimes none will be written
e.g. server side map file contains no HTML).

Typical use case would be something like retrieving the completed
ImageMap object and iterating though its HotSpots, passing them to a
factory which queries their type (rect, circle, pol), coordinates and
user object and returns an org.w3c.dom.html.HTMLAreaElement for each.

Keith

-- 

-= Keith James - kdj@sanger.ac.uk - http://www.sanger.ac.uk/Users/kdj =-
Pathogen Sequencing Unit, Wellcome Trust Sanger Institute, Cambridge, UK