From 4ef4c11fe12fd22a12b395e53baa069c33c75ab2 Mon Sep 17 00:00:00 2001 From: Matthias Betz Date: Tue, 12 Apr 2022 12:36:01 +0200 Subject: [PATCH] added type adapters added validation tests --- citygml4j-quality-ade/pom.xml | 2 +- .../quality/adapter/EdgeAdapter.java | 69 - .../ValidationResultPropertyAdapter.java | 33 + .../adapter/types/AbstractErrorAdapter.java | 10 + .../types/AbstractGeometryErrorAdapter.java | 7 + .../types/AbstractPolygonErrorAdapter.java | 37 + .../types/AbstractRingErrorAdapter.java | 36 + .../types/AbstractSemanticErrorAdapter.java | 7 + .../types/AbstractSolidErrorAdapter.java | 37 + .../AllPolygonsOrientedWrongErrorAdapter.java | 28 + .../adapter/types/CheckingAdapter.java | 57 + .../types/CityObjectPropertiesAdapter.java | 47 + .../adapter/types/ComponentListAdapter.java | 58 + .../ConsecutivePointsSameErrorAdapter.java | 61 + .../quality/adapter/types/EdgeAdapter.java | 56 + .../adapter/types/EdgeListAdapter.java | 55 + .../quality/adapter/types/ErrorAdapter.java | 51 + .../types/FeatureStatisticsAdapter.java | 57 + .../quality/adapter/types/FilterAdapter.java | 56 + .../types/GlobalParametersAdapter.java | 57 + .../types/HoleOutsideErrorAdapter.java | 54 + .../types/InnerRingsNestedErrorAdapter.java | 58 + .../InteriorDisconnectedErrorAdapter.java | 28 + .../types/IntersectingRingsErrorAdapter.java | 59 + .../types/MultipleComponentsErrorAdapter.java | 56 + .../types/NonManifoldEdgeErrorAdapter.java | 54 + .../types/NonManifoldVertexErrorAdapter.java | 51 + .../OrientationRingsSameErrorAdapter.java | 54 + .../adapter/types/ParameterAdapter.java | 60 + .../PlanarDistancePlaneErrorAdapter.java | 62 + .../PlanarNormalsDeviationErrorAdapter.java | 55 + .../adapter/types/PolygonIdListAdapter.java | 55 + .../PolygonWrongOrientationErrorAdapter.java | 55 + .../adapter/types/RequirementAdapter.java | 66 + .../types/RingNotClosedErrorAdapter.java | 26 + .../RingSelfIntersectionErrorAdapter.java | 77 + .../types/RingTooFewPointsErrorAdapter.java | 27 + .../SemanticAttributeMissingErrorAdapter.java | 62 + ...manticAttributeWrongValueErrorAdapter.java | 64 + .../types/SolidNotClosedErrorAdapter.java | 54 + .../SolidSelfIntersectionErrorAdapter.java | 60 + .../SolidTooFewPolygonsErrorAdapter.java | 28 + .../adapter/types/StatisticsAdapter.java | 86 + .../adapter/types/ValidationAdapter.java | 75 + .../adapter/types/ValidationPlanAdapter.java | 71 + .../types/ValidationResultAdapter.java | 69 + .../adapter/types/ZonedDateTimeAdapter.java | 37 + .../properties/ValidationResultProperty.java | 48 + .../model/types/CityObjectProperties.java | 8 +- .../model/types/MultipleComponentsError.java | 14 +- .../types/PolygonWrongOrientationError.java | 21 +- .../types/SolidSelfIntersectionError.java | 23 +- .../quality/model/types/ValidationPlan.java | 4 +- .../UncheckedMissingADESchemaException.java | 37 - ...gml4j.model.citygml.ade.binding.ADEContext | 1 - .../src/main/resources/qualityAde.xsd | 28 +- .../stuttgart/quality/QualityAdeTests.java | 1772 +++++------------ ...impleSolid_AllPolygonsWrongOrientation.gml | 255 --- .../resources/SimpleSolid_HoleOutside.gml | 256 --- .../resources/SimpleSolid_InnerRingNested.gml | 257 --- .../SimpleSolid_InteriorDisconnected.gml | 255 --- .../SimpleSolid_IntersectingRings.gml | 257 --- ...impleSolid_MultipleConnectedComponents.gml | 266 --- .../resources/SimpleSolid_NonManifoldEdge.gml | 262 --- .../SimpleSolid_NonManifoldVertex.gml | 256 --- ...pleSolid_NonPlanarPolygonDistancePlane.gml | 257 --- ...Solid_NonPlanarPolygonNormalsDeviation.gml | 256 --- .../SimpleSolid_OrientationRingsSame.gml | 256 --- .../SimpleSolid_PolygonWrongOrientation.gml | 262 --- .../resources/SimpleSolid_RingNotClosed.gml | 255 --- .../SimpleSolid_RingSelfIntersection.gml | 261 --- .../resources/SimpleSolid_SolidNotClosed.gml | 262 --- .../SimpleSolid_SolidSelfIntersection.gml | 257 --- .../resources/SimpleSolid_TooFewPoints.gml | 255 --- .../resources/SimpleSolid_TooFewPolygons.gml | 255 --- citygml4j-quality-ade/test.gml | 66 +- 76 files changed, 2889 insertions(+), 6097 deletions(-) delete mode 100644 citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/EdgeAdapter.java create mode 100644 citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/properties/ValidationResultPropertyAdapter.java create mode 100644 citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/AbstractErrorAdapter.java create mode 100644 citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/AbstractGeometryErrorAdapter.java create mode 100644 citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/AbstractPolygonErrorAdapter.java create mode 100644 citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/AbstractRingErrorAdapter.java create mode 100644 citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/AbstractSemanticErrorAdapter.java create mode 100644 citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/AbstractSolidErrorAdapter.java create mode 100644 citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/AllPolygonsOrientedWrongErrorAdapter.java create mode 100644 citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/CheckingAdapter.java create mode 100644 citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/CityObjectPropertiesAdapter.java create mode 100644 citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/ComponentListAdapter.java create mode 100644 citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/ConsecutivePointsSameErrorAdapter.java create mode 100644 citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/EdgeAdapter.java create mode 100644 citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/EdgeListAdapter.java create mode 100644 citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/ErrorAdapter.java create mode 100644 citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/FeatureStatisticsAdapter.java create mode 100644 citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/FilterAdapter.java create mode 100644 citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/GlobalParametersAdapter.java create mode 100644 citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/HoleOutsideErrorAdapter.java create mode 100644 citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/InnerRingsNestedErrorAdapter.java create mode 100644 citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/InteriorDisconnectedErrorAdapter.java create mode 100644 citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/IntersectingRingsErrorAdapter.java create mode 100644 citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/MultipleComponentsErrorAdapter.java create mode 100644 citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/NonManifoldEdgeErrorAdapter.java create mode 100644 citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/NonManifoldVertexErrorAdapter.java create mode 100644 citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/OrientationRingsSameErrorAdapter.java create mode 100644 citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/ParameterAdapter.java create mode 100644 citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/PlanarDistancePlaneErrorAdapter.java create mode 100644 citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/PlanarNormalsDeviationErrorAdapter.java create mode 100644 citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/PolygonIdListAdapter.java create mode 100644 citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/PolygonWrongOrientationErrorAdapter.java create mode 100644 citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/RequirementAdapter.java create mode 100644 citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/RingNotClosedErrorAdapter.java create mode 100644 citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/RingSelfIntersectionErrorAdapter.java create mode 100644 citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/RingTooFewPointsErrorAdapter.java create mode 100644 citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/SemanticAttributeMissingErrorAdapter.java create mode 100644 citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/SemanticAttributeWrongValueErrorAdapter.java create mode 100644 citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/SolidNotClosedErrorAdapter.java create mode 100644 citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/SolidSelfIntersectionErrorAdapter.java create mode 100644 citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/SolidTooFewPolygonsErrorAdapter.java create mode 100644 citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/StatisticsAdapter.java create mode 100644 citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/ValidationAdapter.java create mode 100644 citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/ValidationPlanAdapter.java create mode 100644 citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/ValidationResultAdapter.java create mode 100644 citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/ZonedDateTimeAdapter.java create mode 100644 citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/model/properties/ValidationResultProperty.java delete mode 100644 citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/util/UncheckedMissingADESchemaException.java delete mode 100644 citygml4j-quality-ade/src/main/resources/META-INF/services/org.citygml4j.model.citygml.ade.binding.ADEContext delete mode 100644 citygml4j-quality-ade/src/test/resources/SimpleSolid_AllPolygonsWrongOrientation.gml delete mode 100644 citygml4j-quality-ade/src/test/resources/SimpleSolid_HoleOutside.gml delete mode 100644 citygml4j-quality-ade/src/test/resources/SimpleSolid_InnerRingNested.gml delete mode 100644 citygml4j-quality-ade/src/test/resources/SimpleSolid_InteriorDisconnected.gml delete mode 100644 citygml4j-quality-ade/src/test/resources/SimpleSolid_IntersectingRings.gml delete mode 100644 citygml4j-quality-ade/src/test/resources/SimpleSolid_MultipleConnectedComponents.gml delete mode 100644 citygml4j-quality-ade/src/test/resources/SimpleSolid_NonManifoldEdge.gml delete mode 100644 citygml4j-quality-ade/src/test/resources/SimpleSolid_NonManifoldVertex.gml delete mode 100644 citygml4j-quality-ade/src/test/resources/SimpleSolid_NonPlanarPolygonDistancePlane.gml delete mode 100644 citygml4j-quality-ade/src/test/resources/SimpleSolid_NonPlanarPolygonNormalsDeviation.gml delete mode 100644 citygml4j-quality-ade/src/test/resources/SimpleSolid_OrientationRingsSame.gml delete mode 100644 citygml4j-quality-ade/src/test/resources/SimpleSolid_PolygonWrongOrientation.gml delete mode 100644 citygml4j-quality-ade/src/test/resources/SimpleSolid_RingNotClosed.gml delete mode 100644 citygml4j-quality-ade/src/test/resources/SimpleSolid_RingSelfIntersection.gml delete mode 100644 citygml4j-quality-ade/src/test/resources/SimpleSolid_SolidNotClosed.gml delete mode 100644 citygml4j-quality-ade/src/test/resources/SimpleSolid_SolidSelfIntersection.gml delete mode 100644 citygml4j-quality-ade/src/test/resources/SimpleSolid_TooFewPoints.gml delete mode 100644 citygml4j-quality-ade/src/test/resources/SimpleSolid_TooFewPolygons.gml diff --git a/citygml4j-quality-ade/pom.xml b/citygml4j-quality-ade/pom.xml index 4e26832..7d9e4b1 100644 --- a/citygml4j-quality-ade/pom.xml +++ b/citygml4j-quality-ade/pom.xml @@ -4,7 +4,7 @@ 4.0.0 de.hft.stuttgart citygml4j-quality-ade - 0.1.3 + 3.1.4 UTF-8 diff --git a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/EdgeAdapter.java b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/EdgeAdapter.java deleted file mode 100644 index 57530d5..0000000 --- a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/EdgeAdapter.java +++ /dev/null @@ -1,69 +0,0 @@ -/*- - * Copyright 2022 Hochschule für Technik Stuttgart - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package de.hft.stuttgart.quality.adapter; - -import javax.xml.namespace.QName; - -import org.xmlobjects.builder.ObjectBuildException; -import org.xmlobjects.builder.ObjectBuilder; -import org.xmlobjects.gml.adapter.geometry.DirectPositionAdapter; -import org.xmlobjects.serializer.ObjectSerializeException; -import org.xmlobjects.serializer.ObjectSerializer; -import org.xmlobjects.stream.XMLReadException; -import org.xmlobjects.stream.XMLReader; -import org.xmlobjects.stream.XMLWriteException; -import org.xmlobjects.stream.XMLWriter; -import org.xmlobjects.xml.Attributes; -import org.xmlobjects.xml.Element; -import org.xmlobjects.xml.Namespaces; - -import de.hft.stuttgart.quality.QualityADEModule; -import de.hft.stuttgart.quality.model.types.Edge; - -public class EdgeAdapter implements ObjectBuilder, ObjectSerializer { - - @Override - public Edge createObject(QName name, Object parent) throws ObjectBuildException { - return new Edge(); - } - - @Override - public void buildChildObject(Edge object, QName name, Attributes attributes, XMLReader reader) - throws ObjectBuildException, XMLReadException { - if (!QualityADEModule.NAMESPACE_URI.equals(name.getNamespaceURI())) { - return; - } - switch (name.getLocalPart()) { - case "from" -> object.setFrom(reader.getObjectUsingBuilder(DirectPositionAdapter.class)); - case "to" -> object.setTo(reader.getObjectUsingBuilder(DirectPositionAdapter.class)); - default -> throw new IllegalStateException("Cannot handle name " + name + " when building edge element"); - } - } - - @Override - public void writeChildElements(Edge object, Namespaces namespaces, XMLWriter writer) - throws ObjectSerializeException, XMLWriteException { - if (object.getFrom() != null) { - writer.writeElementUsingSerializer(Element.of(QualityADEModule.NAMESPACE_URI, "from"), object.getFrom(), - DirectPositionAdapter.class, namespaces); - } - if (object.getTo() != null) { - writer.writeElementUsingSerializer(Element.of(QualityADEModule.NAMESPACE_URI, "to"), object.getTo(), - DirectPositionAdapter.class, namespaces); - } - } - -} diff --git a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/properties/ValidationResultPropertyAdapter.java b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/properties/ValidationResultPropertyAdapter.java new file mode 100644 index 0000000..4eae3e6 --- /dev/null +++ b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/properties/ValidationResultPropertyAdapter.java @@ -0,0 +1,33 @@ +/*- + * Copyright 2022 Hochschule für Technik Stuttgart + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package de.hft.stuttgart.quality.adapter.properties; + +import javax.xml.namespace.QName; + +import org.xmlobjects.builder.ObjectBuildException; +import org.xmlobjects.gml.adapter.base.AbstractInlineOrByReferencePropertyAdapter; + +import de.hft.stuttgart.quality.model.properties.ValidationResultProperty; + +public class ValidationResultPropertyAdapter + extends AbstractInlineOrByReferencePropertyAdapter { + + @Override + public ValidationResultProperty createObject(QName name, Object parent) throws ObjectBuildException { + return new ValidationResultProperty(); + } + +} diff --git a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/AbstractErrorAdapter.java b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/AbstractErrorAdapter.java new file mode 100644 index 0000000..ba55287 --- /dev/null +++ b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/AbstractErrorAdapter.java @@ -0,0 +1,10 @@ +package de.hft.stuttgart.quality.adapter.types; + +import org.xmlobjects.builder.ObjectBuilder; +import org.xmlobjects.serializer.ObjectSerializer; + +import de.hft.stuttgart.quality.model.types.AbstractError; + +public abstract class AbstractErrorAdapter implements ObjectBuilder, ObjectSerializer { + +} diff --git a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/AbstractGeometryErrorAdapter.java b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/AbstractGeometryErrorAdapter.java new file mode 100644 index 0000000..aa33625 --- /dev/null +++ b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/AbstractGeometryErrorAdapter.java @@ -0,0 +1,7 @@ +package de.hft.stuttgart.quality.adapter.types; + +import de.hft.stuttgart.quality.model.types.AbstractGeometryError; + +public abstract class AbstractGeometryErrorAdapter extends AbstractErrorAdapter { + +} diff --git a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/AbstractPolygonErrorAdapter.java b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/AbstractPolygonErrorAdapter.java new file mode 100644 index 0000000..de1d806 --- /dev/null +++ b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/AbstractPolygonErrorAdapter.java @@ -0,0 +1,37 @@ +package de.hft.stuttgart.quality.adapter.types; + +import javax.xml.namespace.QName; + +import org.xmlobjects.builder.ObjectBuildException; +import org.xmlobjects.serializer.ObjectSerializeException; +import org.xmlobjects.stream.XMLReadException; +import org.xmlobjects.stream.XMLReader; +import org.xmlobjects.stream.XMLWriteException; +import org.xmlobjects.stream.XMLWriter; +import org.xmlobjects.xml.Attributes; +import org.xmlobjects.xml.Element; +import org.xmlobjects.xml.Namespaces; + +import de.hft.stuttgart.quality.QualityADEModule; +import de.hft.stuttgart.quality.model.types.AbstractPolygonError; + +public abstract class AbstractPolygonErrorAdapter extends AbstractGeometryErrorAdapter { + + @Override + public void buildChildObject(AbstractPolygonError object, QName name, Attributes attributes, XMLReader reader) throws ObjectBuildException, XMLReadException { + if (!QualityADEModule.NAMESPACE_URI.equals(name.getNamespaceURI())) { + return; + } + switch (name.getLocalPart()) { + case "polygonId" -> reader.getTextContent().ifPresent(object::setPolygonId); + default -> throw new IllegalStateException("Cannot handle name " + name + " when building AbstractPolygonError element"); + } + } + + @Override + public void writeChildElements(AbstractPolygonError object, Namespaces namespaces, XMLWriter writer) throws ObjectSerializeException, XMLWriteException { + if (object.getPolygonId() != null) { + writer.writeElement(Element.of(QualityADEModule.NAMESPACE_URI, "polygonId").addTextContent(object.getPolygonId())); + } + } +} diff --git a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/AbstractRingErrorAdapter.java b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/AbstractRingErrorAdapter.java new file mode 100644 index 0000000..a72c626 --- /dev/null +++ b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/AbstractRingErrorAdapter.java @@ -0,0 +1,36 @@ +package de.hft.stuttgart.quality.adapter.types; + +import javax.xml.namespace.QName; + +import org.xmlobjects.builder.ObjectBuildException; +import org.xmlobjects.serializer.ObjectSerializeException; +import org.xmlobjects.stream.XMLReadException; +import org.xmlobjects.stream.XMLReader; +import org.xmlobjects.stream.XMLWriteException; +import org.xmlobjects.stream.XMLWriter; +import org.xmlobjects.xml.Attributes; +import org.xmlobjects.xml.Element; +import org.xmlobjects.xml.Namespaces; + +import de.hft.stuttgart.quality.QualityADEModule; +import de.hft.stuttgart.quality.model.types.AbstractRingError; + +public abstract class AbstractRingErrorAdapter extends AbstractGeometryErrorAdapter { + + @Override + public void buildChildObject(AbstractRingError object, QName name, Attributes attributes, XMLReader reader) throws ObjectBuildException, XMLReadException { + if (!QualityADEModule.NAMESPACE_URI.equals(name.getNamespaceURI())) { + return; + } + switch (name.getLocalPart()) { + case "linearRingId" -> reader.getTextContent().ifPresent(object::setLinearRingId); + } + } + + @Override + public void writeChildElements(AbstractRingError object, Namespaces namespaces, XMLWriter writer) throws ObjectSerializeException, XMLWriteException { + if (object.getLinearRingId() != null) { + writer.writeElement(Element.of(QualityADEModule.NAMESPACE_URI, "linearRingId").addTextContent(object.getLinearRingId())); + } + } +} diff --git a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/AbstractSemanticErrorAdapter.java b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/AbstractSemanticErrorAdapter.java new file mode 100644 index 0000000..c429b97 --- /dev/null +++ b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/AbstractSemanticErrorAdapter.java @@ -0,0 +1,7 @@ +package de.hft.stuttgart.quality.adapter.types; + +import de.hft.stuttgart.quality.model.types.AbstractSemanticError; + +public abstract class AbstractSemanticErrorAdapter extends AbstractErrorAdapter { + +} diff --git a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/AbstractSolidErrorAdapter.java b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/AbstractSolidErrorAdapter.java new file mode 100644 index 0000000..e7255e8 --- /dev/null +++ b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/AbstractSolidErrorAdapter.java @@ -0,0 +1,37 @@ +package de.hft.stuttgart.quality.adapter.types; + +import javax.xml.namespace.QName; + +import org.xmlobjects.builder.ObjectBuildException; +import org.xmlobjects.serializer.ObjectSerializeException; +import org.xmlobjects.stream.XMLReadException; +import org.xmlobjects.stream.XMLReader; +import org.xmlobjects.stream.XMLWriteException; +import org.xmlobjects.stream.XMLWriter; +import org.xmlobjects.xml.Attributes; +import org.xmlobjects.xml.Element; +import org.xmlobjects.xml.Namespaces; + +import de.hft.stuttgart.quality.QualityADEModule; +import de.hft.stuttgart.quality.model.types.AbstractSolidError; + +public abstract class AbstractSolidErrorAdapter extends AbstractGeometryErrorAdapter { + + @Override + public void buildChildObject(AbstractSolidError object, QName name, Attributes attributes, XMLReader reader) throws ObjectBuildException, XMLReadException { + if (!QualityADEModule.NAMESPACE_URI.equals(name.getNamespaceURI())) { + return; + } + switch (name.getLocalPart()) { + case "geometryId" -> reader.getTextContent().ifPresent(object::setGeometryId); + default -> throw new IllegalStateException("Cannot handle name " + name + " when building AbstractSolidError element"); + } + } + + @Override + public void writeChildElements(AbstractSolidError object, Namespaces namespaces, XMLWriter writer) throws ObjectSerializeException, XMLWriteException { + if (object.getGeometryId() != null) { + writer.writeElement(Element.of(QualityADEModule.NAMESPACE_URI, "geometryId").addTextContent(object.getGeometryId())); + } + } +} diff --git a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/AllPolygonsOrientedWrongErrorAdapter.java b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/AllPolygonsOrientedWrongErrorAdapter.java new file mode 100644 index 0000000..496231a --- /dev/null +++ b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/AllPolygonsOrientedWrongErrorAdapter.java @@ -0,0 +1,28 @@ +package de.hft.stuttgart.quality.adapter.types; + +import javax.xml.namespace.QName; + +import org.xmlobjects.annotation.XMLElement; +import org.xmlobjects.builder.ObjectBuildException; +import org.xmlobjects.serializer.ObjectSerializeException; +import org.xmlobjects.xml.Element; +import org.xmlobjects.xml.Namespaces; + +import de.hft.stuttgart.quality.QualityADEModule; +import de.hft.stuttgart.quality.model.types.AllPolygonsOrientedWrongError; + +@XMLElement(name = "GE_S_ALL_POLYGONS_WRONG_ORIENTATION", namespaceURI = QualityADEModule.NAMESPACE_URI) +public class AllPolygonsOrientedWrongErrorAdapter extends AbstractSolidErrorAdapter { + + @Override + public AllPolygonsOrientedWrongError createObject(QName name, Object parent) throws ObjectBuildException { + return new AllPolygonsOrientedWrongError(); + } + + @Override + public Element createElement(AllPolygonsOrientedWrongError object, Namespaces namespaces) + throws ObjectSerializeException { + return Element.of(QualityADEModule.NAMESPACE_URI, "GE_S_ALL_POLYGONS_WRONG_ORIENTATION"); + } + +} diff --git a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/CheckingAdapter.java b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/CheckingAdapter.java new file mode 100644 index 0000000..7926131 --- /dev/null +++ b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/CheckingAdapter.java @@ -0,0 +1,57 @@ +package de.hft.stuttgart.quality.adapter.types; + +import de.hft.stuttgart.quality.model.enums.TopLevelFeatureType; +import de.hft.stuttgart.quality.model.types.Checking; + +import de.hft.stuttgart.quality.QualityADEModule; + +import org.xmlobjects.annotation.XMLElement; +import org.xmlobjects.builder.ObjectBuildException; +import org.xmlobjects.builder.ObjectBuilder; +import org.xmlobjects.serializer.ObjectSerializeException; +import org.xmlobjects.serializer.ObjectSerializer; +import org.xmlobjects.stream.XMLReadException; +import org.xmlobjects.stream.XMLReader; +import org.xmlobjects.stream.XMLWriteException; +import org.xmlobjects.stream.XMLWriter; +import org.xmlobjects.xml.Attributes; +import org.xmlobjects.xml.Element; +import org.xmlobjects.xml.Namespaces; + +import javax.xml.namespace.QName; + +@XMLElement(name = "Checking", namespaceURI = QualityADEModule.NAMESPACE_URI) +public class CheckingAdapter implements ObjectBuilder, ObjectSerializer { + + @Override + public Checking createObject(QName name, Object parent) throws ObjectBuildException { + return new Checking(); + } + + @Override + public void buildChildObject(Checking object, QName name, Attributes attributes, XMLReader reader) + throws ObjectBuildException, XMLReadException { + if (!QualityADEModule.NAMESPACE_URI.equals(name.getNamespaceURI())) { + return; + } + switch (name.getLocalPart()) { + case "featureType" -> reader.getTextContent() + .ifPresent(s -> object.setFeatureType(TopLevelFeatureType.valueOf(s))); + default -> throw new IllegalStateException("Cannot handle name " + name + " when building Checking element"); + } + } + + @Override + public Element createElement(Checking object, Namespaces namespaces) throws ObjectSerializeException { + return Element.of(QualityADEModule.NAMESPACE_URI, "Checking"); + } + + @Override + public void writeChildElements(Checking object, Namespaces namespaces, XMLWriter writer) + throws ObjectSerializeException, XMLWriteException { + if (object.getFeatureType() != null) { + writer.writeElement(Element.of(QualityADEModule.NAMESPACE_URI, "featureType") + .addTextContent(object.getFeatureType().toString())); + } + } +} diff --git a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/CityObjectPropertiesAdapter.java b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/CityObjectPropertiesAdapter.java new file mode 100644 index 0000000..1bf8825 --- /dev/null +++ b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/CityObjectPropertiesAdapter.java @@ -0,0 +1,47 @@ +package de.hft.stuttgart.quality.adapter.types; + +import javax.xml.namespace.QName; + +import org.xmlobjects.annotation.XMLElement; +import org.xmlobjects.builder.ObjectBuildException; +import org.xmlobjects.builder.ObjectBuilder; +import org.xmlobjects.serializer.ObjectSerializeException; +import org.xmlobjects.serializer.ObjectSerializer; +import org.xmlobjects.stream.XMLReadException; +import org.xmlobjects.stream.XMLReader; +import org.xmlobjects.stream.XMLWriteException; +import org.xmlobjects.stream.XMLWriter; +import org.xmlobjects.xml.Attributes; +import org.xmlobjects.xml.Element; +import org.xmlobjects.xml.Namespaces; + +import de.hft.stuttgart.quality.QualityADEModule; +import de.hft.stuttgart.quality.adapter.properties.ValidationResultPropertyAdapter; +import de.hft.stuttgart.quality.model.types.CityObjectProperties; + +@XMLElement(name = "validationResult", namespaceURI = QualityADEModule.NAMESPACE_URI) +public class CityObjectPropertiesAdapter implements ObjectBuilder, ObjectSerializer { + + @Override + public CityObjectProperties createObject(QName name, Object parent) throws ObjectBuildException { + return new CityObjectProperties(); + } + + @Override + public void buildChildObject(CityObjectProperties object, QName name, Attributes attributes, XMLReader reader) throws ObjectBuildException, XMLReadException { + if (!QualityADEModule.NAMESPACE_URI.equals(name.getNamespaceURI())) { + return; + } + switch (name.getLocalPart()) { + case "validationResult" -> object.setValidationResult(reader.getObjectUsingBuilder(ValidationResultPropertyAdapter.class)); + default -> throw new IllegalStateException("Cannot handle name " + name + " when building CityObjectProperties element"); + } + } + + @Override + public void writeChildElements(CityObjectProperties object, Namespaces namespaces, XMLWriter writer) throws ObjectSerializeException, XMLWriteException { + if (object.getValidationResult() != null) { + writer.writeElementUsingSerializer(Element.of(QualityADEModule.NAMESPACE_URI, "validationResult"), object.getValidationResult(), ValidationResultPropertyAdapter.class, namespaces); + } + } +} diff --git a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/ComponentListAdapter.java b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/ComponentListAdapter.java new file mode 100644 index 0000000..017314e --- /dev/null +++ b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/ComponentListAdapter.java @@ -0,0 +1,58 @@ +package de.hft.stuttgart.quality.adapter.types; + +import javax.xml.namespace.QName; + +import org.xmlobjects.annotation.XMLElement; +import org.xmlobjects.builder.ObjectBuildException; +import org.xmlobjects.builder.ObjectBuilder; +import org.xmlobjects.serializer.ObjectSerializeException; +import org.xmlobjects.serializer.ObjectSerializer; +import org.xmlobjects.stream.XMLReadException; +import org.xmlobjects.stream.XMLReader; +import org.xmlobjects.stream.XMLWriteException; +import org.xmlobjects.stream.XMLWriter; +import org.xmlobjects.xml.Attributes; +import org.xmlobjects.xml.Element; +import org.xmlobjects.xml.Namespaces; + +import de.hft.stuttgart.quality.QualityADEModule; +import de.hft.stuttgart.quality.adapter.properties.PolygonIdListPropertyAdapter; +import de.hft.stuttgart.quality.model.properties.PolygonIdListProperty; +import de.hft.stuttgart.quality.model.types.ComponentList; + +@XMLElement(name = "ComponentList", namespaceURI = QualityADEModule.NAMESPACE_URI) +public class ComponentListAdapter implements ObjectBuilder, ObjectSerializer { + + @Override + public ComponentList createObject(QName name, Object parent) throws ObjectBuildException { + return new ComponentList(); + } + + @Override + public void buildChildObject(ComponentList object, QName name, Attributes attributes, XMLReader reader) + throws ObjectBuildException, XMLReadException { + if (!QualityADEModule.NAMESPACE_URI.equals(name.getNamespaceURI())) { + return; + } + switch (name.getLocalPart()) { + case "component" -> object.getComponents() + .add(reader.getObjectUsingBuilder(PolygonIdListPropertyAdapter.class)); + default -> throw new IllegalStateException( + "Cannot handle name " + name + " when building ComponentList element"); + } + } + + @Override + public Element createElement(ComponentList object, Namespaces namespaces) throws ObjectSerializeException { + return Element.of(QualityADEModule.NAMESPACE_URI, "ComponentList"); + } + + @Override + public void writeChildElements(ComponentList object, Namespaces namespaces, XMLWriter writer) + throws ObjectSerializeException, XMLWriteException { + for (PolygonIdListProperty listProperty : object.getComponents()) { + writer.writeElementUsingSerializer(Element.of(QualityADEModule.NAMESPACE_URI, "component"), listProperty, + PolygonIdListPropertyAdapter.class, namespaces); + } + } +} diff --git a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/ConsecutivePointsSameErrorAdapter.java b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/ConsecutivePointsSameErrorAdapter.java new file mode 100644 index 0000000..36c407a --- /dev/null +++ b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/ConsecutivePointsSameErrorAdapter.java @@ -0,0 +1,61 @@ +package de.hft.stuttgart.quality.adapter.types; + +import javax.xml.namespace.QName; + +import org.xmlobjects.annotation.XMLElement; +import org.xmlobjects.builder.ObjectBuildException; +import org.xmlobjects.gml.adapter.geometry.DirectPositionAdapter; +import org.xmlobjects.serializer.ObjectSerializeException; +import org.xmlobjects.stream.XMLReadException; +import org.xmlobjects.stream.XMLReader; +import org.xmlobjects.stream.XMLWriteException; +import org.xmlobjects.stream.XMLWriter; +import org.xmlobjects.xml.Attributes; +import org.xmlobjects.xml.Element; +import org.xmlobjects.xml.Namespaces; + +import de.hft.stuttgart.quality.QualityADEModule; +import de.hft.stuttgart.quality.model.types.ConsecutivePointsSameError; + +@XMLElement(name = "GE_R_CONSECUTIVE_POINTS_SAME", namespaceURI = QualityADEModule.NAMESPACE_URI) +public class ConsecutivePointsSameErrorAdapter extends AbstractRingErrorAdapter { + + @Override + public ConsecutivePointsSameError createObject(QName name, Object parent) throws ObjectBuildException { + return new ConsecutivePointsSameError(); + } + + @Override + public void buildChildObject(ConsecutivePointsSameError object, QName name, Attributes attributes, XMLReader reader) + throws ObjectBuildException, XMLReadException { + if (!QualityADEModule.NAMESPACE_URI.equals(name.getNamespaceURI())) { + return; + } + switch (name.getLocalPart()) { + case "vertex1" -> object.setVertex1(reader.getObjectUsingBuilder(DirectPositionAdapter.class)); + case "vertex2" -> object.setVertex2(reader.getObjectUsingBuilder(DirectPositionAdapter.class)); + default -> super.buildChildObject(object, name, attributes, reader); + } + } + + @Override + public Element createElement(ConsecutivePointsSameError object, Namespaces namespaces) + throws ObjectSerializeException { + return Element.of(QualityADEModule.NAMESPACE_URI, "GE_R_CONSECUTIVE_POINTS_SAME"); + } + + @Override + public void writeChildElements(ConsecutivePointsSameError object, Namespaces namespaces, XMLWriter writer) + throws ObjectSerializeException, XMLWriteException { + super.writeChildElements(object, namespaces, writer); + + if (object.getVertex1() != null) { + writer.writeElementUsingSerializer(Element.of(QualityADEModule.NAMESPACE_URI, "vertex1"), + object.getVertex1(), DirectPositionAdapter.class, namespaces); + } + if (object.getVertex2() != null) { + writer.writeElementUsingSerializer(Element.of(QualityADEModule.NAMESPACE_URI, "vertex2"), + object.getVertex2(), DirectPositionAdapter.class, namespaces); + } + } +} diff --git a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/EdgeAdapter.java b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/EdgeAdapter.java new file mode 100644 index 0000000..0558c40 --- /dev/null +++ b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/EdgeAdapter.java @@ -0,0 +1,56 @@ +package de.hft.stuttgart.quality.adapter.types; + +import javax.xml.namespace.QName; + +import org.xmlobjects.annotation.XMLElement; +import org.xmlobjects.builder.ObjectBuildException; +import org.xmlobjects.builder.ObjectBuilder; +import org.xmlobjects.gml.adapter.geometry.DirectPositionAdapter; +import org.xmlobjects.serializer.ObjectSerializeException; +import org.xmlobjects.serializer.ObjectSerializer; +import org.xmlobjects.stream.XMLReadException; +import org.xmlobjects.stream.XMLReader; +import org.xmlobjects.stream.XMLWriteException; +import org.xmlobjects.stream.XMLWriter; +import org.xmlobjects.xml.Attributes; +import org.xmlobjects.xml.Element; +import org.xmlobjects.xml.Namespaces; + +import de.hft.stuttgart.quality.QualityADEModule; +import de.hft.stuttgart.quality.model.types.Edge; + +@XMLElement(name = "Edge", namespaceURI = QualityADEModule.NAMESPACE_URI) +public class EdgeAdapter implements ObjectBuilder, ObjectSerializer { + + @Override + public Edge createObject(QName name, Object parent) throws ObjectBuildException { + return new Edge(); + } + + @Override + public void buildChildObject(Edge object, QName name, Attributes attributes, XMLReader reader) throws ObjectBuildException, XMLReadException { + if (!QualityADEModule.NAMESPACE_URI.equals(name.getNamespaceURI())) { + return; + } + switch (name.getLocalPart()) { + case "from" -> object.setFrom(reader.getObjectUsingBuilder(DirectPositionAdapter.class)); + case "to" -> object.setTo(reader.getObjectUsingBuilder(DirectPositionAdapter.class)); + default -> throw new IllegalStateException("Cannot handle name " + name + " when building Edge element"); + } + } + + @Override + public Element createElement(Edge object, Namespaces namespaces) throws ObjectSerializeException { + return Element.of(QualityADEModule.NAMESPACE_URI, "Edge"); + } + + @Override + public void writeChildElements(Edge object, Namespaces namespaces, XMLWriter writer) throws ObjectSerializeException, XMLWriteException { + if (object.getFrom() != null) { + writer.writeElementUsingSerializer(Element.of(QualityADEModule.NAMESPACE_URI, "from"), object.getFrom(), DirectPositionAdapter.class, namespaces); + } + if (object.getTo() != null) { + writer.writeElementUsingSerializer(Element.of(QualityADEModule.NAMESPACE_URI, "to"), object.getTo(), DirectPositionAdapter.class, namespaces); + } + } +} diff --git a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/EdgeListAdapter.java b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/EdgeListAdapter.java new file mode 100644 index 0000000..60e23c8 --- /dev/null +++ b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/EdgeListAdapter.java @@ -0,0 +1,55 @@ +package de.hft.stuttgart.quality.adapter.types; + +import javax.xml.namespace.QName; + +import org.xmlobjects.annotation.XMLElement; +import org.xmlobjects.builder.ObjectBuildException; +import org.xmlobjects.builder.ObjectBuilder; +import org.xmlobjects.serializer.ObjectSerializeException; +import org.xmlobjects.serializer.ObjectSerializer; +import org.xmlobjects.stream.XMLReadException; +import org.xmlobjects.stream.XMLReader; +import org.xmlobjects.stream.XMLWriteException; +import org.xmlobjects.stream.XMLWriter; +import org.xmlobjects.xml.Attributes; +import org.xmlobjects.xml.Element; +import org.xmlobjects.xml.Namespaces; + +import de.hft.stuttgart.quality.QualityADEModule; +import de.hft.stuttgart.quality.adapter.properties.EdgePropertyAdapter; +import de.hft.stuttgart.quality.model.properties.EdgeProperty; +import de.hft.stuttgart.quality.model.types.EdgeList; + +@XMLElement(name = "EdgeList", namespaceURI = QualityADEModule.NAMESPACE_URI) +public class EdgeListAdapter implements ObjectBuilder, ObjectSerializer { + + @Override + public EdgeList createObject(QName name, Object parent) throws ObjectBuildException { + return new EdgeList(); + } + + @Override + public void buildChildObject(EdgeList object, QName name, Attributes attributes, XMLReader reader) + throws ObjectBuildException, XMLReadException { + if (!QualityADEModule.NAMESPACE_URI.equals(name.getNamespaceURI())) { + return; + } + switch (name.getLocalPart()) { + case "edge" -> object.getEdges().add(reader.getObjectUsingBuilder(EdgePropertyAdapter.class)); + default -> throw new IllegalStateException("Cannot handle name " + name + " when building EdgeList element"); + } + } + + @Override + public Element createElement(EdgeList object, Namespaces namespaces) throws ObjectSerializeException { + return Element.of(QualityADEModule.NAMESPACE_URI, "EdgeList"); + } + + @Override + public void writeChildElements(EdgeList object, Namespaces namespaces, XMLWriter writer) + throws ObjectSerializeException, XMLWriteException { + for (EdgeProperty edgeProp : object.getEdges()) { + writer.writeElementUsingSerializer(Element.of(QualityADEModule.NAMESPACE_URI, "edge"), edgeProp, EdgePropertyAdapter.class, namespaces); + } + } +} diff --git a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/ErrorAdapter.java b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/ErrorAdapter.java new file mode 100644 index 0000000..b2e6786 --- /dev/null +++ b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/ErrorAdapter.java @@ -0,0 +1,51 @@ +package de.hft.stuttgart.quality.adapter.types; + +import de.hft.stuttgart.quality.model.enums.ErrorId; +import de.hft.stuttgart.quality.model.types.Error; + +import de.hft.stuttgart.quality.QualityADEModule; +import org.xmlobjects.builder.ObjectBuildException; +import org.xmlobjects.builder.ObjectBuilder; +import org.xmlobjects.serializer.ObjectSerializeException; +import org.xmlobjects.serializer.ObjectSerializer; +import org.xmlobjects.stream.XMLReadException; +import org.xmlobjects.stream.XMLReader; +import org.xmlobjects.stream.XMLWriteException; +import org.xmlobjects.stream.XMLWriter; +import org.xmlobjects.xml.Attributes; +import org.xmlobjects.xml.Element; +import org.xmlobjects.xml.Namespaces; + +import javax.xml.namespace.QName; + +public class ErrorAdapter implements ObjectBuilder, ObjectSerializer { + + @Override + public Error createObject(QName name, Object parent) throws ObjectBuildException { + return new Error(); + } + + @Override + public void buildChildObject(Error object, QName name, Attributes attributes, XMLReader reader) + throws ObjectBuildException, XMLReadException { + if (!QualityADEModule.NAMESPACE_URI.equals(name.getNamespaceURI())) { + return; + } + switch (name.getLocalPart()) { + case "occurrences" -> reader.getTextContent().ifPresent(s -> object.setOccurrences(Integer.parseInt(s))); + case "name" -> reader.getTextContent().ifPresent(s -> object.setName(ErrorId.valueOf(s))); + default -> throw new IllegalStateException("Cannot handle name " + name + " when building Error element"); + } + } + + @Override + public void writeChildElements(Error object, Namespaces namespaces, XMLWriter writer) + throws ObjectSerializeException, XMLWriteException { + writer.writeElement(Element.of(QualityADEModule.NAMESPACE_URI, "occurrences") + .addTextContent(Integer.toString(object.getOccurrences()))); + if (object.getName() != null) { + writer.writeElement( + Element.of(QualityADEModule.NAMESPACE_URI, "name").addTextContent(object.getName().toString())); + } + } +} diff --git a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/FeatureStatisticsAdapter.java b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/FeatureStatisticsAdapter.java new file mode 100644 index 0000000..2041159 --- /dev/null +++ b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/FeatureStatisticsAdapter.java @@ -0,0 +1,57 @@ +package de.hft.stuttgart.quality.adapter.types; + +import de.hft.stuttgart.quality.model.types.FeatureStatistics; + +import de.hft.stuttgart.quality.QualityADEModule; + +import org.xmlobjects.annotation.XMLElement; +import org.xmlobjects.builder.ObjectBuildException; +import org.xmlobjects.builder.ObjectBuilder; +import org.xmlobjects.serializer.ObjectSerializeException; +import org.xmlobjects.serializer.ObjectSerializer; +import org.xmlobjects.stream.XMLReadException; +import org.xmlobjects.stream.XMLReader; +import org.xmlobjects.stream.XMLWriteException; +import org.xmlobjects.stream.XMLWriter; +import org.xmlobjects.xml.Attributes; +import org.xmlobjects.xml.Element; +import org.xmlobjects.xml.Namespaces; + +import javax.xml.namespace.QName; + +@XMLElement(name = "FeatureStatistics", namespaceURI = QualityADEModule.NAMESPACE_URI) +public class FeatureStatisticsAdapter implements ObjectBuilder, ObjectSerializer { + + @Override + public FeatureStatistics createObject(QName name, Object parent) throws ObjectBuildException { + return new FeatureStatistics(); + } + + @Override + public void buildChildObject(FeatureStatistics object, QName name, Attributes attributes, XMLReader reader) + throws ObjectBuildException, XMLReadException { + if (!QualityADEModule.NAMESPACE_URI.equals(name.getNamespaceURI())) { + return; + } + switch (name.getLocalPart()) { + case "numChecked" -> reader.getTextContent().ifPresent(s -> object.setNumChecked(Integer.parseInt(s))); + case "numErrors" -> reader.getTextContent().ifPresent(s -> object.setNumErrors(Integer.parseInt(s))); + default -> throw new IllegalStateException( + "Cannot handle name " + name + " when building FeatureStatistics element"); + } + } + + @Override + public Element createElement(FeatureStatistics object, Namespaces namespaces) throws ObjectSerializeException { + return Element.of(QualityADEModule.NAMESPACE_URI, "FeatureStatistics"); + } + + @Override + public void writeChildElements(FeatureStatistics object, Namespaces namespaces, XMLWriter writer) + throws ObjectSerializeException, XMLWriteException { + writer.writeElement(Element.of(QualityADEModule.NAMESPACE_URI, "numChecked") + .addTextContent(Integer.toString(object.getNumChecked()))); + writer.writeElement(Element.of(QualityADEModule.NAMESPACE_URI, "numErrors") + .addTextContent(Integer.toString(object.getNumErrors()))); + } +} diff --git a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/FilterAdapter.java b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/FilterAdapter.java new file mode 100644 index 0000000..dd38819 --- /dev/null +++ b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/FilterAdapter.java @@ -0,0 +1,56 @@ +package de.hft.stuttgart.quality.adapter.types; + +import javax.xml.namespace.QName; + +import org.xmlobjects.annotation.XMLElement; +import org.xmlobjects.builder.ObjectBuildException; +import org.xmlobjects.builder.ObjectBuilder; +import org.xmlobjects.serializer.ObjectSerializeException; +import org.xmlobjects.serializer.ObjectSerializer; +import org.xmlobjects.stream.XMLReadException; +import org.xmlobjects.stream.XMLReader; +import org.xmlobjects.stream.XMLWriteException; +import org.xmlobjects.stream.XMLWriter; +import org.xmlobjects.xml.Attributes; +import org.xmlobjects.xml.Element; +import org.xmlobjects.xml.Namespaces; + +import de.hft.stuttgart.quality.QualityADEModule; +import de.hft.stuttgart.quality.adapter.properties.CheckingPropertyAdapter; +import de.hft.stuttgart.quality.model.properties.CheckingProperty; +import de.hft.stuttgart.quality.model.types.Filter; + +@XMLElement(name = "Filter", namespaceURI = QualityADEModule.NAMESPACE_URI) +public class FilterAdapter implements ObjectBuilder, ObjectSerializer { + + @Override + public Filter createObject(QName name, Object parent) throws ObjectBuildException { + return new Filter(); + } + + @Override + public void buildChildObject(Filter object, QName name, Attributes attributes, XMLReader reader) + throws ObjectBuildException, XMLReadException { + if (!QualityADEModule.NAMESPACE_URI.equals(name.getNamespaceURI())) { + return; + } + switch (name.getLocalPart()) { + case "checking" -> object.getChecking().add(reader.getObjectUsingBuilder(CheckingPropertyAdapter.class)); + default -> throw new IllegalStateException("Cannot handle name " + name + " when building Filter element"); + } + } + + @Override + public Element createElement(Filter object, Namespaces namespaces) throws ObjectSerializeException { + return Element.of(QualityADEModule.NAMESPACE_URI, "Filter"); + } + + @Override + public void writeChildElements(Filter object, Namespaces namespaces, XMLWriter writer) + throws ObjectSerializeException, XMLWriteException { + for (CheckingProperty checkProp : object.getChecking()) { + writer.writeElementUsingSerializer(Element.of(QualityADEModule.NAMESPACE_URI, "checking"), checkProp, + CheckingPropertyAdapter.class, namespaces); + } + } +} diff --git a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/GlobalParametersAdapter.java b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/GlobalParametersAdapter.java new file mode 100644 index 0000000..2eb7fe3 --- /dev/null +++ b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/GlobalParametersAdapter.java @@ -0,0 +1,57 @@ +package de.hft.stuttgart.quality.adapter.types; + +import javax.xml.namespace.QName; + +import org.xmlobjects.annotation.XMLElement; +import org.xmlobjects.builder.ObjectBuildException; +import org.xmlobjects.builder.ObjectBuilder; +import org.xmlobjects.serializer.ObjectSerializeException; +import org.xmlobjects.serializer.ObjectSerializer; +import org.xmlobjects.stream.XMLReadException; +import org.xmlobjects.stream.XMLReader; +import org.xmlobjects.stream.XMLWriteException; +import org.xmlobjects.stream.XMLWriter; +import org.xmlobjects.xml.Attributes; +import org.xmlobjects.xml.Element; +import org.xmlobjects.xml.Namespaces; + +import de.hft.stuttgart.quality.QualityADEModule; +import de.hft.stuttgart.quality.adapter.properties.ParameterPropertyAdapter; +import de.hft.stuttgart.quality.model.properties.ParameterProperty; +import de.hft.stuttgart.quality.model.types.GlobalParameters; + +@XMLElement(name = "GlobalParameters", namespaceURI = QualityADEModule.NAMESPACE_URI) +public class GlobalParametersAdapter implements ObjectBuilder, ObjectSerializer { + + @Override + public GlobalParameters createObject(QName name, Object parent) throws ObjectBuildException { + return new GlobalParameters(); + } + + @Override + public void buildChildObject(GlobalParameters object, QName name, Attributes attributes, XMLReader reader) + throws ObjectBuildException, XMLReadException { + if (!QualityADEModule.NAMESPACE_URI.equals(name.getNamespaceURI())) { + return; + } + switch (name.getLocalPart()) { + case "parameter" -> object.getParameters().add(reader.getObjectUsingBuilder(ParameterPropertyAdapter.class)); + default -> throw new IllegalStateException( + "Cannot handle name " + name + " when building GlobalParameters element"); + } + } + + @Override + public Element createElement(GlobalParameters object, Namespaces namespaces) throws ObjectSerializeException { + return Element.of(QualityADEModule.NAMESPACE_URI, "GlobalParameters"); + } + + @Override + public void writeChildElements(GlobalParameters object, Namespaces namespaces, XMLWriter writer) + throws ObjectSerializeException, XMLWriteException { + for (ParameterProperty gpp : object.getParameters()) { + writer.writeElementUsingSerializer(Element.of(QualityADEModule.NAMESPACE_URI, "parameter"), gpp, + ParameterPropertyAdapter.class, namespaces); + } + } +} diff --git a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/HoleOutsideErrorAdapter.java b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/HoleOutsideErrorAdapter.java new file mode 100644 index 0000000..03cc18f --- /dev/null +++ b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/HoleOutsideErrorAdapter.java @@ -0,0 +1,54 @@ +package de.hft.stuttgart.quality.adapter.types; + +import javax.xml.namespace.QName; + +import org.xmlobjects.annotation.XMLElement; +import org.xmlobjects.builder.ObjectBuildException; +import org.xmlobjects.serializer.ObjectSerializeException; +import org.xmlobjects.stream.XMLReadException; +import org.xmlobjects.stream.XMLReader; +import org.xmlobjects.stream.XMLWriteException; +import org.xmlobjects.stream.XMLWriter; +import org.xmlobjects.xml.Attributes; +import org.xmlobjects.xml.Element; +import org.xmlobjects.xml.Namespaces; + +import de.hft.stuttgart.quality.QualityADEModule; +import de.hft.stuttgart.quality.model.types.HoleOutsideError; + +@XMLElement(name = "GE_P_HOLE_OUTSIDE", namespaceURI = QualityADEModule.NAMESPACE_URI) +public class HoleOutsideErrorAdapter extends AbstractPolygonErrorAdapter { + + @Override + public HoleOutsideError createObject(QName name, Object parent) throws ObjectBuildException { + return new HoleOutsideError(); + } + + @Override + public void buildChildObject(HoleOutsideError object, QName name, Attributes attributes, XMLReader reader) + throws ObjectBuildException, XMLReadException { + if (!QualityADEModule.NAMESPACE_URI.equals(name.getNamespaceURI())) { + return; + } + switch (name.getLocalPart()) { + case "linearRingId" -> reader.getTextContent().ifPresent(object::setLinearRingId); + default -> super.buildChildObject(object, name, attributes, reader); + } + } + + @Override + public Element createElement(HoleOutsideError object, Namespaces namespaces) throws ObjectSerializeException { + return Element.of(QualityADEModule.NAMESPACE_URI, "GE_P_HOLE_OUTSIDE"); + } + + @Override + public void writeChildElements(HoleOutsideError object, Namespaces namespaces, XMLWriter writer) + throws ObjectSerializeException, XMLWriteException { + super.writeChildElements(object, namespaces, writer); + + if (object.getLinearRingId() != null) { + writer.writeElement(Element.of(QualityADEModule.NAMESPACE_URI, "linearRingId") + .addTextContent(object.getLinearRingId())); + } + } +} diff --git a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/InnerRingsNestedErrorAdapter.java b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/InnerRingsNestedErrorAdapter.java new file mode 100644 index 0000000..5553025 --- /dev/null +++ b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/InnerRingsNestedErrorAdapter.java @@ -0,0 +1,58 @@ +package de.hft.stuttgart.quality.adapter.types; + +import javax.xml.namespace.QName; + +import org.xmlobjects.annotation.XMLElement; +import org.xmlobjects.builder.ObjectBuildException; +import org.xmlobjects.serializer.ObjectSerializeException; +import org.xmlobjects.stream.XMLReadException; +import org.xmlobjects.stream.XMLReader; +import org.xmlobjects.stream.XMLWriteException; +import org.xmlobjects.stream.XMLWriter; +import org.xmlobjects.xml.Attributes; +import org.xmlobjects.xml.Element; +import org.xmlobjects.xml.Namespaces; + +import de.hft.stuttgart.quality.QualityADEModule; +import de.hft.stuttgart.quality.model.types.InnerRingsNestedError; + +@XMLElement(name = "GE_P_INNER_RINGS_NESTED", namespaceURI = QualityADEModule.NAMESPACE_URI) +public class InnerRingsNestedErrorAdapter extends AbstractPolygonErrorAdapter { + + @Override + public InnerRingsNestedError createObject(QName name, Object parent) throws ObjectBuildException { + return new InnerRingsNestedError(); + } + + @Override + public void buildChildObject(InnerRingsNestedError object, QName name, Attributes attributes, XMLReader reader) + throws ObjectBuildException, XMLReadException { + if (!QualityADEModule.NAMESPACE_URI.equals(name.getNamespaceURI())) { + return; + } + switch (name.getLocalPart()) { + case "linearRingId1" -> reader.getTextContent().ifPresent(object::setLinearRingId1); + case "linearRingId2" -> reader.getTextContent().ifPresent(object::setLinearRingId2); + default -> super.buildChildObject(object, name, attributes, reader); + } + } + + @Override + public Element createElement(InnerRingsNestedError object, Namespaces namespaces) throws ObjectSerializeException { + return Element.of(QualityADEModule.NAMESPACE_URI, "GE_P_INNER_RINGS_NESTED"); + } + + @Override + public void writeChildElements(InnerRingsNestedError object, Namespaces namespaces, XMLWriter writer) + throws ObjectSerializeException, XMLWriteException { + super.writeChildElements(object, namespaces, writer); + if (object.getLinearRingId1() != null) { + writer.writeElement(Element.of(QualityADEModule.NAMESPACE_URI, "linearRingId1") + .addTextContent(object.getLinearRingId1())); + } + if (object.getLinearRingId2() != null) { + writer.writeElement(Element.of(QualityADEModule.NAMESPACE_URI, "linearRingId2") + .addTextContent(object.getLinearRingId2())); + } + } +} diff --git a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/InteriorDisconnectedErrorAdapter.java b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/InteriorDisconnectedErrorAdapter.java new file mode 100644 index 0000000..c530f04 --- /dev/null +++ b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/InteriorDisconnectedErrorAdapter.java @@ -0,0 +1,28 @@ +package de.hft.stuttgart.quality.adapter.types; + +import javax.xml.namespace.QName; + +import org.xmlobjects.annotation.XMLElement; +import org.xmlobjects.builder.ObjectBuildException; +import org.xmlobjects.serializer.ObjectSerializeException; +import org.xmlobjects.xml.Element; +import org.xmlobjects.xml.Namespaces; + +import de.hft.stuttgart.quality.QualityADEModule; +import de.hft.stuttgart.quality.model.types.InteriorDisconnectedError; + +@XMLElement(name = "GE_P_INTERIOR_DISCONNECTED", namespaceURI = QualityADEModule.NAMESPACE_URI) +public class InteriorDisconnectedErrorAdapter extends AbstractPolygonErrorAdapter { + + @Override + public InteriorDisconnectedError createObject(QName name, Object parent) throws ObjectBuildException { + return new InteriorDisconnectedError(); + } + + @Override + public Element createElement(InteriorDisconnectedError object, Namespaces namespaces) + throws ObjectSerializeException { + return Element.of(QualityADEModule.NAMESPACE_URI, "GE_P_INTERIOR_DISCONNECTED"); + } + +} diff --git a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/IntersectingRingsErrorAdapter.java b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/IntersectingRingsErrorAdapter.java new file mode 100644 index 0000000..e99c910 --- /dev/null +++ b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/IntersectingRingsErrorAdapter.java @@ -0,0 +1,59 @@ +package de.hft.stuttgart.quality.adapter.types; + +import javax.xml.namespace.QName; + +import org.xmlobjects.annotation.XMLElement; +import org.xmlobjects.builder.ObjectBuildException; +import org.xmlobjects.serializer.ObjectSerializeException; +import org.xmlobjects.stream.XMLReadException; +import org.xmlobjects.stream.XMLReader; +import org.xmlobjects.stream.XMLWriteException; +import org.xmlobjects.stream.XMLWriter; +import org.xmlobjects.xml.Attributes; +import org.xmlobjects.xml.Element; +import org.xmlobjects.xml.Namespaces; + +import de.hft.stuttgart.quality.QualityADEModule; +import de.hft.stuttgart.quality.model.types.IntersectingRingsError; + +@XMLElement(name = "GE_P_INTERSECTING_RINGS", namespaceURI = QualityADEModule.NAMESPACE_URI) +public class IntersectingRingsErrorAdapter extends AbstractPolygonErrorAdapter { + + @Override + public IntersectingRingsError createObject(QName name, Object parent) throws ObjectBuildException { + return new IntersectingRingsError(); + } + + @Override + public void buildChildObject(IntersectingRingsError object, QName name, Attributes attributes, XMLReader reader) + throws ObjectBuildException, XMLReadException { + if (!QualityADEModule.NAMESPACE_URI.equals(name.getNamespaceURI())) { + return; + } + switch (name.getLocalPart()) { + case "linearRingId1" -> reader.getTextContent().ifPresent(object::setLinearRingId1); + case "linearRingId2" -> reader.getTextContent().ifPresent(object::setLinearRingId2); + default -> super.buildChildObject(object, name, attributes, reader); + } + } + + @Override + public Element createElement(IntersectingRingsError object, Namespaces namespaces) throws ObjectSerializeException { + return Element.of(QualityADEModule.NAMESPACE_URI, "GE_P_INTERSECTING_RINGS"); + } + + @Override + public void writeChildElements(IntersectingRingsError object, Namespaces namespaces, XMLWriter writer) + throws ObjectSerializeException, XMLWriteException { + super.writeChildElements(object, namespaces, writer); + + if (object.getLinearRingId1() != null) { + writer.writeElement(Element.of(QualityADEModule.NAMESPACE_URI, "linearRingId1") + .addTextContent(object.getLinearRingId1())); + } + if (object.getLinearRingId2() != null) { + writer.writeElement(Element.of(QualityADEModule.NAMESPACE_URI, "linearRingId2") + .addTextContent(object.getLinearRingId2())); + } + } +} diff --git a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/MultipleComponentsErrorAdapter.java b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/MultipleComponentsErrorAdapter.java new file mode 100644 index 0000000..b5baafb --- /dev/null +++ b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/MultipleComponentsErrorAdapter.java @@ -0,0 +1,56 @@ +package de.hft.stuttgart.quality.adapter.types; + +import javax.xml.namespace.QName; + +import org.xmlobjects.annotation.XMLElement; +import org.xmlobjects.builder.ObjectBuildException; +import org.xmlobjects.serializer.ObjectSerializeException; +import org.xmlobjects.stream.XMLReadException; +import org.xmlobjects.stream.XMLReader; +import org.xmlobjects.stream.XMLWriteException; +import org.xmlobjects.stream.XMLWriter; +import org.xmlobjects.xml.Attributes; +import org.xmlobjects.xml.Element; +import org.xmlobjects.xml.Namespaces; + +import de.hft.stuttgart.quality.QualityADEModule; +import de.hft.stuttgart.quality.adapter.properties.ComponentListPropertyAdapter; +import de.hft.stuttgart.quality.model.properties.ComponentListProperty; +import de.hft.stuttgart.quality.model.types.MultipleComponentsError; + +@XMLElement(name = "GE_S_MULTIPLE_CONNECTED_COMPONENTS", namespaceURI = QualityADEModule.NAMESPACE_URI) +public class MultipleComponentsErrorAdapter extends AbstractSolidErrorAdapter { + + @Override + public MultipleComponentsError createObject(QName name, Object parent) throws ObjectBuildException { + return new MultipleComponentsError(); + } + + @Override + public void buildChildObject(MultipleComponentsError object, QName name, Attributes attributes, XMLReader reader) + throws ObjectBuildException, XMLReadException { + if (!QualityADEModule.NAMESPACE_URI.equals(name.getNamespaceURI())) { + return; + } + switch (name.getLocalPart()) { + case "components" -> object.getComponents().add(reader.getObjectUsingBuilder(ComponentListPropertyAdapter.class)); + default -> super.buildChildObject(object, name, attributes, reader); + } + } + + @Override + public Element createElement(MultipleComponentsError object, Namespaces namespaces) + throws ObjectSerializeException { + return Element.of(QualityADEModule.NAMESPACE_URI, "GE_S_MULTIPLE_CONNECTED_COMPONENTS"); + } + + @Override + public void writeChildElements(MultipleComponentsError object, Namespaces namespaces, XMLWriter writer) + throws ObjectSerializeException, XMLWriteException { + super.writeChildElements(object, namespaces, writer); + for (ComponentListProperty clp : object.getComponents()) { + writer.writeElementUsingSerializer(Element.of(QualityADEModule.NAMESPACE_URI, "components"), clp, + ComponentListPropertyAdapter.class, namespaces); + } + } +} diff --git a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/NonManifoldEdgeErrorAdapter.java b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/NonManifoldEdgeErrorAdapter.java new file mode 100644 index 0000000..3ed6e7b --- /dev/null +++ b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/NonManifoldEdgeErrorAdapter.java @@ -0,0 +1,54 @@ +package de.hft.stuttgart.quality.adapter.types; + +import javax.xml.namespace.QName; + +import org.xmlobjects.annotation.XMLElement; +import org.xmlobjects.builder.ObjectBuildException; +import org.xmlobjects.serializer.ObjectSerializeException; +import org.xmlobjects.stream.XMLReadException; +import org.xmlobjects.stream.XMLReader; +import org.xmlobjects.stream.XMLWriteException; +import org.xmlobjects.stream.XMLWriter; +import org.xmlobjects.xml.Attributes; +import org.xmlobjects.xml.Element; +import org.xmlobjects.xml.Namespaces; + +import de.hft.stuttgart.quality.QualityADEModule; +import de.hft.stuttgart.quality.adapter.properties.EdgeListPropertyAdapter; +import de.hft.stuttgart.quality.model.types.NonManifoldEdgeError; + +@XMLElement(name = "GE_S_NON_MANIFOLD_EDGE", namespaceURI = QualityADEModule.NAMESPACE_URI) +public class NonManifoldEdgeErrorAdapter extends AbstractSolidErrorAdapter { + + @Override + public NonManifoldEdgeError createObject(QName name, Object parent) throws ObjectBuildException { + return new NonManifoldEdgeError(); + } + + @Override + public void buildChildObject(NonManifoldEdgeError object, QName name, Attributes attributes, XMLReader reader) + throws ObjectBuildException, XMLReadException { + if (!QualityADEModule.NAMESPACE_URI.equals(name.getNamespaceURI())) { + return; + } + switch (name.getLocalPart()) { + case "edges" -> object.setEdges(reader.getObjectUsingBuilder(EdgeListPropertyAdapter.class)); + default -> super.buildChildObject(object, name, attributes, reader); + } + } + + @Override + public Element createElement(NonManifoldEdgeError object, Namespaces namespaces) throws ObjectSerializeException { + return Element.of(QualityADEModule.NAMESPACE_URI, "GE_S_NON_MANIFOLD_EDGE"); + } + + @Override + public void writeChildElements(NonManifoldEdgeError object, Namespaces namespaces, XMLWriter writer) + throws ObjectSerializeException, XMLWriteException { + super.writeChildElements(object, namespaces, writer); + if (object.getEdges() != null) { + writer.writeElementUsingSerializer(Element.of(QualityADEModule.NAMESPACE_URI, "edges"), object.getEdges(), + EdgeListPropertyAdapter.class, namespaces); + } + } +} diff --git a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/NonManifoldVertexErrorAdapter.java b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/NonManifoldVertexErrorAdapter.java new file mode 100644 index 0000000..79dfb5a --- /dev/null +++ b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/NonManifoldVertexErrorAdapter.java @@ -0,0 +1,51 @@ +package de.hft.stuttgart.quality.adapter.types; + +import javax.xml.namespace.QName; + +import org.xmlobjects.annotation.XMLElement; +import org.xmlobjects.builder.ObjectBuildException; +import org.xmlobjects.gml.adapter.geometry.DirectPositionAdapter; +import org.xmlobjects.serializer.ObjectSerializeException; +import org.xmlobjects.stream.XMLReadException; +import org.xmlobjects.stream.XMLReader; +import org.xmlobjects.stream.XMLWriteException; +import org.xmlobjects.stream.XMLWriter; +import org.xmlobjects.xml.Attributes; +import org.xmlobjects.xml.Element; +import org.xmlobjects.xml.Namespaces; + +import de.hft.stuttgart.quality.QualityADEModule; +import de.hft.stuttgart.quality.model.types.NonManifoldVertexError; + +@XMLElement(name = "GE_S_NON_MANIFOLD_VERTEX", namespaceURI = QualityADEModule.NAMESPACE_URI) +public class NonManifoldVertexErrorAdapter extends AbstractSolidErrorAdapter { + + @Override + public NonManifoldVertexError createObject(QName name, Object parent) throws ObjectBuildException { + return new NonManifoldVertexError(); + } + + @Override + public void buildChildObject(NonManifoldVertexError object, QName name, Attributes attributes, XMLReader reader) throws ObjectBuildException, XMLReadException { + if (!QualityADEModule.NAMESPACE_URI.equals(name.getNamespaceURI())) { + return; + } + switch (name.getLocalPart()) { + case "vertex" -> object.setVertex(reader.getObjectUsingBuilder(DirectPositionAdapter.class)); + default -> super.buildChildObject(object, name, attributes, reader); + } + } + + @Override + public Element createElement(NonManifoldVertexError object, Namespaces namespaces) throws ObjectSerializeException { + return Element.of(QualityADEModule.NAMESPACE_URI, "GE_S_NON_MANIFOLD_VERTEX"); + } + + @Override + public void writeChildElements(NonManifoldVertexError object, Namespaces namespaces, XMLWriter writer) throws ObjectSerializeException, XMLWriteException { + super.writeChildElements(object, namespaces, writer); + if (object.getVertex() != null) { + writer.writeElementUsingSerializer(Element.of(QualityADEModule.NAMESPACE_URI, "vertex"), object.getVertex(), DirectPositionAdapter.class, namespaces); + } + } +} diff --git a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/OrientationRingsSameErrorAdapter.java b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/OrientationRingsSameErrorAdapter.java new file mode 100644 index 0000000..ad8263c --- /dev/null +++ b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/OrientationRingsSameErrorAdapter.java @@ -0,0 +1,54 @@ +package de.hft.stuttgart.quality.adapter.types; + +import javax.xml.namespace.QName; + +import org.xmlobjects.annotation.XMLElement; +import org.xmlobjects.builder.ObjectBuildException; +import org.xmlobjects.serializer.ObjectSerializeException; +import org.xmlobjects.stream.XMLReadException; +import org.xmlobjects.stream.XMLReader; +import org.xmlobjects.stream.XMLWriteException; +import org.xmlobjects.stream.XMLWriter; +import org.xmlobjects.xml.Attributes; +import org.xmlobjects.xml.Element; +import org.xmlobjects.xml.Namespaces; + +import de.hft.stuttgart.quality.QualityADEModule; +import de.hft.stuttgart.quality.model.types.OrientationRingsSameError; + +@XMLElement(name = "GE_P_ORIENTATION_RINGS_SAME", namespaceURI = QualityADEModule.NAMESPACE_URI) +public class OrientationRingsSameErrorAdapter extends AbstractPolygonErrorAdapter { + + @Override + public OrientationRingsSameError createObject(QName name, Object parent) throws ObjectBuildException { + return new OrientationRingsSameError(); + } + + @Override + public void buildChildObject(OrientationRingsSameError object, QName name, Attributes attributes, XMLReader reader) + throws ObjectBuildException, XMLReadException { + if (!QualityADEModule.NAMESPACE_URI.equals(name.getNamespaceURI())) { + return; + } + switch (name.getLocalPart()) { + case "linearRingId" -> reader.getTextContent().ifPresent(object::setLinearRing); + default -> super.buildChildObject(object, name, attributes, reader); + } + } + + @Override + public Element createElement(OrientationRingsSameError object, Namespaces namespaces) + throws ObjectSerializeException { + return Element.of(QualityADEModule.NAMESPACE_URI, "GE_P_ORIENTATION_RINGS_SAME"); + } + + @Override + public void writeChildElements(OrientationRingsSameError object, Namespaces namespaces, XMLWriter writer) + throws ObjectSerializeException, XMLWriteException { + super.writeChildElements(object, namespaces, writer); + if (object.getLinearRing() != null) { + writer.writeElement( + Element.of(QualityADEModule.NAMESPACE_URI, "linearRingId").addTextContent(object.getLinearRing())); + } + } +} diff --git a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/ParameterAdapter.java b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/ParameterAdapter.java new file mode 100644 index 0000000..3f31231 --- /dev/null +++ b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/ParameterAdapter.java @@ -0,0 +1,60 @@ +package de.hft.stuttgart.quality.adapter.types; + +import de.hft.stuttgart.quality.model.types.Parameter; + +import de.hft.stuttgart.quality.QualityADEModule; + +import org.xmlobjects.annotation.XMLElement; +import org.xmlobjects.builder.ObjectBuildException; +import org.xmlobjects.builder.ObjectBuilder; +import org.xmlobjects.serializer.ObjectSerializeException; +import org.xmlobjects.serializer.ObjectSerializer; +import org.xmlobjects.stream.XMLReadException; +import org.xmlobjects.stream.XMLReader; +import org.xmlobjects.stream.XMLWriteException; +import org.xmlobjects.stream.XMLWriter; +import org.xmlobjects.xml.Attributes; +import org.xmlobjects.xml.Element; +import org.xmlobjects.xml.Namespaces; + +import javax.xml.namespace.QName; + +@XMLElement(name = "Parameter", namespaceURI = QualityADEModule.NAMESPACE_URI) +public class ParameterAdapter implements ObjectBuilder, ObjectSerializer { + + @Override + public Parameter createObject(QName name, Object parent) throws ObjectBuildException { + return new Parameter(); + } + + @Override + public void buildChildObject(Parameter object, QName name, Attributes attributes, XMLReader reader) throws ObjectBuildException, XMLReadException { + if (!QualityADEModule.NAMESPACE_URI.equals(name.getNamespaceURI())) { + return; + } + switch (name.getLocalPart()) { + case "name" -> reader.getTextContent().ifPresent(object::setName); + case "uom" -> reader.getTextContent().ifPresent(object::setUom); + case "value" -> reader.getTextContent().ifPresent(object::setValue); + default -> throw new IllegalStateException("Cannot handle name " + name + " when building Parameter element"); + } + } + + @Override + public Element createElement(Parameter object, Namespaces namespaces) throws ObjectSerializeException { + return Element.of(QualityADEModule.NAMESPACE_URI, "Parameter"); + } + + @Override + public void writeChildElements(Parameter object, Namespaces namespaces, XMLWriter writer) throws ObjectSerializeException, XMLWriteException { + if (object.getName() != null) { + writer.writeElement(Element.of(QualityADEModule.NAMESPACE_URI, "name").addTextContent(object.getName())); + } + if (object.getUom() != null) { + writer.writeElement(Element.of(QualityADEModule.NAMESPACE_URI, "uom").addTextContent(object.getUom())); + } + if (object.getValue() != null) { + writer.writeElement(Element.of(QualityADEModule.NAMESPACE_URI, "value").addTextContent(object.getValue())); + } + } +} diff --git a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/PlanarDistancePlaneErrorAdapter.java b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/PlanarDistancePlaneErrorAdapter.java new file mode 100644 index 0000000..acbd568 --- /dev/null +++ b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/PlanarDistancePlaneErrorAdapter.java @@ -0,0 +1,62 @@ +package de.hft.stuttgart.quality.adapter.types; + +import javax.xml.namespace.QName; + +import org.xmlobjects.annotation.XMLElement; +import org.xmlobjects.builder.ObjectBuildException; +import org.xmlobjects.gml.adapter.geometry.DirectPositionAdapter; +import org.xmlobjects.gml.adapter.measures.LengthAdapter; +import org.xmlobjects.serializer.ObjectSerializeException; +import org.xmlobjects.stream.XMLReadException; +import org.xmlobjects.stream.XMLReader; +import org.xmlobjects.stream.XMLWriteException; +import org.xmlobjects.stream.XMLWriter; +import org.xmlobjects.xml.Attributes; +import org.xmlobjects.xml.Element; +import org.xmlobjects.xml.Namespaces; + +import de.hft.stuttgart.quality.QualityADEModule; +import de.hft.stuttgart.quality.model.types.PlanarDistancePlaneError; + +@XMLElement(name = "GE_P_NON_PLANAR_POLYGON_DISTANCE_PLANE", namespaceURI = QualityADEModule.NAMESPACE_URI) +public class PlanarDistancePlaneErrorAdapter extends AbstractPolygonErrorAdapter { + + @Override + public PlanarDistancePlaneError createObject(QName name, Object parent) throws ObjectBuildException { + return new PlanarDistancePlaneError(); + } + + @Override + public void buildChildObject(PlanarDistancePlaneError object, QName name, Attributes attributes, XMLReader reader) + throws ObjectBuildException, XMLReadException { + if (!QualityADEModule.NAMESPACE_URI.equals(name.getNamespaceURI())) { + return; + } + switch (name.getLocalPart()) { + case "vertex" -> object.setVertex(reader.getObjectUsingBuilder(DirectPositionAdapter.class)); + case "distance" -> object.setDistance(reader.getObjectUsingBuilder(LengthAdapter.class)); + default -> super.buildChildObject(object, name, attributes, reader); + } + } + + @Override + public Element createElement(PlanarDistancePlaneError object, Namespaces namespaces) + throws ObjectSerializeException { + return Element.of(QualityADEModule.NAMESPACE_URI, "GE_P_NON_PLANAR_POLYGON_DISTANCE_PLANE"); + } + + @Override + public void writeChildElements(PlanarDistancePlaneError object, Namespaces namespaces, XMLWriter writer) + throws ObjectSerializeException, XMLWriteException { + super.writeChildElements(object, namespaces, writer); + if (object.getDistance() != null) { + writer.writeElementUsingSerializer(Element.of(QualityADEModule.NAMESPACE_URI, "distance"), + object.getDistance(), LengthAdapter.class, namespaces); + } + if (object.getVertex() != null) { + writer.writeElementUsingSerializer(Element.of(QualityADEModule.NAMESPACE_URI, "vertex"), object.getVertex(), + DirectPositionAdapter.class, namespaces); + } + + } +} diff --git a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/PlanarNormalsDeviationErrorAdapter.java b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/PlanarNormalsDeviationErrorAdapter.java new file mode 100644 index 0000000..647f331 --- /dev/null +++ b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/PlanarNormalsDeviationErrorAdapter.java @@ -0,0 +1,55 @@ +package de.hft.stuttgart.quality.adapter.types; + +import javax.xml.namespace.QName; + +import org.xmlobjects.annotation.XMLElement; +import org.xmlobjects.builder.ObjectBuildException; +import org.xmlobjects.gml.adapter.measures.AngleAdapter; +import org.xmlobjects.serializer.ObjectSerializeException; +import org.xmlobjects.stream.XMLReadException; +import org.xmlobjects.stream.XMLReader; +import org.xmlobjects.stream.XMLWriteException; +import org.xmlobjects.stream.XMLWriter; +import org.xmlobjects.xml.Attributes; +import org.xmlobjects.xml.Element; +import org.xmlobjects.xml.Namespaces; + +import de.hft.stuttgart.quality.QualityADEModule; +import de.hft.stuttgart.quality.model.types.PlanarNormalsDeviationError; + +@XMLElement(name = "GE_P_NON_PLANAR_POLYGON_NORMALS_DEVIATION", namespaceURI = QualityADEModule.NAMESPACE_URI) +public class PlanarNormalsDeviationErrorAdapter extends AbstractPolygonErrorAdapter { + + @Override + public PlanarNormalsDeviationError createObject(QName name, Object parent) throws ObjectBuildException { + return new PlanarNormalsDeviationError(); + } + + @Override + public void buildChildObject(PlanarNormalsDeviationError object, QName name, Attributes attributes, + XMLReader reader) throws ObjectBuildException, XMLReadException { + if (!QualityADEModule.NAMESPACE_URI.equals(name.getNamespaceURI())) { + return; + } + switch (name.getLocalPart()) { + case "deviation" -> object.setDeviation(reader.getObjectUsingBuilder(AngleAdapter.class)); + default -> super.buildChildObject(object, name, attributes, reader); + } + } + + @Override + public Element createElement(PlanarNormalsDeviationError object, Namespaces namespaces) + throws ObjectSerializeException { + return Element.of(QualityADEModule.NAMESPACE_URI, "GE_P_NON_PLANAR_POLYGON_NORMALS_DEVIATION"); + } + + @Override + public void writeChildElements(PlanarNormalsDeviationError object, Namespaces namespaces, XMLWriter writer) + throws ObjectSerializeException, XMLWriteException { + super.writeChildElements(object, namespaces, writer); + if (object.getDeviation() != null) { + writer.writeElementUsingSerializer(Element.of(QualityADEModule.NAMESPACE_URI, "deviation"), + object.getDeviation(), AngleAdapter.class, namespaces); + } + } +} diff --git a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/PolygonIdListAdapter.java b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/PolygonIdListAdapter.java new file mode 100644 index 0000000..e481d70 --- /dev/null +++ b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/PolygonIdListAdapter.java @@ -0,0 +1,55 @@ +package de.hft.stuttgart.quality.adapter.types; + +import de.hft.stuttgart.quality.model.types.PolygonIdList; + +import de.hft.stuttgart.quality.QualityADEModule; + +import org.xmlobjects.annotation.XMLElement; +import org.xmlobjects.builder.ObjectBuildException; +import org.xmlobjects.builder.ObjectBuilder; +import org.xmlobjects.serializer.ObjectSerializeException; +import org.xmlobjects.serializer.ObjectSerializer; +import org.xmlobjects.stream.XMLReadException; +import org.xmlobjects.stream.XMLReader; +import org.xmlobjects.stream.XMLWriteException; +import org.xmlobjects.stream.XMLWriter; +import org.xmlobjects.xml.Attributes; +import org.xmlobjects.xml.Element; +import org.xmlobjects.xml.Namespaces; + +import javax.xml.namespace.QName; + +@XMLElement(name = "PolygonIdList", namespaceURI = QualityADEModule.NAMESPACE_URI) +public class PolygonIdListAdapter implements ObjectBuilder, ObjectSerializer { + + @Override + public PolygonIdList createObject(QName name, Object parent) throws ObjectBuildException { + return new PolygonIdList(); + } + + @Override + public void buildChildObject(PolygonIdList object, QName name, Attributes attributes, XMLReader reader) + throws ObjectBuildException, XMLReadException { + if (!QualityADEModule.NAMESPACE_URI.equals(name.getNamespaceURI())) { + return; + } + switch (name.getLocalPart()) { + case "polygonId" -> object.getPolygonIds().add(reader.getTextContent().get()); + default -> throw new IllegalStateException( + "Cannot handle name " + name + " when building PolygonIdList element"); + } + } + + @Override + public Element createElement(PolygonIdList object, Namespaces namespaces) throws ObjectSerializeException { + return Element.of(QualityADEModule.NAMESPACE_URI, "PolygonIdList"); + } + + @Override + public void writeChildElements(PolygonIdList object, Namespaces namespaces, XMLWriter writer) + throws ObjectSerializeException, XMLWriteException { + for (String polygonId : object.getPolygonIds()) { + writer.writeElement(Element.of(QualityADEModule.NAMESPACE_URI, "polygonId").addTextContent(polygonId)); + } + } +} diff --git a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/PolygonWrongOrientationErrorAdapter.java b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/PolygonWrongOrientationErrorAdapter.java new file mode 100644 index 0000000..1bf61a2 --- /dev/null +++ b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/PolygonWrongOrientationErrorAdapter.java @@ -0,0 +1,55 @@ +package de.hft.stuttgart.quality.adapter.types; + +import javax.xml.namespace.QName; + +import org.xmlobjects.annotation.XMLElement; +import org.xmlobjects.builder.ObjectBuildException; +import org.xmlobjects.serializer.ObjectSerializeException; +import org.xmlobjects.stream.XMLReadException; +import org.xmlobjects.stream.XMLReader; +import org.xmlobjects.stream.XMLWriteException; +import org.xmlobjects.stream.XMLWriter; +import org.xmlobjects.xml.Attributes; +import org.xmlobjects.xml.Element; +import org.xmlobjects.xml.Namespaces; + +import de.hft.stuttgart.quality.QualityADEModule; +import de.hft.stuttgart.quality.adapter.properties.EdgeListPropertyAdapter; +import de.hft.stuttgart.quality.model.types.PolygonWrongOrientationError; + +@XMLElement(name = "GE_S_POLYGON_WRONG_ORIENTATION", namespaceURI = QualityADEModule.NAMESPACE_URI) +public class PolygonWrongOrientationErrorAdapter extends AbstractSolidErrorAdapter { + + @Override + public PolygonWrongOrientationError createObject(QName name, Object parent) throws ObjectBuildException { + return new PolygonWrongOrientationError(); + } + + @Override + public void buildChildObject(PolygonWrongOrientationError object, QName name, Attributes attributes, + XMLReader reader) throws ObjectBuildException, XMLReadException { + if (!QualityADEModule.NAMESPACE_URI.equals(name.getNamespaceURI())) { + return; + } + switch (name.getLocalPart()) { + case "edges" -> object.setEdges(reader.getObjectUsingBuilder(EdgeListPropertyAdapter.class)); + default -> super.buildChildObject(object, name, attributes, reader); + } + } + + @Override + public Element createElement(PolygonWrongOrientationError object, Namespaces namespaces) + throws ObjectSerializeException { + return Element.of(QualityADEModule.NAMESPACE_URI, "GE_S_POLYGON_WRONG_ORIENTATION"); + } + + @Override + public void writeChildElements(PolygonWrongOrientationError object, Namespaces namespaces, XMLWriter writer) + throws ObjectSerializeException, XMLWriteException { + super.writeChildElements(object, namespaces, writer); + if (object.getEdges() != null) { + writer.writeElementUsingSerializer(Element.of(QualityADEModule.NAMESPACE_URI, "edges"), object.getEdges(), + EdgeListPropertyAdapter.class, namespaces); + } + } +} diff --git a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/RequirementAdapter.java b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/RequirementAdapter.java new file mode 100644 index 0000000..4d28b45 --- /dev/null +++ b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/RequirementAdapter.java @@ -0,0 +1,66 @@ +package de.hft.stuttgart.quality.adapter.types; + +import de.hft.stuttgart.quality.model.enums.RequirementId; +import de.hft.stuttgart.quality.model.properties.ParameterProperty; +import de.hft.stuttgart.quality.model.types.Requirement; + +import de.hft.stuttgart.quality.QualityADEModule; +import de.hft.stuttgart.quality.adapter.properties.ParameterPropertyAdapter; + +import org.xmlobjects.annotation.XMLElement; +import org.xmlobjects.builder.ObjectBuildException; +import org.xmlobjects.builder.ObjectBuilder; +import org.xmlobjects.serializer.ObjectSerializeException; +import org.xmlobjects.serializer.ObjectSerializer; +import org.xmlobjects.stream.XMLReadException; +import org.xmlobjects.stream.XMLReader; +import org.xmlobjects.stream.XMLWriteException; +import org.xmlobjects.stream.XMLWriter; +import org.xmlobjects.xml.Attributes; +import org.xmlobjects.xml.Element; +import org.xmlobjects.xml.Namespaces; + +import javax.xml.namespace.QName; + +@XMLElement(name = "Requirement", namespaceURI = QualityADEModule.NAMESPACE_URI) +public class RequirementAdapter implements ObjectBuilder, ObjectSerializer { + + @Override + public Requirement createObject(QName name, Object parent) throws ObjectBuildException { + return new Requirement(); + } + + @Override + public void buildChildObject(Requirement object, QName name, Attributes attributes, XMLReader reader) + throws ObjectBuildException, XMLReadException { + if (!QualityADEModule.NAMESPACE_URI.equals(name.getNamespaceURI())) { + return; + } + switch (name.getLocalPart()) { + case "enabled" -> reader.getTextContent().ifPresent(s -> object.setEnabled(Boolean.parseBoolean(s))); + case "requirementType" -> object.setRequirementType(RequirementId.valueOf(reader.getTextContent().get())); + case "parameter" -> object.getParameters().add(reader.getObjectUsingBuilder(ParameterPropertyAdapter.class)); + default -> throw new IllegalStateException("Cannot handle name " + name + " when building Requirement element"); + } + } + + @Override + public Element createElement(Requirement object, Namespaces namespaces) throws ObjectSerializeException { + return Element.of(QualityADEModule.NAMESPACE_URI, "Requirement"); + } + + @Override + public void writeChildElements(Requirement object, Namespaces namespaces, XMLWriter writer) + throws ObjectSerializeException, XMLWriteException { + writer.writeElement(Element.of(QualityADEModule.NAMESPACE_URI, "enabled") + .addTextContent(Boolean.toString(object.isEnabled()))); + if (object.getRequirementType() != null) { + writer.writeElement(Element.of(QualityADEModule.NAMESPACE_URI, "requirementType") + .addTextContent(object.getRequirementType().toString())); + } + for (ParameterProperty params : object.getParameters()) { + writer.writeElementUsingSerializer(Element.of(QualityADEModule.NAMESPACE_URI, "parameter"), params, + ParameterPropertyAdapter.class, namespaces); + } + } +} diff --git a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/RingNotClosedErrorAdapter.java b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/RingNotClosedErrorAdapter.java new file mode 100644 index 0000000..a34143e --- /dev/null +++ b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/RingNotClosedErrorAdapter.java @@ -0,0 +1,26 @@ +package de.hft.stuttgart.quality.adapter.types; + +import javax.xml.namespace.QName; + +import org.xmlobjects.annotation.XMLElement; +import org.xmlobjects.builder.ObjectBuildException; +import org.xmlobjects.serializer.ObjectSerializeException; +import org.xmlobjects.xml.Element; +import org.xmlobjects.xml.Namespaces; + +import de.hft.stuttgart.quality.QualityADEModule; +import de.hft.stuttgart.quality.model.types.RingNotClosedError; + +@XMLElement(name = "GE_R_NOT_CLOSED", namespaceURI = QualityADEModule.NAMESPACE_URI) +public class RingNotClosedErrorAdapter extends AbstractRingErrorAdapter { + + @Override + public RingNotClosedError createObject(QName name, Object parent) throws ObjectBuildException { + return new RingNotClosedError(); + } + + @Override + public Element createElement(RingNotClosedError object, Namespaces namespaces) throws ObjectSerializeException { + return Element.of(QualityADEModule.NAMESPACE_URI, "GE_R_NOT_CLOSED"); + } +} diff --git a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/RingSelfIntersectionErrorAdapter.java b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/RingSelfIntersectionErrorAdapter.java new file mode 100644 index 0000000..0c61218 --- /dev/null +++ b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/RingSelfIntersectionErrorAdapter.java @@ -0,0 +1,77 @@ +package de.hft.stuttgart.quality.adapter.types; + +import javax.xml.namespace.QName; + +import org.xmlobjects.annotation.XMLElement; +import org.xmlobjects.builder.ObjectBuildException; +import org.xmlobjects.gml.adapter.geometry.DirectPositionAdapter; +import org.xmlobjects.serializer.ObjectSerializeException; +import org.xmlobjects.stream.XMLReadException; +import org.xmlobjects.stream.XMLReader; +import org.xmlobjects.stream.XMLWriteException; +import org.xmlobjects.stream.XMLWriter; +import org.xmlobjects.xml.Attributes; +import org.xmlobjects.xml.Element; +import org.xmlobjects.xml.Namespaces; + +import de.hft.stuttgart.quality.QualityADEModule; +import de.hft.stuttgart.quality.adapter.properties.EdgePropertyAdapter; +import de.hft.stuttgart.quality.model.enums.RingSelfIntType; +import de.hft.stuttgart.quality.model.types.RingSelfIntersectionError; + +@XMLElement(name = "GE_R_SELF_INTERSECTION", namespaceURI = QualityADEModule.NAMESPACE_URI) +public class RingSelfIntersectionErrorAdapter extends AbstractRingErrorAdapter { + + @Override + public RingSelfIntersectionError createObject(QName name, Object parent) throws ObjectBuildException { + return new RingSelfIntersectionError(); + } + + @Override + public void buildChildObject(RingSelfIntersectionError object, QName name, Attributes attributes, XMLReader reader) + throws ObjectBuildException, XMLReadException { + if (!QualityADEModule.NAMESPACE_URI.equals(name.getNamespaceURI())) { + return; + } + switch (name.getLocalPart()) { + case "type" -> reader.getTextContent().ifPresent(s -> object.setType(RingSelfIntType.valueOf(s))); + case "edge1" -> object.setEdge1(reader.getObjectUsingBuilder(EdgePropertyAdapter.class)); + case "edge2" -> object.setEdge2(reader.getObjectUsingBuilder(EdgePropertyAdapter.class)); + case "vertex1" -> object.setVertex1(reader.getObjectUsingBuilder(DirectPositionAdapter.class)); + case "vertex2" -> object.setVertex2(reader.getObjectUsingBuilder(DirectPositionAdapter.class)); + default -> super.buildChildObject(object, name, attributes, reader); + } + } + + @Override + public Element createElement(RingSelfIntersectionError object, Namespaces namespaces) + throws ObjectSerializeException { + return Element.of(QualityADEModule.NAMESPACE_URI, "GE_R_SELF_INTERSECTION"); + } + + @Override + public void writeChildElements(RingSelfIntersectionError object, Namespaces namespaces, XMLWriter writer) + throws ObjectSerializeException, XMLWriteException { + super.writeChildElements(object, namespaces, writer); + if (object.getType() != null) { + writer.writeElement( + Element.of(QualityADEModule.NAMESPACE_URI, "type").addTextContent(object.getType().toString())); + } + if (object.getEdge1() != null) { + writer.writeElementUsingSerializer(Element.of(QualityADEModule.NAMESPACE_URI, "edge1"), object.getEdge1(), + EdgePropertyAdapter.class, namespaces); + } + if (object.getEdge2() != null) { + writer.writeElementUsingSerializer(Element.of(QualityADEModule.NAMESPACE_URI, "edge2"), object.getEdge2(), + EdgePropertyAdapter.class, namespaces); + } + if (object.getVertex1() != null) { + writer.writeElementUsingSerializer(Element.of(QualityADEModule.NAMESPACE_URI, "vertex1"), + object.getVertex1(), DirectPositionAdapter.class, namespaces); + } + if (object.getVertex2() != null) { + writer.writeElementUsingSerializer(Element.of(QualityADEModule.NAMESPACE_URI, "vertex2"), + object.getVertex2(), DirectPositionAdapter.class, namespaces); + } + } +} diff --git a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/RingTooFewPointsErrorAdapter.java b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/RingTooFewPointsErrorAdapter.java new file mode 100644 index 0000000..a325d9d --- /dev/null +++ b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/RingTooFewPointsErrorAdapter.java @@ -0,0 +1,27 @@ +package de.hft.stuttgart.quality.adapter.types; + +import javax.xml.namespace.QName; + +import org.xmlobjects.annotation.XMLElement; +import org.xmlobjects.builder.ObjectBuildException; +import org.xmlobjects.serializer.ObjectSerializeException; +import org.xmlobjects.xml.Element; +import org.xmlobjects.xml.Namespaces; + +import de.hft.stuttgart.quality.QualityADEModule; +import de.hft.stuttgart.quality.model.types.RingTooFewPointsError; + +@XMLElement(name = "GE_R_TOO_FEW_POINTS", namespaceURI = QualityADEModule.NAMESPACE_URI) +public class RingTooFewPointsErrorAdapter extends AbstractRingErrorAdapter { + + @Override + public RingTooFewPointsError createObject(QName name, Object parent) throws ObjectBuildException { + return new RingTooFewPointsError(); + } + + @Override + public Element createElement(RingTooFewPointsError object, Namespaces namespaces) throws ObjectSerializeException { + return Element.of(QualityADEModule.NAMESPACE_URI, "GE_R_TOO_FEW_POINTS"); + } + +} diff --git a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/SemanticAttributeMissingErrorAdapter.java b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/SemanticAttributeMissingErrorAdapter.java new file mode 100644 index 0000000..9694a09 --- /dev/null +++ b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/SemanticAttributeMissingErrorAdapter.java @@ -0,0 +1,62 @@ +package de.hft.stuttgart.quality.adapter.types; + +import javax.xml.namespace.QName; + +import org.xmlobjects.annotation.XMLElement; +import org.xmlobjects.builder.ObjectBuildException; +import org.xmlobjects.serializer.ObjectSerializeException; +import org.xmlobjects.stream.XMLReadException; +import org.xmlobjects.stream.XMLReader; +import org.xmlobjects.stream.XMLWriteException; +import org.xmlobjects.stream.XMLWriter; +import org.xmlobjects.xml.Attributes; +import org.xmlobjects.xml.Element; +import org.xmlobjects.xml.Namespaces; + +import de.hft.stuttgart.quality.QualityADEModule; +import de.hft.stuttgart.quality.model.types.SemanticAttributeMissingError; + +@XMLElement(name = "SE_ATTRIBUTE_MISSING", namespaceURI = QualityADEModule.NAMESPACE_URI) +public class SemanticAttributeMissingErrorAdapter extends AbstractSemanticErrorAdapter { + + @Override + public SemanticAttributeMissingError createObject(QName name, Object parent) throws ObjectBuildException { + return new SemanticAttributeMissingError(); + } + + @Override + public void buildChildObject(SemanticAttributeMissingError object, QName name, Attributes attributes, + XMLReader reader) throws ObjectBuildException, XMLReadException { + if (!QualityADEModule.NAMESPACE_URI.equals(name.getNamespaceURI())) { + return; + } + switch (name.getLocalPart()) { + case "childId" -> reader.getTextContent().ifPresent(object::setChildId); + case "attributeName" -> reader.getTextContent().ifPresent(object::setAttributeName); + case "generic" -> reader.getTextContent().ifPresent(s -> object.setGeneric(Boolean.parseBoolean(s))); + default -> throw new IllegalStateException( + "Cannot handle name " + name + " when building SemanticAttributeMissingError element"); + } + } + + @Override + public Element createElement(SemanticAttributeMissingError object, Namespaces namespaces) + throws ObjectSerializeException { + return Element.of(QualityADEModule.NAMESPACE_URI, "SE_ATTRIBUTE_MISSING"); + } + + @Override + public void writeChildElements(SemanticAttributeMissingError object, Namespaces namespaces, XMLWriter writer) + throws ObjectSerializeException, XMLWriteException { + if (object.getChildId() != null) { + writer.writeElement( + Element.of(QualityADEModule.NAMESPACE_URI, "childId").addTextContent(object.getChildId())); + } + if (object.getAttributeName() != null) { + writer.writeElement(Element.of(QualityADEModule.NAMESPACE_URI, "attributeName") + .addTextContent(object.getAttributeName())); + } + writer.writeElement(Element.of(QualityADEModule.NAMESPACE_URI, "generic") + .addTextContent(Boolean.toString(object.isGeneric()))); + } +} diff --git a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/SemanticAttributeWrongValueErrorAdapter.java b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/SemanticAttributeWrongValueErrorAdapter.java new file mode 100644 index 0000000..6ccbb2b --- /dev/null +++ b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/SemanticAttributeWrongValueErrorAdapter.java @@ -0,0 +1,64 @@ +package de.hft.stuttgart.quality.adapter.types; + +import javax.xml.namespace.QName; + +import org.xmlobjects.annotation.XMLElement; +import org.xmlobjects.builder.ObjectBuildException; +import org.xmlobjects.serializer.ObjectSerializeException; +import org.xmlobjects.stream.XMLReadException; +import org.xmlobjects.stream.XMLReader; +import org.xmlobjects.stream.XMLWriteException; +import org.xmlobjects.stream.XMLWriter; +import org.xmlobjects.xml.Attributes; +import org.xmlobjects.xml.Element; +import org.xmlobjects.xml.Namespaces; + +import de.hft.stuttgart.quality.QualityADEModule; +import de.hft.stuttgart.quality.model.types.SemanticAttributeWrongValueError; + +@XMLElement(name = "SE_ATTRIBUTE_WRONG_VALUE", namespaceURI = QualityADEModule.NAMESPACE_URI) +public class SemanticAttributeWrongValueErrorAdapter + extends AbstractSemanticErrorAdapter { + + @Override + public SemanticAttributeWrongValueError createObject(QName name, Object parent) throws ObjectBuildException { + return new SemanticAttributeWrongValueError(); + } + + @Override + public void buildChildObject(SemanticAttributeWrongValueError object, QName name, Attributes attributes, + XMLReader reader) throws ObjectBuildException, XMLReadException { + if (!QualityADEModule.NAMESPACE_URI.equals(name.getNamespaceURI())) { + return; + } + switch (name.getLocalPart()) { + case "childId" -> reader.getTextContent().ifPresent(object::setChildId); + case "attributeName" -> reader.getTextContent().ifPresent(object::setAttributeName); + case "generic" -> reader.getTextContent().ifPresent(s -> object.setGeneric(Boolean.parseBoolean(s))); + default -> throw new IllegalStateException( + "Cannot handle name " + name + " when building SemanticAttributeWrongValueError element"); + } + } + + @Override + public Element createElement(SemanticAttributeWrongValueError object, Namespaces namespaces) + throws ObjectSerializeException { + return Element.of(QualityADEModule.NAMESPACE_URI, "SE_ATTRIBUTE_WRONG_VALUE"); + } + + @Override + public void writeChildElements(SemanticAttributeWrongValueError object, Namespaces namespaces, XMLWriter writer) + throws ObjectSerializeException, XMLWriteException { + super.writeChildElements(object, namespaces, writer); + if (object.getChildId() != null) { + writer.writeElement( + Element.of(QualityADEModule.NAMESPACE_URI, "childId").addTextContent(object.getChildId())); + } + if (object.getAttributeName() != null) { + writer.writeElement(Element.of(QualityADEModule.NAMESPACE_URI, "attributeName") + .addTextContent(object.getAttributeName())); + } + writer.writeElement(Element.of(QualityADEModule.NAMESPACE_URI, "generic") + .addTextContent(Boolean.toString(object.isGeneric()))); + } +} diff --git a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/SolidNotClosedErrorAdapter.java b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/SolidNotClosedErrorAdapter.java new file mode 100644 index 0000000..7f03206 --- /dev/null +++ b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/SolidNotClosedErrorAdapter.java @@ -0,0 +1,54 @@ +package de.hft.stuttgart.quality.adapter.types; + +import javax.xml.namespace.QName; + +import org.xmlobjects.annotation.XMLElement; +import org.xmlobjects.builder.ObjectBuildException; +import org.xmlobjects.serializer.ObjectSerializeException; +import org.xmlobjects.stream.XMLReadException; +import org.xmlobjects.stream.XMLReader; +import org.xmlobjects.stream.XMLWriteException; +import org.xmlobjects.stream.XMLWriter; +import org.xmlobjects.xml.Attributes; +import org.xmlobjects.xml.Element; +import org.xmlobjects.xml.Namespaces; + +import de.hft.stuttgart.quality.QualityADEModule; +import de.hft.stuttgart.quality.adapter.properties.EdgeListPropertyAdapter; +import de.hft.stuttgart.quality.model.types.SolidNotClosedError; + +@XMLElement(name = "GE_S_NOT_CLOSED", namespaceURI = QualityADEModule.NAMESPACE_URI) +public class SolidNotClosedErrorAdapter extends AbstractSolidErrorAdapter { + + @Override + public SolidNotClosedError createObject(QName name, Object parent) throws ObjectBuildException { + return new SolidNotClosedError(); + } + + @Override + public void buildChildObject(SolidNotClosedError object, QName name, Attributes attributes, XMLReader reader) + throws ObjectBuildException, XMLReadException { + if (!QualityADEModule.NAMESPACE_URI.equals(name.getNamespaceURI())) { + return; + } + switch (name.getLocalPart()) { + case "edges" -> object.setEdges(reader.getObjectUsingBuilder(EdgeListPropertyAdapter.class)); + default -> super.buildChildObject(object, name, attributes, reader); + } + } + + @Override + public Element createElement(SolidNotClosedError object, Namespaces namespaces) throws ObjectSerializeException { + return Element.of(QualityADEModule.NAMESPACE_URI, "GE_S_NOT_CLOSED"); + } + + @Override + public void writeChildElements(SolidNotClosedError object, Namespaces namespaces, XMLWriter writer) + throws ObjectSerializeException, XMLWriteException { + super.writeChildElements(object, namespaces, writer); + if (object.getEdges() != null) { + writer.writeElementUsingSerializer(Element.of(QualityADEModule.NAMESPACE_URI, "edges"), object.getEdges(), + EdgeListPropertyAdapter.class, namespaces); + } + } +} diff --git a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/SolidSelfIntersectionErrorAdapter.java b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/SolidSelfIntersectionErrorAdapter.java new file mode 100644 index 0000000..e719eca --- /dev/null +++ b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/SolidSelfIntersectionErrorAdapter.java @@ -0,0 +1,60 @@ +package de.hft.stuttgart.quality.adapter.types; + +import javax.xml.namespace.QName; + +import org.xmlobjects.annotation.XMLElement; +import org.xmlobjects.builder.ObjectBuildException; +import org.xmlobjects.serializer.ObjectSerializeException; +import org.xmlobjects.stream.XMLReadException; +import org.xmlobjects.stream.XMLReader; +import org.xmlobjects.stream.XMLWriteException; +import org.xmlobjects.stream.XMLWriter; +import org.xmlobjects.xml.Attributes; +import org.xmlobjects.xml.Element; +import org.xmlobjects.xml.Namespaces; + +import de.hft.stuttgart.quality.QualityADEModule; +import de.hft.stuttgart.quality.model.types.SolidSelfIntersectionError; + +@XMLElement(name = "GE_S_SELF_INTERSECTION", namespaceURI = QualityADEModule.NAMESPACE_URI) +public class SolidSelfIntersectionErrorAdapter extends AbstractSolidErrorAdapter { + + @Override + public SolidSelfIntersectionError createObject(QName name, Object parent) throws ObjectBuildException { + return new SolidSelfIntersectionError(); + } + + @Override + public void buildChildObject(SolidSelfIntersectionError object, QName name, Attributes attributes, XMLReader reader) + throws ObjectBuildException, XMLReadException { + if (!QualityADEModule.NAMESPACE_URI.equals(name.getNamespaceURI())) { + return; + } + switch (name.getLocalPart()) { + case "polygonId1" -> reader.getTextContent().ifPresent(object::setPolygonId1); + case "polygonId2" -> reader.getTextContent().ifPresent(object::setPolygonId2); + + default -> super.buildChildObject(object, name, attributes, reader); + } + } + + @Override + public Element createElement(SolidSelfIntersectionError object, Namespaces namespaces) + throws ObjectSerializeException { + return Element.of(QualityADEModule.NAMESPACE_URI, "GE_S_SELF_INTERSECTION"); + } + + @Override + public void writeChildElements(SolidSelfIntersectionError object, Namespaces namespaces, XMLWriter writer) + throws ObjectSerializeException, XMLWriteException { + super.writeChildElements(object, namespaces, writer); + if (object.getPolygonId1() != null) { + writer.writeElement( + Element.of(QualityADEModule.NAMESPACE_URI, "polygonId1").addTextContent(object.getPolygonId1())); + } + if (object.getPolygonId2() != null) { + writer.writeElement( + Element.of(QualityADEModule.NAMESPACE_URI, "polygonId2").addTextContent(object.getPolygonId2())); + } + } +} diff --git a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/SolidTooFewPolygonsErrorAdapter.java b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/SolidTooFewPolygonsErrorAdapter.java new file mode 100644 index 0000000..7588b41 --- /dev/null +++ b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/SolidTooFewPolygonsErrorAdapter.java @@ -0,0 +1,28 @@ +package de.hft.stuttgart.quality.adapter.types; + +import javax.xml.namespace.QName; + +import org.xmlobjects.annotation.XMLElement; +import org.xmlobjects.builder.ObjectBuildException; +import org.xmlobjects.serializer.ObjectSerializeException; +import org.xmlobjects.xml.Element; +import org.xmlobjects.xml.Namespaces; + +import de.hft.stuttgart.quality.QualityADEModule; +import de.hft.stuttgart.quality.model.types.SolidTooFewPolygonsError; + +@XMLElement(name = "GE_S_TOO_FEW_POLYGONS", namespaceURI = QualityADEModule.NAMESPACE_URI) +public class SolidTooFewPolygonsErrorAdapter extends AbstractSolidErrorAdapter { + + @Override + public SolidTooFewPolygonsError createObject(QName name, Object parent) throws ObjectBuildException { + return new SolidTooFewPolygonsError(); + } + + @Override + public Element createElement(SolidTooFewPolygonsError object, Namespaces namespaces) + throws ObjectSerializeException { + return Element.of(QualityADEModule.NAMESPACE_URI, "GE_S_TOO_FEW_POLYGONS"); + } + +} diff --git a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/StatisticsAdapter.java b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/StatisticsAdapter.java new file mode 100644 index 0000000..c6ec157 --- /dev/null +++ b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/StatisticsAdapter.java @@ -0,0 +1,86 @@ +package de.hft.stuttgart.quality.adapter.types; + +import javax.xml.namespace.QName; + +import org.xmlobjects.annotation.XMLElement; +import org.xmlobjects.builder.ObjectBuildException; +import org.xmlobjects.builder.ObjectBuilder; +import org.xmlobjects.serializer.ObjectSerializeException; +import org.xmlobjects.serializer.ObjectSerializer; +import org.xmlobjects.stream.XMLReadException; +import org.xmlobjects.stream.XMLReader; +import org.xmlobjects.stream.XMLWriteException; +import org.xmlobjects.stream.XMLWriter; +import org.xmlobjects.xml.Attributes; +import org.xmlobjects.xml.Element; +import org.xmlobjects.xml.Namespaces; + +import de.hft.stuttgart.quality.QualityADEModule; +import de.hft.stuttgart.quality.adapter.properties.FeatureStatisticsPropertyAdapter; +import de.hft.stuttgart.quality.model.types.Statistics; + +@XMLElement(name = "Statistics", namespaceURI = QualityADEModule.NAMESPACE_URI) +public class StatisticsAdapter implements ObjectBuilder, ObjectSerializer { + + @Override + public Statistics createObject(QName name, Object parent) throws ObjectBuildException { + return new Statistics(); + } + + @Override + public void buildChildObject(Statistics object, QName name, Attributes attributes, XMLReader reader) + throws ObjectBuildException, XMLReadException { + if (!QualityADEModule.NAMESPACE_URI.equals(name.getNamespaceURI())) { + return; + } + switch (name.getLocalPart()) { + case "numErrorBuildings" -> object + .setNumErrorBuildings(reader.getObjectUsingBuilder(FeatureStatisticsPropertyAdapter.class)); + case "numErrorVegetation" -> object + .setNumErrorVegetation(reader.getObjectUsingBuilder(FeatureStatisticsPropertyAdapter.class)); + case "numErrorLandObjects" -> object + .setNumErrorLandObjects(reader.getObjectUsingBuilder(FeatureStatisticsPropertyAdapter.class)); + case "numErrorBridgeObjects" -> object + .setNumErrorBridgeObjects(reader.getObjectUsingBuilder(FeatureStatisticsPropertyAdapter.class)); + case "numErrorWaterObjects" -> object + .setNumErrorWaterObjects(reader.getObjectUsingBuilder(FeatureStatisticsPropertyAdapter.class)); + case "numErrorTransportation" -> object + .setNumErrorTransportation(reader.getObjectUsingBuilder(FeatureStatisticsPropertyAdapter.class)); + default -> throw new IllegalStateException("Cannot handle name " + name + " when building Statistics element"); + } + } + + @Override + public Element createElement(Statistics object, Namespaces namespaces) throws ObjectSerializeException { + return Element.of(QualityADEModule.NAMESPACE_URI, "Statistics"); + } + + @Override + public void writeChildElements(Statistics object, Namespaces namespaces, XMLWriter writer) + throws ObjectSerializeException, XMLWriteException { + if (object.getNumErrorBuildings() != null) { + writer.writeElementUsingSerializer(Element.of(QualityADEModule.NAMESPACE_URI, "numErrorBuildings"), + object.getNumErrorBuildings(), FeatureStatisticsPropertyAdapter.class, namespaces); + } + if (object.getNumErrorVegetation() != null) { + writer.writeElementUsingSerializer(Element.of(QualityADEModule.NAMESPACE_URI, "numErrorVegetation"), + object.getNumErrorVegetation(), FeatureStatisticsPropertyAdapter.class, namespaces); + } + if (object.getNumErrorLandObjects() != null) { + writer.writeElementUsingSerializer(Element.of(QualityADEModule.NAMESPACE_URI, "numErrorLandObjects"), + object.getNumErrorLandObjects(), FeatureStatisticsPropertyAdapter.class, namespaces); + } + if (object.getNumErrorBridgeObjects() != null) { + writer.writeElementUsingSerializer(Element.of(QualityADEModule.NAMESPACE_URI, "numErrorBridgeObjects"), + object.getNumErrorBridgeObjects(), FeatureStatisticsPropertyAdapter.class, namespaces); + } + if (object.getNumErrorWaterObjects() != null) { + writer.writeElementUsingSerializer(Element.of(QualityADEModule.NAMESPACE_URI, "numErrorWaterObjects"), + object.getNumErrorWaterObjects(), FeatureStatisticsPropertyAdapter.class, namespaces); + } + if (object.getNumErrorTransportation() != null) { + writer.writeElementUsingSerializer(Element.of(QualityADEModule.NAMESPACE_URI, "numErrorTransportation"), + object.getNumErrorTransportation(), FeatureStatisticsPropertyAdapter.class, namespaces); + } + } +} diff --git a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/ValidationAdapter.java b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/ValidationAdapter.java new file mode 100644 index 0000000..77ece23 --- /dev/null +++ b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/ValidationAdapter.java @@ -0,0 +1,75 @@ +package de.hft.stuttgart.quality.adapter.types; + +import javax.xml.namespace.QName; + +import org.citygml4j.xml.adapter.core.AbstractFeatureAdapter; +import org.xmlobjects.annotation.XMLElement; +import org.xmlobjects.builder.ObjectBuildException; +import org.xmlobjects.serializer.ObjectSerializeException; +import org.xmlobjects.stream.XMLReadException; +import org.xmlobjects.stream.XMLReader; +import org.xmlobjects.stream.XMLWriteException; +import org.xmlobjects.stream.XMLWriter; +import org.xmlobjects.xml.Attributes; +import org.xmlobjects.xml.Element; +import org.xmlobjects.xml.Namespaces; + +import de.hft.stuttgart.quality.QualityADEModule; +import de.hft.stuttgart.quality.adapter.properties.StatisticsPropertyAdapter; +import de.hft.stuttgart.quality.adapter.properties.ValidationPlanPropertyAdapter; +import de.hft.stuttgart.quality.model.types.Validation; + +@XMLElement(name = "Validation", namespaceURI = QualityADEModule.NAMESPACE_URI) +public class ValidationAdapter extends AbstractFeatureAdapter { + + private static final ZonedDateTimeAdapter DATE_TIME_ADAPTER = new ZonedDateTimeAdapter(); + + @Override + public Validation createObject(QName name, Object parent) throws ObjectBuildException { + return new Validation(); + } + + @Override + public void buildChildObject(Validation object, QName name, Attributes attributes, XMLReader reader) + throws ObjectBuildException, XMLReadException { + if (!QualityADEModule.NAMESPACE_URI.equals(name.getNamespaceURI())) { + return; + } + switch (name.getLocalPart()) { + case "validationDate" -> reader.getTextContent() + .ifPresent(s -> object.setValidationDate(DATE_TIME_ADAPTER.fromString(s))); + case "validationSoftware" -> reader.getTextContent().ifPresent(object::setValidationSoftware); + case "statistics" -> object.setStatistics(reader.getObjectUsingBuilder(StatisticsPropertyAdapter.class)); + case "validationPlan" -> object + .setValidationPlan(reader.getObjectUsingBuilder(ValidationPlanPropertyAdapter.class)); + default -> super.buildChildObject(object, name, attributes, reader); + } + } + + @Override + public Element createElement(Validation object, Namespaces namespaces) throws ObjectSerializeException { + return Element.of(QualityADEModule.NAMESPACE_URI, "Validation"); + } + + @Override + public void writeChildElements(Validation object, Namespaces namespaces, XMLWriter writer) + throws ObjectSerializeException, XMLWriteException { + super.writeChildElements(object, namespaces, writer); + if (object.getValidationDate() != null) { + writer.writeElement(Element.of(QualityADEModule.NAMESPACE_URI, "validationDate") + .addTextContent(DATE_TIME_ADAPTER.toString(object.getValidationDate()))); + } + if (object.getValidationSoftware() != null) { + writer.writeElement(Element.of(QualityADEModule.NAMESPACE_URI, "validationSoftware") + .addTextContent(object.getValidationSoftware())); + } + if (object.getStatistics() != null) { + writer.writeElementUsingSerializer(Element.of(QualityADEModule.NAMESPACE_URI, "statistics"), + object.getStatistics(), StatisticsPropertyAdapter.class, namespaces); + } + if (object.getValidationPlan() != null) { + writer.writeElementUsingSerializer(Element.of(QualityADEModule.NAMESPACE_URI, "validationPlan"), + object.getValidationPlan(), ValidationPlanPropertyAdapter.class, namespaces); + } + } +} diff --git a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/ValidationPlanAdapter.java b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/ValidationPlanAdapter.java new file mode 100644 index 0000000..245bc01 --- /dev/null +++ b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/ValidationPlanAdapter.java @@ -0,0 +1,71 @@ +package de.hft.stuttgart.quality.adapter.types; + +import javax.xml.namespace.QName; + +import org.xmlobjects.annotation.XMLElement; +import org.xmlobjects.builder.ObjectBuildException; +import org.xmlobjects.builder.ObjectBuilder; +import org.xmlobjects.serializer.ObjectSerializeException; +import org.xmlobjects.serializer.ObjectSerializer; +import org.xmlobjects.stream.XMLReadException; +import org.xmlobjects.stream.XMLReader; +import org.xmlobjects.stream.XMLWriteException; +import org.xmlobjects.stream.XMLWriter; +import org.xmlobjects.xml.Attributes; +import org.xmlobjects.xml.Element; +import org.xmlobjects.xml.Namespaces; + +import de.hft.stuttgart.quality.QualityADEModule; +import de.hft.stuttgart.quality.adapter.properties.FilterPropertyAdapter; +import de.hft.stuttgart.quality.adapter.properties.GlobalParametersPropertyAdapter; +import de.hft.stuttgart.quality.adapter.properties.RequirementPropertyAdapter; +import de.hft.stuttgart.quality.model.properties.RequirementProperty; +import de.hft.stuttgart.quality.model.types.ValidationPlan; + +@XMLElement(name = "ValidationPlan", namespaceURI = QualityADEModule.NAMESPACE_URI) +public class ValidationPlanAdapter implements ObjectBuilder, ObjectSerializer { + + @Override + public ValidationPlan createObject(QName name, Object parent) throws ObjectBuildException { + return new ValidationPlan(); + } + + @Override + public void buildChildObject(ValidationPlan object, QName name, Attributes attributes, XMLReader reader) + throws ObjectBuildException, XMLReadException { + if (!QualityADEModule.NAMESPACE_URI.equals(name.getNamespaceURI())) { + return; + } + switch (name.getLocalPart()) { + case "globalParameters" -> object + .setGlobalParameters(reader.getObjectUsingBuilder(GlobalParametersPropertyAdapter.class)); + case "filter" -> object.setFilter(reader.getObjectUsingBuilder(FilterPropertyAdapter.class)); + case "requirement" -> object.getRequirements() + .add(reader.getObjectUsingBuilder(RequirementPropertyAdapter.class)); + default -> throw new IllegalStateException( + "Cannot handle name " + name + " when building ValidationPlan element"); + } + } + + @Override + public Element createElement(ValidationPlan object, Namespaces namespaces) throws ObjectSerializeException { + return Element.of(QualityADEModule.NAMESPACE_URI, "ValidationPlan"); + } + + @Override + public void writeChildElements(ValidationPlan object, Namespaces namespaces, XMLWriter writer) + throws ObjectSerializeException, XMLWriteException { + if (object.getGlobalParameters() != null) { + writer.writeElementUsingSerializer(Element.of(QualityADEModule.NAMESPACE_URI, "globalParameters"), + object.getGlobalParameters(), GlobalParametersPropertyAdapter.class, namespaces); + } + if (object.getFilter() != null) { + writer.writeElementUsingSerializer(Element.of(QualityADEModule.NAMESPACE_URI, "filter"), object.getFilter(), + FilterPropertyAdapter.class, namespaces); + } + for (RequirementProperty req : object.getRequirements()) { + writer.writeElementUsingSerializer(Element.of(QualityADEModule.NAMESPACE_URI, "requirement"), req, + RequirementPropertyAdapter.class, namespaces); + } + } +} diff --git a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/ValidationResultAdapter.java b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/ValidationResultAdapter.java new file mode 100644 index 0000000..68f5b8d --- /dev/null +++ b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/ValidationResultAdapter.java @@ -0,0 +1,69 @@ +package de.hft.stuttgart.quality.adapter.types; + +import javax.xml.namespace.QName; + +import org.xmlobjects.annotation.XMLElement; +import org.xmlobjects.builder.ObjectBuildException; +import org.xmlobjects.builder.ObjectBuilder; +import org.xmlobjects.gml.adapter.base.ReferenceAdapter; +import org.xmlobjects.serializer.ObjectSerializeException; +import org.xmlobjects.serializer.ObjectSerializer; +import org.xmlobjects.stream.XMLReadException; +import org.xmlobjects.stream.XMLReader; +import org.xmlobjects.stream.XMLWriteException; +import org.xmlobjects.stream.XMLWriter; +import org.xmlobjects.xml.Attributes; +import org.xmlobjects.xml.Element; +import org.xmlobjects.xml.Namespaces; + +import de.hft.stuttgart.quality.QualityADEModule; +import de.hft.stuttgart.quality.adapter.properties.AbstractErrorPropertyAdapter; +import de.hft.stuttgart.quality.model.enums.ResultType; +import de.hft.stuttgart.quality.model.properties.AbstractErrorProperty; +import de.hft.stuttgart.quality.model.types.ValidationResult; + +@XMLElement(name = "ValidationResult", namespaceURI = QualityADEModule.NAMESPACE_URI) +public class ValidationResultAdapter implements ObjectBuilder, ObjectSerializer { + + @Override + public ValidationResult createObject(QName name, Object parent) throws ObjectBuildException { + return new ValidationResult(); + } + + @Override + public void buildChildObject(ValidationResult object, QName name, Attributes attributes, XMLReader reader) + throws ObjectBuildException, XMLReadException { + if (!QualityADEModule.NAMESPACE_URI.equals(name.getNamespaceURI())) { + return; + } + switch (name.getLocalPart()) { + case "validationPlanID" -> object.setValidationPlanID(reader.getObjectUsingBuilder(ReferenceAdapter.class)); + case "error" -> object.getErrors().add(reader.getObjectUsingBuilder(AbstractErrorPropertyAdapter.class)); + case "resultType" -> reader.getTextContent().ifPresent(s -> object.setResultType(ResultType.valueOf(s))); + default -> throw new IllegalStateException( + "Cannot handle name " + name + " when building ValidationResult element"); + } + } + + @Override + public Element createElement(ValidationResult object, Namespaces namespaces) throws ObjectSerializeException { + return Element.of(QualityADEModule.NAMESPACE_URI, "ValidationResult"); + } + + @Override + public void writeChildElements(ValidationResult object, Namespaces namespaces, XMLWriter writer) + throws ObjectSerializeException, XMLWriteException { + if (object.getValidationPlanID() != null) { + writer.writeElementUsingSerializer(Element.of(QualityADEModule.NAMESPACE_URI, "validationPlanID"), + object.getValidationPlanID(), ReferenceAdapter.class, namespaces); + } + for (AbstractErrorProperty err : object.getErrors()) { + writer.writeElementUsingSerializer(Element.of(QualityADEModule.NAMESPACE_URI, "error"), err, + AbstractErrorPropertyAdapter.class, namespaces); + } + if (object.getResultType() != null) { + writer.writeElement(Element.of(QualityADEModule.NAMESPACE_URI, "resultType") + .addTextContent(object.getResultType().toString())); + } + } +} diff --git a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/ZonedDateTimeAdapter.java b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/ZonedDateTimeAdapter.java new file mode 100644 index 0000000..5a66e34 --- /dev/null +++ b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/ZonedDateTimeAdapter.java @@ -0,0 +1,37 @@ +/*- + * Copyright 2022 Hochschule für Technik Stuttgart + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package de.hft.stuttgart.quality.adapter.types; + +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.time.ZonedDateTime; +import java.time.format.DateTimeFormatter; + +public class ZonedDateTimeAdapter { + + public ZonedDateTime fromString(String v) { + try { + return ZonedDateTime.from(DateTimeFormatter.ISO_OFFSET_DATE_TIME.parse(v)); + } catch (Exception e) { + return LocalDateTime.parse(v).atZone(ZoneId.systemDefault()); + } + } + + public String toString(ZonedDateTime v) { + return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(v); + } + +} diff --git a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/model/properties/ValidationResultProperty.java b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/model/properties/ValidationResultProperty.java new file mode 100644 index 0000000..db6f38c --- /dev/null +++ b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/model/properties/ValidationResultProperty.java @@ -0,0 +1,48 @@ +/*- + * Copyright 2022 Hochschule für Technik Stuttgart + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package de.hft.stuttgart.quality.model.properties; + +import java.io.Serial; + +import org.citygml4j.core.model.ade.ADEObject; +import org.xmlobjects.gml.model.base.AbstractInlineOrByReferenceProperty; + +import de.hft.stuttgart.quality.model.types.ValidationResult; + +public class ValidationResultProperty extends AbstractInlineOrByReferenceProperty implements ADEObject { + + + @Serial + private static final long serialVersionUID = 480940868730913996L; + + public ValidationResultProperty() { + super(); + } + + public ValidationResultProperty(ValidationResult object) { + super(object); + } + + public ValidationResultProperty(String href) { + super(href); + } + + @Override + public Class getTargetType() { + return ValidationResult.class; + } + +} diff --git a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/model/types/CityObjectProperties.java b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/model/types/CityObjectProperties.java index e9c058d..98eabb6 100644 --- a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/model/types/CityObjectProperties.java +++ b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/model/types/CityObjectProperties.java @@ -4,18 +4,20 @@ import java.io.Serial; import org.citygml4j.core.model.core.ADEOfAbstractCityObject; +import de.hft.stuttgart.quality.model.properties.ValidationResultProperty; + public class CityObjectProperties extends ADEOfAbstractCityObject { @Serial private static final long serialVersionUID = 1273072314736964714L; - private ValidationResult validationResult; + private ValidationResultProperty validationResult; - public ValidationResult getValidationResult() { + public ValidationResultProperty getValidationResult() { return validationResult; } - public void setValidationResult(ValidationResult validationResult) { + public void setValidationResult(ValidationResultProperty validationResult) { this.validationResult = asChild(validationResult); } } diff --git a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/model/types/MultipleComponentsError.java b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/model/types/MultipleComponentsError.java index 02eb853..9bb38d6 100644 --- a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/model/types/MultipleComponentsError.java +++ b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/model/types/MultipleComponentsError.java @@ -27,17 +27,17 @@ public class MultipleComponentsError extends AbstractSolidError { @Serial private static final long serialVersionUID = 4322219502819024437L; - private List edges; + private List components; - public List getEdges() { - if (edges == null) { - edges = new ChildList<>(this); + public List getComponents() { + if (components == null) { + components = new ChildList<>(this); } - return edges; + return components; } - public void setEdges(List edges) { - this.edges = asChild(edges); + public void setComponents(List edges) { + this.components = asChild(edges); } } diff --git a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/model/types/PolygonWrongOrientationError.java b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/model/types/PolygonWrongOrientationError.java index 786914b..6df9ef1 100644 --- a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/model/types/PolygonWrongOrientationError.java +++ b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/model/types/PolygonWrongOrientationError.java @@ -17,28 +17,21 @@ package de.hft.stuttgart.quality.model.types; import java.io.Serial; +import de.hft.stuttgart.quality.model.properties.EdgeListProperty; + public class PolygonWrongOrientationError extends AbstractSolidError { @Serial private static final long serialVersionUID = 4975827693656963892L; - private String polygonId1; - private String polygonId2; - - public String getPolygonId1() { - return polygonId1; - } - - public void setPolygonId1(String polygonId1) { - this.polygonId1 = polygonId1; - } + private EdgeListProperty edges; - public String getPolygonId2() { - return polygonId2; + public EdgeListProperty getEdges() { + return edges; } - public void setPolygonId2(String polygonId2) { - this.polygonId2 = polygonId2; + public void setEdges(EdgeListProperty edges) { + this.edges = edges; } } diff --git a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/model/types/SolidSelfIntersectionError.java b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/model/types/SolidSelfIntersectionError.java index 2bbe224..8ab1538 100644 --- a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/model/types/SolidSelfIntersectionError.java +++ b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/model/types/SolidSelfIntersectionError.java @@ -19,7 +19,26 @@ import java.io.Serial; public class SolidSelfIntersectionError extends AbstractSolidError { - @Serial - private static final long serialVersionUID = 5070991901664859830L; + @Serial + private static final long serialVersionUID = 5070991901664859830L; + + private String polygonId1; + private String polygonId2; + + public String getPolygonId1() { + return polygonId1; + } + + public void setPolygonId1(String polygonId1) { + this.polygonId1 = polygonId1; + } + + public String getPolygonId2() { + return polygonId2; + } + + public void setPolygonId2(String polygonId2) { + this.polygonId2 = polygonId2; + } } diff --git a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/model/types/ValidationPlan.java b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/model/types/ValidationPlan.java index 32af5a4..4b33144 100644 --- a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/model/types/ValidationPlan.java +++ b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/model/types/ValidationPlan.java @@ -51,14 +51,14 @@ public class ValidationPlan extends GMLObject implements ADEObject { this.filter = asChild(filter); } - public List getRequirement() { + public List getRequirements() { if (requirement == null) { requirement = new ChildList<>(this); } return requirement; } - public void setRequirement(List requirement) { + public void setRequirements(List requirement) { this.requirement = asChild(requirement); } diff --git a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/util/UncheckedMissingADESchemaException.java b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/util/UncheckedMissingADESchemaException.java deleted file mode 100644 index f0a31ac..0000000 --- a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/util/UncheckedMissingADESchemaException.java +++ /dev/null @@ -1,37 +0,0 @@ -/*- - * Copyright 2020 Hochschule für Technik Stuttgart - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package de.hft.stuttgart.quality.util; - - -import org.citygml4j.xml.reader.MissingADESchemaException; - -public class UncheckedMissingADESchemaException extends RuntimeException { - - private static final long serialVersionUID = -5684499826072882203L; - - private MissingADESchemaException cause; - - public UncheckedMissingADESchemaException(MissingADESchemaException e) { - super(e); - this.cause = e; - } - - @Override - public synchronized MissingADESchemaException getCause() { - return cause; - } - -} diff --git a/citygml4j-quality-ade/src/main/resources/META-INF/services/org.citygml4j.model.citygml.ade.binding.ADEContext b/citygml4j-quality-ade/src/main/resources/META-INF/services/org.citygml4j.model.citygml.ade.binding.ADEContext deleted file mode 100644 index 7d74a72..0000000 --- a/citygml4j-quality-ade/src/main/resources/META-INF/services/org.citygml4j.model.citygml.ade.binding.ADEContext +++ /dev/null @@ -1 +0,0 @@ -de.hft.stuttgart.quality.QualityADEContext \ No newline at end of file diff --git a/citygml4j-quality-ade/src/main/resources/qualityAde.xsd b/citygml4j-quality-ade/src/main/resources/qualityAde.xsd index f3d06ae..6bfd61a 100644 --- a/citygml4j-quality-ade/src/main/resources/qualityAde.xsd +++ b/citygml4j-quality-ade/src/main/resources/qualityAde.xsd @@ -561,8 +561,8 @@ - - + + @@ -573,13 +573,13 @@ - + - + - - + + @@ -590,20 +590,20 @@ - + - + - - - - - - + + + + + + diff --git a/citygml4j-quality-ade/src/test/java/de/hft/stuttgart/quality/QualityAdeTests.java b/citygml4j-quality-ade/src/test/java/de/hft/stuttgart/quality/QualityAdeTests.java index 62a4b87..2198bec 100644 --- a/citygml4j-quality-ade/src/test/java/de/hft/stuttgart/quality/QualityAdeTests.java +++ b/citygml4j-quality-ade/src/test/java/de/hft/stuttgart/quality/QualityAdeTests.java @@ -15,1368 +15,546 @@ */ package de.hft.stuttgart.quality; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.time.ZonedDateTime; +import java.util.Locale; + +import javax.xml.XMLConstants; +import javax.xml.transform.Source; +import javax.xml.transform.stream.StreamSource; +import javax.xml.validation.Schema; +import javax.xml.validation.SchemaFactory; +import javax.xml.validation.Validator; + +import org.citygml4j.core.ade.ADEException; +import org.citygml4j.core.ade.ADERegistry; +import org.citygml4j.core.model.CityGMLVersion; +import org.citygml4j.core.model.building.Building; +import org.citygml4j.core.model.core.AbstractCityObjectProperty; +import org.citygml4j.core.model.core.AbstractFeatureProperty; +import org.citygml4j.core.model.core.CityModel; +import org.citygml4j.xml.CityGMLContext; +import org.citygml4j.xml.CityGMLContextException; +import org.citygml4j.xml.module.citygml.CoreModule; +import org.citygml4j.xml.schema.CityGMLSchemaHandler; +import org.citygml4j.xml.writer.CityGMLOutputFactory; +import org.citygml4j.xml.writer.CityGMLWriteException; +import org.citygml4j.xml.writer.CityGMLWriter; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.xml.sax.ErrorHandler; +import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; +import org.xmlobjects.gml.model.base.Reference; +import org.xmlobjects.gml.model.geometry.DirectPosition; +import org.xmlobjects.gml.model.measures.Angle; +import org.xmlobjects.gml.model.measures.Length; +import org.xmlobjects.schema.SchemaHandlerException; + +import de.hft.stuttgart.quality.model.enums.RequirementId; +import de.hft.stuttgart.quality.model.enums.ResultType; +import de.hft.stuttgart.quality.model.enums.RingSelfIntType; +import de.hft.stuttgart.quality.model.enums.TopLevelFeatureType; +import de.hft.stuttgart.quality.model.properties.AbstractErrorProperty; +import de.hft.stuttgart.quality.model.properties.CheckingProperty; +import de.hft.stuttgart.quality.model.properties.ComponentListProperty; +import de.hft.stuttgart.quality.model.properties.EdgeListProperty; +import de.hft.stuttgart.quality.model.properties.EdgeProperty; +import de.hft.stuttgart.quality.model.properties.FeatureStatisticsProperty; +import de.hft.stuttgart.quality.model.properties.FilterProperty; +import de.hft.stuttgart.quality.model.properties.GlobalParametersProperty; +import de.hft.stuttgart.quality.model.properties.ParameterProperty; +import de.hft.stuttgart.quality.model.properties.PolygonIdListProperty; +import de.hft.stuttgart.quality.model.properties.RequirementProperty; +import de.hft.stuttgart.quality.model.properties.StatisticsProperty; +import de.hft.stuttgart.quality.model.properties.ValidationPlanProperty; +import de.hft.stuttgart.quality.model.properties.ValidationResultProperty; +import de.hft.stuttgart.quality.model.types.AllPolygonsOrientedWrongError; +import de.hft.stuttgart.quality.model.types.Checking; +import de.hft.stuttgart.quality.model.types.CityObjectProperties; +import de.hft.stuttgart.quality.model.types.ComponentList; +import de.hft.stuttgart.quality.model.types.ConsecutivePointsSameError; +import de.hft.stuttgart.quality.model.types.Edge; +import de.hft.stuttgart.quality.model.types.EdgeList; +import de.hft.stuttgart.quality.model.types.FeatureStatistics; +import de.hft.stuttgart.quality.model.types.Filter; +import de.hft.stuttgart.quality.model.types.GlobalParameters; +import de.hft.stuttgart.quality.model.types.HoleOutsideError; +import de.hft.stuttgart.quality.model.types.InnerRingsNestedError; +import de.hft.stuttgart.quality.model.types.InteriorDisconnectedError; +import de.hft.stuttgart.quality.model.types.IntersectingRingsError; +import de.hft.stuttgart.quality.model.types.MultipleComponentsError; +import de.hft.stuttgart.quality.model.types.NonManifoldEdgeError; +import de.hft.stuttgart.quality.model.types.NonManifoldVertexError; +import de.hft.stuttgart.quality.model.types.OrientationRingsSameError; +import de.hft.stuttgart.quality.model.types.Parameter; +import de.hft.stuttgart.quality.model.types.PlanarDistancePlaneError; +import de.hft.stuttgart.quality.model.types.PlanarNormalsDeviationError; +import de.hft.stuttgart.quality.model.types.PolygonIdList; +import de.hft.stuttgart.quality.model.types.PolygonWrongOrientationError; +import de.hft.stuttgart.quality.model.types.Requirement; +import de.hft.stuttgart.quality.model.types.RingNotClosedError; +import de.hft.stuttgart.quality.model.types.RingSelfIntersectionError; +import de.hft.stuttgart.quality.model.types.RingTooFewPointsError; +import de.hft.stuttgart.quality.model.types.SemanticAttributeMissingError; +import de.hft.stuttgart.quality.model.types.SemanticAttributeWrongValueError; +import de.hft.stuttgart.quality.model.types.SolidNotClosedError; +import de.hft.stuttgart.quality.model.types.SolidSelfIntersectionError; +import de.hft.stuttgart.quality.model.types.SolidTooFewPolygonsError; +import de.hft.stuttgart.quality.model.types.Statistics; +import de.hft.stuttgart.quality.model.types.Validation; +import de.hft.stuttgart.quality.model.types.ValidationPlan; +import de.hft.stuttgart.quality.model.types.ValidationResult; + class QualityAdeTests { - /* + @BeforeAll + static void setUsLocale() throws ADEException { + Locale.setDefault(Locale.US); + ADERegistry.getInstance().loadADE(new QualityADEContext()); + } + + @Test - void testValidationPlan() throws ADEException, CityGMLContextException, CityGMLWriteException { + void testAllPolygonsOrientedWrong() throws ADEException, CityGMLContextException, CityGMLWriteException, SAXException, IOException, SchemaHandlerException { CityModel model = new CityModel(); + ValidationResult res = fillCityModel(model); - Validation v = new Validation(); - model.getFeatureMembers().add(new AbstractFeatureProperty(v)); - v.setValidationSoftware("testSoftware"); - v.setValidationDate(ZonedDateTime.now()); - ValidationPlan plan = new ValidationPlan(); - Requirement req = new Requirement(); - req.setEnabled(true); - req.setName(RequirementId.R_GE_P_HOLE_OUTSIDE); - plan.getRequirements().add(req); - - Checking checking = new Checking(); - checking.setFeatureType(TopLevelFeatureType.BRIDGE); - plan.getFilter().add(checking); - - Parameter param = new Parameter(); - param.setName("test"); - param.setUom("uom"); - param.setValue("5"); - plan.getGlobalParameters().add(param); - - v.setValidationPlan(plan); - - - ADERegistry.getInstance().loadADE(new QualityADEContext()); - - CityGMLContext context = CityGMLContext.newInstance(); - CityGMLVersion version = CityGMLVersion.v2_0; - CityGMLOutputFactory out = context.createCityGMLOutputFactory(version); + AllPolygonsOrientedWrongError err = new AllPolygonsOrientedWrongError(); + err.setGeometryId("geomId"); + res.getErrors().add(new AbstractErrorProperty(err)); - - try (CityGMLChunkWriter writer = out.createCityGMLChunkWriter(Paths.get("test.gml"), StandardCharsets.UTF_8.name())) { - writer.withIndent(" ") - .withSchemaLocation(QualityADEModule.NAMESPACE_URI, getClass().getResource("/qualityAde.xsd").toString()) - .withDefaultPrefixes() - .withDefaultNamespace(CoreModule.of(version).getNamespaceURI()) - .writeMember(v); - } - + byte[] buf = writeModel(model); + assertTrue(validate(new ByteArrayInputStream(buf))); } - - - - @Test - void testReadingConsecutiveSameError() - throws ADEException, CityGMLBuilderException, CityGMLReadException, FileNotFoundException { - CityModel cityModel = readCityGml("src/test/resources/SimpleSolid_Error_QualityADE.gml"); - testValidationPlan(cityModel); - - List cityObjectMember = cityModel.getCityObjectMember(); - assertEquals(1, cityObjectMember.size()); - CityObjectMember com = cityObjectMember.get(0); - AbstractCityObject aco = com.getCityObject(); - assertNotNull(aco); - assertTrue(aco instanceof Building); - Building b = (Building) aco; - - List gen = b.getGenericApplicationPropertyOfCityObject(); - ADEComponent resultComp = gen.get(0); - assertTrue(resultComp instanceof ValidationResult); - ValidationResult result = (ValidationResult) resultComp; - assertEquals(ResultType.ERROR, result.getResult()); - assertFalse(result.getErrors().isEmpty()); - List errors = result.getErrors(); - assertEquals(1, errors.size()); - ValidationError validationError = errors.get(0); - assertTrue(validationError instanceof ConsecutivePointsSame); - ConsecutivePointsSame err = (ConsecutivePointsSame) validationError; - assertEquals("_Simple_BD.1_PG.6_LR.1", err.getLinearRingId()); - Double x1 = err.getVertex1().getValue().get(0); - assertEquals(11.5, x1, 0.0000001); - Double x2 = err.getVertex2().getValue().get(0); - assertEquals(11.5, x2, 0.0000001); - } - - @Test - void testReadingTooFewPointsError() - throws ADEException, CityGMLBuilderException, CityGMLReadException, FileNotFoundException { - CityModel cityModel = readCityGml("src/test/resources/SimpleSolid_TooFewPoints.gml"); - - List cityObjectMember = cityModel.getCityObjectMember(); - CityObjectMember com = cityObjectMember.get(0); - AbstractCityObject aco = com.getCityObject(); - Building b = (Building) aco; - - List gen = b.getGenericApplicationPropertyOfCityObject(); - ADEComponent resultComp = gen.get(0); - ValidationResult result = (ValidationResult) resultComp; - assertEquals(ResultType.ERROR, result.getResult()); - assertFalse(result.getErrors().isEmpty()); - List errors = result.getErrors(); - ValidationError validationError = errors.get(0); - assertTrue(validationError instanceof TooFewPoints); - TooFewPoints err = (TooFewPoints) validationError; - assertEquals("_Simple_BD.1_PG.6_LR.1", err.getLinearRingId()); - } - - @Test - void testReadingRingSelfIntersectionError() - throws ADEException, CityGMLBuilderException, CityGMLReadException, FileNotFoundException { - CityModel cityModel = readCityGml("src/test/resources/SimpleSolid_RingSelfIntersection.gml"); - - List cityObjectMember = cityModel.getCityObjectMember(); - CityObjectMember com = cityObjectMember.get(0); - AbstractCityObject aco = com.getCityObject(); - Building b = (Building) aco; - - List gen = b.getGenericApplicationPropertyOfCityObject(); - ADEComponent resultComp = gen.get(0); - ValidationResult result = (ValidationResult) resultComp; - assertEquals(ResultType.ERROR, result.getResult()); - assertFalse(result.getErrors().isEmpty()); - List errors = result.getErrors(); - ValidationError validationError = errors.get(0); - assertTrue(validationError instanceof RingSelfIntersection); - RingSelfIntersection err = (RingSelfIntersection) validationError; - assertEquals("_Simple_BD.1_PG.6_LR.1", err.getLinearRingId()); - assertEquals(RingSelfIntType.POINT_TOUCHES_EDGE, err.getType()); - assertNull(err.getEdge2()); - Edge edge1 = err.getEdge1(); - assertEquals(10.0, edge1.getFrom().getValue().get(0), 0.000001); - assertEquals(11.0, edge1.getTo().getValue().get(0), 0.000001); - assertEquals(5.0, err.getVertex1().getValue().get(0)); - assertNull(err.getVertex2()); - } - - @Test - void testReadingRingNotClosedError() - throws ADEException, CityGMLBuilderException, CityGMLReadException, FileNotFoundException { - CityModel cityModel = readCityGml("src/test/resources/SimpleSolid_RingNotClosed.gml"); - - List cityObjectMember = cityModel.getCityObjectMember(); - CityObjectMember com = cityObjectMember.get(0); - AbstractCityObject aco = com.getCityObject(); - Building b = (Building) aco; - - List gen = b.getGenericApplicationPropertyOfCityObject(); - ADEComponent resultComp = gen.get(0); - ValidationResult result = (ValidationResult) resultComp; - assertEquals(ResultType.ERROR, result.getResult()); - assertFalse(result.getErrors().isEmpty()); - List errors = result.getErrors(); - ValidationError validationError = errors.get(0); - assertTrue(validationError instanceof RingNotClosed); - RingNotClosed err = (RingNotClosed) validationError; - assertEquals("_Simple_BD.1_PG.6_LR.1", err.getLinearRingId()); - } - - @Test - void testReadingInteriorDisconnectedError() - throws ADEException, CityGMLBuilderException, CityGMLReadException, FileNotFoundException { - CityModel cityModel = readCityGml("src/test/resources/SimpleSolid_InteriorDisconnected.gml"); - - List cityObjectMember = cityModel.getCityObjectMember(); - CityObjectMember com = cityObjectMember.get(0); - AbstractCityObject aco = com.getCityObject(); - Building b = (Building) aco; - - List gen = b.getGenericApplicationPropertyOfCityObject(); - ADEComponent resultComp = gen.get(0); - ValidationResult result = (ValidationResult) resultComp; - assertEquals(ResultType.ERROR, result.getResult()); - assertFalse(result.getErrors().isEmpty()); - List errors = result.getErrors(); - ValidationError validationError = errors.get(0); - - assertTrue(validationError instanceof InteriorDisconnected); - InteriorDisconnected err = (InteriorDisconnected) validationError; - assertEquals("_Simple_BD.1_PG.1", err.getPolygonId()); - } - - @Test - void testReadingIntersectingRingsError() - throws ADEException, CityGMLBuilderException, CityGMLReadException, FileNotFoundException { - CityModel cityModel = readCityGml("src/test/resources/SimpleSolid_IntersectingRings.gml"); - - List cityObjectMember = cityModel.getCityObjectMember(); - CityObjectMember com = cityObjectMember.get(0); - AbstractCityObject aco = com.getCityObject(); - Building b = (Building) aco; - - List gen = b.getGenericApplicationPropertyOfCityObject(); - ADEComponent resultComp = gen.get(0); - ValidationResult result = (ValidationResult) resultComp; - assertEquals(ResultType.ERROR, result.getResult()); - assertFalse(result.getErrors().isEmpty()); - List errors = result.getErrors(); - ValidationError validationError = errors.get(0); - - assertTrue(validationError instanceof IntersectingRings); - IntersectingRings err = (IntersectingRings) validationError; - assertEquals("_Simple_BD.1_PG.1", err.getPolygonId()); - assertEquals("_Simple_BD.1_PG.1_Ring1", err.getLinearRingId1()); - assertEquals("_Simple_BD.1_PG.1_Ring2", err.getLinearRingId2()); - } - - @Test - void testReadingNonPlanarPolygonDistancePlaneError() - throws ADEException, CityGMLBuilderException, CityGMLReadException, FileNotFoundException { - CityModel cityModel = readCityGml("src/test/resources/SimpleSolid_NonPlanarPolygonDistancePlane.gml"); - - List cityObjectMember = cityModel.getCityObjectMember(); - CityObjectMember com = cityObjectMember.get(0); - AbstractCityObject aco = com.getCityObject(); - Building b = (Building) aco; - - List gen = b.getGenericApplicationPropertyOfCityObject(); - ADEComponent resultComp = gen.get(0); - ValidationResult result = (ValidationResult) resultComp; - assertEquals(ResultType.ERROR, result.getResult()); - assertFalse(result.getErrors().isEmpty()); - List errors = result.getErrors(); - ValidationError validationError = errors.get(0); - - assertTrue(validationError instanceof NonPlanarDistancePlane); - NonPlanarDistancePlane err = (NonPlanarDistancePlane) validationError; - assertEquals("_Simple_BD.1_PG.1", err.getPolygonId()); - assertEquals(1.0, err.getVertex().getValue().get(0), 0.000001); - assertEquals(0.001, err.getDistance().getValue(), 0.000001); - assertEquals("m", err.getDistance().getUom()); - } - - @Test - void testReadingInnerRingsNestedError() - throws ADEException, CityGMLBuilderException, CityGMLReadException, FileNotFoundException { - CityModel cityModel = readCityGml("src/test/resources/SimpleSolid_InnerRingNested.gml"); - - List cityObjectMember = cityModel.getCityObjectMember(); - CityObjectMember com = cityObjectMember.get(0); - AbstractCityObject aco = com.getCityObject(); - Building b = (Building) aco; - - List gen = b.getGenericApplicationPropertyOfCityObject(); - ADEComponent resultComp = gen.get(0); - ValidationResult result = (ValidationResult) resultComp; - assertEquals(ResultType.ERROR, result.getResult()); - assertFalse(result.getErrors().isEmpty()); - List errors = result.getErrors(); - ValidationError validationError = errors.get(0); - - assertTrue(validationError instanceof InnerRingsNested); - InnerRingsNested err = (InnerRingsNested) validationError; - assertEquals("_Simple_BD.1_PG.1", err.getPolygonId()); - assertEquals("_Simple_BD.1_PG.1_Ring1", err.getLinearRingId1()); - assertEquals("_Simple_BD.1_PG.1_Ring2", err.getLinearRingId2()); - } - - @Test - void testReadingHoleOutsideError() - throws ADEException, CityGMLBuilderException, CityGMLReadException, FileNotFoundException { - CityModel cityModel = readCityGml("src/test/resources/SimpleSolid_HoleOutside.gml"); - - List cityObjectMember = cityModel.getCityObjectMember(); - CityObjectMember com = cityObjectMember.get(0); - AbstractCityObject aco = com.getCityObject(); - Building b = (Building) aco; - - List gen = b.getGenericApplicationPropertyOfCityObject(); - ADEComponent resultComp = gen.get(0); - ValidationResult result = (ValidationResult) resultComp; - assertEquals(ResultType.ERROR, result.getResult()); - assertFalse(result.getErrors().isEmpty()); - List errors = result.getErrors(); - ValidationError validationError = errors.get(0); - - assertTrue(validationError instanceof HoleOutside); - HoleOutside err = (HoleOutside) validationError; - assertEquals("_Simple_BD.1_PG.1", err.getPolygonId()); - assertEquals("_Simple_BD.1_PG.1_Ring1", err.getLinearRingId()); - } - - @Test - void testReadingNonPlanarNormalsDeviationError() - throws ADEException, CityGMLBuilderException, CityGMLReadException, FileNotFoundException { - CityModel cityModel = readCityGml("src/test/resources/SimpleSolid_NonPlanarPolygonNormalsDeviation.gml"); - - List cityObjectMember = cityModel.getCityObjectMember(); - CityObjectMember com = cityObjectMember.get(0); - AbstractCityObject aco = com.getCityObject(); - Building b = (Building) aco; - - List gen = b.getGenericApplicationPropertyOfCityObject(); - ADEComponent resultComp = gen.get(0); - ValidationResult result = (ValidationResult) resultComp; - assertEquals(ResultType.ERROR, result.getResult()); - assertFalse(result.getErrors().isEmpty()); - List errors = result.getErrors(); - ValidationError validationError = errors.get(0); - - assertTrue(validationError instanceof NonPlanarNormalsDeviation); - NonPlanarNormalsDeviation err = (NonPlanarNormalsDeviation) validationError; - assertEquals("_Simple_BD.1_PG.1", err.getPolygonId()); - assertEquals(1.0, err.getDeviation().getValue()); - assertEquals("deg", err.getDeviation().getUom()); - } - - @Test - void testReadingOrientationRingsSameError() - throws ADEException, CityGMLBuilderException, CityGMLReadException, FileNotFoundException { - CityModel cityModel = readCityGml("src/test/resources/SimpleSolid_OrientationRingsSame.gml"); - - List cityObjectMember = cityModel.getCityObjectMember(); - CityObjectMember com = cityObjectMember.get(0); - AbstractCityObject aco = com.getCityObject(); - Building b = (Building) aco; - - List gen = b.getGenericApplicationPropertyOfCityObject(); - ADEComponent resultComp = gen.get(0); - ValidationResult result = (ValidationResult) resultComp; - assertEquals(ResultType.ERROR, result.getResult()); - assertFalse(result.getErrors().isEmpty()); - List errors = result.getErrors(); - ValidationError validationError = errors.get(0); - - assertTrue(validationError instanceof OrientationRingsSame); - OrientationRingsSame err = (OrientationRingsSame) validationError; - assertEquals("_Simple_BD.1_PG.1", err.getPolygonId()); - assertEquals("_Simple_BD.1_PG.1_Ring1", err.getLinearRingId()); - } - - @Test - void testReadingAllPolygonsWrongOrientationError() - throws ADEException, CityGMLBuilderException, CityGMLReadException, FileNotFoundException { - CityModel cityModel = readCityGml("src/test/resources/SimpleSolid_AllPolygonsWrongOrientation.gml"); - - List cityObjectMember = cityModel.getCityObjectMember(); - CityObjectMember com = cityObjectMember.get(0); - AbstractCityObject aco = com.getCityObject(); - Building b = (Building) aco; - - List gen = b.getGenericApplicationPropertyOfCityObject(); - ADEComponent resultComp = gen.get(0); - ValidationResult result = (ValidationResult) resultComp; - assertEquals(ResultType.ERROR, result.getResult()); - assertFalse(result.getErrors().isEmpty()); - List errors = result.getErrors(); - ValidationError validationError = errors.get(0); - - assertTrue(validationError instanceof AllPolygonsWrongOrientation); - AllPolygonsWrongOrientation err = (AllPolygonsWrongOrientation) validationError; - assertEquals("_Simple_BD.1_Geom1", err.getGeometryId()); - } - - @Test - void testReadingPolygonWrongOrientationError() - throws ADEException, CityGMLBuilderException, CityGMLReadException, FileNotFoundException { - CityModel cityModel = readCityGml("src/test/resources/SimpleSolid_PolygonWrongOrientation.gml"); - - List cityObjectMember = cityModel.getCityObjectMember(); - CityObjectMember com = cityObjectMember.get(0); - AbstractCityObject aco = com.getCityObject(); - Building b = (Building) aco; - - List gen = b.getGenericApplicationPropertyOfCityObject(); - ADEComponent resultComp = gen.get(0); - ValidationResult result = (ValidationResult) resultComp; - assertEquals(ResultType.ERROR, result.getResult()); - assertFalse(result.getErrors().isEmpty()); - List errors = result.getErrors(); - ValidationError validationError = errors.get(0); - - assertTrue(validationError instanceof PolygonWrongOrientation); - PolygonWrongOrientation err = (PolygonWrongOrientation) validationError; - assertEquals("_Simple_BD.1_Geom1", err.getGeometryId()); - assertFalse(err.getEdges().isEmpty()); - List edges = err.getEdges(); - Edge edge = edges.get(0); - DirectPosition from = edge.getFrom(); - assertEquals(10.0, from.getValue().get(0), 0.000001); - assertEquals(11.0, edge.getTo().getValue().get(0), 0.000001); - } - - @Test - void testReadingNonManifoldVertexError() - throws ADEException, CityGMLBuilderException, CityGMLReadException, FileNotFoundException { - CityModel cityModel = readCityGml("src/test/resources/SimpleSolid_NonManifoldVertex.gml"); - - List cityObjectMember = cityModel.getCityObjectMember(); - CityObjectMember com = cityObjectMember.get(0); - AbstractCityObject aco = com.getCityObject(); - Building b = (Building) aco; - - List gen = b.getGenericApplicationPropertyOfCityObject(); - ADEComponent resultComp = gen.get(0); - ValidationResult result = (ValidationResult) resultComp; - assertEquals(ResultType.ERROR, result.getResult()); - assertFalse(result.getErrors().isEmpty()); - List errors = result.getErrors(); - ValidationError validationError = errors.get(0); - - assertTrue(validationError instanceof NonManifoldVertex); - NonManifoldVertex err = (NonManifoldVertex) validationError; - assertEquals("_Simple_BD.1_Geom1", err.getGeometryId()); - DirectPosition vertex = err.getVertex(); - assertEquals(1.0, vertex.getValue().get(0), 0.000001); - } - - @Test - void testReadingNonManifoldEdgeError() - throws ADEException, CityGMLBuilderException, CityGMLReadException, FileNotFoundException { - CityModel cityModel = readCityGml("src/test/resources/SimpleSolid_NonManifoldEdge.gml"); - - List cityObjectMember = cityModel.getCityObjectMember(); - CityObjectMember com = cityObjectMember.get(0); - AbstractCityObject aco = com.getCityObject(); - Building b = (Building) aco; - - List gen = b.getGenericApplicationPropertyOfCityObject(); - ADEComponent resultComp = gen.get(0); - ValidationResult result = (ValidationResult) resultComp; - assertEquals(ResultType.ERROR, result.getResult()); - assertFalse(result.getErrors().isEmpty()); - List errors = result.getErrors(); - ValidationError validationError = errors.get(0); - - assertTrue(validationError instanceof NonManifoldEdge); - NonManifoldEdge err = (NonManifoldEdge) validationError; - assertEquals("_Simple_BD.1_Geom1", err.getGeometryId()); - assertFalse(err.getEdges().isEmpty()); - List edges = err.getEdges(); - Edge edge = edges.get(0); - DirectPosition from = edge.getFrom(); - assertEquals(10.0, from.getValue().get(0), 0.000001); - assertEquals(11.0, edge.getTo().getValue().get(0), 0.000001); - } - - @Test - void testReadingSolidNotClosedError() - throws ADEException, CityGMLBuilderException, CityGMLReadException, FileNotFoundException { - CityModel cityModel = readCityGml("src/test/resources/SimpleSolid_SolidNotClosed.gml"); - - List cityObjectMember = cityModel.getCityObjectMember(); - CityObjectMember com = cityObjectMember.get(0); - AbstractCityObject aco = com.getCityObject(); - Building b = (Building) aco; - - List gen = b.getGenericApplicationPropertyOfCityObject(); - ADEComponent resultComp = gen.get(0); - ValidationResult result = (ValidationResult) resultComp; - assertEquals(ResultType.ERROR, result.getResult()); - assertFalse(result.getErrors().isEmpty()); - List errors = result.getErrors(); - ValidationError validationError = errors.get(0); - - assertTrue(validationError instanceof SolidNotClosed); - SolidNotClosed err = (SolidNotClosed) validationError; - assertEquals("_Simple_BD.1_Geom1", err.getGeometryId()); - assertFalse(err.getEdges().isEmpty()); - List edges = err.getEdges(); - Edge edge = edges.get(0); - DirectPosition from = edge.getFrom(); - assertEquals(10.0, from.getValue().get(0), 0.000001); - assertEquals(11.0, edge.getTo().getValue().get(0), 0.000001); - } - @Test - void testReadingTooFewPolygonsError() - throws ADEException, CityGMLBuilderException, CityGMLReadException, FileNotFoundException { - CityModel cityModel = readCityGml("src/test/resources/SimpleSolid_TooFewPolygons.gml"); - - List cityObjectMember = cityModel.getCityObjectMember(); - CityObjectMember com = cityObjectMember.get(0); - AbstractCityObject aco = com.getCityObject(); - Building b = (Building) aco; - - List gen = b.getGenericApplicationPropertyOfCityObject(); - ADEComponent resultComp = gen.get(0); - ValidationResult result = (ValidationResult) resultComp; - assertEquals(ResultType.ERROR, result.getResult()); - assertFalse(result.getErrors().isEmpty()); - List errors = result.getErrors(); - ValidationError validationError = errors.get(0); - - assertTrue(validationError instanceof TooFewPolygons); - TooFewPolygons err = (TooFewPolygons) validationError; - assertEquals("_Simple_BD.1_Geom1", err.getGeometryId()); - } - - @Test - void testReadingMultipleConnectedComponentsError() - throws ADEException, CityGMLBuilderException, CityGMLReadException, FileNotFoundException { - CityModel cityModel = readCityGml("src/test/resources/SimpleSolid_MultipleConnectedComponents.gml"); - - List cityObjectMember = cityModel.getCityObjectMember(); - CityObjectMember com = cityObjectMember.get(0); - AbstractCityObject aco = com.getCityObject(); - Building b = (Building) aco; - - List gen = b.getGenericApplicationPropertyOfCityObject(); - ADEComponent resultComp = gen.get(0); - ValidationResult result = (ValidationResult) resultComp; - assertEquals(ResultType.ERROR, result.getResult()); - assertFalse(result.getErrors().isEmpty()); - List errors = result.getErrors(); - ValidationError validationError = errors.get(0); - - assertTrue(validationError instanceof MultipleConnectedComponents); - MultipleConnectedComponents err = (MultipleConnectedComponents) validationError; - assertEquals("_Simple_BD.1_Geom1", err.getGeometryId()); - assertEquals("_Simple_BD.1_PG.1", err.getComponents().get(0).getPolygonIds().get(0)); - assertEquals("_Simple_BD.1_PG.2", err.getComponents().get(0).getPolygonIds().get(1)); - assertEquals("_Simple_BD.1_PG.3", err.getComponents().get(1).getPolygonIds().get(0)); - assertEquals("_Simple_BD.1_PG.4", err.getComponents().get(1).getPolygonIds().get(1)); - } - - @Test - void testWritingAttributeMissingError() - throws ADEException, CityGMLBuilderException, CityGMLWriteException, CityGMLReadException { - CityModel model = new CityModel(); - Building b = new Building(); - model.getCityObjectMember().add(new CityObjectMember(b)); - - ValidationResult result = new ValidationResult(); - result.setResult(ResultType.ERROR); - b.addGenericApplicationPropertyOfCityObject(result); - AttributeMissing error = new AttributeMissing(); - error.setAttributeName("TestName"); - error.setChildId("TestId"); - error.setGeneric(true); - result.getErrors().add(error); - byte[] gml = writeCityGml(model); - model = readCityGml(gml); - - AbstractCityObject co = model.getCityObjectMember().get(0).getCityObject(); - List ades = co.getGenericApplicationPropertyOfCityObject(); - ADEComponent adeComponent = ades.get(0); - ValidationResult valRes = (ValidationResult) adeComponent; - assertEquals(ResultType.ERROR, valRes.getResult()); - - ValidationError valError = valRes.getErrors().get(0); - AttributeMissing error2 = (AttributeMissing) valError; - assertEquals(error.getAttributeName(), error2.getAttributeName()); - assertEquals(error.getChildId(), error2.getChildId()); - assertEquals(error.isGeneric(), error2.isGeneric()); + void testConsecutivePointsSameError() throws ADEException, CityGMLContextException, CityGMLWriteException, SAXException, IOException, SchemaHandlerException { + CityModel model = new CityModel(); + ValidationResult res = fillCityModel(model); + + ConsecutivePointsSameError err = new ConsecutivePointsSameError(); + err.setLinearRingId("ringId"); + err.setVertex1(new DirectPosition(1, 2, 3)); + err.setVertex2(new DirectPosition(5, 6, 7)); + res.getErrors().add(new AbstractErrorProperty(err)); + + byte[] buf = writeModel(model); + assertTrue(validate(new ByteArrayInputStream(buf))); } - + @Test - void testWritingAttributeWrongValueError() - throws ADEException, CityGMLBuilderException, CityGMLWriteException, CityGMLReadException { - CityModel model = new CityModel(); - Building b = new Building(); - model.getCityObjectMember().add(new CityObjectMember(b)); - - ValidationResult result = new ValidationResult(); - result.setResult(ResultType.ERROR); - b.addGenericApplicationPropertyOfCityObject(result); - AttributeWrongValue error = new AttributeWrongValue(); - error.setAttributeName("TestName"); - error.setChildId("TestId"); - error.setGeneric(true); - result.getErrors().add(error); - byte[] gml = writeCityGml(model); - model = readCityGml(gml); - - AbstractCityObject co = model.getCityObjectMember().get(0).getCityObject(); - List ades = co.getGenericApplicationPropertyOfCityObject(); - ADEComponent adeComponent = ades.get(0); - ValidationResult valRes = (ValidationResult) adeComponent; - assertEquals(ResultType.ERROR, valRes.getResult()); - - ValidationError valError = valRes.getErrors().get(0); - AttributeWrongValue error2 = (AttributeWrongValue) valError; - assertEquals(error.getAttributeName(), error2.getAttributeName()); - assertEquals(error.getChildId(), error2.getChildId()); - assertEquals(error.isGeneric(), error2.isGeneric()); + void testHoleOutsideError() throws ADEException, CityGMLContextException, CityGMLWriteException, SAXException, IOException, SchemaHandlerException { + CityModel model = new CityModel(); + ValidationResult res = fillCityModel(model); + + HoleOutsideError err = new HoleOutsideError(); + err.setLinearRingId("ringId"); + err.setPolygonId("polyId"); + res.getErrors().add(new AbstractErrorProperty(err)); + + byte[] buf = writeModel(model); + assertTrue(validate(new ByteArrayInputStream(buf))); } - + @Test - void testWritingMultipleConnectedComponentsError() - throws ADEException, CityGMLBuilderException, CityGMLWriteException, CityGMLReadException { - CityModel model = new CityModel(); - Building b = new Building(); - model.getCityObjectMember().add(new CityObjectMember(b)); - - ValidationResult result = new ValidationResult(); - result.setResult(ResultType.ERROR); - b.addGenericApplicationPropertyOfCityObject(result); - MultipleConnectedComponents error = new MultipleConnectedComponents(); - error.setGeometryId("TestGeometry"); - Component c1 = new Component(); - c1.getPolygonIds().add("TestPoly"); - error.getComponents().add(c1); - result.getErrors().add(error); - - byte[] gml = writeCityGml(model); - model = readCityGml(gml); - - AbstractCityObject co = model.getCityObjectMember().get(0).getCityObject(); - List ades = co.getGenericApplicationPropertyOfCityObject(); - ADEComponent adeComponent = ades.get(0); - ValidationResult valRes = (ValidationResult) adeComponent; - assertEquals(ResultType.ERROR, valRes.getResult()); - - ValidationError valError = valRes.getErrors().get(0); - MultipleConnectedComponents error2 = (MultipleConnectedComponents) valError; - assertEquals(error.getGeometryId(), error2.getGeometryId()); - assertEquals(error.getComponents().get(0).getPolygonIds().get(0), - error2.getComponents().get(0).getPolygonIds().get(0)); + void testInnerRingsNestedError() throws ADEException, CityGMLContextException, CityGMLWriteException, SAXException, IOException, SchemaHandlerException { + CityModel model = new CityModel(); + ValidationResult res = fillCityModel(model); + + InnerRingsNestedError err = new InnerRingsNestedError(); + err.setLinearRingId1("ringId1"); + err.setLinearRingId2("ringId2"); + err.setPolygonId("polyId"); + res.getErrors().add(new AbstractErrorProperty(err)); + + byte[] buf = writeModel(model); + assertTrue(validate(new ByteArrayInputStream(buf))); } - + @Test - void testWritingTooFewPolygonsError() - throws ADEException, CityGMLBuilderException, CityGMLWriteException, CityGMLReadException { - CityModel model = new CityModel(); - Building b = new Building(); - model.getCityObjectMember().add(new CityObjectMember(b)); - - ValidationResult result = new ValidationResult(); - result.setResult(ResultType.ERROR); - b.addGenericApplicationPropertyOfCityObject(result); - TooFewPolygons error = new TooFewPolygons(); - error.setGeometryId("TestGeometry"); - result.getErrors().add(error); - - byte[] gml = writeCityGml(model); - model = readCityGml(gml); - - AbstractCityObject co = model.getCityObjectMember().get(0).getCityObject(); - List ades = co.getGenericApplicationPropertyOfCityObject(); - ADEComponent adeComponent = ades.get(0); - ValidationResult valRes = (ValidationResult) adeComponent; - assertEquals(ResultType.ERROR, valRes.getResult()); - - ValidationError valError = valRes.getErrors().get(0); - TooFewPolygons error2 = (TooFewPolygons) valError; - assertEquals(error.getGeometryId(), error2.getGeometryId()); + void testInteriorDisconnectedError() throws ADEException, CityGMLContextException, CityGMLWriteException, SAXException, IOException, SchemaHandlerException { + CityModel model = new CityModel(); + ValidationResult res = fillCityModel(model); + + InteriorDisconnectedError err = new InteriorDisconnectedError(); + err.setPolygonId("polyId"); + res.getErrors().add(new AbstractErrorProperty(err)); + + byte[] buf = writeModel(model); + assertTrue(validate(new ByteArrayInputStream(buf))); } - + @Test - void testWritingSolidNotClosedError() - throws ADEException, CityGMLBuilderException, CityGMLWriteException, CityGMLReadException { - CityModel model = new CityModel(); - Building b = new Building(); - model.getCityObjectMember().add(new CityObjectMember(b)); - - ValidationResult result = new ValidationResult(); - result.setResult(ResultType.ERROR); - b.addGenericApplicationPropertyOfCityObject(result); - SolidNotClosed error = new SolidNotClosed(); - error.setGeometryId("TestGeometry"); - DirectPosition from = new DirectPosition(); - from.getValue().add(10.0); - DirectPosition to = new DirectPosition(); - to.getValue().add(11.0); - Edge e = new Edge(); - e.setFrom(from); - e.setTo(to); - error.getEdges().add(e); - result.getErrors().add(error); - - byte[] gml = writeCityGml(model); - model = readCityGml(gml); - - AbstractCityObject co = model.getCityObjectMember().get(0).getCityObject(); - List ades = co.getGenericApplicationPropertyOfCityObject(); - ADEComponent adeComponent = ades.get(0); - ValidationResult valRes = (ValidationResult) adeComponent; - assertEquals(ResultType.ERROR, valRes.getResult()); - - ValidationError valError = valRes.getErrors().get(0); - SolidNotClosed error2 = (SolidNotClosed) valError; - assertEquals(error.getGeometryId(), error2.getGeometryId()); - Edge edge = error.getEdges().get(0); - assertEquals(edge.getFrom().getValue().get(0), e.getFrom().getValue().get(0), 0.00001); - assertEquals(edge.getTo().getValue().get(0), e.getTo().getValue().get(0), 0.00001); + void testIntersectingRingsError() throws ADEException, CityGMLContextException, CityGMLWriteException, SAXException, IOException, SchemaHandlerException { + CityModel model = new CityModel(); + ValidationResult res = fillCityModel(model); + + IntersectingRingsError err = new IntersectingRingsError(); + err.setLinearRingId1("ringId1"); + err.setLinearRingId2("ringId2"); + err.setPolygonId("polyId"); + res.getErrors().add(new AbstractErrorProperty(err)); + + byte[] buf = writeModel(model); + assertTrue(validate(new ByteArrayInputStream(buf))); } - + @Test - void testWritingNonManifoldEdgeError() - throws ADEException, CityGMLBuilderException, CityGMLWriteException, CityGMLReadException { - CityModel model = new CityModel(); - Building b = new Building(); - model.getCityObjectMember().add(new CityObjectMember(b)); - - ValidationResult result = new ValidationResult(); - result.setResult(ResultType.ERROR); - b.addGenericApplicationPropertyOfCityObject(result); - NonManifoldEdge error = new NonManifoldEdge(); - error.setGeometryId("TestGeometry"); - DirectPosition from = new DirectPosition(); - from.getValue().add(10.0); - DirectPosition to = new DirectPosition(); - to.getValue().add(11.0); - Edge e = new Edge(); - e.setFrom(from); - e.setTo(to); - error.getEdges().add(e); - result.getErrors().add(error); - - byte[] gml = writeCityGml(model); - model = readCityGml(gml); - - AbstractCityObject co = model.getCityObjectMember().get(0).getCityObject(); - List ades = co.getGenericApplicationPropertyOfCityObject(); - ADEComponent adeComponent = ades.get(0); - ValidationResult valRes = (ValidationResult) adeComponent; - assertEquals(ResultType.ERROR, valRes.getResult()); - - ValidationError valError = valRes.getErrors().get(0); - NonManifoldEdge error2 = (NonManifoldEdge) valError; - assertEquals(error.getGeometryId(), error2.getGeometryId()); - Edge edge = error.getEdges().get(0); - assertEquals(edge.getFrom().getValue().get(0), e.getFrom().getValue().get(0), 0.00001); - assertEquals(edge.getTo().getValue().get(0), e.getTo().getValue().get(0), 0.00001); + void testMultipleComponentsError() throws ADEException, CityGMLContextException, CityGMLWriteException, SAXException, IOException, SchemaHandlerException { + CityModel model = new CityModel(); + ValidationResult res = fillCityModel(model); + + MultipleComponentsError err = new MultipleComponentsError(); + err.setGeometryId("geomId"); + ComponentList comp = new ComponentList(); + PolygonIdList polygons = new PolygonIdList(); + polygons.getPolygonIds().add("test1"); + polygons.getPolygonIds().add("test2"); + comp.getComponents().add(new PolygonIdListProperty(polygons)); + + err.getComponents().add(new ComponentListProperty(comp)); + + res.getErrors().add(new AbstractErrorProperty(err)); + + byte[] buf = writeModel(model); + assertTrue(validate(new ByteArrayInputStream(buf))); } - + @Test - void testWritingNonManifoldVertexError() - throws ADEException, CityGMLBuilderException, CityGMLWriteException, CityGMLReadException { - CityModel model = new CityModel(); - Building b = new Building(); - model.getCityObjectMember().add(new CityObjectMember(b)); - - ValidationResult result = new ValidationResult(); - result.setResult(ResultType.ERROR); - b.addGenericApplicationPropertyOfCityObject(result); - NonManifoldVertex error = new NonManifoldVertex(); - error.setGeometryId("TestGeometry"); - DirectPosition vertex = new DirectPosition(); - vertex.getValue().add(10.0); - error.setVertex(vertex); - result.getErrors().add(error); - - byte[] gml = writeCityGml(model); - model = readCityGml(gml); - - AbstractCityObject co = model.getCityObjectMember().get(0).getCityObject(); - List ades = co.getGenericApplicationPropertyOfCityObject(); - ADEComponent adeComponent = ades.get(0); - ValidationResult valRes = (ValidationResult) adeComponent; - assertEquals(ResultType.ERROR, valRes.getResult()); - - ValidationError valError = valRes.getErrors().get(0); - NonManifoldVertex error2 = (NonManifoldVertex) valError; - assertEquals(error.getGeometryId(), error2.getGeometryId()); - assertEquals(error.getVertex().getValue().get(0), error2.getVertex().getValue().get(0)); + void testNonManifoldEdgeError() throws ADEException, CityGMLContextException, CityGMLWriteException, SAXException, IOException, SchemaHandlerException { + CityModel model = new CityModel(); + ValidationResult res = fillCityModel(model); + + NonManifoldEdgeError err = new NonManifoldEdgeError(); + err.setGeometryId("geomId"); + EdgeList edges = new EdgeList(); + Edge edge = new Edge(); + edge.setFrom(new DirectPosition(1, 2, 3)); + edge.setTo(new DirectPosition(5, 6, 7)); + edges.getEdges().add(new EdgeProperty(edge)); + err.setEdges(new EdgeListProperty(edges)); + + res.getErrors().add(new AbstractErrorProperty(err)); + + byte[] buf = writeModel(model); + assertTrue(validate(new ByteArrayInputStream(buf))); } - + @Test - void testWritingPolygonWrongOrientationError() - throws ADEException, CityGMLBuilderException, CityGMLWriteException, CityGMLReadException { - CityModel model = new CityModel(); - Building b = new Building(); - model.getCityObjectMember().add(new CityObjectMember(b)); - - ValidationResult result = new ValidationResult(); - result.setResult(ResultType.ERROR); - b.addGenericApplicationPropertyOfCityObject(result); - PolygonWrongOrientation error = new PolygonWrongOrientation(); - error.setGeometryId("TestGeometry"); - DirectPosition from = new DirectPosition(); - from.getValue().add(10.0); - DirectPosition to = new DirectPosition(); - to.getValue().add(11.0); - Edge e = new Edge(); - e.setFrom(from); - e.setTo(to); - error.getEdges().add(e); - result.getErrors().add(error); - - byte[] gml = writeCityGml(model); - model = readCityGml(gml); - - AbstractCityObject co = model.getCityObjectMember().get(0).getCityObject(); - List ades = co.getGenericApplicationPropertyOfCityObject(); - ADEComponent adeComponent = ades.get(0); - ValidationResult valRes = (ValidationResult) adeComponent; - assertEquals(ResultType.ERROR, valRes.getResult()); - - ValidationError valError = valRes.getErrors().get(0); - PolygonWrongOrientation error2 = (PolygonWrongOrientation) valError; - assertEquals(error.getGeometryId(), error2.getGeometryId()); - Edge edge = error.getEdges().get(0); - assertEquals(edge.getFrom().getValue().get(0), e.getFrom().getValue().get(0), 0.00001); - assertEquals(edge.getTo().getValue().get(0), e.getTo().getValue().get(0), 0.00001); + void testNonManifoldVertexError() throws ADEException, CityGMLContextException, CityGMLWriteException, SAXException, IOException, SchemaHandlerException { + CityModel model = new CityModel(); + ValidationResult res = fillCityModel(model); + + NonManifoldVertexError err = new NonManifoldVertexError(); + err.setGeometryId("geomId"); + err.setVertex(new DirectPosition(1, 2, 3)); + res.getErrors().add(new AbstractErrorProperty(err)); + + byte[] buf = writeModel(model); + assertTrue(validate(new ByteArrayInputStream(buf))); } - + @Test - void testWritingAllPolygonsWrongOrientationError() - throws ADEException, CityGMLBuilderException, CityGMLWriteException, CityGMLReadException { - CityModel model = new CityModel(); - Building b = new Building(); - model.getCityObjectMember().add(new CityObjectMember(b)); - - ValidationResult result = new ValidationResult(); - result.setResult(ResultType.ERROR); - b.addGenericApplicationPropertyOfCityObject(result); - AllPolygonsWrongOrientation error = new AllPolygonsWrongOrientation(); - error.setGeometryId("TestGeometry"); - result.getErrors().add(error); - - byte[] gml = writeCityGml(model); - model = readCityGml(gml); - - AbstractCityObject co = model.getCityObjectMember().get(0).getCityObject(); - List ades = co.getGenericApplicationPropertyOfCityObject(); - ADEComponent adeComponent = ades.get(0); - ValidationResult valRes = (ValidationResult) adeComponent; - assertEquals(ResultType.ERROR, valRes.getResult()); - - ValidationError valError = valRes.getErrors().get(0); - AllPolygonsWrongOrientation error2 = (AllPolygonsWrongOrientation) valError; - assertEquals(error.getGeometryId(), error2.getGeometryId()); + void testOrientationRingsSameError() throws ADEException, CityGMLContextException, CityGMLWriteException, SAXException, IOException, SchemaHandlerException { + CityModel model = new CityModel(); + ValidationResult res = fillCityModel(model); + + OrientationRingsSameError err = new OrientationRingsSameError(); + err.setLinearRing("ring1"); + err.setPolygonId("polyId"); + res.getErrors().add(new AbstractErrorProperty(err)); + + byte[] buf = writeModel(model); + assertTrue(validate(new ByteArrayInputStream(buf))); } - + @Test - void testWritingOrientationRingsSameError() - throws ADEException, CityGMLBuilderException, CityGMLWriteException, CityGMLReadException { - CityModel model = new CityModel(); - Building b = new Building(); - model.getCityObjectMember().add(new CityObjectMember(b)); - - ValidationResult result = new ValidationResult(); - result.setResult(ResultType.ERROR); - b.addGenericApplicationPropertyOfCityObject(result); - OrientationRingsSame error = new OrientationRingsSame(); - error.setPolygonId("TestPolygon"); - error.setLinearRingId("TestRing"); - result.getErrors().add(error); - - byte[] gml = writeCityGml(model); - model = readCityGml(gml); - - AbstractCityObject co = model.getCityObjectMember().get(0).getCityObject(); - List ades = co.getGenericApplicationPropertyOfCityObject(); - ADEComponent adeComponent = ades.get(0); - ValidationResult valRes = (ValidationResult) adeComponent; - assertEquals(ResultType.ERROR, valRes.getResult()); - - ValidationError valError = valRes.getErrors().get(0); - OrientationRingsSame error2 = (OrientationRingsSame) valError; - assertEquals(error.getPolygonId(), error2.getPolygonId()); - assertEquals(error.getLinearRingId(), error2.getLinearRingId()); + void testPlanarDistancePlaneError() throws ADEException, CityGMLContextException, CityGMLWriteException, SAXException, IOException, SchemaHandlerException { + CityModel model = new CityModel(); + ValidationResult res = fillCityModel(model); + + PlanarDistancePlaneError err = new PlanarDistancePlaneError(); + err.setPolygonId("polyId"); + err.setDistance(new Length(5d, "m")); + err.setVertex(new DirectPosition(1, 2, 3)); + res.getErrors().add(new AbstractErrorProperty(err)); + + byte[] buf = writeModel(model); + assertTrue(validate(new ByteArrayInputStream(buf))); } - + @Test - void testWritingNonPlanarNormalsDeviationError() - throws ADEException, CityGMLBuilderException, CityGMLWriteException, CityGMLReadException { - CityModel model = new CityModel(); - Building b = new Building(); - model.getCityObjectMember().add(new CityObjectMember(b)); - - ValidationResult result = new ValidationResult(); - result.setResult(ResultType.ERROR); - b.addGenericApplicationPropertyOfCityObject(result); - NonPlanarNormalsDeviation error = new NonPlanarNormalsDeviation(); - error.setPolygonId("TestPolygon"); - Angle deviation = new Angle(); - deviation.setValue(1.0); - deviation.setUom("deg"); - error.setDeviation(deviation); - result.getErrors().add(error); - - byte[] gml = writeCityGml(model); - model = readCityGml(gml); - - AbstractCityObject co = model.getCityObjectMember().get(0).getCityObject(); - List ades = co.getGenericApplicationPropertyOfCityObject(); - ADEComponent adeComponent = ades.get(0); - ValidationResult valRes = (ValidationResult) adeComponent; - assertEquals(ResultType.ERROR, valRes.getResult()); - - ValidationError valError = valRes.getErrors().get(0); - NonPlanarNormalsDeviation error2 = (NonPlanarNormalsDeviation) valError; - assertEquals(error.getPolygonId(), error2.getPolygonId()); - assertEquals(error.getDeviation().getValue(), error2.getDeviation().getValue()); - assertEquals(error.getDeviation().getUom(), error2.getDeviation().getUom()); + void testPlanarNormalsDeviationError() throws ADEException, CityGMLContextException, CityGMLWriteException, SAXException, IOException, SchemaHandlerException { + CityModel model = new CityModel(); + ValidationResult res = fillCityModel(model); + + PlanarNormalsDeviationError err = new PlanarNormalsDeviationError(); + err.setPolygonId("polyId"); + err.setDeviation(new Angle(5d, "deg")); + res.getErrors().add(new AbstractErrorProperty(err)); + + byte[] buf = writeModel(model); + assertTrue(validate(new ByteArrayInputStream(buf))); } - + @Test - void testWritingHoleOutsideError() - throws ADEException, CityGMLBuilderException, CityGMLWriteException, CityGMLReadException { - CityModel model = new CityModel(); - Building b = new Building(); - model.getCityObjectMember().add(new CityObjectMember(b)); - - ValidationResult result = new ValidationResult(); - result.setResult(ResultType.ERROR); - b.addGenericApplicationPropertyOfCityObject(result); - HoleOutside error = new HoleOutside(); - error.setPolygonId("TestPolygon"); - error.setLinearRingId("TestRing1"); - result.getErrors().add(error); - - byte[] gml = writeCityGml(model); - model = readCityGml(gml); - - AbstractCityObject co = model.getCityObjectMember().get(0).getCityObject(); - List ades = co.getGenericApplicationPropertyOfCityObject(); - ADEComponent adeComponent = ades.get(0); - ValidationResult valRes = (ValidationResult) adeComponent; - assertEquals(ResultType.ERROR, valRes.getResult()); - - ValidationError valError = valRes.getErrors().get(0); - HoleOutside error2 = (HoleOutside) valError; - assertEquals(error.getPolygonId(), error2.getPolygonId()); - assertEquals(error.getLinearRingId(), error2.getLinearRingId()); + void testPolygonWrongOrientationError() throws ADEException, CityGMLContextException, CityGMLWriteException, SAXException, IOException, SchemaHandlerException { + CityModel model = new CityModel(); + ValidationResult res = fillCityModel(model); + + PolygonWrongOrientationError err = new PolygonWrongOrientationError(); + err.setGeometryId("geomId"); + EdgeList edges = new EdgeList(); + Edge edge = new Edge(); + edge.setFrom(new DirectPosition(1, 2, 3)); + edge.setTo(new DirectPosition(5, 6, 7)); + edges.getEdges().add(new EdgeProperty(edge)); + err.setEdges(new EdgeListProperty(edges)); + res.getErrors().add(new AbstractErrorProperty(err)); + + byte[] buf = writeModel(model); + assertTrue(validate(new ByteArrayInputStream(buf))); } - + @Test - void testWritingInnerRingsNestedError() - throws ADEException, CityGMLBuilderException, CityGMLWriteException, CityGMLReadException { - CityModel model = new CityModel(); - Building b = new Building(); - model.getCityObjectMember().add(new CityObjectMember(b)); - - ValidationResult result = new ValidationResult(); - result.setResult(ResultType.ERROR); - b.addGenericApplicationPropertyOfCityObject(result); - InnerRingsNested error = new InnerRingsNested(); - error.setPolygonId("TestPolygon"); - error.setLinearRingId1("TestRing1"); - error.setLinearRingId2("TestRing2"); - result.getErrors().add(error); - - byte[] gml = writeCityGml(model); - model = readCityGml(gml); - - AbstractCityObject co = model.getCityObjectMember().get(0).getCityObject(); - List ades = co.getGenericApplicationPropertyOfCityObject(); - ADEComponent adeComponent = ades.get(0); - ValidationResult valRes = (ValidationResult) adeComponent; - assertEquals(ResultType.ERROR, valRes.getResult()); - - ValidationError valError = valRes.getErrors().get(0); - InnerRingsNested error2 = (InnerRingsNested) valError; - assertEquals(error.getPolygonId(), error2.getPolygonId()); - assertEquals(error.getLinearRingId1(), error2.getLinearRingId1()); - assertEquals(error.getLinearRingId2(), error2.getLinearRingId2()); + void testRingNotClosedError() throws ADEException, CityGMLContextException, CityGMLWriteException, SAXException, IOException, SchemaHandlerException { + CityModel model = new CityModel(); + ValidationResult res = fillCityModel(model); + + RingNotClosedError err = new RingNotClosedError(); + err.setLinearRingId("ringId"); + res.getErrors().add(new AbstractErrorProperty(err)); + + byte[] buf = writeModel(model); + assertTrue(validate(new ByteArrayInputStream(buf))); } - + @Test - void testWritingNonPlanarDistancePlaneError() - throws ADEException, CityGMLBuilderException, CityGMLWriteException, CityGMLReadException { - CityModel model = new CityModel(); - Building b = new Building(); - model.getCityObjectMember().add(new CityObjectMember(b)); - - ValidationResult result = new ValidationResult(); - result.setResult(ResultType.ERROR); - b.addGenericApplicationPropertyOfCityObject(result); - NonPlanarDistancePlane error = new NonPlanarDistancePlane(); - error.setPolygonId("TestPolygon"); - DirectPosition vertex = new DirectPosition(); - vertex.getValue().add(1.0); - error.setVertex(vertex); - Length distance = new Length(0.1); - distance.setUom("m"); - error.setDistance(distance); - result.getErrors().add(error); - - byte[] gml = writeCityGml(model); - model = readCityGml(gml); - - AbstractCityObject co = model.getCityObjectMember().get(0).getCityObject(); - List ades = co.getGenericApplicationPropertyOfCityObject(); - ADEComponent adeComponent = ades.get(0); - ValidationResult valRes = (ValidationResult) adeComponent; - assertEquals(ResultType.ERROR, valRes.getResult()); - - ValidationError valError = valRes.getErrors().get(0); - NonPlanarDistancePlane error2 = (NonPlanarDistancePlane) valError; - assertEquals(error.getPolygonId(), error2.getPolygonId()); - assertEquals(error.getVertex().getValue().get(0), error2.getVertex().getValue().get(0), 0.00001); - assertEquals(error.getDistance().getValue(), error2.getDistance().getValue(), 0.00001); + void testRingSelfIntersectionError() throws ADEException, CityGMLContextException, CityGMLWriteException, SAXException, IOException, SchemaHandlerException { + CityModel model = new CityModel(); + ValidationResult res = fillCityModel(model); + + RingSelfIntersectionError err = new RingSelfIntersectionError(); + err.setLinearRingId("ringId"); + Edge edge = new Edge(); + edge.setFrom(new DirectPosition(1, 2, 3)); + edge.setTo(new DirectPosition(5, 6, 7)); + err.setEdge1(new EdgeProperty(edge)); + err.setEdge2(new EdgeProperty(edge)); + err.setType(RingSelfIntType.EDGE_INTERSECTS_EDGE); + err.setVertex1(new DirectPosition(1, 2, 3)); + res.getErrors().add(new AbstractErrorProperty(err)); + + byte[] buf = writeModel(model); + assertTrue(validate(new ByteArrayInputStream(buf))); } - + @Test - void testWritingIntersectingRingsError() - throws ADEException, CityGMLBuilderException, CityGMLWriteException, CityGMLReadException { - CityModel model = new CityModel(); - Building b = new Building(); - model.getCityObjectMember().add(new CityObjectMember(b)); - - ValidationResult result = new ValidationResult(); - result.setResult(ResultType.ERROR); - b.addGenericApplicationPropertyOfCityObject(result); - IntersectingRings error = new IntersectingRings(); - error.setPolygonId("TestPolygon"); - error.setLinearRingId1("TestRing1"); - error.setLinearRingId2("TestRing2"); - result.getErrors().add(error); - - byte[] gml = writeCityGml(model); - model = readCityGml(gml); - - AbstractCityObject co = model.getCityObjectMember().get(0).getCityObject(); - List ades = co.getGenericApplicationPropertyOfCityObject(); - ADEComponent adeComponent = ades.get(0); - ValidationResult valRes = (ValidationResult) adeComponent; - assertEquals(ResultType.ERROR, valRes.getResult()); - - ValidationError valError = valRes.getErrors().get(0); - IntersectingRings error2 = (IntersectingRings) valError; - assertEquals(error.getPolygonId(), error2.getPolygonId()); - assertEquals(error.getLinearRingId1(), error2.getLinearRingId1()); - assertEquals(error.getLinearRingId2(), error2.getLinearRingId2()); + void testRingTooFewPointsError() throws ADEException, CityGMLContextException, CityGMLWriteException, SAXException, IOException, SchemaHandlerException { + CityModel model = new CityModel(); + ValidationResult res = fillCityModel(model); + + RingTooFewPointsError err = new RingTooFewPointsError(); + err.setLinearRingId("ringId"); + res.getErrors().add(new AbstractErrorProperty(err)); + + byte[] buf = writeModel(model); + assertTrue(validate(new ByteArrayInputStream(buf))); } - + @Test - void testWritingInteriorDisconnectedError() - throws ADEException, CityGMLBuilderException, CityGMLWriteException, CityGMLReadException { - CityModel model = new CityModel(); - Building b = new Building(); - model.getCityObjectMember().add(new CityObjectMember(b)); - - ValidationResult result = new ValidationResult(); - result.setResult(ResultType.ERROR); - b.addGenericApplicationPropertyOfCityObject(result); - InteriorDisconnected error = new InteriorDisconnected(); - error.setPolygonId("TestPolygon"); - result.getErrors().add(error); - - byte[] gml = writeCityGml(model); - model = readCityGml(gml); - - AbstractCityObject co = model.getCityObjectMember().get(0).getCityObject(); - List ades = co.getGenericApplicationPropertyOfCityObject(); - ADEComponent adeComponent = ades.get(0); - ValidationResult valRes = (ValidationResult) adeComponent; - assertEquals(ResultType.ERROR, valRes.getResult()); - - ValidationError valError = valRes.getErrors().get(0); - InteriorDisconnected error2 = (InteriorDisconnected) valError; - assertEquals(error.getPolygonId(), error2.getPolygonId()); + void testSemanticAttributeMissingError() throws ADEException, CityGMLContextException, CityGMLWriteException, SAXException, IOException, SchemaHandlerException { + CityModel model = new CityModel(); + ValidationResult res = fillCityModel(model); + + SemanticAttributeMissingError err = new SemanticAttributeMissingError(); + err.setAttributeName("attribute"); + err.setChildId("child"); + err.setGeneric(true); + res.getErrors().add(new AbstractErrorProperty(err)); + + byte[] buf = writeModel(model); + assertTrue(validate(new ByteArrayInputStream(buf))); } - + @Test - void testWritingRingNotClosedError() - throws ADEException, CityGMLBuilderException, CityGMLWriteException, CityGMLReadException { - CityModel model = new CityModel(); - Building b = new Building(); - model.getCityObjectMember().add(new CityObjectMember(b)); - - ValidationResult result = new ValidationResult(); - result.setResult(ResultType.ERROR); - b.addGenericApplicationPropertyOfCityObject(result); - RingNotClosed error = new RingNotClosed(); - error.setLinearRingId("TestRing"); - result.getErrors().add(error); - - byte[] gml = writeCityGml(model); - model = readCityGml(gml); - - AbstractCityObject co = model.getCityObjectMember().get(0).getCityObject(); - List ades = co.getGenericApplicationPropertyOfCityObject(); - ADEComponent adeComponent = ades.get(0); - ValidationResult valRes = (ValidationResult) adeComponent; - assertEquals(ResultType.ERROR, valRes.getResult()); - - ValidationError valError = valRes.getErrors().get(0); - RingNotClosed error2 = (RingNotClosed) valError; - assertEquals(error.getLinearRingId(), error2.getLinearRingId()); + void testSemanticAttributeWrongValueError() throws ADEException, CityGMLContextException, CityGMLWriteException, SAXException, IOException, SchemaHandlerException { + CityModel model = new CityModel(); + ValidationResult res = fillCityModel(model); + + SemanticAttributeWrongValueError err = new SemanticAttributeWrongValueError(); + err.setAttributeName("attribute"); + err.setChildId("child"); + err.setGeneric(true); + res.getErrors().add(new AbstractErrorProperty(err)); + + byte[] buf = writeModel(model); + assertTrue(validate(new ByteArrayInputStream(buf))); } - + @Test - void testWritingTooFewPointsError() - throws ADEException, CityGMLBuilderException, CityGMLWriteException, CityGMLReadException { - CityModel model = new CityModel(); - Building b = new Building(); - model.getCityObjectMember().add(new CityObjectMember(b)); - - ValidationResult result = new ValidationResult(); - result.setResult(ResultType.ERROR); - b.addGenericApplicationPropertyOfCityObject(result); - TooFewPoints error = new TooFewPoints(); - error.setLinearRingId("TestRing"); - result.getErrors().add(error); - - byte[] gml = writeCityGml(model); - model = readCityGml(gml); - - AbstractCityObject co = model.getCityObjectMember().get(0).getCityObject(); - List ades = co.getGenericApplicationPropertyOfCityObject(); - ADEComponent adeComponent = ades.get(0); - ValidationResult valRes = (ValidationResult) adeComponent; - assertEquals(ResultType.ERROR, valRes.getResult()); - - ValidationError valError = valRes.getErrors().get(0); - TooFewPoints error2 = (TooFewPoints) valError; - assertEquals(error.getLinearRingId(), error2.getLinearRingId()); + void testSolidNotClosedError() throws ADEException, CityGMLContextException, CityGMLWriteException, SAXException, IOException, SchemaHandlerException { + CityModel model = new CityModel(); + ValidationResult res = fillCityModel(model); + + SolidNotClosedError err = new SolidNotClosedError(); + err.setGeometryId("geomId"); + EdgeList edges = new EdgeList(); + Edge edge = new Edge(); + edge.setFrom(new DirectPosition(1, 2, 3)); + edge.setTo(new DirectPosition(5, 6, 7)); + edges.getEdges().add(new EdgeProperty(edge)); + err.setEdges(new EdgeListProperty(edges)); + res.getErrors().add(new AbstractErrorProperty(err)); + + byte[] buf = writeModel(model); + assertTrue(validate(new ByteArrayInputStream(buf))); } - + @Test - void testWritingConsecutiveSameError() - throws ADEException, CityGMLBuilderException, CityGMLWriteException, CityGMLReadException { - CityModel model = new CityModel(); - Building b = new Building(); - model.getCityObjectMember().add(new CityObjectMember(b)); - - ValidationResult result = new ValidationResult(); - result.setResult(ResultType.ERROR); - b.addGenericApplicationPropertyOfCityObject(result); - - ConsecutivePointsSame error = new ConsecutivePointsSame(); - error.setLinearRingId("TestRing"); - DirectPosition vertex1 = new DirectPosition(); - vertex1.getValue().add(10.0); - vertex1.getValue().add(5.0); - vertex1.getValue().add(7.0); - error.setVertex1(vertex1); - DirectPosition vertex2 = new DirectPosition(); - vertex2.getValue().add(15.0); - vertex2.getValue().add(55.0); - vertex2.getValue().add(71.0); - error.setVertex2(vertex2); - result.getErrors().add(error); - - byte[] gml = writeCityGml(model); - model = readCityGml(gml); - - AbstractCityObject co = model.getCityObjectMember().get(0).getCityObject(); - List ades = co.getGenericApplicationPropertyOfCityObject(); - ADEComponent adeComponent = ades.get(0); - ValidationResult valRes = (ValidationResult) adeComponent; - assertEquals(ResultType.ERROR, valRes.getResult()); - - ValidationError valError = valRes.getErrors().get(0); - ConsecutivePointsSame error2 = (ConsecutivePointsSame) valError; - assertEquals(error.getLinearRingId(), error2.getLinearRingId()); - assertEquals(error.getVertex1().getValue().get(0), error2.getVertex1().getValue().get(0)); - assertEquals(error.getVertex2().getValue().get(0), error2.getVertex2().getValue().get(0)); + void testSolidSelfIntersectionError() throws ADEException, CityGMLContextException, CityGMLWriteException, SAXException, IOException, SchemaHandlerException { + CityModel model = new CityModel(); + ValidationResult res = fillCityModel(model); + + SolidSelfIntersectionError err = new SolidSelfIntersectionError(); + err.setGeometryId("geomId"); + err.setPolygonId1("poly1"); + err.setPolygonId2("poly2"); + res.getErrors().add(new AbstractErrorProperty(err)); + + byte[] buf = writeModel(model); + assertTrue(validate(new ByteArrayInputStream(buf))); } - + @Test - void testWritingRingSelfIntersection() - throws ADEException, CityGMLBuilderException, CityGMLWriteException, CityGMLReadException { - CityModel model = new CityModel(); - Building b = new Building(); - model.getCityObjectMember().add(new CityObjectMember(b)); - - ValidationResult result = new ValidationResult(); - result.setResult(ResultType.ERROR); - b.addGenericApplicationPropertyOfCityObject(result); - - RingSelfIntersection error = new RingSelfIntersection(); - error.setType(RingSelfIntType.DUPLICATE_POINT); - error.setLinearRingId("TestRing"); - DirectPosition vertex1 = new DirectPosition(); - vertex1.getValue().add(10.0); - vertex1.getValue().add(5.0); - vertex1.getValue().add(7.0); - error.setVertex1(vertex1); - DirectPosition vertex2 = new DirectPosition(); - vertex2.getValue().add(15.0); - vertex2.getValue().add(55.0); - vertex2.getValue().add(71.0); - error.setVertex2(vertex2); - result.getErrors().add(error); - - byte[] gml = writeCityGml(model); - model = readCityGml(gml); - - AbstractCityObject co = model.getCityObjectMember().get(0).getCityObject(); - List ades = co.getGenericApplicationPropertyOfCityObject(); - ADEComponent adeComponent = ades.get(0); - ValidationResult valRes = (ValidationResult) adeComponent; - assertEquals(ResultType.ERROR, valRes.getResult()); - - ValidationError valError = valRes.getErrors().get(0); - RingSelfIntersection error2 = (RingSelfIntersection) valError; - assertEquals(error.getLinearRingId(), error2.getLinearRingId()); - assertEquals(error.getVertex1().getValue().get(0), error2.getVertex1().getValue().get(0)); - assertEquals(error.getVertex2().getValue().get(0), error2.getVertex2().getValue().get(0)); + void testSolidTooFewPolygonsError() throws ADEException, CityGMLContextException, CityGMLWriteException, SAXException, IOException, SchemaHandlerException { + CityModel model = new CityModel(); + ValidationResult res = fillCityModel(model); + + SolidTooFewPolygonsError err = new SolidTooFewPolygonsError(); + err.setGeometryId("geomId"); + res.getErrors().add(new AbstractErrorProperty(err)); + + byte[] buf = writeModel(model); + assertTrue(validate(new ByteArrayInputStream(buf))); } + + + + private boolean validate(InputStream stream) throws SAXException, IOException, CityGMLContextException, SchemaHandlerException { - @Test - void testWritingValidationPlan() - throws ADEException, CityGMLBuilderException, CityGMLWriteException, CityGMLReadException { - CityModel model = new CityModel(); - Validation val = new Validation(); - model.addGenericApplicationPropertyOfCityModel(val); - - ZonedDateTime expectedDate = LocalDateTime.of(2002, 5, 30, 9, 0).atZone(ZoneId.systemDefault()); - - val.setValidationDate(expectedDate); - val.setValidationSoftware("CityDoctor2"); - ValidationPlan plan = new ValidationPlan(); - val.setValidationPlan(plan); - - Parameter roundingParameter = new Parameter(); - roundingParameter.setName("numberOfRoundingPlaces"); - roundingParameter.setValue("8"); - plan.getGlobalParameters().add(roundingParameter); - - Parameter minVertexDistance = new Parameter(); - minVertexDistance.setName("minVertexDistance"); - minVertexDistance.setValue("0.0001"); - minVertexDistance.setUom("m"); - plan.getGlobalParameters().add(minVertexDistance); - - Requirement rTooFewPoints = new Requirement(); - rTooFewPoints.setEnabled(true); - rTooFewPoints.setName(RequirementId.R_GE_R_TOO_FEW_POINTS); - plan.getRequirements().add(rTooFewPoints); - - Checking buildingChecking = new Checking(); - buildingChecking.setValue(TopLevelFeatureType.BUILDING); - plan.getFilter().add(buildingChecking); - - Statistics statistics = new Statistics(); - val.setStatistics(statistics); - - FeatureStatistics numErrorBridgeObjects = new FeatureStatistics(); - numErrorBridgeObjects.setNumChecked(0); - numErrorBridgeObjects.setNumErrors(0); - statistics.setNumErrorBridgeObjects(numErrorBridgeObjects); - - FeatureStatistics numErrorBuildings = new FeatureStatistics(); - numErrorBuildings.setNumChecked(1); - numErrorBuildings.setNumErrors(1); - statistics.setNumErrorBuildings(numErrorBuildings); - - FeatureStatistics numErrors = new FeatureStatistics(); - statistics.setNumErrorLandObjects(numErrors); - statistics.setNumErrorTransportation(numErrors); - statistics.setNumErrorVegetation(numErrors); - statistics.setNumErrorWaterObjects(numErrors); + CityGMLContext context = CityGMLContext.newInstance(); - ErrorStatistics stats1 = new ErrorStatistics(); - stats1.setAmount(1); - stats1.setName(ErrorId.GE_R_CONSECUTIVE_POINTS_SAME); - statistics.getErrorStatistics().add(stats1); + CityGMLSchemaHandler schemaHandler = context.getDefaultSchemaHandler(); + Source[] schemas = schemaHandler.getSchemas(); - byte[] gml = writeCityGml(model); - model = readCityGml(gml); + SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); + Schema schema = schemaFactory.newSchema(schemas); - testValidationPlan(model); - } + Validator validator = schema.newValidator(); + boolean[] foundErrors = new boolean[1]; + foundErrors[0] = false; - private CityModel readCityGml(InputStream input) - throws ADEException, CityGMLBuilderException, CityGMLReadException { - CityGMLContext context = CityGMLContext.getInstance(); - List adeContexts = context.getADEContexts(); - if (adeContexts.isEmpty()) { - for (ADEContext adeContext : ServiceLoader.load(ADEContext.class)) { - context.registerADEContext(adeContext); - } + validator.setErrorHandler(new ErrorHandler() { + @Override + public void error(SAXParseException exception) { + String message = "[" + exception.getLineNumber() + ", " + exception.getColumnNumber() + "] " + + exception.getMessage(); + System.out.println(message); + foundErrors[0] = true; } - CityGMLBuilder builder = context.createCityGMLBuilder(); - CityGMLInputFactory in = builder.createCityGMLInputFactory(); - in.setProperty(CityGMLInputFactory.USE_VALIDATION, true); - in.setProperty(CityGMLInputFactory.FEATURE_READ_MODE, FeatureReadMode.NO_SPLIT); - in.setValidationEventHandler(event -> { - System.out.print( - "[" + event.getLocator().getLineNumber() + "," + event.getLocator().getColumnNumber() + "] "); - System.out.println(event.getMessage()); - throw new IllegalStateException(event.getLinkedException()); - }); - try (CityGMLReader reader = in.createCityGMLReader("?", input)) { - while (reader.hasNext()) { - CityGML nextFeature = reader.nextFeature(); - if (nextFeature instanceof CityModel) { - return (CityModel) nextFeature; - } + @Override + public void warning(SAXParseException exception) { + error(exception); } - } - throw new IllegalStateException("No CityModel found in GML file"); - } - private CityModel readCityGml(File f) - throws FileNotFoundException, ADEException, CityGMLBuilderException, CityGMLReadException { - return readCityGml(new FileInputStream(f)); - } + @Override + public void fatalError(SAXParseException exception) { + error(exception); + } + }); - private CityModel readCityGml(String fileName) - throws FileNotFoundException, ADEException, CityGMLBuilderException, CityGMLReadException { - return readCityGml(new File(fileName)); - } + Path file = Paths.get("test.gml"); - private CityModel readCityGml(byte[] bytes) throws ADEException, CityGMLBuilderException, CityGMLReadException { - return readCityGml(new ByteArrayInputStream(bytes)); + validator.validate(new StreamSource(file.toFile())); + return !foundErrors[0]; } + - private void testValidationPlan(CityModel cityModel) { - assertFalse(cityModel.getGenericApplicationPropertyOfCityModel().isEmpty()); - List ades = cityModel.getGenericApplicationPropertyOfCityModel(); - ADEComponent adeComponent = ades.get(0); - assertTrue(adeComponent instanceof Validation); - Validation val = (Validation) adeComponent; - ZonedDateTime expectedDate = LocalDateTime.of(2002, 5, 30, 9, 0).atZone(ZoneId.systemDefault()); - assertTrue(expectedDate.isEqual(val.getValidationDate())); - assertEquals("CityDoctor2", val.getValidationSoftware()); - assertNotNull(val.getValidationPlan()); - ValidationPlan plan = val.getValidationPlan(); - assertNotNull(plan.getGlobalParameters()); - assertFalse(plan.getGlobalParameters().isEmpty()); - List globalParameters = plan.getGlobalParameters(); - Parameter roundingParameter = globalParameters.get(0); - assertEquals("numberOfRoundingPlaces", roundingParameter.getName()); - assertEquals("8", roundingParameter.getValue()); - assertNull(roundingParameter.getUom()); - Parameter minVertexDistance = globalParameters.get(1); - assertEquals("minVertexDistance", minVertexDistance.getName()); - assertEquals("0.0001", minVertexDistance.getValue()); - assertEquals("m", minVertexDistance.getUom()); - - assertNotNull(plan.getRequirements()); - assertFalse(plan.getRequirements().isEmpty()); - - List requirements = plan.getRequirements(); - Requirement rTooFewPoints = requirements.get(0); - assertEquals(RequirementId.R_GE_R_TOO_FEW_POINTS, rTooFewPoints.getName()); - assertTrue(rTooFewPoints.isEnabled()); - - assertNotNull(plan.getFilter()); - assertFalse(plan.getFilter().isEmpty()); - - List filter = plan.getFilter(); - Checking buildingChecking = filter.get(0); - assertEquals(TopLevelFeatureType.BUILDING, buildingChecking.getValue()); - - Statistics statistics = val.getStatistics(); - assertNotNull(statistics); - FeatureStatistics numErrorBridgeObjects = statistics.getNumErrorBridgeObjects(); - assertNotNull(numErrorBridgeObjects); - assertEquals(0, numErrorBridgeObjects.getNumChecked()); - assertEquals(0, numErrorBridgeObjects.getNumErrors()); - - FeatureStatistics numErrorBuildings = statistics.getNumErrorBuildings(); - assertEquals(1, numErrorBuildings.getNumChecked()); - assertEquals(1, numErrorBuildings.getNumErrors()); + private byte[] writeModel(CityModel model) throws ADEException, CityGMLContextException, CityGMLWriteException { - List errorStatistics = statistics.getErrorStatistics(); - assertNotNull(errorStatistics); - assertFalse(errorStatistics.isEmpty()); - ErrorStatistics stats1 = errorStatistics.get(0); - assertEquals(ErrorId.GE_R_CONSECUTIVE_POINTS_SAME, stats1.getName()); - assertEquals(1, stats1.getAmount()); + CityGMLContext context = CityGMLContext.newInstance(); + CityGMLVersion version = CityGMLVersion.v2_0; + CityGMLOutputFactory out = context.createCityGMLOutputFactory(version); + ByteArrayOutputStream outStream = new ByteArrayOutputStream(); + try (CityGMLWriter writer = out.createCityGMLWriter(outStream, StandardCharsets.UTF_8.name())) { + writer.withIndent(" ") + .withSchemaLocation(QualityADEModule.NAMESPACE_URI, getClass().getResource("/qualityAde.xsd").toString()) + .withDefaultPrefixes() + .withDefaultNamespace(CoreModule.of(version).getNamespaceURI()) + .write(model); + } + return outStream.toByteArray(); } - private byte[] writeCityGml(CityModel model) throws ADEException, CityGMLBuilderException, CityGMLWriteException { - CityGMLContext context = CityGMLContext.getInstance(); - List adeContexts = context.getADEContexts(); - if (adeContexts == null || adeContexts.isEmpty()) { - for (ADEContext adeContext : ServiceLoader.load(ADEContext.class)) { - context.registerADEContext(adeContext); - } - } + private ValidationResult fillCityModel(CityModel model) { + Validation v = new Validation(); + v.setId("planId"); + model.getFeatureMembers().add(new AbstractFeatureProperty(v)); + v.setValidationSoftware("testSoftware"); + v.setValidationDate(ZonedDateTime.now()); + ValidationPlan plan = new ValidationPlan(); + + Statistics stats = new Statistics(); + FeatureStatistics fStats = new FeatureStatistics(); + fStats.setNumChecked(5); + fStats.setNumErrors(2); + stats.setNumErrorBridgeObjects(new FeatureStatisticsProperty(fStats)); + v.setStatistics(new StatisticsProperty(stats)); + + Requirement req = new Requirement(); + req.setEnabled(true); + req.setRequirementType(RequirementId.R_GE_P_HOLE_OUTSIDE); + plan.getRequirements().add(new RequirementProperty(req)); - CityGMLBuilder builder = context.createCityGMLBuilder(); + Checking checking = new Checking(); + checking.setFeatureType(TopLevelFeatureType.BRIDGE); + + Filter filter = new Filter(); + filter.getChecking().add(new CheckingProperty(checking)); + plan.setFilter(new FilterProperty(filter)); - CityGMLOutputFactory outputFactory = builder.createCityGMLOutputFactory(CityGMLVersion.DEFAULT); - ByteArrayOutputStream out = new ByteArrayOutputStream(); - try (CityGMLWriter writer = outputFactory.createCityGMLWriter(out)) { - writer.setIndentString(" "); - writer.setPrefixes(CityGMLVersion.DEFAULT); - writer.setPrefix("qual", QualityADEModule.NAMESPACE_URI); - writer.setSchemaLocation(QualityADEModule.NAMESPACE_URI, - QualityADEModule.NAMESPACE_URI + "/qualityAdeOld.xsd"); - writer.setSchemaLocations(CityGMLVersion.DEFAULT); - writer.write(model); - return out.toByteArray(); - } - } */ + Parameter param = new Parameter(); + param.setName("test"); + param.setUom("uom"); + param.setValue("5"); + GlobalParameters globalParams = new GlobalParameters(); + globalParams.getParameters().add(new ParameterProperty(param)); + plan.setGlobalParameters(new GlobalParametersProperty(globalParams)); + v.setValidationPlan(new ValidationPlanProperty(plan)); + + + Building b = new Building(); + b.setId("testId"); + model.getCityObjectMembers().add(new AbstractCityObjectProperty(b)); + + CityObjectProperties props = new CityObjectProperties(); + b.addADEProperty(props); + ValidationResult res = new ValidationResult(); + props.setValidationResult(new ValidationResultProperty(res)); + res.setResultType(ResultType.ERROR); + res.setValidationPlanID(new Reference(v)); + return res; + } } diff --git a/citygml4j-quality-ade/src/test/resources/SimpleSolid_AllPolygonsWrongOrientation.gml b/citygml4j-quality-ade/src/test/resources/SimpleSolid_AllPolygonsWrongOrientation.gml deleted file mode 100644 index 0ef3a62..0000000 --- a/citygml4j-quality-ade/src/test/resources/SimpleSolid_AllPolygonsWrongOrientation.gml +++ /dev/null @@ -1,255 +0,0 @@ - - - - - - - - - - _Simple_BD.1_Geom1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 10.0 10.0 3.0 - 11.5 10.0 4.5 - 11.5 10.0 4.5 - 11.5 15.0 4.5 - 10.0 15.0 3.0 - 10.0 10.0 3.0 - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - 2002-05-30T09:00:00 - CityDoctor2 - - - 8 - 0.0001 - - - - - - - - - distance - 0.01 - 1 - 0.0000 - - - - - - - - - - - - - - - - - BUILDING - TRANSPORTATION - VEGETATION - BRIDGE - WATER - LAND - - - - 1 - 0 - 0 - 0 - 0 - 0 - - 1 - - - - \ No newline at end of file diff --git a/citygml4j-quality-ade/src/test/resources/SimpleSolid_HoleOutside.gml b/citygml4j-quality-ade/src/test/resources/SimpleSolid_HoleOutside.gml deleted file mode 100644 index 6c3c99d..0000000 --- a/citygml4j-quality-ade/src/test/resources/SimpleSolid_HoleOutside.gml +++ /dev/null @@ -1,256 +0,0 @@ - - - - - - - - - - _Simple_BD.1_PG.1 - _Simple_BD.1_PG.1_Ring1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 10.0 10.0 3.0 - 11.5 10.0 4.5 - 11.5 10.0 4.5 - 11.5 15.0 4.5 - 10.0 15.0 3.0 - 10.0 10.0 3.0 - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - 2002-05-30T09:00:00 - CityDoctor2 - - - 8 - 0.0001 - - - - - - - - - distance - 0.01 - 1 - 0.0000 - - - - - - - - - - - - - - - - - BUILDING - TRANSPORTATION - VEGETATION - BRIDGE - WATER - LAND - - - - 1 - 0 - 0 - 0 - 0 - 0 - - 1 - - - - \ No newline at end of file diff --git a/citygml4j-quality-ade/src/test/resources/SimpleSolid_InnerRingNested.gml b/citygml4j-quality-ade/src/test/resources/SimpleSolid_InnerRingNested.gml deleted file mode 100644 index 71f5720..0000000 --- a/citygml4j-quality-ade/src/test/resources/SimpleSolid_InnerRingNested.gml +++ /dev/null @@ -1,257 +0,0 @@ - - - - - - - - - - _Simple_BD.1_PG.1 - _Simple_BD.1_PG.1_Ring1 - _Simple_BD.1_PG.1_Ring2 - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 10.0 10.0 3.0 - 11.5 10.0 4.5 - 11.5 10.0 4.5 - 11.5 15.0 4.5 - 10.0 15.0 3.0 - 10.0 10.0 3.0 - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - 2002-05-30T09:00:00 - CityDoctor2 - - - 8 - 0.0001 - - - - - - - - - distance - 0.01 - 1 - 0.0000 - - - - - - - - - - - - - - - - - BUILDING - TRANSPORTATION - VEGETATION - BRIDGE - WATER - LAND - - - - 1 - 0 - 0 - 0 - 0 - 0 - - 1 - - - - \ No newline at end of file diff --git a/citygml4j-quality-ade/src/test/resources/SimpleSolid_InteriorDisconnected.gml b/citygml4j-quality-ade/src/test/resources/SimpleSolid_InteriorDisconnected.gml deleted file mode 100644 index 580a6ef..0000000 --- a/citygml4j-quality-ade/src/test/resources/SimpleSolid_InteriorDisconnected.gml +++ /dev/null @@ -1,255 +0,0 @@ - - - - - - - - - - _Simple_BD.1_PG.1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 10.0 10.0 3.0 - 11.5 10.0 4.5 - 11.5 10.0 4.5 - 11.5 15.0 4.5 - 10.0 15.0 3.0 - 10.0 10.0 3.0 - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - 2002-05-30T09:00:00 - CityDoctor2 - - - 8 - 0.0001 - - - - - - - - - distance - 0.01 - 1 - 0.0000 - - - - - - - - - - - - - - - - - BUILDING - TRANSPORTATION - VEGETATION - BRIDGE - WATER - LAND - - - - 1 - 0 - 0 - 0 - 0 - 0 - - 1 - - - - \ No newline at end of file diff --git a/citygml4j-quality-ade/src/test/resources/SimpleSolid_IntersectingRings.gml b/citygml4j-quality-ade/src/test/resources/SimpleSolid_IntersectingRings.gml deleted file mode 100644 index 4acb090..0000000 --- a/citygml4j-quality-ade/src/test/resources/SimpleSolid_IntersectingRings.gml +++ /dev/null @@ -1,257 +0,0 @@ - - - - - - - - - - _Simple_BD.1_PG.1 - _Simple_BD.1_PG.1_Ring1 - _Simple_BD.1_PG.1_Ring2 - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 10.0 10.0 3.0 - 11.5 10.0 4.5 - 11.5 10.0 4.5 - 11.5 15.0 4.5 - 10.0 15.0 3.0 - 10.0 10.0 3.0 - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - 2002-05-30T09:00:00 - CityDoctor2 - - - 8 - 0.0001 - - - - - - - - - distance - 0.01 - 1 - 0.0000 - - - - - - - - - - - - - - - - - BUILDING - TRANSPORTATION - VEGETATION - BRIDGE - WATER - LAND - - - - 1 - 0 - 0 - 0 - 0 - 0 - - 1 - - - - \ No newline at end of file diff --git a/citygml4j-quality-ade/src/test/resources/SimpleSolid_MultipleConnectedComponents.gml b/citygml4j-quality-ade/src/test/resources/SimpleSolid_MultipleConnectedComponents.gml deleted file mode 100644 index 87ae4d3..0000000 --- a/citygml4j-quality-ade/src/test/resources/SimpleSolid_MultipleConnectedComponents.gml +++ /dev/null @@ -1,266 +0,0 @@ - - - - - - - - - - - _Simple_BD.1_Geom1 - - - _Simple_BD.1_PG.1 - _Simple_BD.1_PG.2 - - - _Simple_BD.1_PG.3 - _Simple_BD.1_PG.4 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 10.0 10.0 3.0 - 11.5 10.0 4.5 - 11.5 10.0 4.5 - 11.5 15.0 4.5 - 10.0 15.0 3.0 - 10.0 10.0 3.0 - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - 2002-05-30T09:00:00 - CityDoctor2 - - - 8 - 0.0001 - - - - - - - - - distance - 0.01 - 1 - 0.0000 - - - - - - - - - - - - - - - - - BUILDING - TRANSPORTATION - VEGETATION - BRIDGE - WATER - LAND - - - - 1 - 0 - 0 - 0 - 0 - 0 - - 1 - - - - \ No newline at end of file diff --git a/citygml4j-quality-ade/src/test/resources/SimpleSolid_NonManifoldEdge.gml b/citygml4j-quality-ade/src/test/resources/SimpleSolid_NonManifoldEdge.gml deleted file mode 100644 index c0c52b9..0000000 --- a/citygml4j-quality-ade/src/test/resources/SimpleSolid_NonManifoldEdge.gml +++ /dev/null @@ -1,262 +0,0 @@ - - - - - - - - - - - _Simple_BD.1_Geom1 - - - 10.0 1.0 2.0 - 11.0 2.0 3.0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 10.0 10.0 3.0 - 11.5 10.0 4.5 - 11.5 10.0 4.5 - 11.5 15.0 4.5 - 10.0 15.0 3.0 - 10.0 10.0 3.0 - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - 2002-05-30T09:00:00 - CityDoctor2 - - - 8 - 0.0001 - - - - - - - - - distance - 0.01 - 1 - 0.0000 - - - - - - - - - - - - - - - - - BUILDING - TRANSPORTATION - VEGETATION - BRIDGE - WATER - LAND - - - - 1 - 0 - 0 - 0 - 0 - 0 - - 1 - - - - \ No newline at end of file diff --git a/citygml4j-quality-ade/src/test/resources/SimpleSolid_NonManifoldVertex.gml b/citygml4j-quality-ade/src/test/resources/SimpleSolid_NonManifoldVertex.gml deleted file mode 100644 index 78ab1d3..0000000 --- a/citygml4j-quality-ade/src/test/resources/SimpleSolid_NonManifoldVertex.gml +++ /dev/null @@ -1,256 +0,0 @@ - - - - - - - - - - _Simple_BD.1_Geom1 - 1.0 2.0 3.0 - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 10.0 10.0 3.0 - 11.5 10.0 4.5 - 11.5 10.0 4.5 - 11.5 15.0 4.5 - 10.0 15.0 3.0 - 10.0 10.0 3.0 - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - 2002-05-30T09:00:00 - CityDoctor2 - - - 8 - 0.0001 - - - - - - - - - distance - 0.01 - 1 - 0.0000 - - - - - - - - - - - - - - - - - BUILDING - TRANSPORTATION - VEGETATION - BRIDGE - WATER - LAND - - - - 1 - 0 - 0 - 0 - 0 - 0 - - 1 - - - - \ No newline at end of file diff --git a/citygml4j-quality-ade/src/test/resources/SimpleSolid_NonPlanarPolygonDistancePlane.gml b/citygml4j-quality-ade/src/test/resources/SimpleSolid_NonPlanarPolygonDistancePlane.gml deleted file mode 100644 index df2c5d4..0000000 --- a/citygml4j-quality-ade/src/test/resources/SimpleSolid_NonPlanarPolygonDistancePlane.gml +++ /dev/null @@ -1,257 +0,0 @@ - - - - - - - - - - _Simple_BD.1_PG.1 - 1.0 2.0 3.0 - 0.001 - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 10.0 10.0 3.0 - 11.5 10.0 4.5 - 11.5 10.0 4.5 - 11.5 15.0 4.5 - 10.0 15.0 3.0 - 10.0 10.0 3.0 - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - 2002-05-30T09:00:00 - CityDoctor2 - - - 8 - 0.0001 - - - - - - - - - distance - 0.01 - 1 - 0.0000 - - - - - - - - - - - - - - - - - BUILDING - TRANSPORTATION - VEGETATION - BRIDGE - WATER - LAND - - - - 1 - 0 - 0 - 0 - 0 - 0 - - 1 - - - - \ No newline at end of file diff --git a/citygml4j-quality-ade/src/test/resources/SimpleSolid_NonPlanarPolygonNormalsDeviation.gml b/citygml4j-quality-ade/src/test/resources/SimpleSolid_NonPlanarPolygonNormalsDeviation.gml deleted file mode 100644 index 07af13e..0000000 --- a/citygml4j-quality-ade/src/test/resources/SimpleSolid_NonPlanarPolygonNormalsDeviation.gml +++ /dev/null @@ -1,256 +0,0 @@ - - - - - - - - - - _Simple_BD.1_PG.1 - 1.0 - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 10.0 10.0 3.0 - 11.5 10.0 4.5 - 11.5 10.0 4.5 - 11.5 15.0 4.5 - 10.0 15.0 3.0 - 10.0 10.0 3.0 - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - 2002-05-30T09:00:00 - CityDoctor2 - - - 8 - 0.0001 - - - - - - - - - distance - 0.01 - 1 - 0.0000 - - - - - - - - - - - - - - - - - BUILDING - TRANSPORTATION - VEGETATION - BRIDGE - WATER - LAND - - - - 1 - 0 - 0 - 0 - 0 - 0 - - 1 - - - - \ No newline at end of file diff --git a/citygml4j-quality-ade/src/test/resources/SimpleSolid_OrientationRingsSame.gml b/citygml4j-quality-ade/src/test/resources/SimpleSolid_OrientationRingsSame.gml deleted file mode 100644 index a5dfffe..0000000 --- a/citygml4j-quality-ade/src/test/resources/SimpleSolid_OrientationRingsSame.gml +++ /dev/null @@ -1,256 +0,0 @@ - - - - - - - - - - _Simple_BD.1_PG.1 - _Simple_BD.1_PG.1_Ring1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 10.0 10.0 3.0 - 11.5 10.0 4.5 - 11.5 10.0 4.5 - 11.5 15.0 4.5 - 10.0 15.0 3.0 - 10.0 10.0 3.0 - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - 2002-05-30T09:00:00 - CityDoctor2 - - - 8 - 0.0001 - - - - - - - - - distance - 0.01 - 1 - 0.0000 - - - - - - - - - - - - - - - - - BUILDING - TRANSPORTATION - VEGETATION - BRIDGE - WATER - LAND - - - - 1 - 0 - 0 - 0 - 0 - 0 - - 1 - - - - \ No newline at end of file diff --git a/citygml4j-quality-ade/src/test/resources/SimpleSolid_PolygonWrongOrientation.gml b/citygml4j-quality-ade/src/test/resources/SimpleSolid_PolygonWrongOrientation.gml deleted file mode 100644 index 2ef9c87..0000000 --- a/citygml4j-quality-ade/src/test/resources/SimpleSolid_PolygonWrongOrientation.gml +++ /dev/null @@ -1,262 +0,0 @@ - - - - - - - - - - - _Simple_BD.1_Geom1 - - - 10.0 1.0 2.0 - 11.0 2.0 3.0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 10.0 10.0 3.0 - 11.5 10.0 4.5 - 11.5 10.0 4.5 - 11.5 15.0 4.5 - 10.0 15.0 3.0 - 10.0 10.0 3.0 - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - 2002-05-30T09:00:00 - CityDoctor2 - - - 8 - 0.0001 - - - - - - - - - distance - 0.01 - 1 - 0.0000 - - - - - - - - - - - - - - - - - BUILDING - TRANSPORTATION - VEGETATION - BRIDGE - WATER - LAND - - - - 1 - 0 - 0 - 0 - 0 - 0 - - 1 - - - - \ No newline at end of file diff --git a/citygml4j-quality-ade/src/test/resources/SimpleSolid_RingNotClosed.gml b/citygml4j-quality-ade/src/test/resources/SimpleSolid_RingNotClosed.gml deleted file mode 100644 index f019062..0000000 --- a/citygml4j-quality-ade/src/test/resources/SimpleSolid_RingNotClosed.gml +++ /dev/null @@ -1,255 +0,0 @@ - - - - - - - - - - _Simple_BD.1_PG.6_LR.1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 10.0 10.0 3.0 - 11.5 10.0 4.5 - 11.5 10.0 4.5 - 11.5 15.0 4.5 - 10.0 15.0 3.0 - 10.0 10.0 3.0 - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - 2002-05-30T09:00:00 - CityDoctor2 - - - 8 - 0.0001 - - - - - - - - - distance - 0.01 - 1 - 0.0000 - - - - - - - - - - - - - - - - - BUILDING - TRANSPORTATION - VEGETATION - BRIDGE - WATER - LAND - - - - 1 - 0 - 0 - 0 - 0 - 0 - - 1 - - - - \ No newline at end of file diff --git a/citygml4j-quality-ade/src/test/resources/SimpleSolid_RingSelfIntersection.gml b/citygml4j-quality-ade/src/test/resources/SimpleSolid_RingSelfIntersection.gml deleted file mode 100644 index 5b036f2..0000000 --- a/citygml4j-quality-ade/src/test/resources/SimpleSolid_RingSelfIntersection.gml +++ /dev/null @@ -1,261 +0,0 @@ - - - - - - - - - - _Simple_BD.1_PG.6_LR.1 - POINT_TOUCHES_EDGE - - 10.0 11.0 12.0 - 11.0 4.0 0.0 - - 5.0 6.0 7.0 - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 10.0 10.0 3.0 - 11.5 10.0 4.5 - 11.5 10.0 4.5 - 11.5 15.0 4.5 - 10.0 15.0 3.0 - 10.0 10.0 3.0 - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - 2002-05-30T09:00:00 - CityDoctor2 - - - 8 - 0.0001 - - - - - - - - - distance - 0.01 - 1 - 0.0000 - - - - - - - - - - - - - - - - - BUILDING - TRANSPORTATION - VEGETATION - BRIDGE - WATER - LAND - - - - 1 - 0 - 0 - 0 - 0 - 0 - - 1 - - - - \ No newline at end of file diff --git a/citygml4j-quality-ade/src/test/resources/SimpleSolid_SolidNotClosed.gml b/citygml4j-quality-ade/src/test/resources/SimpleSolid_SolidNotClosed.gml deleted file mode 100644 index 9e12672..0000000 --- a/citygml4j-quality-ade/src/test/resources/SimpleSolid_SolidNotClosed.gml +++ /dev/null @@ -1,262 +0,0 @@ - - - - - - - - - - - _Simple_BD.1_Geom1 - - - 10.0 1.0 2.0 - 11.0 2.0 3.0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 10.0 10.0 3.0 - 11.5 10.0 4.5 - 11.5 10.0 4.5 - 11.5 15.0 4.5 - 10.0 15.0 3.0 - 10.0 10.0 3.0 - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - 2002-05-30T09:00:00 - CityDoctor2 - - - 8 - 0.0001 - - - - - - - - - distance - 0.01 - 1 - 0.0000 - - - - - - - - - - - - - - - - - BUILDING - TRANSPORTATION - VEGETATION - BRIDGE - WATER - LAND - - - - 1 - 0 - 0 - 0 - 0 - 0 - - 1 - - - - \ No newline at end of file diff --git a/citygml4j-quality-ade/src/test/resources/SimpleSolid_SolidSelfIntersection.gml b/citygml4j-quality-ade/src/test/resources/SimpleSolid_SolidSelfIntersection.gml deleted file mode 100644 index 6d55c8a..0000000 --- a/citygml4j-quality-ade/src/test/resources/SimpleSolid_SolidSelfIntersection.gml +++ /dev/null @@ -1,257 +0,0 @@ - - - - - - - - - - _Simple_BD.1_Geom1 - _Simple_BD.1_PG.1 - _Simple_BD.1_PG.2 - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 10.0 10.0 3.0 - 11.5 10.0 4.5 - 11.5 10.0 4.5 - 11.5 15.0 4.5 - 10.0 15.0 3.0 - 10.0 10.0 3.0 - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - 2002-05-30T09:00:00 - CityDoctor2 - - - 8 - 0.0001 - - - - - - - - - distance - 0.01 - 1 - 0.0000 - - - - - - - - - - - - - - - - - BUILDING - TRANSPORTATION - VEGETATION - BRIDGE - WATER - LAND - - - - 1 - 0 - 0 - 0 - 0 - 0 - - 1 - - - - \ No newline at end of file diff --git a/citygml4j-quality-ade/src/test/resources/SimpleSolid_TooFewPoints.gml b/citygml4j-quality-ade/src/test/resources/SimpleSolid_TooFewPoints.gml deleted file mode 100644 index 244901c..0000000 --- a/citygml4j-quality-ade/src/test/resources/SimpleSolid_TooFewPoints.gml +++ /dev/null @@ -1,255 +0,0 @@ - - - - - - - - - - _Simple_BD.1_PG.6_LR.1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 10.0 10.0 3.0 - 11.5 10.0 4.5 - 11.5 10.0 4.5 - 11.5 15.0 4.5 - 10.0 15.0 3.0 - 10.0 10.0 3.0 - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - 2002-05-30T09:00:00 - CityDoctor2 - - - 8 - 0.0001 - - - - - - - - - distance - 0.01 - 1 - 0.0000 - - - - - - - - - - - - - - - - - BUILDING - TRANSPORTATION - VEGETATION - BRIDGE - WATER - LAND - - - - 1 - 0 - 0 - 0 - 0 - 0 - - 1 - - - - \ No newline at end of file diff --git a/citygml4j-quality-ade/src/test/resources/SimpleSolid_TooFewPolygons.gml b/citygml4j-quality-ade/src/test/resources/SimpleSolid_TooFewPolygons.gml deleted file mode 100644 index af54124..0000000 --- a/citygml4j-quality-ade/src/test/resources/SimpleSolid_TooFewPolygons.gml +++ /dev/null @@ -1,255 +0,0 @@ - - - - - - - - - - _Simple_BD.1_Geom1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 10.0 10.0 3.0 - 11.5 10.0 4.5 - 11.5 10.0 4.5 - 11.5 15.0 4.5 - 10.0 15.0 3.0 - 10.0 10.0 3.0 - - - - - - - - - - - - 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 - - - - - - - - - - - - - - - - - - - 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 - - - - - - - - - - - - - 2002-05-30T09:00:00 - CityDoctor2 - - - 8 - 0.0001 - - - - - - - - - distance - 0.01 - 1 - 0.0000 - - - - - - - - - - - - - - - - - BUILDING - TRANSPORTATION - VEGETATION - BRIDGE - WATER - LAND - - - - 1 - 0 - 0 - 0 - 0 - 0 - - 1 - - - - \ No newline at end of file diff --git a/citygml4j-quality-ade/test.gml b/citygml4j-quality-ade/test.gml index 9e3fd3e..9ade22c 100644 --- a/citygml4j-quality-ade/test.gml +++ b/citygml4j-quality-ade/test.gml @@ -1,18 +1,64 @@ + + + + + + + + geomId + + + ERROR + + + + - - 2022-03-29T12:31:57.2173659+02:00 + + 2022-04-12T12:28:14.1485207+02:00 testSoftware + + + + + 5 + 2 + + + + - - 5 - - - - BRIDGE - + + + + + + test + uom + 5 + + + + + + + + + BRIDGE + + + + + + + true + R_GE_P_HOLE_OUTSIDE + + + - + \ No newline at end of file -- GitLab