|
From: <rv...@us...> - 2011-05-19 13:00:35
|
Revision: 873
http://treebase.svn.sourceforge.net/treebase/?rev=873&view=rev
Author: rvos
Date: 2011-05-19 13:00:28 +0000 (Thu, 19 May 2011)
Log Message:
-----------
Added additional loop to identify the root node based on the implicit topology (instead of by looking for the @root attribute).
Modified Paths:
--------------
trunk/treebase-web/src/main/webapp/scripts/jsphylosvg-min.js
Modified: trunk/treebase-web/src/main/webapp/scripts/jsphylosvg-min.js
===================================================================
--- trunk/treebase-web/src/main/webapp/scripts/jsphylosvg-min.js 2011-05-19 12:57:49 UTC (rev 872)
+++ trunk/treebase-web/src/main/webapp/scripts/jsphylosvg-min.js 2011-05-19 13:00:28 UTC (rev 873)
@@ -761,6 +761,27 @@
}
}
+ // RAV: the root attribute is used to indicate whether an implicitly rooted
+ // topology should, from a biological p.o.v., be considered as such. However,
+ // valid NeXML tree structures are always rooted, even if they don't have
+ // the root attribute, in the sense that there's always going to be one node
+ // that doesn't have two edges pointing into it. It seems to me that we can
+ // still render these trees, we just have to find which node is the one that
+ // doesn't have two edges pointing in. This loop does that.
+ if (!root){
+ for(i = 0; i < nexNodes.length; i++) {
+ var targetCount = 0;
+ for(j = 0; j < nexEdges.length; j++) {
+ if(nexEdges[j].target == nexNodes[i].id) {
+ targetCount++;
+ }
+ }
+ if ( targetCount < 2 ) {
+ root = nexNodes[i];
+ }
+ }
+ }
+
if(root){
root = recursiveParse(root);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|