X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fio%2FHTMLOutput.java;h=d15a6e807b1406e4927f50aaa885f2ccf924cadf;hb=44d9bd9b511490baec5302be3b7756be0adebde3;hp=b42547a1b3213e5a17efcdf280ef6d0ad0833835;hpb=8a55dd77f109200c28f35d1c1d33da72982381a3;p=jalview.git
diff --git a/src/jalview/io/HTMLOutput.java b/src/jalview/io/HTMLOutput.java
index b42547a..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,8 +30,18 @@ public class HTMLOutput
out.println("");
out.println("");
out.println("
");
@@ -39,21 +50,57 @@ 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);
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)+" | ");
@@ -68,9 +115,9 @@ public class HTMLOutput
out.close();
- jalview.util.BrowserLauncher.openURL( choice );
+ jalview.util.BrowserLauncher.openURL( "file:///"+choice );
}
- catch(Exception ex){}
+ catch(Exception ex){ex.printStackTrace();}
}
}