1
|
<!DOCTYPE html>
|
2
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
|
3
|
<head>
|
4
|
<?php
|
5
|
require 'class/utils.class.php';
|
6
|
require_once 'constants.inc.php';
|
7
|
utils::init();
|
8
|
|
9
|
$form_extpoint = file_get_contents('html/form_extpoint.html');
|
10
|
|
11
|
$form_param = file_get_contents('html/form_param.html');
|
12
|
|
13
|
if (isset($_GET['dir']) && isset($_GET['panorama'])) {
|
14
|
$dir = $_GET['dir'];
|
15
|
$name = $_GET['panorama'];
|
16
|
} else {
|
17
|
$dir = PANORAMA_PATH;
|
18
|
$name = 'ttn_mediatheque';
|
19
|
}
|
20
|
$opt_vals = array();
|
21
|
foreach(array('to_cap', 'to_ele', 'to_zoom') as $val) {
|
22
|
if (!empty($_GET[$val])) $opt_vals[$val] = $_GET[$val];
|
23
|
}
|
24
|
|
25
|
$base_dir = $dir.'/'.$name;
|
26
|
$pt = new site_point($base_dir);
|
27
|
if(!$pt) die("impossible d'accéder à ".$base_dir." !\n");
|
28
|
$params = $pt->get_params();
|
29
|
$prefix = $pt->get_prefix();
|
30
|
?>
|
31
|
<meta http-equiv="Content-type" content="text/html; charset=UTF-8"/>
|
32
|
<?php
|
33
|
$titre = 'panorama';
|
34
|
if ($params && isset($params['titre'])) $titre .= ' : '.$params['titre'];
|
35
|
printf ("<title>%s</title>\n", $titre);
|
36
|
?>
|
37
|
<script>
|
38
|
<?php
|
39
|
printf ("var title = \"%s\"\n", $titre);
|
40
|
printf ("var img_prefix = '%s/%s'\n", $base_dir, $prefix);
|
41
|
if (is_array($params)) $opt_vals = array_merge($params, $opt_vals);
|
42
|
foreach(array('to_cap', 'to_ele', 'to_zoom', 'image_loop') as $val) {
|
43
|
if (isset($opt_vals[$val])) printf ('var '.$val.' = '.$opt_vals[$val].";\n");
|
44
|
}
|
45
|
?>
|
46
|
</script>
|
47
|
<script src="js/pano.js"></script>
|
48
|
<script>window.onload = load_pano</script>
|
49
|
<script>
|
50
|
<?php
|
51
|
$zoom_array = $pt->get_magnifications();
|
52
|
|
53
|
foreach($zoom_array as $zoom => $val) {
|
54
|
echo "zooms[$zoom] = new tzoom($zoom);\n";
|
55
|
echo "zooms[$zoom].ntiles.x = ".$val['nx'].";\n";
|
56
|
echo "zooms[$zoom].ntiles.y = ".$val['ny'].";\n";
|
57
|
$size = getimagesize(sprintf($base_dir.'/'.$prefix.'_%03d_%03d_%03d.jpg', $zoom, 0, 0));
|
58
|
echo "zooms[$zoom].tile.width = ".$size[0].";\n";
|
59
|
echo "zooms[$zoom].tile.height = ".$size[1].";\n";
|
60
|
$size = getimagesize(sprintf($base_dir.'/'.$prefix.'_%03d_%03d_%03d.jpg', $zoom, $val['nx']-1, $val['ny']-1));
|
61
|
echo "zooms[$zoom].last_tile.width = ".$size[0].";\n";
|
62
|
echo "zooms[$zoom].last_tile.height = ".$size[1].";\n";
|
63
|
}
|
64
|
|
65
|
$dir_list = new sites_dir($dir);
|
66
|
|
67
|
$ipt = 0;
|
68
|
foreach(site_point::get_all() as $opt) {
|
69
|
$prm = $opt->get_params();
|
70
|
$oname = $opt->get_name();
|
71
|
if (($oname != $name) && $opt->has_params()) {
|
72
|
list($dist, $cap, $ele) = $pt->coordsToCap($prm['latitude'], $prm['longitude'], $prm['altitude']);
|
73
|
|
74
|
$lnk = $opt->get_url($cap + 180, -$ele);
|
75
|
printf('point_list[%d] = new Array("%s", %03lf, %03lf, %03lf, "%s");'."\n", $ipt++, $prm['titre'], $dist, $cap, $ele, $lnk);
|
76
|
}
|
77
|
}
|
78
|
|
79
|
$ref_points = array ();
|
80
|
$ref_points_filename = 'ref_points.local.php';
|
81
|
if (file_exists($ref_points_filename)) {
|
82
|
include $ref_points_filename;
|
83
|
}
|
84
|
$extra_names = array();
|
85
|
$ref_names = array();
|
86
|
if (is_array($ref_points)) {
|
87
|
foreach ($ref_points as $name => $vals) {
|
88
|
$extra_names[] = $name;
|
89
|
list($dist, $cap, $ele) = $pt->coordsToCap($vals[0], $vals[1], $vals[2]);
|
90
|
$ref_names[$name] = array($dist, $cap, $ele);
|
91
|
printf('point_list[%d] = new Array("%s", %03lf, %03lf, %03lf, "");'."\n", $ipt++, $name, $dist, $cap, $ele);
|
92
|
}
|
93
|
}
|
94
|
|
95
|
|
96
|
if (isset($params['reference'])) {
|
97
|
echo "ref_points = new Array();\n";
|
98
|
foreach ($params['reference'] as $nm => $val) {
|
99
|
if (isset($ref_names[$nm])) {
|
100
|
list($dist, $cap, $ele) = $ref_names[$nm];
|
101
|
list($px, $py) = explode(',', $val);
|
102
|
printf("ref_points[\"%s\"] = {x:%.5f, cap:%.5f, y:%.5f, ele:%.5f};\n", $nm, $px, $cap, $py, $ele);
|
103
|
}
|
104
|
}
|
105
|
}
|
106
|
|
107
|
$localLat = (isset($_POST["loca_latitude"])) ? $_POST["loca_latitude"] : NULL;
|
108
|
$localLon = (isset($_POST["loca_longitude"])) ? $_POST["loca_longitude"] : NULL;
|
109
|
$localAlt = (isset($_POST["loca_altitude"])) ? $_POST["loca_altitude"] : NULL;
|
110
|
|
111
|
if ($localLat && $localLon && $localAlt) {
|
112
|
list($localDistance, $localCap, $localEle) = $pt->coordsToCap($localLat, $localLon, $localAlt);
|
113
|
$n = "point temporaire";
|
114
|
printf('point_list[%d] = new Array("%s", %03lf, %03lf, %03lf, "temporary");'."\n",$ipt++, $n, $localDistance, $localCap, $localEle);
|
115
|
}
|
116
|
?>
|
117
|
</script>
|
118
|
<link type="image/x-icon" rel="shortcut icon" href="images/tsf.png"/>
|
119
|
<link rel="stylesheet" media="screen" href="css/map.css" />
|
120
|
<script src="js/hide_n_showForm.js"></script>
|
121
|
</head>
|
122
|
<body>
|
123
|
<canvas id="mon-canvas">
|
124
|
Ce message indique que ce navigateur est vétuste car il ne supporte pas <samp>canvas</samp> (IE6, IE7, IE8, ...)
|
125
|
</canvas>
|
126
|
|
127
|
<fieldset id="control"><legend>contrôle</legend>
|
128
|
<label>Zoom : <input type="range" min="0" max="2" value="2" id="zoom_ctrl"/></label>
|
129
|
<label>Cap : <input type="number" min="0" max="360" step="10" value="0" autofocus="" id="angle_ctrl"/></label>
|
130
|
<label>Élévation : <input type="number" min="-90" max="90" step="1" value="0" autofocus="" id="elvtn_ctrl"/></label>
|
131
|
</fieldset>
|
132
|
|
133
|
<?php
|
134
|
|
135
|
if ($params && isset($params['latitude']) && isset($params['longitude'])) {
|
136
|
print("<div id=\"params\">\n");
|
137
|
printf ("<p>latitude : <em><span id=\"pos_lat\">%.5f</span>°</em></p>\n", $params['latitude']);
|
138
|
printf ("<p>longitude : <em><span id=\"pos_lon\">%.5f</span>°</em></p>\n", $params['longitude']);
|
139
|
if (isset($params['altitude'])) printf ("<p>altitude : <em><span id=\"pos_alt\">%d</span> m</em></p>\n", $params['altitude']);
|
140
|
print("</div>\n");
|
141
|
echo $form_extpoint;
|
142
|
} elseif ($params == false ) {
|
143
|
$dir = $_GET['dir'];
|
144
|
$name = $_GET['panorama'];
|
145
|
printf($form_param, $name, $name);
|
146
|
}
|
147
|
echo '<p id="info"></p>'."\n";
|
148
|
|
149
|
echo "<p id=\"insert\">";
|
150
|
if (count($extra_names) > 1) {
|
151
|
echo "<select id=\"sel_point\" name=\"known_points\">\n";
|
152
|
foreach ($extra_names as $nm) {
|
153
|
echo '<option>'.$nm."</option>\n";
|
154
|
}
|
155
|
echo "</select>\n";
|
156
|
echo "<input type=\"button\" id=\"do-insert\" value=\"insérer\"/>\n";
|
157
|
echo "<input type=\"button\" id=\"do-delete\" value=\"suppimer\"/>\n";
|
158
|
echo "<input type=\"button\" id=\"show-cap\" value=\"visualiser cet axe sur OSM\"/>\n";
|
159
|
} else {
|
160
|
echo "Pas de point de reférénce connu, lisez le <em>README.md</em> pour en ajouter. \n";
|
161
|
}
|
162
|
echo "<input type=\"button\" id=\"do-cancel\" value=\"annuler\"/>\n";
|
163
|
echo "</p>\n";
|
164
|
?>
|
165
|
<p id="res"></p>
|
166
|
<div class="validators">
|
167
|
page validée par
|
168
|
<a href="http://validator.w3.org/check?uri=referer"><img src="images/valid_xhtml.svg" alt="Valid XHTML" title="xHTML validé !"/></a>
|
169
|
<a href="http://jigsaw.w3.org/css-validator/check/referer"><img src="images/valid_css.svg" alt="CSS validé !" title="CSS validé !"/></a>
|
170
|
</div>
|
171
|
</body>
|
172
|
</html>
|