git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'develop' into features/JAL-2393customMatrices
[jalview.git]
/
src
/
jalview
/
appletgui
/
TreeCanvas.java
diff --git
a/src/jalview/appletgui/TreeCanvas.java
b/src/jalview/appletgui/TreeCanvas.java
index
3b509e5
..
48e9d64
100755
(executable)
--- a/
src/jalview/appletgui/TreeCanvas.java
+++ b/
src/jalview/appletgui/TreeCanvas.java
@@
-21,7
+21,7
@@
package jalview.appletgui;
import jalview.analysis.Conservation;
package jalview.appletgui;
import jalview.analysis.Conservation;
-import jalview.analysis.NJTree;
+import jalview.analysis.TreeModel;
import jalview.api.AlignViewportI;
import jalview.datamodel.Sequence;
import jalview.datamodel.SequenceGroup;
import jalview.api.AlignViewportI;
import jalview.datamodel.Sequence;
import jalview.datamodel.SequenceGroup;
@@
-48,12
+48,13
@@
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.util.Enumeration;
import java.util.Hashtable;
import java.awt.event.MouseMotionListener;
import java.util.Enumeration;
import java.util.Hashtable;
+import java.util.List;
import java.util.Vector;
public class TreeCanvas extends Panel implements MouseListener,
MouseMotionListener
{
import java.util.Vector;
public class TreeCanvas extends Panel implements MouseListener,
MouseMotionListener
{
- NJTree tree;
+ TreeModel tree;
ScrollPane scrollPane;
ScrollPane scrollPane;
@@
-115,13
+116,13
@@
public class TreeCanvas extends Panel implements MouseListener,
selected.addOrRemove(sequence, true);
}
selected.addOrRemove(sequence, true);
}
- public void setTree(NJTree tree)
+ public void setTree(TreeModel tree2)
{
{
- this.tree = tree;
- tree.findHeight(tree.getTopNode());
+ this.tree = tree2;
+ tree2.findHeight(tree2.getTopNode());
// Now have to calculate longest name based on the leaves
// Now have to calculate longest name based on the leaves
- Vector<SequenceNode> leaves = tree.findLeaves(tree.getTopNode());
+ Vector<SequenceNode> leaves = tree2.findLeaves(tree2.getTopNode());
boolean has_placeholders = false;
longestName = "";
boolean has_placeholders = false;
longestName = "";
@@
-146,7
+147,7
@@
public class TreeCanvas extends Panel implements MouseListener,
}
public void drawNode(Graphics g, SequenceNode node, float chunk,
}
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)
{
{
if (node == null)
{
@@
-157,8
+158,8
@@
public class TreeCanvas extends Panel implements MouseListener,
{
// Drawing leaf node
{
// 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;
int xstart = (int) ((height - dist) * scale) + offx;
int xend = (int) (height * scale) + offx;
@@
-240,8
+241,8
@@
public class TreeCanvas extends Panel implements MouseListener,
drawNode(g, (SequenceNode) node.right(), chunk, scale, width, offx,
offy);
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;
int xstart = (int) ((height - dist) * scale) + offx;
int xend = (int) (height * scale) + offx;
@@
-338,7
+339,7
@@
public class TreeCanvas extends Panel implements MouseListener,
SequenceNode top = tree.getTopNode();
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
if (top.count == 0)
{
top.count = ((SequenceNode) top.left()).count
@@
-350,7
+351,7
@@
public class TreeCanvas extends Panel implements MouseListener,
}
public void pickNode(Rectangle pickBox, SequenceNode node, float chunk,
}
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)
{
{
if (node == null)
{
@@
-359,7
+360,7
@@
public class TreeCanvas extends Panel implements MouseListener,
if (node.left() == null && node.right() == null)
{
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;
// float dist = node.dist;
// int xstart = (int) ( (height - dist) * scale) + offx;
@@
-465,7
+466,7
@@
public class TreeCanvas extends Panel implements MouseListener,
// for
// scrollbar
// for
// scrollbar
- float wscale = (width - labelLength - offx * 2) / tree.getMaxHeight();
+ double wscale = (width - labelLength - offx * 2) / tree.getMaxHeight();
SequenceNode top = tree.getTopNode();
SequenceNode top = tree.getTopNode();
@@
-593,8
+594,7
@@
public class TreeCanvas extends Panel implements MouseListener,
threshold = (float) (x - offx)
/ (float) (getSize().width - labelLength - 2 * offx);
threshold = (float) (x - offx)
/ (float) (getSize().width - labelLength - 2 * offx);
- tree.getGroups().removeAllElements();
- tree.groupNodes(tree.getTopNode(), threshold);
+ List<SequenceNode> groups = tree.groupNodes(threshold);
setColor(tree.getTopNode(), Color.black);
av.setSelectionGroup(null);
setColor(tree.getTopNode(), Color.black);
av.setSelectionGroup(null);
@@
-608,7
+608,7
@@
public class TreeCanvas extends Panel implements MouseListener,
codingComplement.clearSequenceColours();
}
codingComplement.clearSequenceColours();
}
- colourGroups();
+ colourGroups(groups);
}
}
}
}
@@
-618,17
+618,16
@@
public class TreeCanvas extends Panel implements MouseListener,
}
}
- void colourGroups()
+ void colourGroups(List<SequenceNode> groups)
{
{
- for (int i = 0; i < tree.getGroups().size(); i++)
+ for (int i = 0; i < groups.size(); i++)
{
Color col = new Color((int) (Math.random() * 255),
(int) (Math.random() * 255), (int) (Math.random() * 255));
{
Color col = new Color((int) (Math.random() * 255),
(int) (Math.random() * 255), (int) (Math.random() * 255));
- setColor(tree.getGroups().elementAt(i), col.brighter());
+ setColor(groups.get(i), col.brighter());
- Vector<SequenceNode> l = tree.findLeaves(tree.getGroups()
- .elementAt(i));
+ Vector<SequenceNode> l = tree.findLeaves(groups.get(i));
Vector<SequenceI> sequences = new Vector<SequenceI>();
for (int j = 0; j < l.size(); j++)
Vector<SequenceI> sequences = new Vector<SequenceI>();
for (int j = 0; j < l.size(); j++)
@@
-656,35
+655,38
@@
public class TreeCanvas extends Panel implements MouseListener,
}
else
{
}
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
}
// 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
}
// 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
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());
c.calculate();
c.verdict(false, av.getConsPercGaps());
- cs.setConservation(c);
-
- sg.cs = cs;
+ sg.setColourScheme(cs);
+ sg.getGroupColourScheme().setConservation(c);
}
av.getAlignment().addGroup(sg);
}
av.getAlignment().addGroup(sg);