Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
meshviewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
infrastruktur
meshviewer
Commits
115d9aba
Commit
115d9aba
authored
Feb 25, 2016
by
Moorviper
Browse files
Options
Downloads
Patches
Plain Diff
Location Picker
Both Rightclick and Button with higher precision
parent
32b919dc
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
lib/infobox/location.js
+92
-0
92 additions, 0 deletions
lib/infobox/location.js
lib/infobox/main.js
+7
-1
7 additions, 1 deletion
lib/infobox/main.js
lib/map.js
+14
-2
14 additions, 2 deletions
lib/map.js
lib/router.js
+14
-0
14 additions, 0 deletions
lib/router.js
lib/title.js
+4
-0
4 additions, 0 deletions
lib/title.js
with
131 additions
and
3 deletions
lib/infobox/location.js
0 → 100644
+
92
−
0
View file @
115d9aba
define
(
function
()
{
return
function
(
config
,
el
,
router
,
d
)
{
var
h2
=
document
.
createElement
(
"
h2
"
)
h2
.
textContent
=
"
Location:
"
+
d
.
toString
()
el
.
appendChild
(
h2
)
getJSON
(
"
https://nominatim.openstreetmap.org/reverse?format=json&lat=
"
+
d
.
lat
+
"
&lon=
"
+
d
.
lng
+
"
&zoom=18&addressdetail=0
"
)
.
then
(
function
(
result
)
{
h2
.
textContent
=
result
.
display_name
})
var
h3lat
=
document
.
createElement
(
"
h3
"
)
h3lat
.
textContent
=
"
Breitengrad
"
el
.
appendChild
(
h3lat
)
var
txt1
=
document
.
createElement
(
"
textarea
"
)
txt1
.
id
=
"
location-latitude
"
txt1
.
value
=
d
.
lat
.
toFixed
(
9
)
var
p
=
document
.
createElement
(
"
p
"
)
p
.
appendChild
(
txt1
)
p
.
appendChild
(
createCopyButton
(
txt1
.
id
))
el
.
appendChild
(
p
)
var
h3lng
=
document
.
createElement
(
"
h3
"
)
h3lng
.
textContent
=
"
Längengrad
"
el
.
appendChild
(
h3lng
)
var
txt2
=
document
.
createElement
(
"
textarea
"
)
txt2
.
id
=
"
location-longitude
"
txt2
.
value
=
d
.
lng
.
toFixed
(
9
)
var
p2
=
document
.
createElement
(
"
p
"
)
p2
.
appendChild
(
txt2
)
p2
.
appendChild
(
createCopyButton
(
txt2
.
id
))
el
.
appendChild
(
p2
)
var
a1
=
document
.
createElement
(
"
a
"
)
a1
.
textContent
=
"
plain
"
a1
.
onclick
=
function
()
{
switch2plain
()
return
false
}
a1
.
href
=
config
.
siteURL
var
a2
=
document
.
createElement
(
"
a
"
)
a2
.
textContent
=
"
uci
"
a2
.
onclick
=
function
()
{
switch2uci
()
return
false
}
a2
.
href
=
config
.
siteURL
var
p3
=
document
.
createElement
(
"
p
"
)
p3
.
textContent
=
"
Du kannst zwischen
"
p3
.
appendChild
(
a1
)
var
t1
=
document
.
createTextNode
(
"
und
"
)
p3
.
appendChild
(
t1
)
p3
.
appendChild
(
a2
)
var
t2
=
document
.
createTextNode
(
"
wechseln.
"
)
p3
.
appendChild
(
t2
)
el
.
appendChild
(
p3
)
function
createCopyButton
(
id
)
{
var
btn
=
document
.
createElement
(
"
button
"
)
btn
.
className
=
"
ion-ios-copy
"
btn
.
title
=
"
Kopiere
"
btn
.
onclick
=
function
()
{
copy2clip
(
id
)
}
return
btn
}
function
copy2clip
(
id
)
{
var
copyTextarea
=
document
.
querySelector
(
"
#
"
+
id
)
copyTextarea
.
select
()
try
{
var
successful
=
document
.
execCommand
(
"
copy
"
)
var
msg
=
successful
?
"
successful
"
:
"
unsuccessful
"
console
.
log
(
"
Copying text command was
"
+
msg
)
}
catch
(
err
)
{
console
.
log
(
"
Oops, unable to copy
"
)
}
}
function
switch2plain
()
{
var
box1
=
document
.
getElementById
(
"
location-latitude
"
)
box1
.
value
=
d
.
lat
.
toFixed
(
9
)
var
box2
=
document
.
getElementById
(
"
location-longitude
"
)
box2
.
value
=
d
.
lng
.
toFixed
(
9
)
}
function
switch2uci
()
{
var
box1
=
document
.
getElementById
(
"
location-latitude
"
)
box1
.
value
=
"
uci set gluon-node-info.@location[0].latitude='
"
+
d
.
lat
.
toFixed
(
9
)
+
"
'
"
var
box2
=
document
.
getElementById
(
"
location-longitude
"
)
box2
.
value
=
"
uci set gluon-node-info.@location[0].longitude='
"
+
d
.
lng
.
toFixed
(
9
)
+
"
'
"
}
}
})
This diff is collapsed.
Click to expand it.
lib/infobox/main.js
+
7
−
1
View file @
115d9aba
define
([
"
infobox/link
"
,
"
infobox/node
"
],
function
(
Link
,
Node
)
{
define
([
"
infobox/link
"
,
"
infobox/node
"
,
"
infobox/location
"
],
function
(
Link
,
Node
,
Location
)
{
return
function
(
config
,
sidebar
,
router
)
{
return
function
(
config
,
sidebar
,
router
)
{
var
self
=
this
var
self
=
this
var
el
var
el
...
@@ -41,6 +41,12 @@ define(["infobox/link", "infobox/node"], function (Link, Node) {
...
@@ -41,6 +41,12 @@ define(["infobox/link", "infobox/node"], function (Link, Node) {
new
Link
(
config
,
el
,
router
,
d
)
new
Link
(
config
,
el
,
router
,
d
)
}
}
self
.
gotoLocation
=
function
(
d
)
{
console
.
log
(
"
goto location called with
"
,
d
)
create
()
new
Location
(
config
,
el
,
router
,
d
)
}
return
self
return
self
}
}
})
})
This diff is collapsed.
Click to expand it.
lib/map.js
+
14
−
2
View file @
115d9aba
...
@@ -20,7 +20,9 @@ define(["map/clientlayer", "map/labelslayer",
...
@@ -20,7 +20,9 @@ define(["map/clientlayer", "map/labelslayer",
var
button
=
L
.
DomUtil
.
create
(
"
button
"
,
"
add-layer
"
)
var
button
=
L
.
DomUtil
.
create
(
"
button
"
,
"
add-layer
"
)
button
.
textContent
=
"
"
button
.
textContent
=
"
"
L
.
DomEvent
.
disableClickPropagation
(
button
)
// L.DomEvent.disableClickPropagation(button)
// Click propagation isn't disabled as this causes problems with the
// location picking mode; instead propagation is stopped in onClick().
L
.
DomEvent
.
addListener
(
button
,
"
click
"
,
this
.
f
,
this
)
L
.
DomEvent
.
addListener
(
button
,
"
click
"
,
this
.
f
,
this
)
this
.
button
=
button
this
.
button
=
button
...
@@ -233,7 +235,7 @@ define(["map/clientlayer", "map/labelslayer",
...
@@ -233,7 +235,7 @@ define(["map/clientlayer", "map/labelslayer",
}
}
function
showCoordinates
(
e
)
{
function
showCoordinates
(
e
)
{
window
.
prompt
(
"
Koordinaten (Lat, Lng)
"
,
e
.
latlng
.
lat
.
toFixed
(
6
)
+
"
,
"
+
e
.
latlng
.
lng
.
toFixed
(
6
))
window
.
prompt
(
"
Koordinaten (Lat, Lng)
"
,
e
.
latlng
.
lat
.
toFixed
(
9
)
+
"
,
"
+
e
.
latlng
.
lng
.
toFixed
(
9
))
disableCoords
()
disableCoords
()
}
}
...
@@ -271,6 +273,11 @@ define(["map/clientlayer", "map/labelslayer",
...
@@ -271,6 +273,11 @@ define(["map/clientlayer", "map/labelslayer",
}
}
}
}
function
contextMenuGotoLocation
(
e
)
{
console
.
log
(
"
context menu called at
"
,
e
)
router
.
gotoLocation
(
e
.
latlng
)
}
var
el
=
document
.
createElement
(
"
div
"
)
var
el
=
document
.
createElement
(
"
div
"
)
el
.
classList
.
add
(
"
map
"
)
el
.
classList
.
add
(
"
map
"
)
...
@@ -292,6 +299,7 @@ define(["map/clientlayer", "map/labelslayer",
...
@@ -292,6 +299,7 @@ define(["map/clientlayer", "map/labelslayer",
map
.
on
(
"
locationfound
"
,
locationFound
)
map
.
on
(
"
locationfound
"
,
locationFound
)
map
.
on
(
"
locationerror
"
,
locationError
)
map
.
on
(
"
locationerror
"
,
locationError
)
map
.
on
(
"
dragend
"
,
saveView
)
map
.
on
(
"
dragend
"
,
saveView
)
map
.
on
(
"
contextmenu
"
,
contextMenuGotoLocation
)
addButton
(
locateUserButton
)
addButton
(
locateUserButton
)
addButton
(
showCoordsPickerButton
)
addButton
(
showCoordsPickerButton
)
...
@@ -498,6 +506,10 @@ define(["map/clientlayer", "map/labelslayer",
...
@@ -498,6 +506,10 @@ define(["map/clientlayer", "map/labelslayer",
updateView
()
updateView
()
}
}
self
.
gotoLocation
=
function
()
{
//ignore
}
self
.
destroy
=
function
()
{
self
.
destroy
=
function
()
{
clearButtons
()
clearButtons
()
map
.
remove
()
map
.
remove
()
...
...
This diff is collapsed.
Click to expand it.
lib/router.js
+
14
−
0
View file @
115d9aba
...
@@ -62,6 +62,18 @@ define(function () {
...
@@ -62,6 +62,18 @@ define(function () {
return
true
return
true
}
}
function
gotoLocation
(
d
)
{
if
(
!
d
)
return
false
targets
.
forEach
(
function
(
t
)
{
if
(
!
t
.
gotoLocation
)
console
.
warn
(
"
has no gotoLocation
"
,
t
)
t
.
gotoLocation
(
d
)
})
return
true
}
function
loadState
(
s
)
{
function
loadState
(
s
)
{
if
(
!
s
)
if
(
!
s
)
return
false
return
false
...
@@ -162,6 +174,8 @@ define(function () {
...
@@ -162,6 +174,8 @@ define(function () {
}
}
}
}
self
.
gotoLocation
=
gotoLocation
self
.
reset
=
function
()
{
self
.
reset
=
function
()
{
resetView
()
resetView
()
}
}
...
...
This diff is collapsed.
Click to expand it.
lib/title.js
+
4
−
0
View file @
115d9aba
...
@@ -23,6 +23,10 @@ define(function () {
...
@@ -23,6 +23,10 @@ define(function () {
setTitle
(
d
.
source
.
node
.
nodeinfo
.
hostname
+
"
–
"
+
d
.
target
.
node
.
nodeinfo
.
hostname
)
setTitle
(
d
.
source
.
node
.
nodeinfo
.
hostname
+
"
–
"
+
d
.
target
.
node
.
nodeinfo
.
hostname
)
}
}
this
.
gotoLocation
=
function
()
{
//ignore
}
this
.
destroy
=
function
()
{
this
.
destroy
=
function
()
{
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment