Loading files.js +20 −8 Original line number Original line Diff line number Diff line Loading @@ -9,6 +9,7 @@ Copyright (C) 2014 Elphel, Inc. var path_local = "local"; var path_local = "local"; var path_remote = "https://raw.githubusercontent.com/Elphel/elens/master"; var path_remote = "https://raw.githubusercontent.com/Elphel/elens/master"; var path_remote_browse = "https://github.com/Elphel/elens"; var pattern_local = "local: "; var pattern_local = "local: "; var pattern_remote = "github: "; var pattern_remote = "github: "; Loading Loading @@ -42,7 +43,7 @@ function save_design(){ xml += "\t\t</back>\n"; xml += "\t\t</back>\n"; xml += "\t</element>\n"; xml += "\t</element>\n"; }); }); xml += "</Document>" xml += "</Document>"; postSettings($("#file_to_save").val(), "save", xml); postSettings($("#file_to_save").val(), "save", xml); } } Loading @@ -66,9 +67,11 @@ function parse_save_response(text) { jquery_list("load_designs_list","Load",load_design); jquery_list("load_designs_list","Load",load_design); } } function getDesign(file,path) { function getDesign(f,p) { //set globals createLink(f,p); $.ajax({ $.ajax({ url: "files.php?file="+file+"&cmd=read&path="+path, url: "files.php?file="+f+"&cmd=read&path="+p, type: "GET", type: "GET", async: false, async: false, complete: function(response){ complete: function(response){ Loading Loading @@ -114,7 +117,16 @@ function restore_design(text){ $(this).find("back").find("a4").text() $(this).find("back").find("a4").text() ); ); }); }); } function createLink(f,p){ var string = "<a href='"; string+= window.location.href.substr(0,window.location.href.lastIndexOf('?')); string+="?file="+f; string+="&path="+p; string+="'>Permanent Link</a>"; $("#link").html(string); string = "<a href='files.php?file="+f+"&path="+p+"'>Download XML</a>"; $("#link_dl").html(string); } } files.php +1 −1 Original line number Original line Diff line number Diff line Loading @@ -12,7 +12,7 @@ if (isset($_GET['file'])) $file = $_GET['file']; else die("-1"); else die("-1"); if (isset($_GET['cmd'])) $cmd = $_GET['cmd']; if (isset($_GET['cmd'])) $cmd = $_GET['cmd']; else die("-2"); else $cmd = "read"; if (isset($_GET['path'])) $default_path = $_GET['path']; if (isset($_GET['path'])) $default_path = $_GET['path']; else die("-3"); else die("-3"); Loading index.css +7 −1 Original line number Original line Diff line number Diff line Loading @@ -69,6 +69,12 @@ input{ #ray_draw_div{ #ray_draw_div{ position: absolute; position: absolute; left:1010px; left:1010px; top:122px; } #links{ position: absolute; left:1014; top:74px; top:74px; } } Loading index.html +12 −0 Original line number Original line Diff line number Diff line Loading @@ -79,5 +79,17 @@ Copyright (C) 2014 Elphel, Inc. </tr> </tr> </table> </table> </div> </div> <div id="links"> <table style="border:0px"> <tr> <td width=120 style="text-align:left"><div id="link_local"></div></td> <td width=120 style="text-align:left"><div id="link_remote"></div></td> </tr> <tr> <td width=120 style="text-align:left"><div id="link"></div></td> <td width=120 style="text-align:left"><div id="link_dl"></div></td> </tr> </table> </div> </body> </body> </html> </html> No newline at end of file lens_design.js +21 −3 Original line number Original line Diff line number Diff line Loading @@ -23,6 +23,9 @@ var selected_elements = Array(); var epsilon = 0.0001; var epsilon = 0.0001; var epsilon2 = 0.0001; var epsilon2 = 0.0001; var file = ""; var path = ""; $(function(){ $(function(){ yO = $("#cnv1").height()/2; yO = $("#cnv1").height()/2; console.log("Drawing axii"); console.log("Drawing axii"); Loading @@ -37,6 +40,11 @@ $(function(){ if (cnv_div.addEventListener) cnv_div.addEventListener('DOMMouseScroll', wheelEvent, false); if (cnv_div.addEventListener) cnv_div.addEventListener('DOMMouseScroll', wheelEvent, false); cnv_div.onmousewheel = wheelEvent; cnv_div.onmousewheel = wheelEvent; parseURL(); if (file!=""&&path!="") { getDesign(file,path); } //ray_draw(0,0,0); //ray_draw(0,0,0); }); }); Loading Loading @@ -117,10 +125,10 @@ function array_update_entries(){ if (e[i].front.h>0) { if (e[i].front.h>0) { tmp = find_optical_power(e[i]) tmp = find_optical_power(e[i]) total_power+= tmp; total_power+= tmp; console.log("Optical power of element #"+i+" is "+tmp+" diopters"); //console.log("Optical power of element #"+i+" is "+tmp+" diopters"); } } } } console.log("Total optical power is "+total_power); //console.log("Total optical power is "+total_power); table_update_all(); table_update_all(); } } Loading Loading @@ -945,10 +953,20 @@ function find_optical_power(element){ var d = +element.t; var d = +element.t; var inv_f = (n-1)*(1/r1-1/r2+(n-1)*d/n/(r1*r2)); var inv_f = (n-1)*(1/r1-1/r2+(n-1)*d/n/(r1*r2)); var f = 1/inv_f; var f = 1/inv_f; console.log("f = "+f+" mm"); //console.log("f = "+f+" mm"); return inv_f*1000; return inv_f*1000; } } function parseURL() { var parameters=location.href.replace(/\?/ig,"&").split("&"); for (var i=0;i<parameters.length;i++) parameters[i]=parameters[i].split("="); for (var i=1;i<parameters.length;i++) { switch (parameters[i][0]) { case "file": file = parameters[i][1];break; case "path": path = parameters[i][1];break; } } } var Glass = { var Glass = { "BAF51" : {n:1.652242,B1:1.51503623,B2:0.153621958,B3:1.15427909,C1:0.00942734715,C2:0.04308265,C3:124.889868},//barium flint "BAF51" : {n:1.652242,B1:1.51503623,B2:0.153621958,B3:1.15427909,C1:0.00942734715,C2:0.04308265,C3:124.889868},//barium flint Loading Loading
files.js +20 −8 Original line number Original line Diff line number Diff line Loading @@ -9,6 +9,7 @@ Copyright (C) 2014 Elphel, Inc. var path_local = "local"; var path_local = "local"; var path_remote = "https://raw.githubusercontent.com/Elphel/elens/master"; var path_remote = "https://raw.githubusercontent.com/Elphel/elens/master"; var path_remote_browse = "https://github.com/Elphel/elens"; var pattern_local = "local: "; var pattern_local = "local: "; var pattern_remote = "github: "; var pattern_remote = "github: "; Loading Loading @@ -42,7 +43,7 @@ function save_design(){ xml += "\t\t</back>\n"; xml += "\t\t</back>\n"; xml += "\t</element>\n"; xml += "\t</element>\n"; }); }); xml += "</Document>" xml += "</Document>"; postSettings($("#file_to_save").val(), "save", xml); postSettings($("#file_to_save").val(), "save", xml); } } Loading @@ -66,9 +67,11 @@ function parse_save_response(text) { jquery_list("load_designs_list","Load",load_design); jquery_list("load_designs_list","Load",load_design); } } function getDesign(file,path) { function getDesign(f,p) { //set globals createLink(f,p); $.ajax({ $.ajax({ url: "files.php?file="+file+"&cmd=read&path="+path, url: "files.php?file="+f+"&cmd=read&path="+p, type: "GET", type: "GET", async: false, async: false, complete: function(response){ complete: function(response){ Loading Loading @@ -114,7 +117,16 @@ function restore_design(text){ $(this).find("back").find("a4").text() $(this).find("back").find("a4").text() ); ); }); }); } function createLink(f,p){ var string = "<a href='"; string+= window.location.href.substr(0,window.location.href.lastIndexOf('?')); string+="?file="+f; string+="&path="+p; string+="'>Permanent Link</a>"; $("#link").html(string); string = "<a href='files.php?file="+f+"&path="+p+"'>Download XML</a>"; $("#link_dl").html(string); } }
files.php +1 −1 Original line number Original line Diff line number Diff line Loading @@ -12,7 +12,7 @@ if (isset($_GET['file'])) $file = $_GET['file']; else die("-1"); else die("-1"); if (isset($_GET['cmd'])) $cmd = $_GET['cmd']; if (isset($_GET['cmd'])) $cmd = $_GET['cmd']; else die("-2"); else $cmd = "read"; if (isset($_GET['path'])) $default_path = $_GET['path']; if (isset($_GET['path'])) $default_path = $_GET['path']; else die("-3"); else die("-3"); Loading
index.css +7 −1 Original line number Original line Diff line number Diff line Loading @@ -69,6 +69,12 @@ input{ #ray_draw_div{ #ray_draw_div{ position: absolute; position: absolute; left:1010px; left:1010px; top:122px; } #links{ position: absolute; left:1014; top:74px; top:74px; } } Loading
index.html +12 −0 Original line number Original line Diff line number Diff line Loading @@ -79,5 +79,17 @@ Copyright (C) 2014 Elphel, Inc. </tr> </tr> </table> </table> </div> </div> <div id="links"> <table style="border:0px"> <tr> <td width=120 style="text-align:left"><div id="link_local"></div></td> <td width=120 style="text-align:left"><div id="link_remote"></div></td> </tr> <tr> <td width=120 style="text-align:left"><div id="link"></div></td> <td width=120 style="text-align:left"><div id="link_dl"></div></td> </tr> </table> </div> </body> </body> </html> </html> No newline at end of file
lens_design.js +21 −3 Original line number Original line Diff line number Diff line Loading @@ -23,6 +23,9 @@ var selected_elements = Array(); var epsilon = 0.0001; var epsilon = 0.0001; var epsilon2 = 0.0001; var epsilon2 = 0.0001; var file = ""; var path = ""; $(function(){ $(function(){ yO = $("#cnv1").height()/2; yO = $("#cnv1").height()/2; console.log("Drawing axii"); console.log("Drawing axii"); Loading @@ -37,6 +40,11 @@ $(function(){ if (cnv_div.addEventListener) cnv_div.addEventListener('DOMMouseScroll', wheelEvent, false); if (cnv_div.addEventListener) cnv_div.addEventListener('DOMMouseScroll', wheelEvent, false); cnv_div.onmousewheel = wheelEvent; cnv_div.onmousewheel = wheelEvent; parseURL(); if (file!=""&&path!="") { getDesign(file,path); } //ray_draw(0,0,0); //ray_draw(0,0,0); }); }); Loading Loading @@ -117,10 +125,10 @@ function array_update_entries(){ if (e[i].front.h>0) { if (e[i].front.h>0) { tmp = find_optical_power(e[i]) tmp = find_optical_power(e[i]) total_power+= tmp; total_power+= tmp; console.log("Optical power of element #"+i+" is "+tmp+" diopters"); //console.log("Optical power of element #"+i+" is "+tmp+" diopters"); } } } } console.log("Total optical power is "+total_power); //console.log("Total optical power is "+total_power); table_update_all(); table_update_all(); } } Loading Loading @@ -945,10 +953,20 @@ function find_optical_power(element){ var d = +element.t; var d = +element.t; var inv_f = (n-1)*(1/r1-1/r2+(n-1)*d/n/(r1*r2)); var inv_f = (n-1)*(1/r1-1/r2+(n-1)*d/n/(r1*r2)); var f = 1/inv_f; var f = 1/inv_f; console.log("f = "+f+" mm"); //console.log("f = "+f+" mm"); return inv_f*1000; return inv_f*1000; } } function parseURL() { var parameters=location.href.replace(/\?/ig,"&").split("&"); for (var i=0;i<parameters.length;i++) parameters[i]=parameters[i].split("="); for (var i=1;i<parameters.length;i++) { switch (parameters[i][0]) { case "file": file = parameters[i][1];break; case "path": path = parameters[i][1];break; } } } var Glass = { var Glass = { "BAF51" : {n:1.652242,B1:1.51503623,B2:0.153621958,B3:1.15427909,C1:0.00942734715,C2:0.04308265,C3:124.889868},//barium flint "BAF51" : {n:1.652242,B1:1.51503623,B2:0.153621958,B3:1.15427909,C1:0.00942734715,C2:0.04308265,C3:124.889868},//barium flint Loading