[Biojava-l] Overlaid drawing class

Matthew Pocock mrp@sanger.ac.uk
Mon, 21 May 2001 15:12:47 +0100


Hi

I sudgest that you create a new class called OverlayRenderer that 
maintains a list of renderers much like MultiLineRenderer does (rip off 
the listener manager code - it's debugged now!). It returns max rather 
than sum over child depths for getDepth, and doesn't translate the 
graphics context when rendering. This should be easy to write.

While you're at it, you may wish to write an OverlayFeatureRenderer that 
allows multiple feature renderers to render to the same area of screen, 
and then write a FeatureSequenceRenderer that is a FeatureRenderer that 
invokes a SequenceRenderer for just the region contained by that feature.

That way, you could have a renderer for an exon that is an overlay of a 
box renderer and your stop-codon sequence renderer.

Piece of cake. Not sure about the class names, though ;-) Bother me if 
it isn't clear and I can produce skeleton code.

Matthew


Dr S.M. Huen wrote:

> 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
> 
> 
> 
> _______________________________________________
> Biojava-l mailing list  -  Biojava-l@biojava.org
> http://biojava.org/mailman/listinfo/biojava-l