From 742b787530801404bf8d316e680c47eed13abd62 Mon Sep 17 00:00:00 2001
From: Matthias Betz <matthias.betz@hft-stuttgart.de>
Date: Thu, 3 Dec 2020 14:48:12 +0100
Subject: [PATCH] fixed schematron tests, with new schematron format

---
 .../utils/BoundingBoxCalculator.java           |  2 +-
 .../src/test/resources/schematronTest.xml      | 18 ++++++++----------
 2 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/utils/BoundingBoxCalculator.java b/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/utils/BoundingBoxCalculator.java
index c9d36e9..5ff2bf8 100644
--- a/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/utils/BoundingBoxCalculator.java
+++ b/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/utils/BoundingBoxCalculator.java
@@ -116,7 +116,7 @@ public class BoundingBoxCalculator {
 	private static void findMinMax(Vector3d low, Vector3d high, CityObject co) {
 		for (Geometry geom : co.getGeometries()) {
 			if (geom.getVertices() == null) {
-				continue;
+				geom.updateVertices();
 			}
 			for (Vertex v : geom.getVertices()) {
 				if (v.getX() < low.getX()) {
diff --git a/CityDoctorParent/CityDoctorValidation/src/test/resources/schematronTest.xml b/CityDoctorParent/CityDoctorValidation/src/test/resources/schematronTest.xml
index 39c81af..7049740 100644
--- a/CityDoctorParent/CityDoctorValidation/src/test/resources/schematronTest.xml
+++ b/CityDoctorParent/CityDoctorValidation/src/test/resources/schematronTest.xml
@@ -1,19 +1,17 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <schema xmlns="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
-    <!-- semantic requirements SimStadt monthly energy balance -->
     <ns prefix="gml" uri="http://www.opengis.net/gml"/>
     <ns prefix="bldg" uri="http://www.opengis.net/citygml/building/2.0"/>
     
     <pattern>
-        <rule context="//Building | //bldg:Building">
-            <assert test="@gml:id | @id">Attribute gml:id is missing in one building. </assert>
-            <assert test="count(lod1Solid) = 1"><value-of select="@gml:id | @id"/>: SE_MISSING_ELEMENT lod1Solid</assert>
-            <assert test="count(yearOfConstruction) &gt;= 1"><value-of select="@gml:id | @id"/>: SE_MISSING_ELEMENT yearOfConstruction</assert>
-            <assert test="count(function) = 1"><value-of select="@gml:id | @id"/>: SE_MISSING_ELEMENT function</assert>
-        </rule>
-        <rule context="//BuildingPart | //bldg:BuildingPart">
-            <assert test="@gml:id | @id"><value-of select="@gml:id | @id"/>: Attribute gml:id is missing in one building part.</assert>
-            <assert test="count(lod1Solid) = 1"><value-of select="@gml:id | @id"/>: SE_MISSING_ELEMENT lod1Solid</assert>
+        <rule context="//*:Building">
+            <assert test="count(*:lod2Solid) = 1"><value-of select="@gml:id | @id"/>||||SEM_ATTRIBUTE_MISSING||lod1Solid||false</assert>
+            <assert test="count(*:yearOfConstruction) &gt;= 1"><value-of select="@gml:id | @id"/>||||SEM_ATTRIBUTE_MISSING||yearOfConstruction||false</assert>
+            <assert test="count(*:function) = 1"><value-of select="@gml:id | @id"/>||||SEM_ATTRIBUTE_MISSING||function||false</assert>
+			<assert test="*:doubleAttribute[@name = 'Volume'] &gt; 0 and *:doubleAttribute[@name = 'Volume'] &lt; 5000"><value-of select="@gml:id | @id"/>||||SEM_ATTRIBUTE_WRONG_VALUE||volume||true</assert>
         </rule>
+		<rule context="//*:Building//*:RoofSurface">
+            <assert test="count(function) = 1"><value-of select="ancestor::*:Building/@*:id"/>||<value-of select="@gml:id | @id"/>||SEM_ATTRIBUTE_MISSING||function||false</assert>
+		</rule>
     </pattern>
 </schema> 
-- 
GitLab