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
1e0db345
Commit
1e0db345
authored
Feb 13, 2023
by
Eric Duminil
Browse files
Kinda working import
parent
3ad6d82d
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/resources/eu/simstadt/regionchooser/website/script/simstadt_openlayers.js
View file @
1e0db345
...
...
@@ -67,7 +67,7 @@ const regionChooser = (function(){
const
kmlFormat
=
new
ol
.
format
.
KML
({
extractStyles
:
false
});
kml_source
.
addEventListener
(
"
addfeature
"
,
function
()
{
map
.
getView
().
fitExtent
(
kml_source
.
getExtent
(),
(
map
.
getSize
())
)
;
map
.
getView
().
fitExtent
(
kml_source
.
getExtent
(),
map
.
getSize
());
});
function
updateGMLPolygons
()
{
...
...
@@ -383,10 +383,30 @@ const regionChooser = (function(){
}
importWKT
=
function
(
e
){
console
.
log
(
"
Let's import WKT
!!!
"
);
console
.
log
(
"
Let's import WKT
Polygon :
"
+
wktPolygon
);
var
wktPolygon
=
document
.
getElementById
(
"
wktPolygon
"
).
value
;
console
.
log
(
wktPolygon
);
var
wktFormat
=
new
ol
.
format
.
WKT
();
var
feature
=
wktFormat
.
readFeature
(
wktPolygon
,
{
dataProjection
:
ol
.
proj
.
get
(
'
EPSG:4326
'
),
featureProjection
:
ol
.
proj
.
get
(
'
EPSG:3857
'
)
});
//TODO: Check if import was succesful
sketch
=
feature
;
updateGMLPolygons
();
drawnLayer
.
getFeatures
().
clear
();
intersections
.
clear
();
drawnLayer
.
addFeature
(
feature
);
map
.
getView
().
fitExtent
(
feature
.
getGeometry
().
getExtent
(),
map
.
getSize
());
displayInfo
();
draw
.
setActive
(
false
);
e
.
preventDefault
();
// to avoid refresh
}
// Executed by JavaFX when whole page is loaded.
...
...
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