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