[Biojava-l] Overlaid drawing class

Dr S.M. Huen smh1008@cus.cam.ac.uk
Tue, 15 May 2001 21:41:41 +0100 (BST)


I have been thinking about some means of doing overdraw in biojava, ie.
have renderers draw into the same space.

Would it be reasonable to make a class similar to MultiLineRenderer that
allowed something like

addRenderer(renderer, OverlayRenderer.OVERLAY);

When asked to overlay, the offset within the drawing space is not
incremented by depth after drawing so the next renderer draws over the
graphic for this one.

I think it was suggested that I used something like this to put the CDS
ziggies and stops together over 6 frames but it's not immediately apparent
to me how I can stop them drawing tiled rather than overlaid on each other
with the current MultilineRenderer.

The code would then be something like:-
SixFrameRenderer sixFrame = new SixFrameRenderer();

...

zml.addRenderer(new SixFrameZiggyRenderer(sixFrame),OverlayRenderer.OVERLAY);
zml.addRenderer(new StopChecker(sixFrame),OverlayRenderer.TILED);


This way all the information about the graphical position of the six
frames relative to each other are encapsulated in the SixFrameRenderer and
the SixFrameZiggyRenderer and StopChecker renderers that use it just call
the SixFrameRenderer methods:-

public void drawStop(Location, StrandedFeature);
creates a cookie to maintain frame state info.
public ziggyCookie createZiggy(strandedFeature);
// draws block and (if necessary) the splice line. State info is
// maintained in cookie.  This requires know which frame to put the 
// next block in etc.
public void drawLocationFeature(Location, ziggyCookie); 


Is this a reasonable way to design it or is there a better one?

Thanks,
David