Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Eric Duminil
RegionChooser
Commits
6ca6f01d
Commit
6ca6f01d
authored
2 years ago
by
Eric Duminil
Browse files
Options
Download
Email Patches
Plain Diff
Highlight polygon when hovering over name
parent
7e96e8ba
master
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/resources/eu/simstadt/regionchooser/website/script/simstadt_openlayers.js
+15
-3
...stadt/regionchooser/website/script/simstadt_openlayers.js
with
15 additions
and
3 deletions
+15
-3
src/main/resources/eu/simstadt/regionchooser/website/script/simstadt_openlayers.js
+
15
-
3
View file @
6ca6f01d
...
...
@@ -168,10 +168,11 @@ var regionChooser = (function(){
var
intersectionArea
=
intersection
.
getGeometry
().
getArea
();
var
citygml_percentage
=
Math
.
round
(
intersectionArea
/
feature
[
"
area
"
]
*
100
);
var
sketch_percentage
=
Math
.
round
(
intersectionArea
/
polygonArea
*
100
);
var
id
=
feature
.
getId
();
intersections
.
addFeature
(
intersection
);
var
link
=
'
<li>
'
// TODO: If possible, highlight the corresponding polygon when hovering above a name.
link
+=
'
<input type="checkbox" id="citygml_
'
+
feature
.
getId
()
+
'
" class="select_citygml" onclick="regionChooser.isDownloadPossible();">
<label for="citygml_
'
+
feature
.
getId
()
+
'
">
'
+
feature
[
'
name
'
]
+
'
</label>
'
;
var
link
=
'
<li
onmouseover="regionChooser.highlightPolygon(
'
+
id
+
'
)" onmouseout="regionChooser.resetHighlight(
'
+
id
+
'
)"
>
'
;
link
+=
'
<input type="checkbox" id="citygml_
'
+
feature
.
getId
()
+
'
" class="select_citygml" onclick="regionChooser.isDownloadPossible();">
'
+
'
<label for="citygml_
'
+
feature
.
getId
()
+
'
">
'
+
feature
[
'
name
'
]
+
'
</label>
'
;
link
+=
"
(
"
+
citygml_percentage
+
"
%
"
;
if
(
sketch_percentage
==
100
)
{
...
...
@@ -180,6 +181,17 @@ var regionChooser = (function(){
dataPanel
.
append
(
link
+
"
)
\n
"
);
}
publicScope
.
highlightPolygon
=
function
(
i
)
{
var
feature
=
kml_source
.
getFeatureById
(
i
);
feature
.
oldStyle
=
feature
.
getStyle
();
feature
.
setStyle
(
polygon_style
(
"
#ff44a2
"
,
0.7
));
}
publicScope
.
resetHighlight
=
function
(
i
)
{
var
feature
=
kml_source
.
getFeatureById
(
i
);
feature
.
setStyle
(
feature
.
oldStyle
);
}
publicScope
.
isDownloadPossible
=
function
(){
var
checkedBoxes
=
Array
.
from
(
document
.
querySelectorAll
(
"
input.select_citygml
"
)).
filter
(
c
=>
c
.
checked
);
document
.
getElementById
(
"
download_region_button
"
).
disabled
=
(
checkedBoxes
.
length
==
0
);
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets