Commit 6b3e4144 authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

location and heading more alignment options

parent f05bad46
...@@ -207,11 +207,71 @@ function hll_w_i(i,v){ ...@@ -207,11 +207,71 @@ function hll_w_i(i,v){
* hll2_... * hll2_...
*/ */
function hll2_r_i(i,v){
var lat = Data.camera.kml.latitude;
var lng = Data.camera.kml.longitude;
var f1 = hll_f_3d_i(i,[lat,lng,v[0]]);
var f2 = hll_f_map_i(i,[lat,lng,v[0]]);
//return (f1-f2+360)%360;
return (f1-f2);
}
function hll2_dr_dx_i(i,v){ function hll2_dr_dx_i(i,v){
return 0;
var lat = Data.camera.kml.latitude;
var lng = Data.camera.kml.longitude;
return hll_dr_dh_i(i,[lat,lng,v[0]]);
}
function hll2_w_i(i,v){
var lat = Data.camera.kml.latitude;
var lng = Data.camera.kml.longitude;
return hll_w_i(i,[lat,lng,v[0]]);
}
/**
* Functions for position latitude and longitude (heading is fixed)
* hll3_...
*/
function hll3_r_i(i,v){
var heading = Data.camera.kml.heading;
var f1 = hll_f_3d_i(i,[v[0],v[1],heading]);
var f2 = hll_f_map_i(i,[v[0],v[1],heading]);
//return (f1-f2+360)%360;
return (f1-f2);
} }
function hll3_dr_dx_i(i,v){
var heading = Data.camera.kml.heading;
return hll_dr_dx_i(i,[v[0],v[1],heading]);
}
function hll3_dr_dy_i(i,v){
var heading = Data.camera.kml.heading;
return hll_dr_dy_i(i,[v[0],v[1],heading]);
}
function hll3_w_i(i,v){
var heading = Data.camera.kml.heading;
return hll_w_i(i,[v[0],v[1],heading]);
}
......
...@@ -187,7 +187,12 @@ html, body, #x3d_wrapper { ...@@ -187,7 +187,12 @@ html, body, #x3d_wrapper {
height:25px; height:25px;
} }
#exit_button,#align_button,#align_tr_button,#download_button{ #exit_button,
#align_button,
#align_button_heading,
#align_button_location,
#align_tr_button,
#download_button{
background-size: 32px 32px; background-size: 32px 32px;
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center; background-position: center;
...@@ -222,7 +227,11 @@ html, body, #x3d_wrapper { ...@@ -222,7 +227,11 @@ html, body, #x3d_wrapper {
background-color: rgba(240,150,150,1); background-color: rgba(240,150,150,1);
} }
#align_button:hover, #align_tr_button:hover, #download_button:hover{ #align_button:hover,
#align_button_heading:hover,
#align_button_location:hover,
#align_tr_button:hover,
#download_button:hover{
/* background-image:url('images/align.png'); */ /* background-image:url('images/align.png'); */
background-color: rgba(240,240,240,1); background-color: rgba(240,240,240,1);
} }
...@@ -362,3 +371,22 @@ html, body, #x3d_wrapper { ...@@ -362,3 +371,22 @@ html, body, #x3d_wrapper {
width: 50px; width: 50px;
text-align: right; text-align: right;
} }
#align_button_heading{
background-image:url('images/ic_explore_black_48dp_1x.png');
background-color: rgba(200,250,200,1);
}
#align_button_location{
background-image:url('images/ic_explore_black_48dp_1x.png');
background-color: rgba(200,200,250,1);
}
#align_button,
#align_button_heading,
#align_button_location{
display: block;
/* float:right; */
/* margin-right:2px; */
}
...@@ -48,6 +48,29 @@ function align_init(){ ...@@ -48,6 +48,29 @@ function align_init(){
x3dom_align_hll(); x3dom_align_hll();
}); });
var pos = $("#align_button").position();
var width = $("#align_button").width();
$("#align_button_heading").css({
position:"absolute",
top: pos.top+"px",
left: -(width+2)+"px"
});
$("#align_button_location").css({
position:"absolute",
top: pos.top+"px",
left: -(2*(width+2))+"px"
});
$("#align_button_heading").on("click",function(){
x3dom_align_hll2();
});
$("#align_button_location").on("click",function(){
x3dom_align_hll3();
});
$("#align_tr_button").on("click",function(){ $("#align_tr_button").on("click",function(){
x3dom_align_art(); x3dom_align_art();
}); });
...@@ -269,6 +292,108 @@ function distance_error(x,y,h){ ...@@ -269,6 +292,108 @@ function distance_error(x,y,h){
} }
/**
* find heading (fixed lat and lng)
*/
function x3dom_align_hll2(){
// need at least 1 point
if (Data.markers != undefined){
if (Data.markers.length<1){
var msg = "Alignment error: place at least 1 marker";
ui_showMessage("window-error",msg);
return -1;
}
}else{
var msg = "Alignment error: place at least 1 marker";
ui_showMessage("window-error",msg);
return -1;
}
if (!check_markers()){
//var msg = "Alignment error: marker has not been moved over 3D or Map";
//ui_showMessage("window-error",msg);
return -2;
}
ui_hideMessage("window-error");
// initial approximation:
var x0 = Data.camera.kml.latitude;
var y0 = Data.camera.kml.longitude;
var h0 = Data.camera.kml.heading;
var epsilon = 1e-8;
//var xyh = [x0,y0,(h0>180)?h0-360:h0];
var xyh = [(h0>180)?h0-360:h0];
var result = numbers.calculus.GaussNewton(xyh,Data.markers.length,hll2_r_i,[hll2_dr_dx_i],epsilon,hll2_w_i);
xyh = [x0,y0,result.v[0]];
var s1 = result.error;
var counter = result.count;
//calc distance error
de = distance_error(x0,y0,(h0>180)?h0-360:h0);
//de = -de;
//convert to conventional range
xyh[0] = (xyh[0]+360)%360;
//init apply dialog
apply_alignment_dialog_hll([x0,y0,h0],xyh,counter,s1,de);
}
/**
* find lat and lng (fixed heading)
*/
function x3dom_align_hll3(){
// need at least 3 points
if (Data.markers != undefined){
if (Data.markers.length<2){
var msg = "Alignment error: place at least 2 markers";
ui_showMessage("window-error",msg);
return -1;
}
}else{
var msg = "Alignment error: place at least 2 markers";
ui_showMessage("window-error",msg);
return -1;
}
if (!check_markers()){
//var msg = "Alignment error: marker has not been moved over 3D or Map";
//ui_showMessage("window-error",msg);
return -2;
}
ui_hideMessage("window-error");
// initial approximation:
var x0 = Data.camera.kml.latitude;
var y0 = Data.camera.kml.longitude;
var h0 = Data.camera.kml.heading;
var epsilon = 1e-8;
var xyh = [x0,y0];
var result = numbers.calculus.GaussNewton(xyh,Data.markers.length,hll3_r_i,[hll3_dr_dx_i,hll3_dr_dy_i],epsilon,hll3_w_i);
xyh = [result.v[0],result.v[1],h0];
var s1 = result.error;
var counter = result.count;
//calc distance error
de = distance_error(x0,y0,(h0>180)?h0-360:h0);
//de = -de;
//convert to conventional range
xyh[2] = (xyh[2]+360)%360;
//init apply dialog
apply_alignment_dialog_hll([x0,y0,h0],xyh,counter,s1,de);
}
/** /**
* Tilt, roll and relative height * Tilt, roll and relative height
*/ */
......
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