Mercurial > hg > Members > nobuyasu > html > graphViewer
changeset 7:29db6ff1d63e draft
create startUserDesktopUI function
author | Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 20 Mar 2013 05:23:49 +0900 |
parents | a4323051f7af |
children | 07191a24a9a4 |
files | index.html |
diffstat | 1 files changed, 66 insertions(+), 135 deletions(-) [+] |
line wrap: on
line diff
--- a/index.html Wed Mar 20 04:58:35 2013 +0900 +++ b/index.html Wed Mar 20 05:23:49 2013 +0900 @@ -237,13 +237,13 @@ } var nodeNum = 0; -var OFFSET = 100; +var OFFSET = 200; var miniD = $('#miniDisplay')[0].style; var offsetLeft = parseInt(miniD.width.split('px')[0]); var offsetTop = parseInt(miniD.height.split('px')[0]); function calcNewNodePosition() { var position = {}; - position = {x: nodeNum*OFFSET + offsetLeft, y: nodeNum*OFFSET + offsetTop / 3}; + position = {x: offsetLeft, y: nodeNum*OFFSET + offsetTop / 3}; nodeNum++; return position; } @@ -265,7 +265,6 @@ function traverseAction() { var isInDirTrue = $('#direction_in')[0].checked; var isOutDirTrue = $('#direction_out')[0].checked; - } @@ -493,34 +492,6 @@ jsPlumb.draggable($('.graphNode')); } -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.position) { - childNode.position = calcChildNodePosition(node, numCalcChild); - updateNode(childNode); - } - numCalcChild++; - } - /* 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); - } - } - } -} - var EDGE_LIST = { evidence:'evidence', dependency:'dependency', @@ -563,15 +534,25 @@ } } + + var GRAPH_DATA = new GraphData(); var rootNode = {}; +function startUserDesktopUI() { + function showFirstEvidenceList(graphData) { + var nodes = graphData.nodes; + for (var id in nodes) { + updateNode(nodes[id]); + } + } + var graphData = GRAPH_DATA; + showFirstEvidenceList(graphData); +} + function testStart() { init(); var graphData = parseJSONGraphData(GRAPH_DATA, sampleData); - var rootNodeId = "1"; - rootNode = graphData.nodes[rootNodeId]; - recursiveCalcPosition(graphData, rootNode); - updateNode(rootNode); + startUserDesktopUI(); } function logProperty(d) { @@ -594,120 +575,70 @@ } ]; +edgeInfo2 = [ + { + kind:"collected", + direction:"in", + num:"1" + } +]; + sampleData = { nodes: [ { id:"1", title:"context1", - kind:"agree", createdUser:"oshiro", edgeInfo:edgeInfo1 + }, + { + id:"2", + title:"context2", + content:"content", + createUser:"tamayose", + edgeInfo:edgeInfo2 + } + ] +}; + +/* id 1 select direction in and kind collected */ +sampleData2 = { + nodes: [ + { + id:"3", + title:"id 3", + createUser:"kinjo", + edgeInfo:edgeInfo1 + }, + { + id:"4", + title:"id 4", + createUser:"oshiro", + edgeInfo:edgeInfo2 + } + ] +}; + +/* id 1 select direction out and kind reject */ +sampleData3 = { + nodes: [ + { + id:"6", + title:"id 6", + createUser:"kinjo", + edgeInfo:edgeInfo1 } ] }; -sampleJSONData = { +/* id 2 select direction in and kind collected */ +sampleData4 = { nodes: [ { - id:"1", - title:"context1", - kind:"agree", - createdUser:"oshiro" - }, - { - id:"2", - title:"task2", - kind:"reject", - createdUser:"kinjo" - }, - { - id:"3", - title:"context3", - createdUser:"tamayose" - }, - { - id:"4", - title:"task4", - kind:"agree", - createdUser:"oshiro" - }, - { id:"5", - title:"conetxt5", - createdUser:"oshiro" - }, - { - id:"6", - title:"context6", - createdUser:"kinjo" - }, - { - id:"7", - title:"context7", - createdUser:"tamayose" - }, - { - id:"8", - title:"task2", - createdUser:"tamayose" - } - ], - edges: [ - { - id:"11", - from:"2", - to:"1", - rel:"dependency", - type:"" - }, - { - id:"12", - from:"1", - to:"3", - rel:"evidence", - type:"" - }, - { - id:"13", - from:"3", - to:"4", - rel:"evidence", - type:"" - }, - { - id:"14", - from:"3", - to:"5", - rel:"derived", - type:"" - }, - { - id:"15", - from:"1", - to:"6", - rel:"evidence", - type:"" - }, - { - id:"17", - from:"7", - to:"4", - rel:"evidence", - type:"" - }, - { - id:"18", - from:"7", - to:"5", - rel:"evidence", - type:"" - }, - { - id:"19", - from:"8", - to:"2", - rel:"version", - type:"" + title:"id 5", + createUser:"user 5", + edgeInfo:edgeInfo2 } ] };