X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FTreeCanvas.java;h=7040c42f26aaf554723f5e4508233b44944194f3;hb=6666fd8b18b395d444e7f4c76016231f5a4d3669;hp=47c2d284facae05d1c8a33d77069252eeec890e8;hpb=2bd3c28fe234c6883bec5412db83a809ab8d1500;p=jalview.git diff --git a/src/jalview/appletgui/TreeCanvas.java b/src/jalview/appletgui/TreeCanvas.java index 47c2d28..7040c42 100755 --- a/src/jalview/appletgui/TreeCanvas.java +++ b/src/jalview/appletgui/TreeCanvas.java @@ -146,7 +146,7 @@ public class TreeCanvas extends Panel implements MouseListener, } public void drawNode(Graphics g, SequenceNode node, float chunk, - float scale, int width, int offx, int offy) + double scale, int width, int offx, int offy) { if (node == null) { @@ -157,8 +157,8 @@ public class TreeCanvas extends Panel implements MouseListener, { // Drawing leaf node - float height = node.height; - float dist = node.dist; + double height = node.height; + double dist = node.dist; int xstart = (int) ((height - dist) * scale) + offx; int xend = (int) (height * scale) + offx; @@ -240,8 +240,8 @@ public class TreeCanvas extends Panel implements MouseListener, drawNode(g, (SequenceNode) node.right(), chunk, scale, width, offx, offy); - float height = node.height; - float dist = node.dist; + double height = node.height; + double dist = node.dist; int xstart = (int) ((height - dist) * scale) + offx; int xend = (int) (height * scale) + offx; @@ -338,7 +338,7 @@ public class TreeCanvas extends Panel implements MouseListener, SequenceNode top = tree.getTopNode(); - float wscale = (float) (width * .8 - offx * 2) / tree.getMaxHeight(); + double wscale = (float) (width * .8 - offx * 2) / tree.getMaxHeight(); if (top.count == 0) { top.count = ((SequenceNode) top.left()).count @@ -350,7 +350,7 @@ public class TreeCanvas extends Panel implements MouseListener, } public void pickNode(Rectangle pickBox, SequenceNode node, float chunk, - float scale, int width, int offx, int offy) + double scale, int width, int offx, int offy) { if (node == null) { @@ -359,7 +359,7 @@ public class TreeCanvas extends Panel implements MouseListener, if (node.left() == null && node.right() == null) { - float height = node.height; + double height = node.height; // float dist = node.dist; // int xstart = (int) ( (height - dist) * scale) + offx; @@ -465,7 +465,7 @@ public class TreeCanvas extends Panel implements MouseListener, // for // scrollbar - float wscale = (width - labelLength - offx * 2) / tree.getMaxHeight(); + double wscale = (width - labelLength - offx * 2) / tree.getMaxHeight(); SequenceNode top = tree.getTopNode(); @@ -528,8 +528,7 @@ public class TreeCanvas extends Panel implements MouseListener, for (int i = 0; i < leaves.size(); i++) { - SequenceI seq = (SequenceI) leaves.elementAt(i) - .element(); + SequenceI seq = (SequenceI) leaves.elementAt(i).element(); treeSelectionChanged(seq); } } @@ -628,14 +627,13 @@ public class TreeCanvas extends Panel implements MouseListener, (int) (Math.random() * 255), (int) (Math.random() * 255)); setColor(tree.getGroups().elementAt(i), col.brighter()); - Vector l = tree.findLeaves(tree - .getGroups().elementAt(i)); + Vector l = tree.findLeaves(tree.getGroups() + .elementAt(i)); Vector sequences = new Vector(); for (int j = 0; j < l.size(); j++) { - SequenceI s1 = (SequenceI) l.elementAt(j) - .element(); + SequenceI s1 = (SequenceI) l.elementAt(j).element(); if (!sequences.contains(s1)) { sequences.addElement(s1); @@ -658,35 +656,38 @@ public class TreeCanvas extends Panel implements MouseListener, } else { - cs = ColourSchemeProperty.getColour(sg, ColourSchemeProperty - .getColourName(av.getGlobalColourScheme())); + cs = ColourSchemeProperty.getColourScheme(sg, + ColourSchemeProperty.getColourName(av + .getGlobalColourScheme())); } // cs is null if shading is an annotationColourGradient - if (cs != null) - { - cs.setThreshold(av.getGlobalColourScheme().getThreshold(), - av.isIgnoreGapsConsensus()); - } + // if (cs != null) + // { + // cs.setThreshold(av.getViewportColourScheme().getThreshold(), + // av.isIgnoreGapsConsensus()); + // } } // TODO: cs used to be initialized with a sequence collection and // recalcConservation called automatically // instead we set it manually - recalc called after updateAnnotation - sg.cs = cs; + sg.setColourScheme(cs); + sg.getGroupColourScheme().setThreshold( + av.getResidueShading().getThreshold(), + av.isIgnoreGapsConsensus()); sg.setName("JTreeGroup:" + sg.hashCode()); sg.setIdColour(col); if (av.getGlobalColourScheme() != null - && av.getGlobalColourScheme().conservationApplied()) + && av.getResidueShading().conservationApplied()) { - Conservation c = new Conservation("Group", 3, - sg.getSequences(null), sg.getStartRes(), sg.getEndRes()); + Conservation c = new Conservation("Group", sg.getSequences(null), + sg.getStartRes(), sg.getEndRes()); c.calculate(); c.verdict(false, av.getConsPercGaps()); - cs.setConservation(c); - - sg.cs = cs; + sg.setColourScheme(cs); + sg.getGroupColourScheme().setConservation(c); } av.getAlignment().addGroup(sg);