Commit ba0dc914 authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

if kml is missing

parent d24cda5c
...@@ -209,6 +209,17 @@ function light_init(){ ...@@ -209,6 +209,17 @@ function light_init(){
$.ajax({ $.ajax({
url: SETTINGS.files.kml+"?"+Date.now(), url: SETTINGS.files.kml+"?"+Date.now(),
success: function(response){ success: function(response){
parse_light_init_response(response);
},
error: function(response){
console.log("KML not found. Using defaults");
parse_light_init_response(response);
}
});
}
function parse_light_init_response(response){
var longitude = parseFloat($(response).find("Camera").find("longitude").text()); var longitude = parseFloat($(response).find("Camera").find("longitude").text());
var latitude = parseFloat($(response).find("Camera").find("latitude").text()); var latitude = parseFloat($(response).find("Camera").find("latitude").text());
...@@ -224,11 +235,11 @@ function light_init(){ ...@@ -224,11 +235,11 @@ function light_init(){
x: 0, x: 0,
y: 0, y: 0,
z: 0, z: 0,
latitude: latitude || 0, latitude: latitude || 40.7233861,
longitude: longitude || 0, longitude: longitude || -111.9328843,
altitude: altitude || 0, altitude: altitude || 1305.1,
heading: heading || 0, heading: heading || 0,
tilt: tilt || 0, tilt: tilt || 90,
roll: roll || 0, roll: roll || 0,
fov: fov || 0, fov: fov || 0,
}); });
...@@ -236,11 +247,11 @@ function light_init(){ ...@@ -236,11 +247,11 @@ function light_init(){
// store kml // store kml
// this data changes only in leaflet's edit location mode // this data changes only in leaflet's edit location mode
Data.camera.kml = { Data.camera.kml = {
latitude: latitude || 0, latitude: latitude || 40.7233861,
longitude: longitude || 0, longitude: longitude || -111.9328843,
altitude: altitude || 0, altitude: altitude || 1305.1,
heading: heading || 0, heading: heading || 0,
tilt: tilt || 0, tilt: tilt || 90,
roll: roll || 0, roll: roll || 0,
name : $(response).find("name").text(), name : $(response).find("name").text(),
description : $(response).find("Camera").find("description").text(), description : $(response).find("Camera").find("description").text(),
...@@ -269,8 +280,6 @@ function light_init(){ ...@@ -269,8 +280,6 @@ function light_init(){
}; };
}); });
},
});
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment