index.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  2. <HTML>
  3. <HEAD>
  4. <TITLE>CornellBox </TITLE>
  5. <BODY>
  6. <P>
  7. <div style="width:512px; float:left; background-color:#E6AB81; padding:20px; text-align:justify;">
  8. <?php
  9. // chemin des données
  10. $data_path = '/mnt/graal/cornellBox/distrib/';
  11. $lesScenes = array(
  12. "CornellBoxNonVide",
  13. "CornellBoxNonVideTextureArcade",
  14. "CornellBoxNonVideTextureDegrade",
  15. "CornellBoxNonVideTextureDamier",
  16. "CornellBoxVide",
  17. "CornellBoxVideTextureDamier",
  18. "Bar1",
  19. "Bureau1_cam2",
  20. "Boulanger",
  21. "Exterieur01",
  22. "Sponza1"
  23. );
  24. $MAX = 1000;
  25. session_start ();
  26. //nettoyer le graphique
  27. shell_exec("rm fig.png");
  28. $adresse = $_SERVER['PHP_SELF'];
  29. if (!empty($_REQUEST['scene'])){
  30. $_SESSION['scene'] = $_REQUEST['scene'];
  31. }
  32. $scene=$_SESSION['scene'];
  33. //echo $scene;
  34. if (!empty($_REQUEST['ech'])){
  35. $n = $_REQUEST['ech'];
  36. //if ($n<1) $n=1;
  37. //if ($n>$MAX) $n=$MAX;
  38. $_SESSION['ech'] = $n;
  39. } else if(!isset($_SESSION['ech'])){
  40. $_SESSION['ech'] = $MAX;
  41. }
  42. $ech = $_SESSION['ech'];
  43. echo "<A href=$adresse> <IMG src='images/".$scene."_10.png' ismap border='0'> </A>";
  44. ?>
  45. <form>
  46. <select name="scene" onClick="javascript:this.form.submit();">
  47. <!--<option value=""> ----- Choisir ----- </option>-->
  48. <?php
  49. foreach ($lesScenes as $i){
  50. if ($i == $scene){
  51. $selected="selected";
  52. }
  53. else{
  54. $selected="";
  55. }
  56. echo "<option value='$i' $selected>$i</option>";
  57. }
  58. ?>
  59. <!--<option value="CornellBoxNonVide"> CornellBoxNonVide </option>
  60. <option value="CornellBoxNonVideTextureDegrade"> CornellBoxNonVideTextureDegrade </option> -->
  61. </select>
  62. </p>
  63. échantillons analysés :
  64. <input name="ech" type="text" size="5" value="<?php echo $ech?>" onChange="javascript:this.form.submit();">
  65. <input name="OK" type="submit" value="changer">
  66. </form>
  67. </div>
  68. <div style="width:400px; float:left; background-color:#E6AB81; padding:20px; text-align:justify;">
  69. <?php
  70. if (!empty($_SERVER['QUERY_STRING'])){
  71. if (empty($_REQUEST['scene'])){
  72. //echo $_SERVER['QUERY_STRING'];
  73. $coords = explode (',', $_SERVER['QUERY_STRING']);
  74. $affiche = '(' . $coords[0] . ', ' . $coords[1] . ')';
  75. echo '<p style="color: red;">Point ' . $affiche . '</p>';
  76. $fichier_dat = $data_path.$scene.'/'.$coords[0].'/'.$scene.'_'.$coords[0].'_'.$coords[1].'.dat';
  77. //echo $fichier_dat;
  78. echo "<BR>";
  79. $commande = "Rscript analyse/analyse.R ".$fichier_dat." ".$ech;
  80. //echo $commande;
  81. $ligne = shell_exec($commande);
  82. echo "<IMG src='fig.png'>";
  83. echo "<pre>$ligne</pre>";
  84. }
  85. }
  86. ?>
  87. </div>