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
22cecee7
Commit
22cecee7
authored
2 years ago
by
Eric Duminil
Browse files
Options
Download
Email Patches
Plain Diff
no more id
parent
35144651
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
+10
-22
...stadt/regionchooser/website/script/simstadt_openlayers.js
with
10 additions
and
22 deletions
+10
-22
src/main/resources/eu/simstadt/regionchooser/website/script/simstadt_openlayers.js
+
10
-
22
View file @
22cecee7
...
...
@@ -11,11 +11,9 @@ const regionChooser = (function(){
const
dataPanel
=
$
(
'
#dataPanel
'
);
const
wgs84Sphere
=
new
ol
.
Sphere
(
6378137
);
var
features_by_project
;
var
gmlId
;
publicScope
.
init
=
function
(){
//NOTE: Only called from JavaFX. At startup, or when Repo has been changed.
gmlId
=
0
;
kml_source
.
clear
();
document
.
getElementById
(
"
select_repository
"
).
style
.
visibility
=
"
visible
"
;
}
...
...
@@ -49,7 +47,6 @@ const regionChooser = (function(){
publicScope
.
addCityGmlHull
=
function
(
kmlString
)
{
options
=
{
featureProjection
:
ol
.
proj
.
get
(
'
EPSG:3857
'
)};
feature
=
kmlFormat
.
readFeature
(
kmlString
,
options
);
feature
.
setId
(
gmlId
++
);
kml_source
.
addFeature
(
feature
);
dataPanel
.
append
(
'
.
'
);
srsName
=
feature
.
get
(
"
srsName
"
);
...
...
@@ -200,13 +197,17 @@ const regionChooser = (function(){
publicScope
.
isDownloadPossible
=
function
(){
kml_source
.
getFeatures
().
forEach
(
f
=>
refreshStyle
(
f
,
"
original
"
));
//TODO: Dry
var
selectedFeatures
=
Array
.
from
(
document
.
querySelectorAll
(
"
input.select_citygml
"
)).
filter
(
c
=>
c
.
checked
).
map
(
c
=>
c
.
feature
);
selectedFeatures
=
getSelectedGMLs
();
selectedFeatures
.
forEach
(
f
=>
refreshStyle
(
f
,
"
selected
"
));
document
.
getElementById
(
"
download_region_button
"
).
disabled
=
(
selectedFeatures
.
length
==
0
);
}
function
getSelectedGMLs
(){
return
Array
.
from
(
document
.
querySelectorAll
(
"
input.select_citygml
"
)).
filter
(
c
=>
c
.
checked
).
map
(
c
=>
c
.
feature
);
}
function
findIntersection
(
feature
,
polygon
)
{
try
{
return
turf
.
intersect
(
polygon
,
feature
[
"
geoJSON
"
]);
...
...
@@ -244,17 +245,8 @@ const regionChooser = (function(){
dataPanel
.
append
(
text
+
"
<br/>
\n
"
);
}
getCheckedPolygons
=
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
)
{
publicScope
.
downloadRegionFromCityGMLs
=
function
(
features
)
{
//FIXME: Somehow, no feedback comes after large files are downloaded. :(
var
features
=
getCheckedPolygons
(
checkbox_ids
);
var
project
=
features
[
0
].
get
(
"
project
"
);
var
srsName
=
features
[
0
].
get
(
"
srsName
"
);
...
...
@@ -399,15 +391,11 @@ const regionChooser = (function(){
publicScope
.
downloadFromSelectedCityGMLs
=
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
);
let
selectedGMLs
=
getSelectedGMLs
();
feature
s
.
forEach
(
f
=>
f
.
setStyle
(
utils
.
polygon_style
(
"
#ffff00
"
,
0.8
)));
selectedGML
s
.
forEach
(
f
=>
f
.
setStyle
(
utils
.
polygon_style
(
"
#ffff00
"
,
0.8
)));
publicScope
.
downloadRegionFromCityGMLs
(
ch
ec
k
ed
Boxes
.
map
(
c
=>
c
.
id
)
);
publicScope
.
downloadRegionFromCityGMLs
(
sel
ec
t
ed
GMLs
);
}
publicScope
.
selectAllOrNone
=
function
(
allOrNone
)
{
...
...
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