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
d818e19f
Commit
d818e19f
authored
2 years ago
by
Eric Duminil
Browse files
Options
Download
Email Patches
Plain Diff
Work in progress. Highlight
parent
6ca6f01d
master
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/resources/eu/simstadt/regionchooser/website/script/simstadt_openlayers.js
+21
-4
...stadt/regionchooser/website/script/simstadt_openlayers.js
with
21 additions
and
4 deletions
+21
-4
src/main/resources/eu/simstadt/regionchooser/website/script/simstadt_openlayers.js
+
21
-
4
View file @
d818e19f
...
...
@@ -96,6 +96,7 @@ var regionChooser = (function(){
feature
[
"
project
"
]
=
feature
.
get
(
"
project
"
);
feature
[
"
name
"
]
=
feature
.
get
(
"
name
"
);
feature
[
"
source
"
]
=
"
CityGML
"
;
feature
[
"
originalStyle
"
]
=
feature
.
getStyle
();
});
var
features
=
Array
.
from
(
kml_source
.
getFeatures
());
...
...
@@ -183,17 +184,23 @@ var regionChooser = (function(){
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
.
ol
d
Style
);
feature
.
setStyle
(
feature
.
o
rigina
lStyle
);
}
publicScope
.
isDownloadPossible
=
function
(){
kml_source
.
getFeatures
().
forEach
(
f
=>
f
.
setStyle
(
f
.
originalStyle
));
//TODO: Dry
var
checkedBoxes
=
Array
.
from
(
document
.
querySelectorAll
(
"
input.select_citygml
"
)).
filter
(
c
=>
c
.
checked
);
var
checkbox_ids
=
checkedBoxes
.
map
(
c
=>
c
.
id
);
var
features
=
getCheckedPolygons
(
checkbox_ids
);
features
.
forEach
(
f
=>
f
.
setStyle
(
polygon_style
(
"
#ffff00
"
,
0.8
)));
document
.
getElementById
(
"
download_region_button
"
).
disabled
=
(
checkedBoxes
.
length
==
0
);
}
...
...
@@ -234,11 +241,15 @@ var regionChooser = (function(){
dataPanel
.
append
(
text
+
"
<br/>
\n
"
);
}
publicScope
.
downloadRegionFromCityGML
s
=
function
(
checkbox_ids
)
{
var
features
=
checkbox_ids
.
map
(
checkbox_id
=>
{
getCheckedPolygon
s
=
function
(
checkbox_ids
){
return
checkbox_ids
.
map
(
checkbox_id
=>
{
var
i
=
Number
(
checkbox_id
.
replace
(
"
citygml_
"
,
""
));
return
kml_source
.
getFeatureById
(
i
);
})
}
publicScope
.
downloadRegionFromCityGMLs
=
function
(
checkbox_ids
)
{
var
features
=
getCheckedPolygons
(
checkbox_ids
);
var
project
=
features
[
0
].
get
(
"
project
"
);
var
srsName
=
features
[
0
].
get
(
"
srsName
"
);
...
...
@@ -393,6 +404,12 @@ var regionChooser = (function(){
document
.
getElementById
(
"
download_region_button
"
).
disabled
=
true
;
var
checkedBoxes
=
Array
.
from
(
document
.
querySelectorAll
(
"
input.select_citygml
"
)).
filter
(
c
=>
c
.
checked
);
// CheckBoxes isn't empty, because otherwise the button cannot be clicked.
var
checkbox_ids
=
checkedBoxes
.
map
(
c
=>
c
.
id
);
var
features
=
getCheckedPolygons
(
checkbox_ids
);
features
.
forEach
(
f
=>
f
.
setStyle
(
polygon_style
(
"
#ffff00
"
,
0.8
)));
publicScope
.
downloadRegionFromCityGMLs
(
checkedBoxes
.
map
(
c
=>
c
.
id
));
}
...
...
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