Commit 60cf1d18 authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

tilt, roll and alt fitting results apply dialog

parent 6796bdda
......@@ -142,19 +142,19 @@ function x3dom_align_hll(){
//convert to conventional range
xyh[2] = (xyh[2]+360)%360;
//init apply dialog
apply_alignment_dialog([x0,y0,h0],xyh,counter,s1,de);
apply_alignment_dialog_hll([x0,y0,h0],xyh,counter,s1,de);
}
/*
* ui dialog to apply or cancel results
*/
function apply_alignment_dialog(xyh0,xyh1,c,e,de){
function apply_alignment_dialog_hll(xyh0,xyh1,c,e,de){
var d = $("<div>",{id:"aa1_dialog"});
var dc = $([
'<div>Alignment algorithm results</div>',
'<div>Least squares fitting results for heading, latitude & longitude</div>',
'<br/>',
'<div>Error: <b>'+e+' &deg;</b></div>',
'<div>d<sup>-1</sup> Error: <b>'+de+' m<sup>-1</sup></b></div>',
......@@ -163,9 +163,9 @@ function apply_alignment_dialog(xyh0,xyh1,c,e,de){
'<table>',
' <tr>',
' <th></th>',
' <th>Latitude</th>',
' <th>Longitude</th>',
' <th>Heading</th>',
' <th>Latitude, &deg;</th>',
' <th>Longitude, &deg;</th>',
' <th>Heading, &deg;</th>',
' </tr>',
' <tr>',
' <th>old</th>',
......@@ -189,7 +189,7 @@ function apply_alignment_dialog(xyh0,xyh1,c,e,de){
var b1 = $("<button>").html("apply");
b1.on('click',function(){
apply_alignment(xyh1);
apply_alignment_hll(xyh1);
b2.click();
});
......@@ -208,7 +208,7 @@ function apply_alignment_dialog(xyh0,xyh1,c,e,de){
/*
* actual apply function
*/
function apply_alignment(xyh){
function apply_alignment_hll(xyh){
var Camera = Map.marker;
......@@ -280,6 +280,8 @@ function x3dom_align_art(){
var result = numbers.calculus.GaussNewton([0,0],Data.markers.length,art2_r_i,[art2_dr_dx_i,art2_dr_da_i],epsilon,art2_w_i);
console.log(result);
result.v[0] = result.v[0]*180/Math.PI;
apply_alignment_dialog_art([0,0,0],[result.v[0],0,result.v[1]],result.count,result.error,false);
return;
......@@ -288,25 +290,86 @@ function x3dom_align_art(){
var result = numbers.calculus.GaussNewton([0,0,0],Data.markers.length,art_r_i,[art_dr_dx_i,art_dr_dy_i,art_dr_da_i],epsilon,art_w_i);
console.log(result);
//convert to degs
result.v[0] = result.v[0]*180/Math.PI;
result.v[1] = result.v[1]*180/Math.PI;
apply_alignment_dialog_art([0,0,0],result.v,result.count,result.error,true);
}
/*
* not used
*/
function align_roll(){
function apply_alignment_dialog_art(a0,a1,c,e,full){
console.log("roll");
var d = $("<div>",{id:"aa1_dialog"});
var dc = $([
(full)? '<div>Least squares fitting results for <b>tilt</b>, <b>roll</b> and <b>relative altitude</b></div>':'<div>Least squares fitting results for <b>tilt</b> and <b>relative altitude</b> (roll=0)</div>',
'<br/>',
'<div>Error: <b>'+e+' m</b></div>',
'<div>Iterations: <b>'+c+'</b></div>',
'<div>',
'<table>',
' <tr>',
' <th></th>',
' <th>Tilt, &deg;</th>',
(full)? ' <th>Roll, &deg;</th>':'',
' <th>Altitude, m</th>',
' </tr>',
' <tr>',
' <th>old</th>',
' <td>'+a0[0]+'</td>',
(full)? ' <td>'+a0[1]+'</td>':'',
' <td>'+a0[2]+'</td>',
' </tr>',
' <tr>',
' <th>new</th>',
' <td>'+a1[0]+'</td>',
(full)? ' <td>'+a1[1]+'</td>':'',
' <td>'+a1[2]+'</td>',
' </tr>',
'</table>',
'</div>',
'<br/>'
].join('\n'));
d.append(dc);
var b1 = $("<button>").html("apply");
b1.on('click',function(){
apply_alignment_art(a1);
b2.click();
});
var b2 = $("<button>").html("cancel");
b2.on('click',function(){
$("#aa1_dialog").remove();
});
d.append($("<div>").append(b1).append(b2));
$("body").append(d);
}
function apply_alignment_art(tra){
var Camera = Map.marker;
Data.camera.tilt = tra[0]+90;
Data.camera.roll = tra[1];
Data.camera.altitude = tra[2];
/*
* not used
*/
function align_tilt(){
Data.camera.kml.tilt = tra[0]+90;
Data.camera.kml.roll = tra[1];
Data.camera.kml.altitude = tra[2];
console.log("tilt");
Map.marker.setAltitude(tra[2]);
// no need
Map.marker._syncMeasureMarkersToBasePoint();
x3d_initial_camera_placement();
}
......
......@@ -74,23 +74,23 @@
<div id='help_button'>?</div>
<div id='download_button' title='Download 3d model (.obj & .x3d formats)'></div>
<div id='menu_button'></div>
<div id='align_button' title='Run least squares fit algorithm (Gauss-Newton) for camera heading and location using markers.
<div id='align_button' title='Run least squares fitting algorithm (Gauss-Newton) for camera heading and location using markers.
Instructions:
1. Use approximate location control on the map to change initial approximation for the algorithm.
2. Place at least 3 markers in the 3D scene (ctrl+click) - drag to position more precisely.
3. Move all markers on the map to update their location - drag to position more precisely.
4. Click this button - the results will appear in a dialog window with "apply"/"cancel"
5. To save the result click upload button (Initial location and heading) in the menu.' class='edit'></div>
4. Click this button - the results will appear in a dialog window with "apply"/"cancel".
5. To save the result click upload button (map data) in the menu.' class='edit'></div>
<!--<div id='align_tr_button' title='Align tilt and roll' class='edit'></div>-->
<div id='align_tr_button' title='Run least squares fit algorithm (Gauss-Newton) for camera tilt, roll and altitude (relative).
<div id='align_tr_button' title='Run least squares fitting algorithm (Gauss-Newton) for camera tilt, roll and altitude (relative).
Instructions:
1. Place markers in the 3D scene (ctrl+click) - drag to position more precisely.
* 2 markers - adjust tilt and altitude, while roll = 0&deg;
* 3+ markers - adjust tilt, roll and altitude
2. Move all markers on the map to update their location - drag to position more precisely.
3. Turn on "Switch and Elevation control mode" for the map, drag markers over map to set approximate altitude relative to the camera.
4. Click this button - the results will appear in the browser console. Look for "v"-vector data.
' class='experimental'></div>
4. Click this button - the results will appear in a dialog window with "apply"/"cancel".
5. To save the result click upload button (map data) in the menu.' class='edit'></div>
</div>
<div id='info-wrapper'>
......@@ -155,12 +155,15 @@ Instructions:
<td>&nbsp;</td>
</tr>
<tr>
<td title='Adjust initial location and heading'>Edit mode</td>
<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>
Initial location and heading:
<td title='.kml:
* latitude and longitude,
* heading, tilt and roll angles
* altitude (relative to the ground)'>
Camera initial position and orientation data:
</td>
<td>
<button id='restorekml' class='ic donothide' title='restore'><img src='js/images/ic_file_download_black_48dp_1x.png' class='icim donothide'/></button>
......
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