Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Eric Duminil
RegionChooser
Commits
75ee91fc
Commit
75ee91fc
authored
Oct 14, 2022
by
Eric Duminil
Browse files
Refresh style.
parent
ec11b3d8
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/resources/eu/simstadt/regionchooser/website/script/simstadt_openlayers.js
View file @
75ee91fc
var
regionChooser
=
(
function
(){
const
styles
=
{};
styles
.
original
=
utils
.
polygon_style
(
'
#447744
'
,
0.2
);
styles
.
highlighted
=
utils
.
polygon_style
(
"
#ff44a2
"
,
0.7
);
styles
.
selected
=
utils
.
polygon_style
(
"
#ffff00
"
,
0.8
);
const
regionChooser
=
(
function
(){
//TODO: Somehow split in classes. This file is getting too big and mixed
var
publicScope
=
{};
const
fromJavaFX
=
navigator
.
userAgent
.
indexOf
(
'
JavaFX
'
)
!==
-
1
;
...
...
@@ -26,7 +32,7 @@ var regionChooser = (function(){
var
kml_layer
=
new
ol
.
layer
.
Vector
({
source
:
kml_source
,
style
:
utils
.
polygon_style
(
'
#447744
'
,
0.2
)
style
:
styles
.
original
});
var
intersections
=
new
ol
.
source
.
Vector
();
...
...
@@ -74,7 +80,7 @@ var regionChooser = (function(){
feature
[
"
project
"
]
=
feature
.
get
(
"
project
"
);
feature
[
"
name
"
]
=
feature
.
get
(
"
name
"
);
feature
[
"
source
"
]
=
"
CityGML
"
;
feature
[
"
originalStyle
"
]
=
feature
.
getStyle
()
;
feature
[
"
status
"
]
=
"
original
"
;
});
var
features
=
Array
.
from
(
kml_source
.
getFeatures
());
...
...
@@ -160,22 +166,26 @@ var regionChooser = (function(){
publicScope
.
highlightPolygon
=
function
(
i
)
{
var
feature
=
kml_source
.
getFeatureById
(
i
);
feature
.
setStyle
(
utils
.
polygon_style
(
"
#ff44a2
"
,
0.7
)
);
feature
.
setStyle
(
styles
.
highlighted
);
}
publicScope
.
resetHighlight
=
function
(
i
)
{
var
feature
=
kml_source
.
getFeatureById
(
i
);
feature
.
setStyle
(
feature
.
originalStyle
);
refreshStyle
(
feature
);
}
refreshStyle
=
function
(
feature
){
feature
.
setStyle
(
styles
[
feature
.
status
]);
}
publicScope
.
isDownloadPossible
=
function
(){
kml_source
.
getFeatures
().
forEach
(
f
=>
f
.
s
etStyle
(
f
.
original
Style
)
);
kml_source
.
getFeatures
().
forEach
(
f
=>
{
f
.
s
tatus
=
"
original
"
;
refresh
Style
(
f
)}
);
//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
.
s
etStyle
(
utils
.
polygon_style
(
"
#ffff00
"
,
0.8
))
);
features
.
forEach
(
f
=>
{
f
.
s
tatus
=
"
selected
"
;
refreshStyle
(
f
)}
);
document
.
getElementById
(
"
download_region_button
"
).
disabled
=
(
checkedBoxes
.
length
==
0
);
}
...
...
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