diff --git a/CityDoctorParent/Extensions/CityDoctorZipLoader/src/test/java/de/hft/stuttgart/citydoctor2/ziploader/ZipTest.java b/CityDoctorParent/Extensions/CityDoctorZipLoader/src/test/java/de/hft/stuttgart/citydoctor2/ziploader/ZipTest.java index ac73522c5f4f6634bbf7d72e2daf4ec4984ed33f..b933add1d376866873bc2562295c36a099be6537 100644 --- a/CityDoctorParent/Extensions/CityDoctorZipLoader/src/test/java/de/hft/stuttgart/citydoctor2/ziploader/ZipTest.java +++ b/CityDoctorParent/Extensions/CityDoctorZipLoader/src/test/java/de/hft/stuttgart/citydoctor2/ziploader/ZipTest.java @@ -75,4 +75,19 @@ public class ZipTest { assertTrue(epsgs.isEmpty()); } + @Test + public void testValidation(){ + ParserConfiguration valConfig = new ParserConfiguration(8,true); + CityGmlArchive cgmlArch = CityGmlArchive.fromZipFile("src/test/resources/validate.zip", valConfig); + int faultyFiles = 0; + for (CityGmlZipEntry entry : cgmlArch.getEntries()) { + if (entry instanceof ErroneousEntry errEntry) { + assertTrue(entry.getFileName().matches("^valFaulty.gml$")); + assertEquals(ZipEntryErrorType.INVALID_CITY_GML_FILE, errEntry.getErrorType()); + faultyFiles++; + } + } + assertEquals(1, faultyFiles); + } + } diff --git a/CityDoctorParent/Extensions/CityDoctorZipLoader/src/test/resources/validate.zip b/CityDoctorParent/Extensions/CityDoctorZipLoader/src/test/resources/validate.zip new file mode 100644 index 0000000000000000000000000000000000000000..f09e946a9c7420535ab6e08669309d262c726f20 Binary files /dev/null and b/CityDoctorParent/Extensions/CityDoctorZipLoader/src/test/resources/validate.zip differ diff --git a/CityDoctorParent/Extensions/CityDoctorZipLoader/src/test/resources/validate/valCorrect.gml b/CityDoctorParent/Extensions/CityDoctorZipLoader/src/test/resources/validate/valCorrect.gml new file mode 100644 index 0000000000000000000000000000000000000000..4671362ba4675f2895d8ec0e858dc36d76423bf4 --- /dev/null +++ b/CityDoctorParent/Extensions/CityDoctorZipLoader/src/test/resources/validate/valCorrect.gml @@ -0,0 +1,193 @@ +<?xml version="1.0" encoding="utf-8"?> +<core:CityModel xmlns:core="http://www.opengis.net/citygml/2.0" xmlns:gen="http://www.opengis.net/citygml/generics/2.0" xmlns:bldg="http://www.opengis.net/citygml/building/2.0" xmlns:app="http://www.opengis.net/citygml/appearance/2.0" xmlns:dem="http://www.opengis.net/citygml/relief/2.0" xmlns:gml="http://www.opengis.net/gml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/citygml/building/2.0 http://schemas.opengis.net/citygml/building/2.0/building.xsd http://www.opengis.net/citygml/appearance/2.0 http://schemas.opengis.net/citygml/appearance/2.0/appearance.xsd http://www.opengis.net/citygml/relief/2.0 http://schemas.opengis.net/citygml/relief/2.0/relief.xsd http://www.opengis.net/citygml/2.0 http://schemas.opengis.net/citygml/2.0/cityGMLBase.xsd http://www.opengis.net/citygml/generics/2.0 http://schemas.opengis.net/citygml/generics/2.0/generics.xsd"> + +<!-- +Einfaches Gebäude mit Grundriss 3m x 5m und Satteldach, Traufhöhe 3m, Firsthöhe 4,5m +Modelliert mit Begrenzungsflächen (eine Dachfläche, 4 Wandflächen, 1 Grundfläche), +die Gebäudegeometrie als Solid, der auf die Polygone der Begrenzungsflächen referenziert + +CityGML 2.0 + +Gebäudevolumen: 56,25 m3 + +10.5.2017 + +Author: V. Coors, HFT Stuttgart +Lizenz: +--> + + <core:cityObjectMember> + <bldg:Building gml:id="_Simple_BD.1"> + <bldg:lod2Solid> + <gml:Solid> + <gml:exterior> + <gml:CompositeSurface> + <gml:surfaceMember xlink:href="#_Simple_BD.1_PG.1"/> + <gml:surfaceMember xlink:href="#_Simple_BD.1_PG.2"/> + <gml:surfaceMember xlink:href="#_Simple_BD.1_PG.3"/> + <gml:surfaceMember xlink:href="#_Simple_BD.1_PG.4"/> + <gml:surfaceMember xlink:href="#_Simple_BD.1_PG.5"/> + <gml:surfaceMember xlink:href="#_Simple_BD.1_PG.6"/> + <gml:surfaceMember xlink:href="#_Simple_BD.1_PG.7"/> + </gml:CompositeSurface> + </gml:exterior> + </gml:Solid> + </bldg:lod2Solid> + <bldg:boundedBy> + <bldg:WallSurface gml:id="_Simple_BD.1_WallSurface_1"> + <bldg:lod2MultiSurface> + <gml:MultiSurface> + <gml:surfaceMember> + <gml:Polygon gml:id="_Simple_BD.1_PG.2"> + <gml:exterior> + <gml:LinearRing gml:id="_Simple_BD.1_PG.2_LR.1"> + <gml:posList srsDimension="3"> + 13.0 15.0 0.0 + 13.0 15.0 3.0 + 13.0 10.0 3.0 + 13.0 10.0 0.0 + 13.0 15.0 0.0 + </gml:posList> + </gml:LinearRing> + </gml:exterior> + </gml:Polygon> + </gml:surfaceMember> + </gml:MultiSurface> + </bldg:lod2MultiSurface> + </bldg:WallSurface> + </bldg:boundedBy> + <bldg:boundedBy> + <bldg:WallSurface gml:id="_Simple_BD.1_WallSurface_2"> + <bldg:lod2MultiSurface> + <gml:MultiSurface> + <gml:surfaceMember> + <gml:Polygon gml:id="_Simple_BD.1_PG.3"> + <gml:exterior> + <gml:LinearRing gml:id="_Simple_BD.1_PG.3_LR.1"> + <gml:posList srsDimension="3"> + 10.0 15.0 0.0 + 10.0 15.0 3.0 + 11.5 15.0 4.5 + 13.0 15.0 3.0 + 13.0 15.0 0.0 + 10.0 15.0 0.0 + </gml:posList> + </gml:LinearRing> + </gml:exterior> + </gml:Polygon> + </gml:surfaceMember> + </gml:MultiSurface> + </bldg:lod2MultiSurface> + </bldg:WallSurface> + </bldg:boundedBy> + <bldg:boundedBy> + <bldg:WallSurface gml:id="_Simple_BD.1_WallSurface_3"> + <bldg:lod2MultiSurface> + <gml:MultiSurface> + <gml:surfaceMember> + <gml:Polygon gml:id="_Simple_BD.1_PG.4"> + <gml:exterior> + <gml:LinearRing gml:id="_Simple_BD.1_PG.4_LR.1"> + <gml:posList srsDimension="3"> + 10.0 10.0 3.0 + 10.0 15.0 3.0 + 10.0 15.0 0.0 + 10.0 10.0 0.0 + 10.0 10.0 3.0 + </gml:posList> + </gml:LinearRing> + </gml:exterior> + </gml:Polygon> + </gml:surfaceMember> + </gml:MultiSurface> + </bldg:lod2MultiSurface> + </bldg:WallSurface> + </bldg:boundedBy> + <bldg:boundedBy> + <bldg:WallSurface gml:id="_Simple_BD.1_WallSurface_4"> + <bldg:lod2MultiSurface> + <gml:MultiSurface> + <gml:surfaceMember> + <gml:Polygon gml:id="_Simple_BD.1_PG.5"> + <gml:exterior> + <gml:LinearRing gml:id="_Simple_BD.1_PG.5_LR.1"> + <gml:posList srsDimension="3"> + 13.0 10.0 0.0 + 13.0 10.0 3.0 + 11.5 10.0 4.5 + 10.0 10.0 3.0 + 10.0 10.0 0.0 + 13.0 10.0 0.0 + </gml:posList> + </gml:LinearRing> + </gml:exterior> + </gml:Polygon> + </gml:surfaceMember> + </gml:MultiSurface> + </bldg:lod2MultiSurface> + </bldg:WallSurface> + </bldg:boundedBy> + <bldg:boundedBy> + <bldg:RoofSurface gml:id="_Simple_BD.1_RoofSurface_1"> + <bldg:lod2MultiSurface> + <gml:MultiSurface> + <gml:surfaceMember> + <gml:Polygon gml:id="_Simple_BD.1_PG.6"> + <gml:exterior> + <gml:LinearRing gml:id="_Simple_BD.1_PG.6_LR.1"> + <gml:posList srsDimension="3"> + 10.0 10.0 3.0 + 11.5 10.0 4.5 + 11.5 15.0 4.5 + 10.0 15.0 3.0 + 10.0 10.0 3.0 + </gml:posList> + </gml:LinearRing> + </gml:exterior> + </gml:Polygon> + </gml:surfaceMember> + <gml:surfaceMember> + <gml:Polygon gml:id="_Simple_BD.1_PG.7"> + <gml:exterior> + <gml:LinearRing gml:id="_Simple_BD.1_PG.7_LR.1"> + <gml:posList srsDimension="3"> + 11.5 10.0 4.5 + 13.0 10.0 3.0 + 13.0 15.0 3.0 + 11.5 15.0 4.5 + 11.5 10.0 4.5 + </gml:posList> + </gml:LinearRing> + </gml:exterior> + </gml:Polygon> + </gml:surfaceMember> + </gml:MultiSurface> + </bldg:lod2MultiSurface> + </bldg:RoofSurface> + </bldg:boundedBy> + <bldg:boundedBy> + <bldg:GroundSurface gml:id="_Simple_BD.1_GroundSurface_1"> + <bldg:lod2MultiSurface> + <gml:MultiSurface> + <gml:surfaceMember> + <gml:Polygon gml:id="_Simple_BD.1_PG.1"> + <gml:exterior> + <gml:LinearRing gml:id="_Simple_BD.1_PG.1_LR.1"> + <gml:posList srsDimension="3"> + 10.0 10.0 0.0 + 10.0 15.0 0.0 + 13.0 15.0 0.0 + 13.0 10.0 0.0 + 10.0 10.0 0.0 + </gml:posList> + </gml:LinearRing> + </gml:exterior> + </gml:Polygon> + </gml:surfaceMember> + </gml:MultiSurface> + </bldg:lod2MultiSurface> + </bldg:GroundSurface> + </bldg:boundedBy> + </bldg:Building> + </core:cityObjectMember> +</core:CityModel> \ No newline at end of file diff --git a/CityDoctorParent/Extensions/CityDoctorZipLoader/src/test/resources/validate/valFaulty.gml b/CityDoctorParent/Extensions/CityDoctorZipLoader/src/test/resources/validate/valFaulty.gml new file mode 100644 index 0000000000000000000000000000000000000000..c0f068ebdadeb4157f4e16fcbc23c62a5922c5c2 --- /dev/null +++ b/CityDoctorParent/Extensions/CityDoctorZipLoader/src/test/resources/validate/valFaulty.gml @@ -0,0 +1,192 @@ +<?xml version="1.0" encoding="utf-8"?> +<core:CityModel xmlns:core="http://www.opengis.net/citygml/2.0" xmlns:gen="http://www.opengis.net/citygml/generics/2.0" xmlns:bldg="http://www.opengis.net/citygml/building/2.0" xmlns:app="http://www.opengis.net/citygml/appearance/2.0" xmlns:dem="http://www.opengis.net/citygml/relief/2.0" xmlns:gml="http://www.opengis.net/gml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/citygml/building/2.0 http://schemas.opengis.net/citygml/building/2.0/building.xsd http://www.opengis.net/citygml/appearance/2.0 http://schemas.opengis.net/citygml/appearance/2.0/appearance.xsd http://www.opengis.net/citygml/relief/2.0 http://schemas.opengis.net/citygml/relief/2.0/relief.xsd http://www.opengis.net/citygml/2.0 http://schemas.opengis.net/citygml/2.0/cityGMLBase.xsd http://www.opengis.net/citygml/generics/2.0 http://schemas.opengis.net/citygml/generics/2.0/generics.xsd"> + +<!-- +Einfaches Gebäude mit Grundriss 3m x 5m und Satteldach, Traufhöhe 3m, Firsthöhe 4,5m +Modelliert mit Begrenzungsflächen (eine Dachfläche, 4 Wandflächen, 1 Grundfläche), +die Gebäudegeometrie als Solid, der auf die Polygone der Begrenzungsflächen referenziert + +CityGML 2.0 + +Gebäudevolumen: 56,25 m3 + +10.5.2017 + +Author: V. Coors, HFT Stuttgart +Lizenz: +--> + + <core:cityObjectMember> + <bldg:Building gml:id="_Simple_BD.1"> + <bldg:lod2Solid> + <gml:Solid> + <gml:exterior> + <gml:CompositeSurface> + <gml:surfaceMember xlink:href="#_Simple_BD.1_PG.1"/> + <gml:surfaceMember xlink:href="#_Simple_BD.1_PG.2"/> + <gml:surfaceMember xlink:href="#_Simple_BD.1_PG.3"/> + <gml:surfaceMember xlink:href="#_Simple_BD.1_PG.4"/> + <gml:surfaceMember xlink:href="#_Simple_BD.1_PG.5"/> + <gml:surfaceMember xlink:href="#_Simple_BD.1_PG.6"/> + <gml:surfaceMember xlink:href="#_Simple_BD.1_PG.7"/> + </gml:CompositeSurface> + </gml:exterior> + </gml:Solid> + </bldg:lod2Solid> + <bldg:boundedBy> + <bldg:WallSurface gml:id="_Simple_BD.1_WallSurface_1"> + <bldg:lod2MultiSurface> + <gml:MultiSurface> + <gml:surfaceMember> + <gml:Polygon gml:id="_Simple_BD.1_PG.2"> + <gml:exterior> + <gml:LinearRing gml:id="_Simple_BD.1_PG.2_LR.1"> + <gml:posList srsDimension="3"> + 13.0 15.0 0.0 + 13.0 15.0 3.0 + 13.0 10.0 3.0 + 13.0 10.0 0.0 + 13.0 15.0 0.0 + </gml:posList> + </gml:LinearRing> + </gml:exterior> + </gml:Polygon> + </gml:surfaceMember> + </gml:MultiSurface> + </bldg:lod2MultiSurface> + </bldg:WallSurface> + </bldg:boundedBy> + <bldg:boundedBy> + <bldg:WallSurface gml:id="_Simple_BD.1_WallSurface_2"> + <bldg:lod2MultiSurface> + <gml:MultiSurface> + <gml:surfaceMember> + <gml:Polygon gml:id="_Simple_BD.1_PG.3"> + <gml:exterior> + <gml:LinearRing gml:id="_Simple_BD.1_PG.3_LR.1"> + <gml:posList srsDimension="3"> + 10.0 15.0 0.0 + 10.0 15.0 3.0 + 11.5 15.0 4.5 + 13.0 15.0 3.0 + 13.0 15.0 0.0 + 10.0 15.0 0.0 + </gml:posList> + </gml:LinearRing> + </gml:exterior> + </gml:Polygon> + </gml:surfaceMember> + </gml:MultiSurface> + </bldg:lod2MultiSurface> + </bldg:WallSurface> + </bldg:boundedBy> + <bldg:boundedBy> + <bldg:WallSurface gml:id="_Simple_BD.1_WallSurface_3"> + <bldg:lod2MultiSurface> + <gml:MultiSurface> + <gml:surfaceMember> + <gml:Polygon gml:id="_Simple_BD.1_PG.4"> + <gml:exterior> + <gml:LinearRing gml:id="_Simple_BD.1_PG.4_LR.1"> + <gml:posList srsDimension="3"> + 10.0 10.0 3.0 + 10.0 15.0 3.0 + 10.0 15.0 0.0 + 10.0 10.0 0.0 + 10.0 10.0 3.0 + </gml:posList> + </gml:LinearRing> + </gml:exterior> + </gml:Polygon> + </gml:surfaceMember> + </gml:MultiSurface> + </bldg:lod2MultiSurface> + </bldg:WallSurface> + </bldg:boundedBy> + <bldg:boundedBy> + <bldg:WallSurface gml:id="_Simple_BD.1_WallSurface_4"> + <bldg:lod2MultiSurface> + <gml:MultiSurface> + <gml:surfaceMember> + <gml:Polygon gml:id="_Simple_BD.1_PG.5"> + <gml:exterior> + <gml:LinearRing gml:id="_Simple_BD.1_PG.5_LR.1"> + <gml:posList srsDimension="3"> + 13.0 10.0 0.0 + 13.0 10.0 3.0 + 11.5 10.0 4.5 + 10.0 10.0 3.0 + 10.0 10.0 0.0 + 13.0 10.0 0.0 + </gml:posList> + </gml:LinearRing> + </gml:exterior> + </gml:Polygon> + </gml:surfaceMember> + </gml:MultiSurface> + </bldg:lod2MultiSurface> + </bldg:WallSurface> + </bldg:boundedBy> + <bldg:boundedBy> + <bldg:RoofSurface gml:id="_Simple_BD.1_RoofSurface_1"> + <bldg:lod2MultiSurface> + <gml:MultiSurface> + <gml:surfaceMember> + <gml:Polygon gml:id="_Simple_BD.1_PG.6"> + <gml:exterior> + <gml:LinearRing gml:id="_Simple_BD.1_PG.6_LR.1"> + <gml:posList srsDimension="3"> + 10.0 10.0 3.0 + 11.5 10.0 4.5 + 11.5 15.0 4.5 + 10.0 15.0 3.0 + 10.0 10.0 3.0 + </gml:posList> + </gml:LinearRing> + </gml:exterior> + </gml:Polygon> + </gml:surfaceMember> + <gml:surfaceMember> + <gml:Polygon gml:id="_Simple_BD.1_PG.7"> + <gml:exterior> + <gml:LinearRing gml:id="_Simple_BD.1_PG.7_LR.1"> + <gml:posList srsDimension="3"> + 11.5 10.0 4.5 + 13.0 10.0 3.0 + 13.0 15.0 3.0 + 11.5 15.0 4.5 + 11.5 10.0 4.5 + </gml:posList> + </gml:LinearRing> + </gml:exterior> + </gml:Polygon> + </gml:surfaceMember> + </gml:MultiSurface> + </bldg:lod2MultiSurface> + </bldg:RoofSurface> + </bldg:boundedBy> + <bldg:boundedBy> + <bldg:GroundSurface gml:id="_Simple_BD.1_GroundSurface_1"> + <bldg:lod2MultiSurface> + <gml:MultiSurface> + <gml:surfaceMember> + <gml:Polygon gml:id="_Simple_BD.1_PG.1"> + <gml:exterior> + <gml:LinearRing gml:id="_Simple_BD.1_PG.1_LR.1"> + <gml:posList srsDimension="3"> + 10.0 10.0 0.0 + 10.0 15.0 0.0 + 13.0 15.0 0.0 + 13.0 10.0 0.0 + 10.0 10.0 0.0 + </gml:posList> + </gml:LinearRing> + </gml:exterior> + </gml:Polygon> + </gml:surfaceMember> + </gml:MultiSurface> + </bldg:lod2MultiSurface> + </bldg:GroundSurface> + </bldg:boundedBy> + </bldg:Building> + </core:cityObjectMember>