Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
isochrone
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Institut für Informatik
dbis
dbis-isochrone
isochrone
Commits
59298ede
Commit
59298ede
authored
11 years ago
by
Nikolaus Krismer
Browse files
Options
Downloads
Patches
Plain Diff
now distinguishing between suggestlist and result
reworked layout
parent
179c8c42
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/webapp/css_new/geosearch.css
+39
-22
39 additions, 22 deletions
src/main/webapp/css_new/geosearch.css
src/main/webapp/js_new/geosearch.js
+81
-34
81 additions, 34 deletions
src/main/webapp/js_new/geosearch.js
with
120 additions
and
56 deletions
src/main/webapp/css_new/geosearch.css
+
39
−
22
View file @
59298ede
.leaflet-control-geosearch
,
.leaflet-control-geosearch
ul
{
.leaflet-control-geosearch-msg
ul
{
background-color
:
transparent
;
list-style
:
none
;
display
:
none
;
height
:
auto
;
margin
:
0px
;
padding
:
0px
;
width
:
400px
;
}
.leaflet-control-geosearch-msg
ul
li
{
background-color
:
#FFFFFF
;
font
:
12px
arial
;
text-indent
:
4px
;
padding
:
4px
;
}
.leaflet-control-geosearch-msg
ul
.leaflet-control-geosearch-result
{
margin-top
:
5px
;
}
.leaflet-control-geosearch-msg
ul
.leaflet-control-geosearch-result
li
{
border
:
1px
solid
#000000
;
}
.leaflet-control-geosearch-msg
ul
.leaflet-control-geosearch-suggests
li
{
border
:
1px
solid
#bbbbbb
;
}
.leaflet-control-geosearch-msg
ul
li
:hover
{
background-color
:
#eeeeee
;
}
.leaflet-control-geosearch-searchdiv
{
background
:
none
repeat
scroll
0
0
#FFFFFF
;
border-radius
:
5px
0px
0px
5px
;
box-shadow
:
0px
0px
5px
rgba
(
0
,
0
,
0
,
0.65
);
margin
:
10px
0
0
0
;
padding
:
5px
;
width
:
390px
;
height
:
auto
;
}
.leaflet-control-geosearch-msg
ul
{
list-style
:
none
;
display
:
none
;
height
:
auto
;
background
:
none
;
.leaflet-control-geosearch-searchdiv
input
{
width
:
100%
;
height
:
28px
;
padding
:
0px
;
text-indent
:
8px
;
border
:
none
;
}
.leaflet-control-geosearch-btn
{
...
...
@@ -30,18 +62,3 @@
width
:
72px
;
}
.leaflet-control-geosearch
ul
li
{
border-radius
:
4px
;
margin
:
2px
0px
;
padding
:
4px
;
font
:
12px
arial
;
text-indent
:
4px
;
}
.leaflet-container
.leaflet-control-geosearch
input
{
width
:
100%
;
height
:
28px
;
padding
:
0px
;
text-indent
:
8px
;
border
:
none
;
}
This diff is collapsed.
Click to expand it.
src/main/webapp/js_new/geosearch.js
+
81
−
34
View file @
59298ede
...
...
@@ -66,7 +66,12 @@ L.Control.GeoSearch = L.Control.extend({
this
.
_map
=
map
;
this
.
_container
=
L
.
DomUtil
.
create
(
'
div
'
,
'
leaflet-control-geosearch
'
);
this
.
_resultSet
=
[];
this
.
_suggestSet
=
[];
var
searchdiv
=
document
.
createElement
(
'
div
'
);
searchdiv
.
id
=
'
leaflet-control-geosearch-searchdiv
'
;
searchdiv
.
className
=
'
leaflet-control-geosearch-searchdiv
'
;
this
.
_searchdiv
=
searchdiv
;
var
searchbox
=
document
.
createElement
(
'
input
'
);
searchbox
.
id
=
'
leaflet-control-geosearch-qry
'
;
...
...
@@ -84,13 +89,21 @@ L.Control.GeoSearch = L.Control.extend({
msgbox
.
className
=
'
leaflet-control-geosearch-msg
'
;
this
.
_msgbox
=
msgbox
;
var
resultslist
=
document
.
createElement
(
'
ul
'
);
resultslist
.
id
=
'
leaflet-control-geosearch-results
'
;
this
.
_resultslist
=
resultslist
;
this
.
_msgbox
.
appendChild
(
this
.
_resultslist
);
this
.
_container
.
appendChild
(
this
.
_searchbtn
);
this
.
_container
.
appendChild
(
this
.
_searchbox
);
var
result
=
document
.
createElement
(
'
ul
'
);
result
.
id
=
'
leaflet-control-geosearch-result
'
;
result
.
className
=
'
leaflet-control-geosearch-result
'
;
this
.
_result
=
result
;
var
suggestlist
=
document
.
createElement
(
'
ul
'
);
suggestlist
.
id
=
'
leaflet-control-geosearch-suggests
'
;
suggestlist
.
className
=
'
leaflet-control-geosearch-suggests
'
;
this
.
_suggestlist
=
suggestlist
;
this
.
_msgbox
.
appendChild
(
this
.
_suggestlist
);
this
.
_msgbox
.
appendChild
(
this
.
_result
);
this
.
_searchdiv
.
appendChild
(
this
.
_searchbtn
);
this
.
_searchdiv
.
appendChild
(
this
.
_searchbox
);
this
.
_container
.
appendChild
(
this
.
_searchdiv
);
this
.
_container
.
appendChild
(
this
.
_msgbox
);
L
.
DomEvent
...
...
@@ -188,21 +201,32 @@ L.Control.GeoSearch = L.Control.extend({
return
addressStr
;
},
_clearResultList
:
function
()
{
this
.
_resultSet
=
[];
_clearResult
:
function
()
{
if
(
this
.
_timeout
!=
null
)
{
clearTimeout
(
this
.
_timeout
);
this
.
_timeout
=
null
;
}
var
elem
=
this
.
_result
slist
;
var
elem
=
this
.
_result
;
elem
.
innerHTML
=
''
;
elem
.
style
.
display
=
'
none
'
;
},
_isInResultSet
:
function
(
o
)
{
_clearSuggestList
:
function
()
{
this
.
_suggestSet
=
[];
if
(
this
.
_timeout
!=
null
)
{
clearTimeout
(
this
.
_timeout
);
this
.
_timeout
=
null
;
}
var
elem
=
this
.
_suggestlist
;
elem
.
innerHTML
=
''
;
elem
.
style
.
display
=
'
none
'
;
},
_isInSuggestSet
:
function
(
o
)
{
var
i
=
0
,
set
=
this
.
_
resul
tSet
;
set
=
this
.
_
sugges
tSet
;
for
(
i
=
0
;
i
<
set
.
length
;
++
i
)
{
if
(
set
[
i
].
lat
==
o
.
lat
&&
set
[
i
].
lon
==
o
.
lon
)
{
...
...
@@ -242,21 +266,21 @@ L.Control.GeoSearch = L.Control.extend({
}
},
_on
Resul
tClick
:
function
(
e
)
{
var
resul
tId
=
e
.
target
.
id
,
resul
tIndex
=
-
1
,
resul
t
=
null
;
_on
Sugges
tClick
:
function
(
e
)
{
var
sugges
tId
=
e
.
target
.
id
,
sugges
tIndex
=
-
1
,
sugges
t
=
null
;
if
(
resul
tId
)
{
resul
tIndex
=
resul
tId
.
substring
(
resul
tId
.
lastIndexOf
(
'
-
'
)
+
1
);
if
(
sugges
tId
)
{
sugges
tIndex
=
sugges
tId
.
substring
(
sugges
tId
.
lastIndexOf
(
'
-
'
)
+
1
);
}
if
(
resul
tIndex
>=
0
)
{
resul
t
=
this
.
_
resultSet
[
resul
tIndex
];
if
(
sugges
tIndex
>=
0
)
{
sugges
t
=
this
.
_
suggestSet
[
sugges
tIndex
];
}
if
(
resul
t
)
{
this
.
_showLocation
(
resul
t
);
if
(
sugges
t
)
{
this
.
_showLocation
(
sugges
t
);
}
},
...
...
@@ -287,7 +311,7 @@ L.Control.GeoSearch = L.Control.extend({
this
.
_showLocation
(
results
[
0
]);
}
else
{
// multiple results found... add to results list and let user choose which one to show
this
.
_set
Resul
tList
(
results
);
this
.
_set
Sugges
tList
(
results
);
}
},
...
...
@@ -297,18 +321,38 @@ L.Control.GeoSearch = L.Control.extend({
}
this
.
_map
.
fireEvent
(
'
geosearch_clicklocation
'
,
{
Location
:
result
});
this
.
_setResult
List
([
result
]
);
this
.
_setResult
(
result
);
},
_setResultList
:
function
(
results
)
{
var
elem
=
this
.
_resultslist
,
_setResult
:
function
(
result
)
{
var
elem
=
this
.
_result
,
li
=
null
,
liText
=
null
;
if
(
result
.
lat
==
undefined
||
result
.
lon
==
undefined
)
{
return
;
}
this
.
_clearResult
();
li
=
document
.
createElement
(
'
li
'
);
li
.
id
=
'
geosearch-result
'
;
li
.
className
=
'
geosearch-result
'
;
liText
=
document
.
createTextNode
(
result
.
displayName
);
li
.
appendChild
(
liText
);
elem
.
appendChild
(
li
);
elem
.
style
.
display
=
'
block
'
;
},
_setSuggestList
:
function
(
results
)
{
var
elem
=
this
.
_suggestlist
,
i
=
0
,
j
=
0
,
li
=
null
,
liText
=
null
,
r
=
null
;
this
.
_clear
Resul
tList
();
this
.
_clear
Sugges
tList
();
for
(
i
=
0
,
j
=
0
;
i
<
results
.
length
;
++
i
)
{
r
=
results
[
i
];
...
...
@@ -316,18 +360,18 @@ L.Control.GeoSearch = L.Control.extend({
continue
;
}
if
(
this
.
_isIn
Resul
tSet
(
r
))
{
if
(
this
.
_isIn
Sugges
tSet
(
r
))
{
continue
;
}
this
.
_
resul
tSet
[
this
.
_
resul
tSet
.
length
]
=
r
;
this
.
_
sugges
tSet
[
this
.
_
sugges
tSet
.
length
]
=
r
;
li
=
document
.
createElement
(
'
li
'
);
li
.
id
=
'
geosearch-
resul
t-
'
+
j
;
li
.
className
=
'
geosearch-
resul
t
'
;
li
.
id
=
'
geosearch-
sugges
t-
'
+
j
;
li
.
className
=
'
geosearch-
sugges
t
'
;
liText
=
document
.
createTextNode
(
r
.
displayName
);
li
.
appendChild
(
liText
);
elem
.
appendChild
(
li
);
L
.
DomEvent
.
addListener
(
li
,
'
click
'
,
this
.
_on
Resul
tClick
,
this
);
L
.
DomEvent
.
addListener
(
li
,
'
click
'
,
this
.
_on
Sugges
tClick
,
this
);
++
j
;
}
...
...
@@ -336,6 +380,9 @@ L.Control.GeoSearch = L.Control.extend({
},
_showLocation
:
function
(
location
)
{
this
.
_setResult
(
location
);
this
.
_clearSuggestList
();
if
(
this
.
options
.
showMarker
==
true
)
{
if
(
typeof
this
.
_positionMarker
===
'
undefined
'
)
{
this
.
_positionMarker
=
L
.
marker
([
location
.
lat
,
location
.
lon
]).
addTo
(
this
.
_map
);
...
...
@@ -349,7 +396,7 @@ L.Control.GeoSearch = L.Control.extend({
},
_printError
:
function
(
message
)
{
var
elem
=
this
.
_result
slist
;
var
elem
=
this
.
_result
;
elem
.
innerHTML
=
'
<li>
'
+
message
+
'
</li>
'
;
elem
.
style
.
display
=
'
block
'
;
...
...
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