X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2FHTMLOutput.java;h=d15a6e807b1406e4927f50aaa885f2ccf924cadf;hb=44d9bd9b511490baec5302be3b7756be0adebde3;hp=8eef36f345af5cd863bb9f50c06e64bf9fee3967;hpb=1ecf6419aba86993b3c223bf5ec0fa79427baf85;p=jalview.git diff --git a/src/jalview/io/HTMLOutput.java b/src/jalview/io/HTMLOutput.java index 8eef36f..d15a6e8 100755 --- a/src/jalview/io/HTMLOutput.java +++ b/src/jalview/io/HTMLOutput.java @@ -11,10 +11,11 @@ import java.util.*; public class HTMLOutput { - SequenceRenderer sr = new SequenceRenderer(); - public HTMLOutput(AlignmentI alignment, ColourSchemeI cs) + + public HTMLOutput(AlignViewport av) { + SequenceRenderer sr = new SequenceRenderer(av); Color color; JFileChooser chooser = new JFileChooser(jalview.bin.Cache.LAST_DIRECTORY); chooser.setDialogTitle("Save as HTML"); @@ -29,7 +30,18 @@ public class HTMLOutput out.println(""); out.println(""); out.println(""); @@ -38,31 +50,74 @@ public class HTMLOutput ////////////// - for (int i = 0; i < alignment.getHeight(); i++) + SequenceGroup [] groups; + SequenceI seq; + ColourSchemeI cs = null; + AlignmentI alignment = av.getAlignment(); + String r,g,b; + + // draws the top row, the measure rule + out.println(""); + int i=0; + for(i=10; i"+i+"
|"); + + out.println(""+i+"
|"); + out.println(""); + + for (i = 0; i < alignment.getHeight(); i++) { - SequenceI seq = alignment.getSequenceAt(i); - out.println(""+seq.getName()+"  "); + seq = alignment.getSequenceAt(i); + groups = alignment.findAllGroups( seq ); + out.println(""+seq.getDisplayId()+"  "); + + for (int res = 0; res < seq.getLength(); res++) { + cs = av.getGlobalColourScheme(); + + if(groups!=null) + { + for (int k = 0; k < groups.length; k++) + if (groups[k].getStartRes() <= res && groups[k].getEndRes() >= res) + { + cs = groups[k].cs; + break; + } + } + + color = sr.getResidueBoxColour(cs, seq, res); - Integer.toHexString(color.getRed()); - out.println("
"+seq.getCharAt(res)+"
"); + if(color.getRGB()<-1) + { + 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)+""); + } out.println(""); } ////////////// - out.println(""); - out.println("\n\n"); + out.println(""); + out.println("\n\n"); out.close(); + + jalview.util.BrowserLauncher.openURL( "file:///"+choice ); } - catch(Exception ex){} + catch(Exception ex){ex.printStackTrace();} } }