From fb94c80fc4ed42cb9b693d81a1c53aa150bb0dd6 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Fri, 10 Dec 2004 14:39:22 +0000 Subject: [PATCH] Now allows multi coloured HTML output --- src/jalview/io/HTMLOutput.java | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/src/jalview/io/HTMLOutput.java b/src/jalview/io/HTMLOutput.java index 14a6ccb..b238383 100755 --- a/src/jalview/io/HTMLOutput.java +++ b/src/jalview/io/HTMLOutput.java @@ -13,7 +13,7 @@ public class HTMLOutput { SequenceRenderer sr = new SequenceRenderer(null); - public HTMLOutput(AlignmentI alignment, ColourSchemeI cs) + public HTMLOutput(AlignViewport av) { Color color; JFileChooser chooser = new JFileChooser(jalview.bin.Cache.LAST_DIRECTORY); @@ -29,8 +29,7 @@ public class HTMLOutput out.println(""); out.println(""); out.println(""); @@ -39,21 +38,37 @@ public class HTMLOutput ////////////// + SequenceGroup group; + SequenceI seq; + ColourSchemeI cs; + AlignmentI alignment = av.getAlignment(); + String r,g,b; for (int i = 0; i < alignment.getHeight(); i++) { - SequenceI seq = alignment.getSequenceAt(i); + seq = alignment.getSequenceAt(i); + group = alignment.findGroup( seq ); out.println(""+seq.getName()+"  "); for (int res = 0; res < seq.getLength(); res++) { + if(group!=null && group.getStartRes()<=res && group.getEndRes()>=res) + cs = group.cs; + else + cs = av.getGlobalColourScheme(); + color = sr.getResidueBoxColour(cs, seq, res); if(color.getRGB()<-1) { - out.println(""+seq.getCharAt(res)+""); + r = Integer.toHexString(color.getRed()); + if(r.length()<2) + r = "0"+r; + g = Integer.toHexString(color.getGreen()); + if(g.length()<2) + g = "0"+g; + b = Integer.toHexString(color.getBlue()); + if(b.length()<2) + b = "0"+b; + out.println(""+seq.getCharAt(res)+""); } else out.println(""+seq.getCharAt(res)+""); -- 1.7.10.2