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
827d0e58
Commit
827d0e58
authored
Aug 23, 2017
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1. +basepath 2. work when kml is missing
parent
ba0dc914
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
83 deletions
+57
-83
ui_init.js
js/ui_init.js
+57
-83
No files found.
js/ui_init.js
View file @
827d0e58
...
@@ -93,6 +93,7 @@ function parseURL(){
...
@@ -93,6 +93,7 @@ function parseURL(){
case
"slidingdrag"
:
SETTINGS
.
slidingdrag
=
true
;
break
;
case
"slidingdrag"
:
SETTINGS
.
slidingdrag
=
true
;
break
;
case
"shiftspeed"
:
SETTINGS
.
shiftspeed
=
parseFloat
(
parameters
[
i
][
1
]);
break
;
case
"shiftspeed"
:
SETTINGS
.
shiftspeed
=
parseFloat
(
parameters
[
i
][
1
]);
break
;
case
"markersize"
:
SETTINGS
.
markersize
=
parseFloat
(
parameters
[
i
][
1
]);
break
;
case
"markersize"
:
SETTINGS
.
markersize
=
parseFloat
(
parameters
[
i
][
1
]);
break
;
case
"basepath"
:
SETTINGS
.
basepath
=
parameters
[
i
][
1
];
break
;
case
"path"
:
SETTINGS
.
path
=
parameters
[
i
][
1
];
break
;
case
"path"
:
SETTINGS
.
path
=
parameters
[
i
][
1
];
break
;
case
"ver"
:
SETTINGS
.
version
=
parameters
[
i
][
1
];
break
;
case
"ver"
:
SETTINGS
.
version
=
parameters
[
i
][
1
];
break
;
...
@@ -209,122 +210,81 @@ function light_init(){
...
@@ -209,122 +210,81 @@ function light_init(){
$
.
ajax
({
$
.
ajax
({
url
:
SETTINGS
.
files
.
kml
+
"?"
+
Date
.
now
(),
url
:
SETTINGS
.
files
.
kml
+
"?"
+
Date
.
now
(),
success
:
function
(
response
){
success
:
function
(
response
){
parse_light_init_response
(
response
);
parse_light_init_response
(
response
,
"init"
);
},
},
error
:
function
(
response
){
error
:
function
(
response
){
console
.
log
(
"KML not found. Using defaults"
);
console
.
log
(
"
Init:
KML not found. Using defaults"
);
parse_light_init_response
(
response
);
parse_light_init_response
(
response
,
"init"
);
}
}
});
});
}
}
function
parse_light_init_response
(
response
){
function
parse_light_init_response
(
response
,
state
){
var
l
ongitude
=
parseFloat
(
$
(
response
).
find
(
"Camera"
).
find
(
"longitude"
).
text
())
;
var
l
atitude
=
parseFloat
(
$
(
response
).
find
(
"Camera"
).
find
(
"latitude"
).
text
())
||
40.7233861
;
var
l
atitude
=
parseFloat
(
$
(
response
).
find
(
"Camera"
).
find
(
"latitude"
).
text
())
;
var
l
ongitude
=
parseFloat
(
$
(
response
).
find
(
"Camera"
).
find
(
"longitude"
).
text
())
||
-
111.9328843
;
var
altitude
=
parseFloat
(
$
(
response
).
find
(
"Camera"
).
find
(
"altitude"
).
text
());
var
altitude
=
parseFloat
(
$
(
response
).
find
(
"Camera"
).
find
(
"altitude"
).
text
())
||
1305.1
;
var
heading
=
parseFloat
(
$
(
response
).
find
(
"Camera"
).
find
(
"heading"
).
text
());
var
heading
=
parseFloat
(
$
(
response
).
find
(
"Camera"
).
find
(
"heading"
).
text
())
||
0.0001
;
var
tilt
=
parseFloat
(
$
(
response
).
find
(
"Camera"
).
find
(
"tilt"
).
text
());
var
tilt
=
parseFloat
(
$
(
response
).
find
(
"Camera"
).
find
(
"tilt"
).
text
())
||
90
;
var
roll
=
parseFloat
(
$
(
response
).
find
(
"Camera"
).
find
(
"roll"
).
text
());
var
roll
=
parseFloat
(
$
(
response
).
find
(
"Camera"
).
find
(
"roll"
).
text
())
||
0
;
var
fov
=
parseFloat
(
$
(
response
).
find
(
"Camera"
).
find
(
"fov"
).
text
());
var
fov
=
parseFloat
(
$
(
response
).
find
(
"Camera"
).
find
(
"fov"
).
text
())
||
0
;
Data
.
camera
=
new
X3L
({
Data
.
camera
=
new
X3L
({
x
:
0
,
x
:
0
,
y
:
0
,
y
:
0
,
z
:
0
,
z
:
0
,
latitude
:
latitude
||
40.7233861
,
latitude
:
latitude
,
longitude
:
longitude
||
-
111.9328843
,
longitude
:
longitude
,
altitude
:
altitude
||
1305.1
,
altitude
:
altitude
,
heading
:
heading
||
0
,
heading
:
heading
,
tilt
:
tilt
||
90
,
tilt
:
tilt
,
roll
:
roll
||
0
,
roll
:
roll
,
fov
:
fov
||
0
,
fov
:
fov
,
});
});
// store kml
// store kml
// this data changes only in leaflet's edit location mode
// this data changes only in leaflet's edit location mode
Data
.
camera
.
kml
=
{
Data
.
camera
.
kml
=
{
latitude
:
latitude
||
40.7233861
,
latitude
:
latitude
,
longitude
:
longitude
||
-
111.9328843
,
longitude
:
longitude
,
altitude
:
altitude
||
1305.1
,
altitude
:
altitude
,
heading
:
heading
||
0
,
heading
:
heading
,
tilt
:
tilt
||
90
,
tilt
:
tilt
,
roll
:
roll
||
0
,
roll
:
roll
,
name
:
$
(
response
).
find
(
"name"
).
text
(),
name
:
$
(
response
).
find
(
"name"
).
text
(),
description
:
$
(
response
).
find
(
"Camera"
).
find
(
"description"
).
text
(),
description
:
$
(
response
).
find
(
"Camera"
).
find
(
"description"
).
text
(),
visibility
:
$
(
response
).
find
(
"visibility"
).
text
(),
visibility
:
$
(
response
).
find
(
"visibility"
).
text
(),
href
:
$
(
response
).
find
(
"Icon"
).
find
(
"href"
).
text
()
href
:
$
(
response
).
find
(
"Icon"
).
find
(
"href"
).
text
()
};
};
var
element
=
document
.
getElementById
(
'x3d_id'
);
if
(
state
==
"init"
){
Scene
=
new
X3DOMObject
(
element
,
Data
,{});
var
element
=
document
.
getElementById
(
'x3d_id'
);
Scene
.
initResize
();
$
.
getScript
(
"js/x3dom/x3dom-full.debug.js"
,
function
(){
Scene
=
new
X3DOMObject
(
element
,
Data
,{});
Map
=
new
LeafletObject
(
'leaflet_map'
,
Data
,{});
Scene
.
initResize
();
//wait until it DOM is extended
x3dom
.
runtime
.
ready
=
function
(){
map_resize_init
();
$
.
getScript
(
"js/x3dom/x3dom-full.debug.js"
,
function
(){
deep_init
();
Map
=
new
LeafletObject
(
'leaflet_map'
,
Data
,{});
//wait until it DOM is extended
x3dom
.
runtime
.
ready
=
function
(){
//align_init();
map_resize_init
();
x3d_initial_camera_placement
();
deep_init
();
Scene
.
resize
();
x3d_events
();
leaf_events
();
};
//align_init();
});
x3d_initial_camera_placement
();
Scene
.
resize
();
}
x3d_events
();
leaf_events
();
function
reset_to_initial_position
(){
$
.
ajax
({
};
url
:
SETTINGS
.
files
.
kml
+
"?"
+
Date
.
now
(),
});
success
:
function
(
response
){
var
longitude
=
parseFloat
(
$
(
response
).
find
(
"Camera"
).
find
(
"longitude"
).
text
());
}
else
{
var
latitude
=
parseFloat
(
$
(
response
).
find
(
"Camera"
).
find
(
"latitude"
).
text
());
var
altitude
=
parseFloat
(
$
(
response
).
find
(
"Camera"
).
find
(
"altitude"
).
text
());
var
heading
=
parseFloat
(
$
(
response
).
find
(
"Camera"
).
find
(
"heading"
).
text
());
var
tilt
=
parseFloat
(
$
(
response
).
find
(
"Camera"
).
find
(
"tilt"
).
text
());
var
roll
=
parseFloat
(
$
(
response
).
find
(
"Camera"
).
find
(
"roll"
).
text
());
var
fov
=
parseFloat
(
$
(
response
).
find
(
"Camera"
).
find
(
"fov"
).
text
());
Data
.
camera
=
new
X3L
({
x
:
0
,
y
:
0
,
z
:
0
,
latitude
:
latitude
||
0
,
longitude
:
longitude
||
0
,
altitude
:
altitude
||
0
,
heading
:
heading
||
0
,
tilt
:
tilt
||
0
,
roll
:
roll
||
0
,
fov
:
fov
||
0
,
});
// store kml
Data
.
camera
.
kml
=
{
latitude
:
latitude
||
0
,
longitude
:
longitude
||
0
,
altitude
:
altitude
||
0
,
heading
:
heading
||
0
,
tilt
:
tilt
||
0
,
roll
:
roll
||
0
,
name
:
$
(
response
).
find
(
"name"
).
text
(),
description
:
$
(
response
).
find
(
"Camera"
).
find
(
"description"
).
text
(),
visibility
:
$
(
response
).
find
(
"visibility"
).
text
(),
href
:
$
(
response
).
find
(
"Icon"
).
find
(
"href"
).
text
()
};
Map
.
marker
.
setHeading
(
heading
);
Map
.
marker
.
setHeading
(
heading
);
Map
.
marker
.
setBasePoint
(
new
L
.
LatLng
(
latitude
,
longitude
));
Map
.
marker
.
setBasePoint
(
new
L
.
LatLng
(
latitude
,
longitude
));
...
@@ -336,6 +296,20 @@ function reset_to_initial_position(){
...
@@ -336,6 +296,20 @@ function reset_to_initial_position(){
reportKmlReloaded
();
reportKmlReloaded
();
}
}
function
reset_to_initial_position
(){
$
.
ajax
({
url
:
SETTINGS
.
files
.
kml
+
"?"
+
Date
.
now
(),
success
:
function
(
response
){
parse_light_init_response
(
response
,
"reset"
);
},
error
:
function
(
response
){
console
.
log
(
"Reset: KML not found. Using defaults"
);
parse_light_init_response
(
response
,
"reset"
);
}
}
});
});
...
...
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