[Biojava-l] LabelledSequenceRenderer does not work with TranslatedSequenceRenderer, Newbie

Keith James kdj at sanger.ac.uk
Thu Mar 25 12:26:46 EST 2004


>>>>> "Kalle" == Kalle Näslund <kalle.naslund at genpat.uu.se> writes:

[...]

    Kalle> Also, can anyone remind me why we have several Panel
    Kalle> implementations please ? shouldnt it be very nice to have
    Kalle> one single implementation, that supports the unique
    Kalle> features of both SequencePanel and TranslatedSequencePanel
    Kalle> ?

Long story...

This came about because SequencePanel had two problems:

1. It will by default render a huge sequence in a single huge
   coordinate space which leads to floating point errors in marking
   tics/points at the far end of the sequence.

   To solve this a hack was put in to translate the drawing
   coordinates to ~0 before drawing. However that broke rendering to
   any Graphics2D derived from a BufferedImage where it produced an
   un-renderable region between 0 and the offset (which was 50 pixels
   wide, if I remember)

2. It was far too slow with available sequence/feature renderers.


So I wrote TranslatedSequencePanel which solves the first problem
without using the offset hack. Instead of placing a huge virtual
rendering area in a ScrollPane, it clips a window of sequence to
render and runs the window along the sequence. Therefore you are
always drawing from 0, even at base 100,000,001 of the sequence.

As a nice side-effect, it also turned out to be 5-10x faster at
rendering with the current sequence/feature renderers.

But people were still using the SequencePanel in their client code, so
I didn't want to remove it.

Keith

-- 

- Keith James <kdj at sanger.ac.uk> Microarray Facility, Team 65 -
- The Wellcome Trust Sanger Institute, Hinxton, Cambridge, UK -



More information about the Biojava-l mailing list