diff options
| author | ziejd2 | 2021-02-24 15:19:03 -0600 |
|---|---|---|
| committer | ziejd2 | 2021-02-24 15:19:03 -0600 |
| commit | 1427e9bf4f85823164b4573a3bcf1ba3ba6b04d0 (patch) | |
| tree | d4356879a9b0a3d44063a6b292ef0197173697af /sourcecodes/layout_svg_no.php | |
| parent | a2b306b10fb07f07c63235861ccfe460153e8609 (diff) | |
| download | BNW-1427e9bf4f85823164b4573a3bcf1ba3ba6b04d0.tar.gz | |
Moving final GENENET8 version to master
Diffstat (limited to 'sourcecodes/layout_svg_no.php')
| -rw-r--r-- | sourcecodes/layout_svg_no.php | 69 |
1 files changed, 47 insertions, 22 deletions
diff --git a/sourcecodes/layout_svg_no.php b/sourcecodes/layout_svg_no.php index f32b4054..f7268788 100644 --- a/sourcecodes/layout_svg_no.php +++ b/sourcecodes/layout_svg_no.php @@ -14,10 +14,9 @@ include("header_new.inc"); include("input_validate.php"); $keyval=valid_keyval($_GET["My_key"]); -//$dir="./data/"; -$dir="/var/lib/genenet/bnw/"; +$dir="./data/"; -$svg_file=$keyval."network_no_edge.svg"; +$svg_file=$dir.$keyval."network_no_edge.svg"; $png_file=$keyval."network_no_edge.png"; @@ -60,8 +59,7 @@ function calcHeight() <div class="panel"> <ul class="navbar_ac"> <?php -//$dir="/tmp/bnw/"; -$dir="/var/lib/genenet/bnw/"; +$dir="/tmp/bnw/"; $filename1=$dir.$keyval."structure_input_temp.txt"; if(file_exists($filename1)) {?> @@ -70,15 +68,16 @@ if(file_exists($filename1)) } ?> <button id='saveButton' class="button1">Save network as PNG</button> -<button id='saveButton_svg' class="button1">Save network as SVG</button> +<a href="<?php print($svg_file);?>" download><button type="submit" class="button1">Save network as SVG</button></a> </ul> </div> <button class="accordion">More about network <i class="fa fa-angle-down" style="font-size: 18px;"></i></button> <div class="panel"> <ul class="navbar_ac"> - <li><a href="matrix_new.php?My_key=<?php print($keyval);?>" target="_blank">View structure matrix</a> + <li><a href="matrix.php?My_key=<?php print($keyval);?>" target="_blank">View structure matrix</a> <li><a href="parameter_display.php?My_key=<?php print($keyval);?>" target="_blank">View network parameters</a> <?php +$dir="/tmp/bnw/"; $filename1=$dir.$keyval."slsettings.txt"; if(file_exists($filename1)) {?> @@ -113,35 +112,61 @@ if(file_exists($filename1)) //onload = "makeDraggable(evt)"; -<?php -$svg_xml = json_encode(file("file://".$dir.$svg_file)); -?> -d3.xml("", function(dumm){ - var data1 = <?php echo $svg_xml;?>; - var data2 = data1.join("") - parser = new DOMParser(); - documentFragment = parser.parseFromString(data2,"text/xml"); + +d3.xml("<?php print($svg_file);?>", function(error, documentFragment){ + if (error) {console.log(error); return;} + var svgNode = documentFragment .getElementsByTagName("svg")[0]; d3.select("#svg_div").node().appendChild(svgNode); + // nodes = d3.selectAll('.node'); + // links = d3.selectAll('.edge'); width = svgNode.getBBox().width*5; height = svgNode.getBBox().height*5; -}); + // nodes + // .call(d3.drag() + // .on("start",dragstarted) + // .on("drag",dragged) + // .on("end",dragended)); + + // links + // .call(d3.drag() + // .on("start",dragstarted) + // .on("drag",dragged) + // .on("end",dragended)); + + + //function dragstarted(d) { + // d3.select(this).raise().classed("active", true); + //} + + //function dragged(d) { + //this.x = this.x || 0; + //this.y = this.y || 0; + //this.x += d3.event.dx; + //this.y += d3.event.dy; + //d3.select(this) + // .attr("transform","translate(" + this.x + "," + this.y + ")"); + //} + + //function dragended(d) { + //d3.select(this).classed("active", false); + //} + + //console.log(svgNode); + //console.log(nodes); + //console.log(links); + + }); </script> <script> - d3.select('#saveButton_svg').on('click',function() { - var svgString = getSVGString(d3.select("#svg_div").select('svg').node()); - var svgBlob = new Blob([svgString],{type:"image/svg+xml;charset=utf-8"}); - saveAs(svgBlob,"<?php echo $svg_file; ?>"); -}); - d3.select('#saveButton').on('click', function(){ var svgString = getSVGString(d3.select("#svg_div").select('svg').node()); |
