X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2FHTMLOutput.java;h=6c2c51ef5110a13b1849a0d250769e8d69332b75;hb=7157dfd20efd2e1db47db1ac12e879eb51c67b92;hp=e4dc83e9d35912535e26518c3aeba827f38e93e3;hpb=efc31b4a8d5cee63555586804a2b79c06bdb5a14;p=jalview.git diff --git a/src/jalview/io/HTMLOutput.java b/src/jalview/io/HTMLOutput.java index e4dc83e..6c2c51e 100755 --- a/src/jalview/io/HTMLOutput.java +++ b/src/jalview/io/HTMLOutput.java @@ -1,6 +1,6 @@ /* * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -24,18 +24,21 @@ import java.awt.*; import jalview.datamodel.*; import jalview.gui.*; -import jalview.schemes.*; public class HTMLOutput { AlignViewport av; SequenceRenderer sr; + FeatureRenderer fr; Color color; - public HTMLOutput(AlignViewport av) + public HTMLOutput(AlignViewport av, SequenceRenderer sr, FeatureRenderer fr1) { this.av = av; - sr = new SequenceRenderer(av); + this.sr = sr; + + fr = new FeatureRenderer(av); + fr.transferSettings(fr1); JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache. getProperty( @@ -110,13 +113,8 @@ public class HTMLOutput "\n"); ////////////// - SequenceGroup[] groups; SequenceI seq; - ColourSchemeI cs = null; AlignmentI alignment = av.getAlignment(); - String r; - String g; - String b; // draws the top row, the measure rule out.println(""); @@ -135,38 +133,24 @@ public class HTMLOutput for (i = 0; i < alignment.getHeight(); i++) { seq = alignment.getSequenceAt(i); - groups = alignment.findAllGroups(seq); - if (av.getShowFullId()) - { - out.println(""); - } - else - { - out.println(""); - } + String id = seq.getDisplayId(av.getShowJVSuffix()); + + out.println(""); for (int res = 0; res < seq.getLength(); res++) { - cs = av.getGlobalColourScheme(); - - if (groups != null) + if (!jalview.util.Comparison.isGap(seq.getCharAt(res))) { - for (int k = 0; k < groups.length; k++) - { - if ( (groups[k].getStartRes() <= res) && - (groups[k].getEndRes() >= res)) - { - cs = groups[k].cs; + color = sr.getResidueBoxColour(seq, res); - break; - } - } + color = fr.findFeatureColour(color, seq, res); + } + else + { + color = Color.white; } - - color = sr.getResidueBoxColour(cs, seq, res); if (color.getRGB() < -1) { @@ -193,9 +177,7 @@ public class HTMLOutput //////////////////////////////////// /// How many sequences and residues can we fit on a printable page? AlignmentI al = av.getAlignment(); - SequenceGroup[] groups; SequenceI seq; - ColourSchemeI cs = null; String r; String g; String b; @@ -205,94 +187,101 @@ public class HTMLOutput "
" + seq.getDisplayId() + - "  
" + seq.getName() + - "  
" + id + + "  
\n"); for (int startRes = 0; startRes < al.getWidth(); - startRes += av.getChunkWidth()) + startRes += av.getWrappedWidth()) { - int endRes = startRes + av.getChunkWidth(); + int endRes = startRes + av.getWrappedWidth(); if (endRes > al.getWidth()) { endRes = al.getWidth(); } - out.println(""); - out.println(""); - - for (int i = startRes + 10; i < endRes; i += 10) - { - out.println(""); - } - - // out.println(""); - out.println(""); - - for (int s = 0; s < al.getHeight(); s++) + if (av.getScaleAboveWrapped()) { out.println(""); - seq = al.getSequenceAt(s); - groups = al.findAllGroups(seq); - if (av.getShowFullId()) + if (av.getScaleLeftWrapped()) { - out.println(""); + out.println(""); } else { - out.println(""); + out.println(""); } - for (int res = startRes; res < endRes; res++) + for (int i = startRes + 10; i < endRes; i += 10) { - cs = av.getGlobalColourScheme(); + out.println(""); + } - 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; - } - } - } + out.println(""); + } - color = sr.getResidueBoxColour(cs, seq, res); + int startPos, endPos; + for (int s = 0; s < al.getHeight(); s++) + { + out.println(""); + seq = al.getSequenceAt(s); - if (color.getRGB() < -1) - { - r = Integer.toHexString(color.getRed()); + startPos = seq.findPosition(startRes); + endPos = seq.findPosition(endRes) - 1; - if (r.length() < 2) - { - r = "0" + r; - } + String id = seq.getDisplayId(av.getShowJVSuffix()); - g = Integer.toHexString(color.getGreen()); + out.println(""); - if (g.length() < 2) - { - g = "0" + g; - } + if (av.getScaleLeftWrapped()) + { + if (startPos > seq.getEnd() || endPos == 0) + { + out.println(""); + } + else + { + out.println(""); + } + } - b = Integer.toHexString(color.getBlue()); + for (int res = startRes; res < endRes; res++) + { + if (!jalview.util.Comparison.isGap(seq.getCharAt(res))) + { + color = sr.getResidueBoxColour(seq, res); - if (b.length() < 2) - { - b = "0" + b; - } + color = fr.findFeatureColour(color, seq, res); + } + else + { + color = Color.white; + } - out.println(""); } else { out.println(""); } + + } + + if (av.getScaleRightWrapped() && + endRes < startRes + av.getWrappedWidth()) + { + out.println(""); + } + + if (av.getScaleRightWrapped() && startPos < endPos) + { + out.println(""); } out.println(""); @@ -311,88 +300,90 @@ public class HTMLOutput public static String getImageMapHTML() { return new String( - "\n" - +"\n" - +"\n" - +"\n" - +"\n" - +"
\n" - +"\n"); + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "
\n" + + "\n"); } }
 " + i + "
|
" + i + - // "
|
" + seq.getDisplayId() + - "   " + seq.getName() + - "   " + i + "
|
" + id + + "   " + startPos + + "  " + + if (color.getRGB() < -1) + { + out.println("" + seq.getCharAt(res) + "" + seq.getCharAt(res) + "" + + "   " + endPos + + "