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
88148030
Commit
88148030
authored
Aug 31, 2017
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1. reset button 2. remove markers button 3. r and t keys and actions
parent
cd6eca74
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
85 additions
and
15 deletions
+85
-15
ui_align.js
js/ui_align.js
+4
-0
ui_init.js
js/ui_init.js
+50
-13
ui_menu.js
js/ui_menu.js
+13
-0
x3dom_init.js
js/x3dom_init.js
+5
-1
viewer.html
viewer.html
+13
-1
No files found.
js/ui_align.js
View file @
88148030
...
...
@@ -413,6 +413,10 @@ function x3dom_align_art(){
//test_height_alignment_set3_2points();
if
(
Data
.
markers
.
length
<
2
){
var
msg
=
"Alignment error: too few markers"
;
ui_showMessage
(
"window-error"
,
msg
);
console
.
log
(
"Too few points"
);
return
;
}
...
...
js/ui_init.js
View file @
88148030
...
...
@@ -202,6 +202,8 @@ function background_init(){
function
light_init
(){
var
mode
=
"t"
;
var
x3delement
=
$
(
"#x3d_id"
).
find
(
"scene"
);
var
model_url
=
SETTINGS
.
files
.
x3d
;
...
...
@@ -219,17 +221,17 @@ function light_init(){
$
.
ajax
({
url
:
SETTINGS
.
files
.
kml
+
"?"
+
Date
.
now
(),
success
:
function
(
response
){
parse_light_init_response
(
response
,
"init"
);
parse_light_init_response
(
response
,
"init"
,
mode
);
},
error
:
function
(
response
){
console
.
log
(
"Init: KML not found. Using defaults"
);
parse_light_init_response
(
response
,
"init"
);
parse_light_init_response
(
response
,
"init"
,
mode
);
}
});
}
function
parse_light_init_response
(
response
,
state
){
function
parse_light_init_response
(
response
,
state
,
mode
){
var
latitude
=
parseFloat
(
$
(
response
).
find
(
"Camera"
).
find
(
"latitude"
).
text
())
||
40.7233861
;
var
longitude
=
parseFloat
(
$
(
response
).
find
(
"Camera"
).
find
(
"longitude"
).
text
())
||
-
111.9328843
;
...
...
@@ -285,7 +287,7 @@ function parse_light_init_response(response,state){
deep_init
();
//align_init();
x3d_initial_camera_placement
();
x3d_initial_camera_placement
(
mode
);
Scene
.
resize
();
x3d_events
();
leaf_events
();
...
...
@@ -299,7 +301,7 @@ function parse_light_init_response(response,state){
Map
.
marker
.
setBasePoint
(
new
L
.
LatLng
(
latitude
,
longitude
));
Map
.
marker
.
_syncMeasureMarkersToBasePoint
();
x3d_initial_camera_placement
();
x3d_initial_camera_placement
(
mode
);
//x3d_mouseMove();
Scene
.
resize
();
...
...
@@ -309,16 +311,16 @@ function parse_light_init_response(response,state){
}
function
reset_to_initial_position
(){
function
reset_to_initial_position
(
mode
){
$
.
ajax
({
url
:
SETTINGS
.
files
.
kml
+
"?"
+
Date
.
now
(),
success
:
function
(
response
){
parse_light_init_response
(
response
,
"reset"
);
parse_light_init_response
(
response
,
"reset"
,
mode
);
},
error
:
function
(
response
){
console
.
log
(
"Reset: KML not found. Using defaults"
);
parse_light_init_response
(
response
,
"reset"
);
parse_light_init_response
(
response
,
"reset"
,
mode
);
}
});
...
...
@@ -417,7 +419,15 @@ function deep_init(){
}
function
x3d_initial_camera_placement
(){
function
x3d_initial_camera_placement
(
mode
){
if
(
mode
==
undefined
){
// reset horizontal
mode
=
"r"
;
}
else
{
// reset with tilt
mode
=
"t"
;
}
Scene
.
old_view_translation
=
null
;
...
...
@@ -452,8 +462,12 @@ function x3d_initial_camera_placement(){
// exclude tilt and roll
var
RC0_rw
=
T
.
inverse
().
mult
(
Mh
).
mult
(
T
);
var
RC0_rw_t
=
T
.
inverse
().
mult
(
Mh
).
mult
(
Mt
).
mult
(
T
);
// what's this?!
var
RC_w
=
R0
.
inverse
().
mult
(
RC0_rw
);
var
RC_w
=
R0
.
inverse
().
mult
(
RC0_rw
);
var
RC_wt
=
R0
.
inverse
().
mult
(
RC0_rw_t
);
// store matrices
Data
.
camera
.
Matrices
=
{
R0
:
R0
,
...
...
@@ -462,7 +476,11 @@ function x3d_initial_camera_placement(){
RC_w0
:
RC_w
};
x3dom_setViewpoint
(
RC_w
);
if
(
mode
==
"r"
){
x3dom_setViewpoint
(
RC_w
);
}
else
{
x3dom_setViewpoint
(
RC_wt
);
}
//x3dom_setViewpoint(RC0_rw);
//x3dom_setViewpoint(R0);
...
...
@@ -929,10 +947,29 @@ function leaf_translation_v1(p0,p1){
}
function
x3d_mouseMove
(){
x3dom_update_map
();
}
function
remove_markers
(){
var
index
;
var
elem
;
Scene
.
highlighted_marker_index
=
null
;
var
n
=
Data
.
markers
.
length
;
for
(
var
i
=
0
;
i
<
n
;
i
++
){
index
=
n
-
1
-
i
;
elem
=
$
(
"#my-sph-"
+
index
);
Data
.
markers
.
splice
(
index
,
1
);
Map
.
deleteMarker
(
index
);
elem
.
remove
();
}
}
js/ui_menu.js
View file @
88148030
...
...
@@ -102,6 +102,7 @@ function menu_init(){
shiftspeed_init
();
marker_size_color_init
();
reset_view_init
();
remove_markers_init
();
align_init
();
work_with_kml_init
();
save_rating_init
();
...
...
@@ -158,6 +159,18 @@ function reset_view_init(){
reset_to_initial_position
();
});
$
(
"#reset_view_t"
).
on
(
'click'
,
function
(){
reset_to_initial_position
(
"t"
);
});
}
function
remove_markers_init
(){
$
(
"#remove_markers"
).
on
(
'click'
,
function
(){
remove_markers
();
});
}
function
work_with_kml_init
(){
...
...
js/x3dom_init.js
View file @
88148030
...
...
@@ -249,7 +249,11 @@ X3DOMObject.prototype.KeyEvents = function(){
self
.
element
.
addEventListener
(
'keypress'
,
function
(
e
){
if
(
e
.
key
==
"r"
){
$
(
"#reset_view"
).
click
();
//reset to initial position - no tilt = horizontal
$
(
"#reset_view"
).
click
();
}
else
if
(
e
.
key
==
"t"
){
//reset to initial position with tilt
reset_to_initial_position
(
"t"
);
}
});
...
...
viewer.html
View file @
88148030
...
...
@@ -150,7 +150,11 @@ Instructions:
<td>
</td>
</tr>
<tr>
<td><button
id=
'reset_view'
class=
'donothide'
>
Reset view
</button></td>
<td>
<button
id=
'reset_view'
class=
'donothide'
title=
'Horizontal: heading=initial, tilt=0, roll=0. Or press r-key'
>
Reset view (r)
</button>
<button
id=
'reset_view_t'
class=
'donothide'
title=
'Tilted: heading=initial, tilt=initial, roll=0. Or press t-key'
>
Reset view (t)
</button>
<button
id=
'remove_markers'
class=
'donothide'
>
Remove markers
</button>
</td>
</tr>
<tr>
<td>
</td>
...
...
@@ -274,6 +278,14 @@ Instructions:
</ul>
</td>
</tr>
<tr>
<td><b>
r
</b>
-key
</td>
<td>
reset view (heading = initial, tilt = 0, roll = 0)
</td>
</tr>
<tr>
<td><b>
t
</b>
-key
</td>
<td>
reset view (heading = initial, tilt = initial, roll = 0)
</td>
</tr>
<tr>
<td><button>
Close
</button></td>
</tr>
...
...
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