changeset 111:5ad0ba30c785 draft

modified recursiveShowRelationNode
author Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
date Mon, 18 Mar 2013 02:11:29 +0900
parents 409e8fd79794
children 34aa9d3b81b6 3440be06e501
files public/viewer/viewer_white.html
diffstat 1 files changed, 20 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/public/viewer/viewer_white.html	Mon Mar 18 01:15:27 2013 +0900
+++ b/public/viewer/viewer_white.html	Mon Mar 18 02:11:29 2013 +0900
@@ -473,7 +473,7 @@
     jsPlumb.draggable($('.graphNode'));
 }
 
-var BASE_THETA = -30;
+var BASE_THETA = -60;
 var BASE_ANGLE = 180;
 var BASE_DISTANCE = 150;
 function calcChildNodePosition(parent, num) {
@@ -498,16 +498,30 @@
 function recursiveShowRelationNodes(graphData, node) {
     if (!node.view) updateNode(node);
     childNodeIds = getRelationNodeIds(graphData, node);
+    /* calcration of childNode position */
+    var numCalcChild = 0;
     for (var i=0; i<childNodeIds.length; i++) {
 	var id = childNodeIds[i];
 	var childNode = graphData.nodes[id];
-	if (!childNode.view) {
-	    childNode.position = calcChildNodePosition(node, i);
+	if (!childNode.position) {
+	    childNode.position = calcChildNodePosition(node, numCalcChild);
 	    updateNode(childNode);
-	    recursiveShowRelationNodes(graphData, childNode);
+	    numCalcChild++;
+//	    recursiveShowRelationNodes(graphData, childNode);
 	}
     }
-    showAllEdge(graphData);
+    /* calcration of grandchildNode position  */
+    for (var i=0; i<childNodeIds.length; i++) {
+	var id = childNodeIds[i];
+	var childNode = graphData.nodes[id];
+	var ids = getRelationNodeIds(graphData, childNode);
+	for (var j=0; j<ids.length; j++) {
+	    var n = graphData.nodes[ids[j]];
+	    if (!n.position) {
+		recursiveShowRelationNodes(graphData, childNode);
+	    }
+	}
+    }
 }
 
 function testStart() {
@@ -517,6 +531,7 @@
     var rootNodeId = "1";
     var rootNode = graphData.nodes[rootNodeId];
     recursiveShowRelationNodes(graphData, rootNode);
+    showAllEdge(graphData);
     
 /*
     updateNode(rootNode);