チェンジセット 122 : BH13SPARQLBuilder/src/hozo/maptool
- 更新日時:
- 2014/07/16 18:01:47 (10 年 前)
- ファイル:
-
- 1 変更
凡例:
- 変更なし
- 追加
- 削除
-
BH13SPARQLBuilder/src/hozo/maptool/jsgui.html
r119 r122 127 127 DURATION = 0; 128 128 129 /* 129 130 // 繝峨Λ繝�げ譎ゅ�蜃ヲ逅� 130 131 var drag = d3.behavior.drag().on("drag", function(d,i) { … … 136 137 redraw(); 137 138 }); 139 */ 138 140 139 141 // SVG縺ョ霑ス蜉 … … 156 158 .enter().append("line") 157 159 .attr("class", "link") 158 .style("stroke-width", function(d) { return Math.sqrt(d.value); 160 .style("stroke-width", function(d) { return Math.sqrt(d.value);}); 159 161 160 162 // 繝弱�繝峨�菴懈� … … 169 171 .style("stroke-width", function(d) { return '1.5px'; }) 170 172 .style("fill", function(d) { return color(d.group); }) 171 .style("cursor", function(d) { return 'pointer'; }) 172 .call(drag);173 .style("cursor", function(d) { return 'pointer'; }); 174 //.call(drag); 173 175 174 176 // 繝弱�繝峨ユ繧ュ繧ケ繝医�菴懈� … … 184 186 .style("stroke-width", function(d) { return '1.5px'; }) 185 187 .style("text-anchor", function(d) { return 'middle'; }) 186 .style("pointer-events", "none") 187 .call(drag);188 .style("pointer-events", "none"); 189 //.call(drag); 188 190 189 191 // 繝ェ繝ウ繧ッ繝�く繧ケ繝医�菴懈� … … 229 231 230 232 document.getElementById("selectpath").innerHTML=(resultText); 231 document.getElementById("showpath").style.display = "block";232 233 233 234 if(d.group > (MAXDEPTH - 2)){ … … 249 250 document.getElementById("showpath").style.left = xPosition + "px" 250 251 document.getElementById("showpath").style.top = yPosition + "px" 251 document.getElementById("showpath").style.display = "block";252 //document.getElementById("showpath").style.display = "block"; 252 253 253 254 }else{ … … 304 305 if(d.view == "no"){ 305 306 for(var t = 0; t < path.length; t++){ 306 if(path[t] == d.target){ 307 linktext = d.property; 307 if(path[t] == d.target && node.data()[d.target].view != "hide"){ 308 var propertytext = d.property 309 var linksplit1 = propertytext.split("/"); 310 var linksplit2 = linksplit1[linksplit1.length].split("#"); 311 linktext = linksplit2[linksplit2.length]; 308 312 d.view = "now"; 309 313 } 310 314 } 311 }else if(d.view == "fix"){ 312 linktext = d.property; 315 }else if(d.view == "fix" && node.data()[d.target].view != "hide"){ 316 var propertytext = d.property 317 var linksplit1 = propertytext.split("/"); 318 var linksplit2 = linksplit1[linksplit1.length].split("#"); 319 linktext = linksplit2[linksplit2.length]; 313 320 } 314 321 return linktext; … … 339 346 }); 340 347 348 //d.hideparent = d.nodeid; 349 350 var childs = []; 351 var prevchilds = []; 352 prevchilds.push(d.nodeid); 353 354 do{ 355 var tmpchilds = []; 356 var curchilds = []; 357 for(var p = 0; p < prevchilds.length; p++){ 358 tmpchilds = get_children(prevchilds[p], json['links']); 359 curchilds = curchilds.concat(tmpchilds); 360 } 361 prevchilds = curchilds; 362 childs = childs.concat(curchilds); 363 364 }while(curchilds.length != 0); 365 366 var childy = d.y; 367 for(var c = 0; c < childs.length; c++){ 368 if(node.data()[childs[c]].y < childy){ 369 childy = node.data()[childs[c]].y; 370 } 371 } 372 373 d.y = childy; 374 375 var maxdy = 0; 376 var mindy = 0; 377 378 for(var c = 0; c < childs.length; c++){ 379 if(node.data()[childs[c]].view != "hide"){ 380 var dy = node.data()[childs[c]].y - d.y; 381 if(dy > maxdy){ 382 maxdy = dy; 383 } 384 node.data()[childs[c]].x = d.x; 385 node.data()[childs[c]].y = d.y; 386 node.data()[childs[c]].dy = dy; 387 node.data()[childs[c]].view = "hide"; 388 node.data()[childs[c]].hideparent = d.nodeid; 389 }else{ 390 if(node.data()[childs[c]].hideparent == d.nodeid){ 391 node.data()[childs[c]].x = d.x + (TREESPACE * (node.data()[childs[c]].group - d.group)); 392 node.data()[childs[c]].y = node.data()[childs[c]].y + node.data()[childs[c]].dy; 393 if(-node.data()[childs[c]].dy < mindy){ 394 mindy = -node.data()[childs[c]].dy; 395 } 396 node.data()[childs[c]].view = "appear"; 397 node.data()[childs[c]].hideparent = -1; 398 } 399 } 400 } 401 402 node 403 .attr("r", function(d){ 404 if(d.view == "appear"){ 405 d.view = "no"; 406 }else if(d.y > childy){ 407 d.y = d.y - maxdy - mindy; 408 } 409 if(d.view == "hide"){ 410 d.x = node.data()[d.hideparent].x; 411 d.y = node.data()[d.hideparent].y; 412 } 413 if(d.nodeid == 0){ 414 d.y = childy; 415 } 416 return (NODEHEIGHT / 2); 417 }); 418 341 419 tlink 342 420 .text(function(d) { 343 421 var linktext = ""; 344 if(d.view == "now" || d.view == "fix"){ 345 linktext = d.property; 422 if((d.view == "now" || d.view == "fix") && (node.data()[d.target].view != "hide")){ 423 var propertytext = d.property 424 var linksplit1 = propertytext.split("/"); 425 var linksplit2 = linksplit1[linksplit1.length].split("#"); 426 linktext = linksplit2[linksplit2.length]; 346 427 d.view = "fix"; 347 428 } 348 429 return linktext; 349 430 }); 431 432 433 redraw(); 350 434 351 435 }).on("mouseout", function(d){ 352 436 d.isDrag = false; 353 437 }); 354 355 // 蝓コ譛ャ繝吶け繝医Ν邂怜�356 var vec = function(sx, sy, dx, dy){357 var vx = (dx - sx);358 var vy = (dy - sy);359 var dist = Math.sqrt(Math.pow(vx, 2) + Math.pow(vy, 2));360 var ret = [];361 ret.x = vx / dist;362 ret.y = vy / dist;363 364 return ret;365 };366 438 367 439 var redraw = function (){ … … 384 456 .duration(DURATION) 385 457 .attr("cx", function(d) {return d.x;}) 386 .attr("cy", function(d) {return d.y;}); 458 .attr("cy", function(d) {return d.y;}) 459 .style("opacity", function(d){ 460 var opa = 1.0; 461 if(d.view == "hide"){ 462 opa = 0.0; 463 } 464 return opa; 465 }) 466 .style("fill", function(d) { 467 var fcolor = color(d.group); 468 469 for(var n = 0; n < node.data().length; n++){ 470 if(d.nodeid == node.data()[n].hideparent){ 471 fcolor = "ffaaaa"; 472 } 473 } 474 return fcolor; 475 }) 476 .style("pointer-events", function(d){ 477 var pe = "auto"; 478 if(d.view == "hide"){ 479 pe = "none"; 480 } 481 return pe; 482 }); 387 483 388 484 tnode … … 395 491 updown = -(NODEHEIGHT * 0.2); 396 492 } 493 if(d.view == "now" || d.view == "moved"){ 494 //updown = 5; 495 } 397 496 return d.y + updown; 497 }) 498 .text(function(d){ 499 var nt = d.name; 500 if(d.view == "hide"){ 501 nt = ""; 502 } 503 return nt; 398 504 }); 399 505 400 506 DURATION = 500; 507 401 508 }; 402 509 … … 408 515 node 409 516 .style("stroke", function(d){ 410 d.view = "no"; 517 if(d.view != "hide"){ 518 d.view = "no"; 519 } 411 520 return "#fafafa"; 412 521 }); … … 499 608 if(!isCommonNow){ 500 609 isCommon = false; 501 ret['nodes'].push({'name':obj['paths'][i]['classLinks'][j]['linkedClassURI'], 'group': (j+1), 'x':0, 'y':0, ' nodeid':ret['nodes'].length, 'view' : 'no'});610 ret['nodes'].push({'name':obj['paths'][i]['classLinks'][j]['linkedClassURI'], 'group': (j+1), 'x':0, 'y':0, 'dy':0, 'nodeid':ret['nodes'].length, 'view' : 'no'}); 502 611 ret['links'].push({'source':source, 'target':ret['nodes'].length - 1, 'value':5, 'property':obj['paths'][i]['classLinks'][j]['propertyURI'], 'view' : 'no'}); 503 612 source = ret['nodes'].length - 1; … … 508 617 509 618 isCommon = false; 510 ret['nodes'].push({'name':obj['paths'][i]['classLinks'][j]['linkedClassURI'], 'group': (j+1), 'x':0, 'y':0, ' nodeid':ret['nodes'].length, 'view' : 'no'});619 ret['nodes'].push({'name':obj['paths'][i]['classLinks'][j]['linkedClassURI'], 'group': (j+1), 'x':0, 'y':0, 'dy':0, 'nodeid':ret['nodes'].length, 'view' : 'no'}); 511 620 ret['links'].push({'source':source, 'target':ret['nodes'].length - 1, 'value':5, 'property':obj['paths'][i]['classLinks'][j]['propertyURI'], 'view' : 'no'}); 512 621 source = ret['nodes'].length - 1; … … 514 623 // 譌「縺ォ蜈ア騾壹Ν繝シ繝医〒縺ェ縺�↑繧画眠隕剰ソス蜉縺励※谺。縺ク 515 624 }else{ 516 ret['nodes'].push({'name':obj['paths'][i]['classLinks'][j]['linkedClassURI'], 'group': (j+1), 'x':0, 'y':0, ' nodeid':ret['nodes'].length, 'view' : 'no'});625 ret['nodes'].push({'name':obj['paths'][i]['classLinks'][j]['linkedClassURI'], 'group': (j+1), 'x':0, 'y':0, 'dy':0, 'nodeid':ret['nodes'].length, 'view' : 'no'}); 517 626 ret['links'].push({'source':source, 'target':ret['nodes'].length - 1, 'value':5, 'property':obj['paths'][i]['classLinks'][j]['propertyURI'], 'view' : 'no'}); 518 627 source = ret['nodes'].length - 1; … … 660 769 function setSEClass(){ 661 770 771 var sel = $("*[name=selectendpoint]").val(); 772 773 if(sel == "input"){ 774 sel = $("*[name=inputendpoint]").val(); 775 } 776 662 777 MAXDEPTH = 0; 663 778 … … 672 787 url : getPathListURL, 673 788 data: { 789 ep: sel, 674 790 startclass: selstart, 675 791 endclass: selend