Commit 84f58cc5 authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

+ import location from another model

parent 9bf96d60
......@@ -390,3 +390,18 @@ html, body, #x3d_wrapper {
/* margin-right:2px; */
}
#model_name{
width: 200px;
padding: 0px 5px;
}
#import_coordinates_button{
height: 25px;
}
......@@ -242,6 +242,53 @@ function editmode_init(){
controls_showhide();
});
$("#import_coordinates_button").on('click',function(){
if ($("#model_name").val()==""){
$("#imstatus").css({color:"rgba(200,70,70,1)"}).html("empty field");
$("#imstatus").show(0).delay(1000).fadeOut(250);
}else{
var kmlfile = SETTINGS.basepath+"/"+$("#model_name").val()+"/"+$("#model_name").val()+".kml";
$.ajax({
url: kmlfile+"?"+Date.now(),
success:function(response){
$("#imstatus").css({color:"rgba(70,200,70,1)"}).html("ok");
$("#imstatus").show(0).delay(1000).fadeOut(250);
var latitude = parseFloat($(response).find("Camera").find("latitude").text());
var longitude = parseFloat($(response).find("Camera").find("longitude").text());
var altitude = parseFloat($(response).find("Camera").find("altitude").text());
Data.camera.latitude = latitude;
Data.camera.longitude = longitude;
Data.camera.altitude = altitude;
Data.camera.kml.latitude = latitude;
Data.camera.kml.longitude = longitude;
Data.camera.kml.altitude = altitude;
//reset
Map.marker.setHeading(Data.camera.heading);
Map.marker.setBasePoint(new L.LatLng(latitude,longitude));
Map.marker._syncMeasureMarkersToBasePoint();
Map._map.panTo(new L.LatLng(latitude,longitude));
x3d_initial_camera_placement("t");
},
error:function(response){
$("#imstatus").css({color:"rgba(200,70,70,1)"}).html("file not found");
$("#imstatus").show(0).delay(1000).fadeOut(250);
}
});
}
});
}
function controls_showhide(){
......
......@@ -169,6 +169,14 @@ Instructions:
<td title='Adjust initial location and orientation'>Edit mode</td>
<td><input id='edit' type='checkbox' class='my-check-box donothide' /></td>
</tr>
<tr class='edit'>
<td title=''>Import coordinates from another model</td>
<td><input id='model_name' type='text' class='input donothide' placeholder='model name' /></td>
<td><button id='import_coordinates_button' class='donothide' >Apply</button></td>
<td valign='middle'>
<div id='imstatus'></div>
</td>
</tr>
<tr class='edit' id='kml_tr'>
<td title='.kml:
* latitude and longitude,
......
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