チェンジセット 116 : BH13SPARQLBuilder/src/hozo/maptool
- 更新日時:
- 2014/07/07 11:19:38 (10 年 前)
- ファイル:
-
- 1 変更
凡例:
- 変更なし
- 追加
- 削除
-
BH13SPARQLBuilder/src/hozo/maptool/jsgui.html
r102 r116 5 5 <title>SPARQL Builder GUI</title> 6 6 7 <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css">8 <link rel="stylesheet" type="text/css" media="screen" href="http://lod.hozo.jp/SparqlFinder/css/main.css" />9 <link rel="stylesheet" type="text/css" media="screen" href="http://lod.hozo.jp/SparqlFinder/css/table.css" />10 <link rel="stylesheet" type="text/css" media="screen" href="http://lod.hozo.jp/SparqlFinder/css/popup.css" />11 7 <style> 12 8 … … 25 21 height: auto; 26 22 padding: 10px; 27 background-color: #aaccee; 28 -webkit-border-radius: 10px; 29 -moz-border-radius: 10px; 30 border-radius: 10px; 31 -webkit-box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.4); 32 -moz-box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.4); 33 box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.4); 23 -webkit-border-radius: 20px; 24 border-radius: 20px; 25 -webkit-box-shadow: 0px 0px 10px #000000; 26 box-shadow: 0px 0px 10px #000000; 27 background-image: -moz-linear-gradient(top, #eeeeff, #ffffff); 28 background-image: -ms-linear-gradient(top, #eeeeff, #ffffff); 29 background-image: -o-linear-gradient(top, #eeeeff, #ffffff); 30 background-image: -webkit-gradient(linear, center top, center bottom, from(#eeeeff), to(#ffffff)); 31 background-image: -webkit-linear-gradient(top, #eeeeff, #ffffff); 32 background-image: linear-gradient(top, #eeeeff, #ffffff); 33 -webkit-background-clip: padding-box; 34 background-clip: padding-box; 34 35 } 35 36 … … 37 38 38 39 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> 39 <script type="text/javascript" src="http://lod.hozo.jp/SparqlFinder/js/jquery-1.10.2.min.js"></script>40 <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.min.js"></script>41 <!-- 縺薙�荳陦後r蜈・繧後k縺ィ繧ソ繝�メ縺ァ縺ョ繝峨Λ繝�げ縺悟庄閭ス縺ォ縺ェ繧� -->42 <script type="text/javascript" src="http://lod.hozo.jp/SparqlFinder/js/jquery.ui.touch-punch.js" charset="UTF-8"></script>43 40 <script type="text/javascript" src="http://d3js.org/d3.v3.min.js"></script> 44 41 <!--<script type="text/javascript" src="http://lod.hozo.jp/SparqlFinder/js/template.js" charset="UTF-8"></script>--> 45 42 <script> 46 43 <!-- 47 48 44 49 45 // SETURLSETURLSETURLSETURLSETURLSETURLSETURLSETURLSETURLSETURLSETURLSETURL … … 73 69 var TREESPACE = 0; 74 70 var DRAWHEIGHT = 0; 71 var NODEHEIGHT = 50; 75 72 var jsontext = ""; 76 73 … … 122 119 123 120 var width = window.innerWidth; 124 var height = TREESPACE * PATHNUM;121 var height = ((NODEHEIGHT * 1.5) * PATHNUM) + NODEHEIGHT; 125 122 126 123 // 繧ォ繝ゥ繝シ繧貞叙蠕� … … 145 142 .attr("width", width) 146 143 .attr("height", height); 147 144 /* 145 var bg = d3.select(".background") 146 .enter() 147 .append("rect") 148 .attr("x", 0) 149 .attr("y", 0) 150 .attr("width", width) 151 .attr("height", height) 152 .attr("fill", #999999); 153 */ 148 154 var link = svg.selectAll(".link") 149 155 .data(json.links) … … 156 162 .enter().append("circle") 157 163 .attr("class", "node") 158 .attr("r", 20)164 .attr("r", (NODEHEIGHT / 2)) 159 165 .attr("cx", function(d) { return d.x;} ) 160 166 .attr("cy", function(d) { return d.y; }) … … 192 198 node.on("mouseover", function(d){ 193 199 200 if (!d. isDrag){ 201 d3.selectAll(".node").style("stroke-width", function(d) { return '1.5px'; }); 202 d3.selectAll(".node").style("stroke", function(d) { return '#ffffff'; }); 203 d3.select(this).style("stroke-width", function(d) { return 2; }); 204 d3.select(this).style("stroke", function(d) { return '#0000ff'; }); 205 } 206 207 d.isDrag = false; 208 194 209 var path = []; 195 210 pathname = []; 196 path.push(d.nodeid); 197 pathname.push(d.name); 198 do{ 199 for(var i = 0; i < link.data().length; i++){ 200 if(path[(path.length-1)] == link.data()[i].target){ 201 path.push(link.data()[i].source); 202 pathname.push(link.data()[i].property); 203 pathname.push(node.data()[link.data()[i].source].name); 211 212 if(d.nodeid != 0){ 213 path.push(d.nodeid); 214 pathname.push(d.name); 215 do{ 216 for(var i = 0; i < link.data().length; i++){ 217 if(path[(path.length-1)] == link.data()[i].target){ 218 path.push(link.data()[i].source); 219 pathname.push(link.data()[i].property); 220 pathname.push(node.data()[link.data()[i].source].name); 221 } 204 222 } 205 } 206 }while(path[(path.length-1)] != 0); 207 var resultText = "<h3>Selected Path</h3>"; 208 for (var i = pathname.length;i > 0; i--){ 209 if(i % 2 == 1){ 210 resultText = resultText + "<span style=\"font-weight: bold;\">" + pathname[i - 1] + "</span><br><br>"; 223 }while(path[(path.length-1)] != 0); 224 var resultText = "<h3>Selected Path</h3>"; 225 for (var i = pathname.length;i > 0; i--){ 226 if(i % 2 == 1){ 227 resultText = resultText + "<span style=\"font-weight: bold;\">" + pathname[i - 1] + "</span><br><br>"; 228 }else{ 229 resultText = resultText + pathname[i - 1] + "<br><br>"; 230 } 231 } 232 233 document.getElementById("selectpath").innerHTML=(resultText); 234 document.getElementById("showpath").style.display = "block"; 235 236 if(d.group > (MAXDEPTH - 2)){ 237 document.getElementById("getsparqlbutton").style.display = "block"; 211 238 }else{ 212 resultText = resultText + pathname[i - 1] + "<br><br>"; 213 } 214 } 215 document.getElementById("selectpath").innerHTML=(resultText); 216 document.getElementById("showpath").style.display = "block"; 217 218 var xPosition = parseFloat(d3.select(this).attr("cx")) + 22; 219 var yPosition = parseFloat(d3.select(this).attr("cy") - document.getElementById("showpath").offsetHeight + document.getElementById("menu").offsetHeight) + 22; 220 221 if(xPosition < 0){ 222 xPosition = 0; 223 } 224 if(yPosition < 0){ 225 yPosition = 0; 226 } 227 228 document.getElementById("showpath").style.left = xPosition + "px" 229 document.getElementById("showpath").style.top = yPosition + "px" 230 document.getElementById("showpath").style.display = "block"; 239 document.getElementById("getsparqlbutton").style.display = "none"; 240 } 241 242 var xPosition = parseFloat(d3.select(this).attr("cx")) + parseFloat(d3.select(this).style("stroke-width")) + (NODEHEIGHT * 0.5); 243 var yPosition = parseFloat(d3.select(this).attr("cy") - document.getElementById("showpath").offsetHeight + document.getElementById("menu").offsetHeight) + (NODEHEIGHT * 0.5); 244 245 if(xPosition < 0){ 246 xPosition = 0; 247 } 248 if(yPosition < 0){ 249 yPosition = 0; 250 } 251 252 document.getElementById("showpath").style.left = xPosition + "px" 253 document.getElementById("showpath").style.top = yPosition + "px" 254 document.getElementById("showpath").style.display = "block"; 255 256 }else{ 257 document.getElementById("showpath").style.display = "none"; 258 } 231 259 232 260 tlink … … 241 269 }) 242 270 243 if (!d. isDrag){244 d3.selectAll(".node").style("stroke-width", function(d) { return '1.5px'; });245 d3.selectAll(".node").style("stroke", function(d) { return '#ffffff'; });246 d3.select(this).style("stroke-width", function(d) { return 2; });247 d3.select(this).style("stroke", function(d) { return '#0000ff'; });248 }249 250 d.isDrag = false;251 271 }); 252 272 … … 281 301 .attr("x", function(d) {return d.x;}) 282 302 .attr("y", function(d) { 283 var updown = 18;303 var updown = (NODEHEIGHT * 0.4); 284 304 if(d.group % 2 == 1){ 285 updown = - 8;305 updown = -(NODEHEIGHT * 0.2); 286 306 } 287 307 return d.y + updown; … … 312 332 MAXDEPTH = 0; 313 333 TREESPACE = 0; 314 DRAWHEIGHT = 0;334 DRAWHEIGHT = NODEHEIGHT; 315 335 316 336 var obj = JSON.parse(jsontext); … … 387 407 } 388 408 TREESPACE = (window.innerWidth - 200) / (MAXDEPTH + 1); 389 DRAWHEIGHT = TREESPACE / 2;390 409 391 410 // 縺ァ縺阪◆邨先棡繧定ソ斐☆ … … 436 455 437 456 if(myNodeIndex != 0){ 438 DRAWHEIGHT += ( TREESPACE / 2);439 var x = (depth * TREESPACE) + (TREESPACE / 2);457 DRAWHEIGHT += (NODEHEIGHT * 1.5); 458 var x = (depth * TREESPACE) + (TREESPACE / 3); 440 459 var y = DRAWHEIGHT; 441 460 nodes[myNodeIndex].x = x; … … 443 462 }else{ 444 463 var x = TREESPACE / 2; 445 var y = ( TREESPACE / 2) * (PATHNUM / 2) + (TREESPACE / 4);464 var y = (NODEHEIGHT * 1.5) * ((PATHNUM - 1) / 2) + NODEHEIGHT; 446 465 nodes[myNodeIndex].x = x; 447 466 nodes[myNodeIndex].y = y; … … 461 480 for (var i=0; i<children.length; i++){ 462 481 if(i == 0){ 463 DRAWHEIGHT -= ( TREESPACE / 2);482 DRAWHEIGHT -= (NODEHEIGHT * 1.5); 464 483 } 465 484 var child = children[i]; … … 499 518 alert(sel); 500 519 } 520 521 document.getElementById("showpath").style.display = "none"; 501 522 502 523 $.ajax({ … … 527 548 528 549 document.getElementById("selectpath").innerHTML = ""; 550 document.getElementById("showpath").style.display = "none"; 529 551 530 552 var selstart = $("*[name=startclass]").val(); … … 618 640 <div id="selectpath" style="word-wrap: break-word;"> 619 641 </div> 620 <input type="button" name="getsparql" value="Get SPARQL" onClick="getSPARQL()">642 <input type="button" id="getsparqlbutton" name="getsparql" value="Get SPARQL" onClick="getSPARQL()"> 621 643 </div> 622 644 </body>