Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Eric Duminil
RegionChooser
Commits
f83c2a68
Commit
f83c2a68
authored
Mar 19, 2018
by
Eric Duminil
Browse files
RegionChooser: GMLs now grouped by projects
parent
6013b2a9
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/eu/simstadt/regionchooser/website/script/simstadt_openlayers.js
View file @
f83c2a68
...
@@ -210,17 +210,15 @@ proj4.defs("EPSG:28992", "+proj=sterea +lat_0=52.15616055555555 +lon_0=5.3876388
...
@@ -210,17 +210,15 @@ proj4.defs("EPSG:28992", "+proj=sterea +lat_0=52.15616055555555 +lon_0=5.3876388
dataPanel
.
append
(
link
+
"
)
\n
"
);
dataPanel
.
append
(
link
+
"
)
\n
"
);
}
}
function
findIntersection
(
feature
,
polygon
,
polygonArea
)
{
function
findIntersection
(
feature
,
polygon
)
{
try
{
try
{
var
jsonIntersection
=
turf
.
intersect
(
polygon
,
feature
[
"
geoJSON
"
]);
return
turf
.
intersect
(
polygon
,
feature
[
"
geoJSON
"
]);
if
(
undefined
!==
jsonIntersection
)
{
showLinkToDownload
(
feature
,
jsonIntersection
,
polygonArea
);
}
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
log
(
feature
.
get
(
'
name
'
)
+
"
-
"
+
err
);
console
.
log
(
feature
.
get
(
'
name
'
)
+
"
-
"
+
err
);
}
}
}
}
//TODO: Use Javascript names (intersection_found => intersectionFound)
function
findIntersections
()
{
function
findIntersections
()
{
var
polygon
=
geoJsonFormat
.
writeFeatureObject
(
sketch
);
var
polygon
=
geoJsonFormat
.
writeFeatureObject
(
sketch
);
var
polygonArea
=
sketch
.
getGeometry
().
getArea
();
var
polygonArea
=
sketch
.
getGeometry
().
getArea
();
...
@@ -232,11 +230,12 @@ proj4.defs("EPSG:28992", "+proj=sterea +lat_0=52.15616055555555 +lon_0=5.3876388
...
@@ -232,11 +230,12 @@ proj4.defs("EPSG:28992", "+proj=sterea +lat_0=52.15616055555555 +lon_0=5.3876388
Object
.
keys
(
features_by_project
).
forEach
(
function
(
project
)
{
Object
.
keys
(
features_by_project
).
forEach
(
function
(
project
)
{
features
=
features_by_project
[
project
];
features
=
features_by_project
[
project
];
dataPanel
.
append
(
"
<h2>
"
+
project
);
features_and_intersections
=
features
.
map
(
f
=>
[
f
,
findIntersection
(
f
,
polygon
)]).
filter
(
l
=>
l
[
1
]
!==
undefined
);
// features_and_intersections = features.map(f=> [findIntersection(f,polygon)])
if
(
features_and_intersections
.
length
>
0
){
for
(
var
i
=
0
;
i
<
features
.
length
;
i
++
)
{
intersection_found
=
true
;
findIntersection
(
features
[
i
],
polygon
,
polygonArea
);
dataPanel
.
append
(
"
<h2 class='
"
+
project
+
"
'>
"
+
project
);
}
features_and_intersections
.
forEach
(
l
=>
showLinkToDownload
(
l
[
0
],
l
[
1
],
polygonArea
));
}
});
});
if
(
!
intersection_found
)
{
if
(
!
intersection_found
)
{
...
@@ -276,7 +275,6 @@ proj4.defs("EPSG:28992", "+proj=sterea +lat_0=52.15616055555555 +lon_0=5.3876388
...
@@ -276,7 +275,6 @@ proj4.defs("EPSG:28992", "+proj=sterea +lat_0=52.15616055555555 +lon_0=5.3876388
}
}
function
displayInfo
()
{
function
displayInfo
()
{
// var start = new Date().getTime();
dataPanel
.
empty
();
dataPanel
.
empty
();
var
geom
=
/** @type {ol.geom.Polygon} */
var
geom
=
/** @type {ol.geom.Polygon} */
(
sketch
.
getGeometry
().
clone
().
transform
(
sourceProj
,
'
EPSG:4326
'
));
(
sketch
.
getGeometry
().
clone
().
transform
(
sourceProj
,
'
EPSG:4326
'
));
...
@@ -288,8 +286,6 @@ proj4.defs("EPSG:28992", "+proj=sterea +lat_0=52.15616055555555 +lon_0=5.3876388
...
@@ -288,8 +286,6 @@ proj4.defs("EPSG:28992", "+proj=sterea +lat_0=52.15616055555555 +lon_0=5.3876388
var
n
=
coords
.
length
;
var
n
=
coords
.
length
;
for
(
var
i
=
0
;
i
<
n
;
i
++
)
{
for
(
var
i
=
0
;
i
<
n
;
i
++
)
{
var
wgs84_coord
=
coords
[
i
];
var
wgs84_coord
=
coords
[
i
];
// wgs84_coords += "regionPolygon.add(new Coord(" + wgs84_coord[1] +
// "," + wgs84_coord[0] + "));<br/>";
wgs84_coords
+=
"
(
"
+
wgs84_coord
[
1
]
+
"
,
"
+
wgs84_coord
[
0
]
+
"
)<br/>
"
;
wgs84_coords
+=
"
(
"
+
wgs84_coord
[
1
]
+
"
,
"
+
wgs84_coord
[
0
]
+
"
)<br/>
"
;
}
}
...
@@ -299,9 +295,6 @@ proj4.defs("EPSG:28992", "+proj=sterea +lat_0=52.15616055555555 +lon_0=5.3876388
...
@@ -299,9 +295,6 @@ proj4.defs("EPSG:28992", "+proj=sterea +lat_0=52.15616055555555 +lon_0=5.3876388
dataPanel
.
append
(
"
Area
"
+
"
<br/>
\n
"
);
dataPanel
.
append
(
"
Area
"
+
"
<br/>
\n
"
);
dataPanel
.
append
((
Math
.
round
(
area
/
1000
)
/
10
).
toString
()
+
"
ha<br/><br/>
\n
"
);
dataPanel
.
append
((
Math
.
round
(
area
/
1000
)
/
10
).
toString
()
+
"
ha<br/><br/>
\n
"
);
findIntersections
();
findIntersections
();
// var end = new Date().getTime();
// var time = end - start;
// console.log('Execution time: ' + time);
}
}
draw
.
on
(
'
drawend
'
,
function
()
{
draw
.
on
(
'
drawend
'
,
function
()
{
...
...
src/eu/simstadt/regionchooser/website/style/style.css
View file @
f83c2a68
...
@@ -121,6 +121,11 @@ div#dataPanel h2 {
...
@@ -121,6 +121,11 @@ div#dataPanel h2 {
font-size
:
16px
;
font-size
:
16px
;
}
}
div
#dataPanel
h2
.NovaFactory
{
color
:
var
(
--color1
);
/** color: #ff7700; Orange as on the map **/
}
div
#dataPanel
li
{
div
#dataPanel
li
{
list-style-type
:
none
;
list-style-type
:
none
;
padding
:
2px
0
0
0
;
padding
:
2px
0
0
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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