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
8f7fcb88
Commit
8f7fcb88
authored
Mar 20, 2018
by
Eric Duminil
Browse files
RegionChooser: Message when extract Citygml fails. New test.
parent
b842320c
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/eu/simstadt/regionchooser/website/script/simstadt_openlayers.js
View file @
8f7fcb88
...
...
@@ -231,7 +231,7 @@ proj4.defs("EPSG:28992", "+proj=sterea +lat_0=52.15616055555555 +lon_0=5.3876388
features_and_intersections
=
features
.
map
(
f
=>
[
f
,
findIntersection
(
f
,
polygon
)]).
filter
(
l
=>
l
[
1
]
!==
undefined
);
if
(
features_and_intersections
.
length
>
0
){
intersection_found
=
true
;
dataPanel
.
append
(
"
<h2>
"
+
project
);
dataPanel
.
append
(
"
<h2
class='info'
>
"
+
project
);
features_and_intersections
.
forEach
(
l
=>
showLinkToDownload
(
l
[
0
],
l
[
1
],
polygonArea
));
}
});
...
...
@@ -256,13 +256,17 @@ proj4.defs("EPSG:28992", "+proj=sterea +lat_0=52.15616055555555 +lon_0=5.3876388
if
(
proj4
.
defs
(
srsName
)){
$
(
"
html
"
).
addClass
(
"
wait
"
);
console
.
log
(
"
Selected region is written in
"
+
srsName
+
"
coordinate system.
"
);
fxapp
.
downloadRegionFromCityGML
(
sketchAsWKT
(
srsName
),
feature
.
get
(
"
project
"
),
feature
.
get
(
"
name
"
),
srsName
);
try
{
fxapp
.
downloadRegionFromCityGML
(
sketchAsWKT
(
srsName
),
feature
.
get
(
"
project
"
),
feature
.
get
(
"
name
"
),
srsName
);
dataPanel
.
append
(
"
<h2 class='ok'>Done!</h2><br/>
\n
"
);
}
catch
(
e
)
{
dataPanel
.
append
(
"
<h2 class='error'>Some problem occured!</h2><br/>
\n
"
);
}
var
end
=
new
Date
().
getTime
();
var
time
=
end
-
start
;
console
.
log
(
'
Download Execution time:
'
+
(
time
/
1000
).
toFixed
(
3
)
+
'
s
'
);
setTimeout
(
function
()
{
$
(
"
html
"
).
removeClass
(
"
wait
"
);
dataPanel
.
append
(
"
Done<br/>
\n
"
);
},
100
);
}
else
{
var
msg
=
"
ERROR : Unknown coordinate system :
\"
"
+
srsName
+
"
\"
. Cannot extract any region
"
;
...
...
@@ -290,7 +294,7 @@ proj4.defs("EPSG:28992", "+proj=sterea +lat_0=52.15616055555555 +lon_0=5.3876388
dataPanel
.
append
(
"
WGS84 Coordinates<br/>
"
);
dataPanel
.
append
(
wgs84_coords
+
"
<br/>
\n
"
);
}
dataPanel
.
append
(
"
<h3>Area :
"
+
(
area
/
10000
).
toFixed
(
1
)
+
"
ha
<br/><br/>
\n
"
);
dataPanel
.
append
(
"
<h3
class='clean'
>Area :
"
+
(
area
/
10000
).
toFixed
(
1
)
+
"
ha
\n
"
);
findIntersections
();
}
...
...
@@ -382,7 +386,7 @@ proj4.defs("EPSG:28992", "+proj=sterea +lat_0=52.15616055555555 +lon_0=5.3876388
function
displayHelp
(){
dataPanel
.
empty
();
dataPanel
.
append
(
"
Welcome to Region Chooser!<br><br>
\n
"
);
dataPanel
.
append
(
"
<h2 class='info'>
Welcome to Region Chooser!<br><br>
\n
"
);
dataPanel
.
append
(
"
You can draw a polygon on the map by clicking.<br>
\n
"
);
dataPanel
.
append
(
"
You can add a new point to an existing edge by clicking and dragging.<br>
\n
"
);
dataPanel
.
append
(
"
You can remove a point with SHIFT + clicking.<br>
\n
"
);
...
...
test/eu/simstadt/regionchooser/RegionExtractorTests.java
View file @
8f7fcb88
...
...
@@ -124,5 +124,16 @@ public void testExtract0BuildingsFromWeirdGML() throws Throwable {
assertTrue
(
emptyGMLString
.
contains
(
"<core:CityModel"
));
// Header
assertTrue
(
emptyGMLString
.
contains
(
"</core:CityModel"
));
// Footer
}
//TODO: Add BuildingParts tests with StuttgartAroundCampus.
@Test
public
void
testExtractBuildingsFromCitygmlWithBuildingParts
()
throws
Throwable
{
//NOTE: Small region, with too many spaces between coordinates
String
wktPolygon
=
"POLYGON((3512683.1280912133 5404783.732132129,3512719.1608604863 5404714.627650777,3512831.40076119 5404768.344155442,3512790.239106708 5404838.614891164,3512683.1280912133 5404783.732132129))"
;
Path
repo
=
Paths
.
get
(
"../TestRepository"
);
Path
citygmlPath
=
repo
.
resolve
(
"Stuttgart.proj/Stuttgart_LOD0_LOD1_around_campus.gml"
);
String
emptyGMLString
=
RegionExtractor
.
selectRegionDirectlyFromCityGML
(
citygmlPath
,
wktPolygon
,
"EPSG:31463"
)
.
toString
();
assertEquals
(
countRegexMatches
(
emptyGMLString
,
"<(core:)?cityObjectMember"
),
2
);
}
}
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