Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
3635898
Adding class StyledSquareTree.java
daisieh Dec 8, 2013
7a2f10b
Add getBranchWidth
daisieh Dec 8, 2013
c74b7ed
adding rotateTo/FromUp methods
daisieh Dec 8, 2013
635dfb3
change color of taxonname if specified.
daisieh Dec 8, 2013
b179a20
Added hook to get the TreePaneSize
daisieh Dec 8, 2013
c624984
Add class NodePropertyAttacher
daisieh Dec 9, 2013
38ff598
Adding some methods to manipulate strings on nodes
daisieh Dec 9, 2013
aa9c312
antialias the tree
daisieh Dec 9, 2013
d1e345e
refactoring, renaming of variables
daisieh Dec 9, 2013
4a3545a
add method rotatePoly, change signature for rotateFromUp
daisieh Dec 9, 2013
de55715
converting from polygons to lines
daisieh Dec 9, 2013
3f85f90
Code cleanup
daisieh Dec 9, 2013
b973623
first attempt at StyledCircularTree
daisieh Dec 9, 2013
7495e4a
adding method rotateLine2D
daisieh Dec 9, 2013
a7a4c0f
moving branchWidth calculation
daisieh Dec 9, 2013
0d8e391
(intermediate commit) Changing Styled tree classes to use lines inste…
daisieh Dec 9, 2013
1f30043
build DEV
daisieh Dec 9, 2013
6a2bff8
add default.tss
daisieh Dec 9, 2013
481761e
I don't know when these snuck in...
daisieh Dec 9, 2013
1ae3e89
Oops, committed an extra line
daisieh Dec 10, 2013
ab28e67
A line got moved in the build.xml file
daisieh Dec 10, 2013
0984a13
set default orientation to user-specified default
daisieh Jan 13, 2014
c09cd68
Merge branch 'master' of https://github.com/MesquiteProject/MesquiteC…
daisieh Jan 13, 2014
e9bd118
ignore intellij files
daisieh Jan 13, 2014
7fdcf87
Merge from MesquiteProject
daisieh Jan 13, 2014
ccdc4da
Should count for line length even if we're appending UnassignedSymbols.
daisieh Feb 25, 2014
25eb286
Merge branch 'master' into StyledSquareTree
daisieh May 8, 2014
ddd89a0
merge 3.0
daisieh Sep 15, 2014
5bb1a05
Recode as UTF-8 instead of UTF-16
daisieh Sep 15, 2014
68199c1
Merge Mesquite 3.0
daisieh Sep 15, 2014
bec9ff4
??
daisieh Sep 15, 2014
b7ef5ab
Merge branch 'StyledSquareTree' of https://github.com/daisieh/Mesquit…
daisieh Sep 15, 2014
92d4166
huh, weirdly was in Chinese?
daisieh Sep 15, 2014
de7b632
try converting to UTF-8 again
daisieh Sep 15, 2014
aedf17f
Merge branch 'intellij' into StyledSquareTree
daisieh Sep 15, 2014
0834dd5
augh file encoding
daisieh Sep 15, 2014
3425900
don't commit build products
daisieh Sep 15, 2014
749def8
commit for push/handoff to Daisie
pmidford Sep 19, 2014
f73c5e0
Merge branch 'PEM_StyledSquareTree' into StyledSquareTree
daisieh Sep 19, 2014
fa5a273
Merge remote-tracking branch 'MesquiteProject/master'
daisieh Oct 4, 2016
0977a46
updating to upstream master
daisieh Oct 4, 2016
eaa0f0e
Merge remote-tracking branch 'MesquiteProject/master' into StyledSqua…
daisieh Oct 17, 2016
b214fec
merge StringUtil.java
daisieh Oct 17, 2016
891274e
don't commit build products
daisieh Oct 17, 2016
59a29c8
Styled Square Tree
daisieh Oct 17, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
Mesquite_Folder/
# Workspace files #
###################
*.iml

# Compiled source #
###################
*.com
Expand Down Expand Up @@ -36,3 +40,7 @@ Mesquite_Folder/
.Trashes
ehthumbs.db
Thumbs.db

# Build products #
##################
Resources/Mesquite*
30 changes: 29 additions & 1 deletion Source/mesquite/lib/MesquiteTree.java
Original file line number Diff line number Diff line change
Expand Up @@ -1743,6 +1743,25 @@ public int numberOfNodesInClade(int node) {
count++; //count node itself
return count;
}

public Vector<Integer> nodesInClade(int node) {
Vector<Integer> nodes = new Vector();
String[] parsedNodes = nodesInCladeAsString(node,null).split(",");
for (String nodeString : parsedNodes) {
nodes.add(Integer.parseInt(nodeString));
}
return nodes;
}

private String nodesInCladeAsString(int node, String nodes) {
if (nodes == null) {
nodes = String.valueOf(node);
}
for (int d = firstDaughterOfNode(node); nodeExists(d); d = nextSisterOfNode(d)) {
nodes = nodesInCladeAsString(d, nodes) + "," + d;
}
return nodes;
}
/*-----------------------------------------*/
/** Returns number of terminal taxa in clade.*/
public int numberOfTerminalsInClade(int node) {
Expand Down Expand Up @@ -5583,7 +5602,16 @@ public String getNodeLabel(int node){
return label[node];
}
/*-----------------------------------------*/
/** Returns whether the node has a label */
public void setStringPropertyOnNode(String propName, String propVal, int node){
this.setAssociatedObject(new NameReference(propName),node, propVal);
}
/*-----------------------------------------*/
/** Gets the node label of the node */
public String getStringPropertyOnNode(String prop, int node){
ObjectArray props = this.getAssociatedObjects(node);
return "";
}
/** Returns whether the node has a label */
public boolean nodeHasLabel(int node){
return (label!=null && nodeExists(node) && label[node]!=null) || (nodeIsTerminal(node));
}
Expand Down
Binary file modified Source/mesquite/lib/StringUtil.java
Binary file not shown.
12 changes: 11 additions & 1 deletion Source/mesquite/lib/TreeDisplay.java
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,17 @@ public Color getBranchColor(int N){
}
}

public Composite setBranchTransparency(Graphics g, int N){
public int getBranchWidth(int node){
long result = tree.getAssociatedLong(NameReference.getNameReference("width"), node);

if (result == MesquiteLong.unassigned) {
return 0;
}
return (int) result;
}


public Composite setBranchTransparency(Graphics g, int N){
if (!showBranchColors)
return null;
if (tree.anySelected() && !tree.getSelected(N)) {
Expand Down
144 changes: 142 additions & 2 deletions Source/mesquite/lib/TreeDrawing.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
package mesquite.lib;

import java.awt.*;
import java.awt.geom.Line2D;

import mesquite.lib.duties.*;
import mesquite.trees.lib.TaxonPolygon;
Expand All @@ -37,7 +38,13 @@ public abstract class TreeDrawing {
public final static int MINNODEWIDTH = 6;
public final static int ACCEPTABLETOUCHWIDTH = 10;
public final static boolean SHOWTOUCHPOLYS = false;
public int[] x; //x positions of nodes
public final static int UP = 0;
public final static int DOWN = 1;
public final static int RIGHT = 2;
public final static int LEFT = 3;
public final static int ALLNODES = -1;

public int[] x; //x positions of nodes
public int[] y; //y positions of nodes
public double[] z; //z positions of nodes (closeness to viewer, smaller numbers closer)
public int[] lineBaseX; //base of line on which to draw labels etc.
Expand Down Expand Up @@ -94,6 +101,10 @@ public void resetNumNodes(int numNodes){
}
}

public void setProperty(int node, String property, String value) {
MesquiteModule.mesquiteTrunk.logln("setProperty called on "+property+", but this property does not exist in "+this.getClass().toString());
}

public int getDrawnRoot(){
return drawnRoot;
}
Expand Down Expand Up @@ -139,7 +150,136 @@ public int getNodeValueTextBaseY(int node, int edgewidth, int stringwidth, int f
public abstract void fillBranch(Tree tree, int N, Graphics g);


/*_________________________________________________*/
public void rotateFromUp(Polygon poly, Point origin, int to_orientation) {
poly.translate(-origin.x,-origin.y);
for(int i=0;i<poly.npoints;i++) {
int old_x = poly.xpoints[i];
int old_y = poly.ypoints[i];
if (to_orientation == RIGHT) {
poly.xpoints[i] = -old_y;
poly.ypoints[i] = old_x;
} else if (to_orientation == DOWN) {
poly.xpoints[i] = -old_x;
poly.ypoints[i] = -old_y;
} else if (to_orientation == LEFT) {
poly.xpoints[i] = old_y;
poly.ypoints[i] = -old_x;
}
}
poly.translate(origin.x,origin.y);
poly.invalidate();
}

public void rotatePoly(Polygon poly, Point origin, double angle) {
poly.translate(-origin.x,-origin.y);
for(int i=0;i<poly.npoints;i++) {
double old_x = poly.xpoints[i];
double old_y = poly.ypoints[i];
double radius = 0;
double old_angle = 0;
if (old_x == 0) {
if (old_y > 0) {
old_angle = Math.PI * 0.5;
radius = old_y;
} else if (old_y < 0) {
old_angle = Math.PI * 1.5;
radius = -old_y;
}
} else if (old_y == 0) {
if (old_x >= 0) {
radius = old_x;
} else {
radius = -old_x;
old_angle = Math.PI;
}
} else {
double t = old_y/old_x;
old_angle = Math.atan(t);
radius = Math.sqrt((old_x*old_x)+(old_y*old_y));
}
double new_angle = angle - old_angle;
poly.xpoints[i] = (int)(radius * (Math.cos(new_angle)));
poly.ypoints[i] = (int)(radius * (Math.sin(new_angle)));
}
poly.translate(origin.x,origin.y);
poly.invalidate();
}

public void rotateLine2D(Line2D.Double line, Point origin, double angle) {

Polygon poly = new Polygon();
poly.addPoint((int)line.x1,(int)line.y1);
poly.addPoint((int)line.x2,(int)line.y2);
poly.translate(-origin.x,-origin.y);
for(int i=0;i<poly.npoints;i++) {
double old_x = poly.xpoints[i];
double old_y = poly.ypoints[i];
double radius = 0;
double old_angle = 0;
if (old_x == 0) {
if (old_y > 0) {
old_angle = Math.PI * 0.5;
radius = old_y;
} else if (old_y < 0) {
old_angle = Math.PI * 1.5;
radius = -old_y;
}
} else if (old_y == 0) {
if (old_x >= 0) {
radius = old_x;
} else {
radius = -old_x;
old_angle = Math.PI;
}
} else {
double t = old_y/old_x;
old_angle = Math.atan(t);
radius = Math.sqrt((old_x*old_x)+(old_y*old_y));
}
double new_angle = angle - old_angle;
poly.xpoints[i] = (int)(radius * (Math.cos(new_angle)));
poly.ypoints[i] = (int)(radius * (Math.sin(new_angle)));
}
poly.translate(origin.x,origin.y);
poly.invalidate();
line.x1 = poly.xpoints[0];
line.x2 = poly.xpoints[1];
line.y1 = poly.ypoints[0];
line.y2 = poly.ypoints[1];
}


public Point pointRotatedFromUp(int to_orientation, Point origin, Point point) {
int old_x = point.x-origin.x;
int old_y = point.y-origin.y;
Point result = new Point(old_x,old_y);
if (to_orientation == RIGHT) {
result.move(-old_y,old_x);
} else if (to_orientation == DOWN) {
result.move(-old_x, -old_y);
} else if (to_orientation == LEFT) {
result.move(old_y, -old_x);
}
result.translate(origin.x, origin.y);
return result;
}

public Point pointRotatedToUp(int from_orientation, Point origin, Point point) {
int old_x = point.x-origin.x;
int old_y = point.y-origin.y;
Point result = new Point(old_x,old_y);
if (from_orientation == RIGHT) {
result.move(old_y, -old_x);
} else if (from_orientation == DOWN) {
result.move(-old_x, -old_y);
} else if (from_orientation == LEFT) {
result.move(-old_y, old_x);
}
result.translate(origin.x, origin.y);
return result;
}

/*_________________________________________________*/
/** Does the basic inverting of the color of a branch **/
public void fillBranchInverted (Tree tree, int N, Graphics g) {
if (GraphicsUtil.useXORMode(g, true)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -439,11 +439,16 @@ else if (taxonNumber>=taxa.getNumTaxa()) {
//check all extras to see if they want to add anything
boolean underlined = false;
Color taxonColor;
if (!tree.anySelected() || tree.getSelected(N))
taxonColor = fontColor;
else
if (!tree.anySelected() || tree.getSelected(N)) {
long result = tree.getAssociatedLong(NameReference.getNameReference("taxoncolor"), N);
if (result == MesquiteLong.unassigned) {
taxonColor = fontColor;
} else {
taxonColor = ColorDistribution.getStandardColor((int) result);
}
} else {
taxonColor = fontColorLight;

}
if (partitions!=null && (colorPartition.getValue() || shadePartition.getValue())){
TaxaGroup mi = (TaxaGroup)partitions.getProperty(taxonNumber);
if (mi!=null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,8 @@ public void paint(Graphics g) {
if (ownerModule == null || ownerModule.isDoomed())
return;
setShowBranchColors(ownerDrawModule.showBranchColors.getValue());
if (MesquiteWindow.checkDoomed(this))
((Graphics2D) g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
if (MesquiteWindow.checkDoomed(this))
return;
setDrawingInProcess(true);
int initialPending = repaintsPending;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2359,7 +2359,10 @@ public Object doCommand(String commandName, String arguments, CommandChecker che
else if (checker.compare(this.getClass(), "Returns the tree info panel", null, commandName, "getInfoPanel")) {
return treeInfoPanel;
}
else if (checker.compare(this.getClass(), "Returns analyses at nodes as a table", null, commandName, "getAsTable")) {
else if (checker.compare(this.getClass(), "Returns the tree pane size", null, commandName, "getTreePaneSize")) {
return new Dimension(getTreePaneWidth(),getTreePaneHeight());
}
else if (checker.compare(this.getClass(), "Returns analyses at nodes as a table", null, commandName, "getAsTable")) {
if (treeDisplay == null)
return null;
String s = treeDisplay.getTableVersion();
Expand Down
Loading