User selection of lat/lon deltas closes #19

pull/73/head
jonsowman 2010-06-03 17:05:07 +01:00
rodzic e30fce5879
commit 6e62e5b816
4 zmienionych plików z 47 dodań i 10 usunięć

Wyświetl plik

@ -76,7 +76,7 @@ a { text-decoration: underline; color: #333; cursor: pointer; }
#input_form {
border-right: none;
border-bottom: none;
height:350px;
height:370px;
width: 400px;
padding: 5px;
bottom: 0; right: 0;

Wyświetl plik

@ -25,6 +25,9 @@ function createModel($post_array) {
$pred_model['burst'] = $post_array['burst'];
$pred_model['float'] = $post_array['float_time'];
$pred_model['delta_lat'] = $post_array['delta_lat'];
$pred_model['delta_lon'] = $post_array['delta_lon'];
$pred_model['wind_error'] = 0;
$pred_model['software'] = $post_array['software'];
@ -55,10 +58,10 @@ function verifyModel($pred_model, $software_available) {
foreach($pred_model as $idx => $value) {
if ($idx == "software") {
if (!in_array($value, $software_available)) return false;
} else {
if (!is_numeric($value)) {
return false;
}
} else if ($idx == "delta_lat" || $idx == "delta_lon") {
if ( $value < 1 || $value > 10 ) return false;
} else if (!is_numeric($value)) {
return false;
}
}
return true;
@ -77,7 +80,11 @@ function runPred($pred_model) {
// use `at` to automatically background the task
$ph = popen("at now", "w");
fwrite($ph, "cd /var/www/hab/predict/ && ./predict.py -v --latdelta=3 --londelta=3 -p1 -f5 -t ".$pred_model['timestamp']." --lat=".$predictor_lat." --lon=".$predictor_lon." " . $use_hd . $pred_model['uuid']);
fwrite($ph, "cd /var/www/hab/predict/ && ./predict.py -v --latdelta="
.$pred_model['delta_lat']." --londelta=".$pred_model['delta_lon']
." -p1 -f5 -t ".$pred_model['timestamp']
." --lat=".$predictor_lat." --lon=".$predictor_lon." " . $use_hd
. $pred_model['uuid']);
fclose($ph);
}

Wyświetl plik

@ -103,6 +103,7 @@ function initialize() {
<div id="scenario_info" class="box">
<h1>Scenario Information</h1>
<span id="from_launch_lat">
<a><span id="showHideDebug">Show Debug</span></a></span> |
<a><span id="showHideForm">Hide Launch Card</span></a></span>
</div>
@ -175,11 +176,25 @@ function initialize() {
<td><input id="float" type="text" name="float_time" value="0"></td>
</tr>
<tr>
<td>Landing prediction software: <td>
<td>Landing prediction software: </td><td>
<select id="software" name="software">
<option value="gfs" selected="selected">GFS</option>
<option value="gfs_hd">GFS HD</option>
</select></td></tr>
<tr><td>Lat/Lon Deltas: </td>
<td>Lat:
<select id="delta_lat" name="delta_lat">
<option value="3" selected="selected">3</option>
<option value="5">5</option>
<option value="10">10</option>
</select>&nbsp;Lon:
<select id="delta_lon" name="delta_lon">
<option value="3" selected="selected">3</option>
<option value="5">5</option>
<option value="10">10</option>
</select>
</td>
</tr>
<tr>
<td>
</td>

Wyświetl plik

@ -37,10 +37,10 @@ function handlePred(pred_uuid) {
$("#prediction_status").html("Searching for wind data...");
$("#input_form").hide("slide", { direction: "down" }, 500);
$("#scenario_info").hide("slide", { direction: "up" }, 500);
// disable user control of the map canvas
$("#map_canvas").fadeTo(1000, 0.2);
// ajax to poll for progress
ajaxEventHandle = setInterval("getJSONProgress('"+pred_uuid+"')", 2000);
//getCSV(pred_uuid);
}
function getCSV(pred_uuid) {
@ -86,8 +86,6 @@ function processProgress(progress) {
$("#scenario_info").show("slide", { direction: "up" }, 500);
toggleWindow("scenario_template", "showHideDebug", "Show Debug",
"Hide Debug", "hide");
// move map to new location
// map.panTo(
// un-fade the map canvas
$("#map_canvas").fadeTo(1500, 1);
appendDebug("Server says: the predictor finished running.");
@ -203,11 +201,28 @@ function parseCSV(lines) {
// pan to the new position
map.panTo(launch_pt);
map.setZoom(8);
return true;
}
function enableMap(map, state) {
if ( state != false && state != true) {
appendDebug("Unrecognised map state");
} else if (state == false) {
map.draggable = false;
map.disableDoubleClickZoom = true;
map.scrollwheel = false;
map.navigationControl = false;
} else if (state == true ) {
map.draggable = true;
map.disableDoubleClickZoom = false;
map.scrollwheel = false;
map.navigationControl = true;
}
}
function clearMapItems() {
if(map_items.length > 0) {
appendDebug("Clearing previous map trace");