Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
x3domlet
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Elphel
x3domlet
Commits
ef6a5a1c
Commit
ef6a5a1c
authored
Sep 28, 2017
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed saving incorrect tilt
parent
da183e17
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
58 deletions
+62
-58
ui_extra_models.js
js/ui_extra_models.js
+62
-58
No files found.
js/ui_extra_models.js
View file @
ef6a5a1c
...
...
@@ -231,7 +231,7 @@ function parse_load_extra_model(name,version,response){
longitude
:
longitude
,
altitude
:
altitude
,
heading
:
heading
,
tilt
:
tilt
,
tilt
:
tilt
+
90
,
roll
:
roll
,
name
:
$
(
response
).
find
(
"name"
).
text
(),
description
:
$
(
response
).
find
(
"Camera"
).
find
(
"description"
).
text
(),
...
...
@@ -359,7 +359,7 @@ function manualposor_refresh_content(){
// B.
//toMatrix
console
.
log
(
tra_rot
);
//
console.log(tra_rot);
// tra_tra is local - convert to real world
var
tra_tra
=
$
(
tra
).
attr
(
"translation"
).
split
(
","
);
...
...
@@ -399,6 +399,12 @@ function manualposor_refresh_content(){
//unbind existing
this
.
removeEventListener
(
"mousewheel"
,
false
);
this
.
removeEventListener
(
"change"
,
false
);
this
.
onchange
=
function
(
event
){
manualposor_update
(
this
);
}
//bind new
this
.
onmousewheel
=
function
(
event
){
...
...
@@ -435,16 +441,20 @@ function manualposor_refresh_content(){
newval
=
tmpval
+
(
delta
>
0
?
speed
:
-
speed
);
$
(
this
).
val
(
newval
.
toFixed
(
preci
));
// move/rotate model
var
tmp_pp
=
$
(
this
).
parent
().
parent
();
manualposor_update
(
this
);
var
tmpname
=
tmp_pp
.
find
(
".mpr_name"
).
html
();
}
var
tmptransform
=
$
(
"inline[name=x3d_"
+
tmpname
+
"]"
).
parent
();
}
});
//get new coordinates
var
angle
=
0
;
var
distance
=
0
;
}
function
manualposor_update
(
elem
){
var
tmp_pp
=
$
(
elem
).
parent
().
parent
();
var
tmpname
=
tmp_pp
.
find
(
".mpr_name"
).
html
();
var
tmptransform
=
$
(
"inline[name=x3d_"
+
tmpname
+
"]"
).
parent
();
var
dp_rw
=
{
x
:
parseFloat
(
tmp_pp
.
find
(
".mpr_x"
).
val
()),
...
...
@@ -452,15 +462,8 @@ function manualposor_refresh_content(){
z
:
parseFloat
(
tmp_pp
.
find
(
".mpr_z"
).
val
())
};
distance
=
Math
.
sqrt
(
dp_rw
.
x
*
dp_rw
.
x
+
dp_rw
.
z
*
dp_rw
.
z
);
angle
=
180
/
Math
.
PI
*
Math
.
atan2
(
dp_rw
.
x
,
-
dp_rw
.
z
);
if
(
dp_rw
.
z
!=
0
){
angle
=
180
/
Math
.
PI
*
Math
.
atan2
(
dp_rw
.
x
,
-
dp_rw
.
z
);
}
console
.
log
(
"Angle-Distance: "
+
angle
+
" "
+
distance
);
var
distance
=
Math
.
sqrt
(
dp_rw
.
x
*
dp_rw
.
x
+
dp_rw
.
z
*
dp_rw
.
z
);
var
angle
=
180
/
Math
.
PI
*
Math
.
atan2
(
dp_rw
.
x
,
-
dp_rw
.
z
);
var
dp_r
=
x3dom_real_to_scene
(
dp_rw
.
x
,
dp_rw
.
y
,
dp_rw
.
z
);
var
new_tra
=
[
dp_r
.
x
,
dp_r
.
y
,
dp_r
.
z
].
join
(
","
);
...
...
@@ -469,11 +472,17 @@ function manualposor_refresh_content(){
var
tilt
=
tmp_pp
.
find
(
".mpr_t"
).
val
()
*
Math
.
PI
/
180
;
var
roll
=
tmp_pp
.
find
(
".mpr_r"
).
val
()
*
Math
.
PI
/
180
;
var
heading
=
tmp_pp
.
find
(
".mpr_h"
).
val
()
*
Math
.
PI
/
180
;
var
tilt
=
tmp_pp
.
find
(
".mpr_t"
).
val
()
*
Math
.
PI
/
180
;
var
roll
=
tmp_pp
.
find
(
".mpr_r"
).
val
()
*
Math
.
PI
/
180
;
// update object
var
initial_coordinates
=
[
Data
.
camera
.
latitude
,
Data
.
camera
.
longitude
];
var
p0
=
new
L
.
LatLng
(
initial_coordinates
[
0
],
initial_coordinates
[
1
]);
//Camera._latlng;
var
p1
=
p0
.
CoordinatesOf
(
angle
,
distance
);
if
(
tmpname
!=
SETTINGS
.
path
){
Data
.
extra_models
[
"x3d_"
+
tmpname
].
latitude
=
p1
.
lat
.
toFixed
(
8
);
Data
.
extra_models
[
"x3d_"
+
tmpname
].
longitude
=
p1
.
lng
.
toFixed
(
8
);
...
...
@@ -481,6 +490,7 @@ function manualposor_refresh_content(){
Data
.
extra_models
[
"x3d_"
+
tmpname
].
tilt
=
parseFloat
(
tmp_pp
.
find
(
".mpr_t"
).
val
())
+
90
;
Data
.
extra_models
[
"x3d_"
+
tmpname
].
roll
=
tmp_pp
.
find
(
".mpr_r"
).
val
();
}
// Heading,Tilt,Roll
var
Mh
=
x3dom
.
fields
.
SFMatrix4f
.
rotationZ
(
heading
);
var
Mt
=
x3dom
.
fields
.
SFMatrix4f
.
rotationY
(
tilt
);
...
...
@@ -506,12 +516,6 @@ function manualposor_refresh_content(){
tmptransform
.
attr
(
"rotation"
,
new_rot
);
tmptransform
.
attr
(
"translation"
,
new_tra
);
}
}
});
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment