Commit 8bafe709 authored by Matthias Betz's avatar Matthias Betz
Browse files

Added citygml4j quality ade integration

Removed produce consumer from stream reading
Added -out parameter to validation streams for writing quality ade stuff
parent b0bdd91b
Pipeline #1910 failed with stage
in 38 seconds
......@@ -15,6 +15,11 @@
<artifactId>CityDoctorModel</artifactId>
<name>CityDoctorModel</name>
<dependencies>
<dependency>
<groupId>de.hft.stuttgart</groupId>
<artifactId>citygml4j-quality-ade</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.citygml4j</groupId>
<artifactId>citygml4j</artifactId>
......
......@@ -19,8 +19,10 @@
package de.hft.stuttgart.citydoctor2.check;
import java.io.Serializable;
import java.util.Optional;
import de.hft.stuttgart.citydoctor2.datastructure.GmlElement;
import de.hft.stuttgart.quality.model.ValidationError;
/**
* Abstract container class for all errors. If your check creates a new error,
......@@ -83,4 +85,8 @@ public interface CheckError extends Serializable {
*/
public void report(ErrorReport report);
public default Optional<ValidationError> convertToQualityAdeDatastructure() {
return Optional.empty();
}
}
......@@ -29,16 +29,22 @@ import de.hft.stuttgart.citydoctor2.utils.Localization;
*/
public enum Unit {
KWH("kWh"), METER("m"), SQUARE_METER("m²"), CUBIC_METER("m³"), RADIAN(Localization.getText("Unit.Radian")), NONE(""), DEGREE(Localization.getText("Unit.Degree"));
KWH("kWh", "kWh"), METER("m", "m"), SQUARE_METER("m²", "m2"), CUBIC_METER("m³", "m3"), RADIAN(Localization.getText("Unit.Radian"), "rad"), NONE("", null), DEGREE(Localization.getText("Unit.Degree"), "deg");
private String representation;
private String gmlRep;
private Unit(String rep) {
private Unit(String rep, String gmlRep) {
representation = rep;
this.gmlRep = gmlRep;
}
public String getRepresentation() {
return representation;
}
public String getGmlRepresentation() {
return gmlRep;
}
}
......@@ -18,6 +18,8 @@
*/
package de.hft.stuttgart.citydoctor2.check.error;
import java.util.Optional;
import de.hft.stuttgart.citydoctor2.check.CheckError;
import de.hft.stuttgart.citydoctor2.check.ErrorId;
import de.hft.stuttgart.citydoctor2.check.ErrorReport;
......@@ -27,6 +29,8 @@ import de.hft.stuttgart.citydoctor2.check.HealingMethod;
import de.hft.stuttgart.citydoctor2.check.ModificationListener;
import de.hft.stuttgart.citydoctor2.datastructure.Geometry;
import de.hft.stuttgart.citydoctor2.datastructure.GmlElement;
import de.hft.stuttgart.quality.model.AllPolygonsWrongOrientation;
import de.hft.stuttgart.quality.model.ValidationError;
/**
* Error when all polygons are oriented wrong.
......@@ -83,4 +87,11 @@ public class AllPolygonsWrongOrientationError implements CheckError {
return getGeometry();
}
@Override
public Optional<ValidationError> convertToQualityAdeDatastructure() {
AllPolygonsWrongOrientation err = new AllPolygonsWrongOrientation();
err.setGeometryId(geom.getGmlId().getGmlString());
return Optional.of(err);
}
}
......@@ -18,6 +18,8 @@
*/
package de.hft.stuttgart.citydoctor2.check.error;
import java.util.Optional;
import de.hft.stuttgart.citydoctor2.check.CheckError;
import de.hft.stuttgart.citydoctor2.check.ErrorId;
import de.hft.stuttgart.citydoctor2.check.ErrorReport;
......@@ -27,6 +29,8 @@ import de.hft.stuttgart.citydoctor2.check.HealingMethod;
import de.hft.stuttgart.citydoctor2.check.ModificationListener;
import de.hft.stuttgart.citydoctor2.datastructure.CityObject;
import de.hft.stuttgart.citydoctor2.datastructure.GmlElement;
import de.hft.stuttgart.quality.model.AttributeMissing;
import de.hft.stuttgart.quality.model.ValidationError;
public class AttributeMissingError implements CheckError {
......@@ -90,4 +94,13 @@ public class AttributeMissingError implements CheckError {
report.add("generic", "" + generic);
}
@Override
public Optional<ValidationError> convertToQualityAdeDatastructure() {
AttributeMissing err = new AttributeMissing();
err.setChildId(childId);
err.setAttributeName(nameOfAttribute);
err.setGeneric(generic);
return Optional.of(err);
}
}
......@@ -18,6 +18,8 @@
*/
package de.hft.stuttgart.citydoctor2.check.error;
import java.util.Optional;
import de.hft.stuttgart.citydoctor2.check.CheckError;
import de.hft.stuttgart.citydoctor2.check.ErrorId;
import de.hft.stuttgart.citydoctor2.check.ErrorReport;
......@@ -27,6 +29,8 @@ import de.hft.stuttgart.citydoctor2.check.HealingMethod;
import de.hft.stuttgart.citydoctor2.check.ModificationListener;
import de.hft.stuttgart.citydoctor2.datastructure.CityObject;
import de.hft.stuttgart.citydoctor2.datastructure.GmlElement;
import de.hft.stuttgart.quality.model.AttributeWrongValue;
import de.hft.stuttgart.quality.model.ValidationError;
public class AttributeValueWrongError implements CheckError {
......@@ -90,4 +94,13 @@ public class AttributeValueWrongError implements CheckError {
report.add("generic", "" + generic);
}
@Override
public Optional<ValidationError> convertToQualityAdeDatastructure() {
AttributeWrongValue err = new AttributeWrongValue();
err.setChildId(childId);
err.setAttributeName(nameOfAttribute);
err.setGeneric(generic);
return Optional.of(err);
}
}
......@@ -18,6 +18,8 @@
*/
package de.hft.stuttgart.citydoctor2.check.error;
import java.util.Optional;
import de.hft.stuttgart.citydoctor2.check.CheckError;
import de.hft.stuttgart.citydoctor2.check.ErrorId;
import de.hft.stuttgart.citydoctor2.check.ErrorReport;
......@@ -28,6 +30,9 @@ import de.hft.stuttgart.citydoctor2.check.ModificationListener;
import de.hft.stuttgart.citydoctor2.datastructure.GmlElement;
import de.hft.stuttgart.citydoctor2.datastructure.LinearRing;
import de.hft.stuttgart.citydoctor2.datastructure.Vertex;
import de.hft.stuttgart.citydoctor2.utils.QualityADEUtils;
import de.hft.stuttgart.quality.model.ConsecutivePointsSame;
import de.hft.stuttgart.quality.model.ValidationError;
/**
* When two points are too close to each other and are consecutive in a linear
......@@ -98,4 +103,13 @@ public class ConsecutivePointSameError implements CheckError {
public GmlElement getFeature() {
return getRing();
}
@Override
public Optional<ValidationError> convertToQualityAdeDatastructure() {
ConsecutivePointsSame err = new ConsecutivePointsSame();
err.setVertex1(QualityADEUtils.convertVertex(p1));
err.setVertex2(QualityADEUtils.convertVertex(p2));
err.setLinearRingId(lr.getGmlId().getGmlString());
return Optional.of(err);
}
}
......@@ -19,6 +19,7 @@
package de.hft.stuttgart.citydoctor2.check.error;
import java.util.List;
import java.util.Optional;
import de.hft.stuttgart.citydoctor2.check.CheckError;
import de.hft.stuttgart.citydoctor2.check.ErrorId;
......@@ -30,6 +31,9 @@ import de.hft.stuttgart.citydoctor2.check.ModificationListener;
import de.hft.stuttgart.citydoctor2.datastructure.Geometry;
import de.hft.stuttgart.citydoctor2.datastructure.GmlElement;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
import de.hft.stuttgart.quality.model.MultipleConnectedComponents;
import de.hft.stuttgart.quality.model.ValidationError;
import de.hft.stuttgart.quality.model.jaxb.Component;
/**
* When a geometry contains two or more not connected geometries, this error is
......@@ -96,4 +100,18 @@ public class MultipleConnectedComponentsError implements CheckError {
public GmlElement getFeature() {
return getGeometry();
}
@Override
public Optional<ValidationError> convertToQualityAdeDatastructure() {
MultipleConnectedComponents err = new MultipleConnectedComponents();
for (List<Polygon> component : components) {
Component c = new Component();
for (Polygon p : component) {
c.getPolygonIds().add(p.getGmlId().getGmlString());
}
err.getComponents().add(c);
}
err.setGeometryId(geom.getGmlId().getGmlString());
return Optional.of(err);
}
}
......@@ -18,6 +18,8 @@
*/
package de.hft.stuttgart.citydoctor2.check.error;
import java.util.Optional;
import de.hft.stuttgart.citydoctor2.check.CheckError;
import de.hft.stuttgart.citydoctor2.check.ErrorId;
import de.hft.stuttgart.citydoctor2.check.ErrorReport;
......@@ -28,6 +30,8 @@ import de.hft.stuttgart.citydoctor2.check.ModificationListener;
import de.hft.stuttgart.citydoctor2.datastructure.GmlElement;
import de.hft.stuttgart.citydoctor2.datastructure.LinearRing;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
import de.hft.stuttgart.quality.model.InnerRingsNested;
import de.hft.stuttgart.quality.model.ValidationError;
/**
* If an inner ring is with in the boundaries of another, this error is created.
......@@ -96,4 +100,13 @@ public class NestedRingError implements CheckError {
public GmlElement getFeature() {
return getPolygon();
}
@Override
public Optional<ValidationError> convertToQualityAdeDatastructure() {
InnerRingsNested err = new InnerRingsNested();
err.setPolygonId(p.getGmlId().getGmlString());
err.setLinearRingId1(innerRing.getGmlId().getGmlString());
err.setLinearRingId2(withinRing.getGmlId().getGmlString());
return Optional.of(err);
}
}
......@@ -19,6 +19,7 @@
package de.hft.stuttgart.citydoctor2.check.error;
import java.util.List;
import java.util.Optional;
import de.hft.stuttgart.citydoctor2.check.CheckError;
import de.hft.stuttgart.citydoctor2.check.ErrorId;
......@@ -30,6 +31,9 @@ import de.hft.stuttgart.citydoctor2.check.ModificationListener;
import de.hft.stuttgart.citydoctor2.datastructure.Edge;
import de.hft.stuttgart.citydoctor2.datastructure.Geometry;
import de.hft.stuttgart.citydoctor2.datastructure.GmlElement;
import de.hft.stuttgart.citydoctor2.utils.QualityADEUtils;
import de.hft.stuttgart.quality.model.NonManifoldEdge;
import de.hft.stuttgart.quality.model.ValidationError;
/**
* If an edge is an edge in 3 or more polygons this error is created.
......@@ -94,4 +98,14 @@ public class NonManifoldEdgeError implements CheckError {
public GmlElement getFeature() {
return getGeometry();
}
@Override
public Optional<ValidationError> convertToQualityAdeDatastructure() {
NonManifoldEdge err = new NonManifoldEdge();
err.setGeometryId(geom.getGmlId().getGmlString());
for (Edge e : edges) {
err.getEdges().add(QualityADEUtils.convertEdge(e));
}
return Optional.of(err);
}
}
......@@ -19,6 +19,7 @@
package de.hft.stuttgart.citydoctor2.check.error;
import java.util.List;
import java.util.Optional;
import de.hft.stuttgart.citydoctor2.check.CheckError;
import de.hft.stuttgart.citydoctor2.check.ErrorId;
......@@ -31,6 +32,9 @@ import de.hft.stuttgart.citydoctor2.datastructure.Geometry;
import de.hft.stuttgart.citydoctor2.datastructure.GmlElement;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
import de.hft.stuttgart.citydoctor2.datastructure.Vertex;
import de.hft.stuttgart.citydoctor2.utils.QualityADEUtils;
import de.hft.stuttgart.quality.model.NonManifoldVertex;
import de.hft.stuttgart.quality.model.ValidationError;
/**
* A vertex which is contained in multiple polygons which are not connected via
......@@ -109,4 +113,12 @@ public class NonManifoldVertexError implements CheckError {
return getGeometry();
}
@Override
public Optional<ValidationError> convertToQualityAdeDatastructure() {
NonManifoldVertex err = new NonManifoldVertex();
err.setGeometryId(geom.getGmlId().getGmlString());
err.setVertex(QualityADEUtils.convertVertex(v));
return Optional.of(err);
}
}
......@@ -18,6 +18,10 @@
*/
package de.hft.stuttgart.citydoctor2.check.error;
import java.util.Optional;
import org.citygml4j.model.gml.measures.Length;
import de.hft.stuttgart.citydoctor2.check.CheckError;
import de.hft.stuttgart.citydoctor2.check.ErrorId;
import de.hft.stuttgart.citydoctor2.check.ErrorReport;
......@@ -30,6 +34,9 @@ import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
import de.hft.stuttgart.citydoctor2.datastructure.Vertex;
import de.hft.stuttgart.citydoctor2.math.Plane;
import de.hft.stuttgart.citydoctor2.utils.Localization;
import de.hft.stuttgart.citydoctor2.utils.QualityADEUtils;
import de.hft.stuttgart.quality.model.NonPlanarDistancePlane;
import de.hft.stuttgart.quality.model.ValidationError;
/**
* Error object for planarity errors containing the polygon, the regression
......@@ -106,4 +113,15 @@ public class NonPlanarPolygonDistancePlaneError implements CheckError {
public GmlElement getFeature() {
return getPolygon();
}
@Override
public Optional<ValidationError> convertToQualityAdeDatastructure() {
NonPlanarDistancePlane err = new NonPlanarDistancePlane();
err.setVertex(QualityADEUtils.convertVertex(v));
err.setPolygonId(p.getGmlId().getGmlString());
Length l = new Length(distance);
l.setUom("m");
err.setDistance(l);
return Optional.of(err);
}
}
......@@ -18,6 +18,10 @@
*/
package de.hft.stuttgart.citydoctor2.check.error;
import java.util.Optional;
import org.citygml4j.model.gml.measures.Angle;
import de.hft.stuttgart.citydoctor2.check.CheckError;
import de.hft.stuttgart.citydoctor2.check.ErrorId;
import de.hft.stuttgart.citydoctor2.check.ErrorReport;
......@@ -27,6 +31,8 @@ import de.hft.stuttgart.citydoctor2.check.HealingMethod;
import de.hft.stuttgart.citydoctor2.check.ModificationListener;
import de.hft.stuttgart.citydoctor2.datastructure.GmlElement;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
import de.hft.stuttgart.quality.model.NonPlanarNormalsDeviation;
import de.hft.stuttgart.quality.model.ValidationError;
/**
* When the normal of the triangles created from the triangulation of the
......@@ -90,4 +96,14 @@ public class NonPlanarPolygonNormalsDeviation implements CheckError {
public GmlElement getFeature() {
return getPolygon();
}
@Override
public Optional<ValidationError> convertToQualityAdeDatastructure() {
NonPlanarNormalsDeviation err = new NonPlanarNormalsDeviation();
err.setPolygonId(p.getGmlId().getGmlString());
Angle a = new Angle(deviation);
a.setUom("rad");
err.setDeviation(a);
return Optional.of(err);
}
}
......@@ -18,6 +18,8 @@
*/
package de.hft.stuttgart.citydoctor2.check.error;
import java.util.Optional;
import de.hft.stuttgart.citydoctor2.check.CheckError;
import de.hft.stuttgart.citydoctor2.check.ErrorId;
import de.hft.stuttgart.citydoctor2.check.ErrorReport;
......@@ -29,6 +31,10 @@ import de.hft.stuttgart.citydoctor2.datastructure.Edge;
import de.hft.stuttgart.citydoctor2.datastructure.GmlElement;
import de.hft.stuttgart.citydoctor2.datastructure.LinearRing;
import de.hft.stuttgart.citydoctor2.datastructure.Vertex;
import de.hft.stuttgart.citydoctor2.utils.QualityADEUtils;
import de.hft.stuttgart.quality.model.RingSelfIntersection;
import de.hft.stuttgart.quality.model.ValidationError;
import de.hft.stuttgart.quality.model.jaxb.RingSelfIntType;
/**
* If a point of a linear ring touches an edge of the same ring it is considered
......@@ -101,4 +107,14 @@ public class PointTouchesEdgeError implements CheckError {
return getRing();
}
@Override
public Optional<ValidationError> convertToQualityAdeDatastructure() {
RingSelfIntersection err = new RingSelfIntersection();
err.setType(RingSelfIntType.POINT_TOUCHES_EDGE);
err.setLinearRingId(lr.getGmlId().getGmlString());
err.setEdge1(QualityADEUtils.convertEdge(e));
err.setVertex1(QualityADEUtils.convertVertex(v));
return Optional.of(err);
}
}
......@@ -19,6 +19,7 @@
package de.hft.stuttgart.citydoctor2.check.error;
import java.util.List;
import java.util.Optional;
import de.hft.stuttgart.citydoctor2.check.CheckError;
import de.hft.stuttgart.citydoctor2.check.ErrorId;
......@@ -30,6 +31,8 @@ import de.hft.stuttgart.citydoctor2.check.ModificationListener;
import de.hft.stuttgart.citydoctor2.datastructure.GmlElement;
import de.hft.stuttgart.citydoctor2.datastructure.LinearRing;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
import de.hft.stuttgart.quality.model.HoleOutside;
import de.hft.stuttgart.quality.model.ValidationError;
/**
* When an interior ring is completely outside the exterior ring this error is
......@@ -95,4 +98,12 @@ public class PolygonHoleOutsideError implements CheckError {
public GmlElement getFeature() {
return getPolygon();
}
@Override
public Optional<ValidationError> convertToQualityAdeDatastructure() {
HoleOutside err = new HoleOutside();
err.setPolygonId(p.getGmlId().getGmlString());
err.setLinearRingId(holesOutside.get(0).getGmlId().getGmlString());
return Optional.of(err);
}
}
......@@ -19,6 +19,7 @@
package de.hft.stuttgart.citydoctor2.check.error;
import java.util.List;
import java.util.Optional;
import de.hft.stuttgart.citydoctor2.check.CheckError;
import de.hft.stuttgart.citydoctor2.check.ErrorId;
......@@ -30,6 +31,8 @@ import de.hft.stuttgart.citydoctor2.check.ModificationListener;
import de.hft.stuttgart.citydoctor2.datastructure.GmlElement;
import de.hft.stuttgart.citydoctor2.datastructure.LinearRing;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
import de.hft.stuttgart.quality.model.InteriorDisconnected;
import de.hft.stuttgart.quality.model.ValidationError;
/**
* If the holes in a polygon split the interior area into two distinct areas
......@@ -96,4 +99,11 @@ public class PolygonInteriorDisconnectedError implements CheckError {
public GmlElement getFeature() {
return getPolygon();
}
@Override
public Optional<ValidationError> convertToQualityAdeDatastructure() {
InteriorDisconnected err = new InteriorDisconnected();
err.setPolygonId(p.getGmlId().getGmlString());
return Optional.of(err);
}
}
......@@ -18,6 +18,8 @@
*/
package de.hft.stuttgart.citydoctor2.check.error;
import java.util.Optional;
import de.hft.stuttgart.citydoctor2.check.CheckError;
import de.hft.stuttgart.citydoctor2.check.ErrorId;
import de.hft.stuttgart.citydoctor2.check.ErrorReport;
......@@ -29,6 +31,8 @@ import de.hft.stuttgart.citydoctor2.datastructure.GmlElement;
import de.hft.stuttgart.citydoctor2.datastructure.LinearRing;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
import de.hft.stuttgart.citydoctor2.utils.SerializablePair;
import de.hft.stuttgart.quality.model.IntersectingRings;
import de.hft.stuttgart.quality.model.ValidationError;
/**
* If the exterior ring and interior rings are intersecting each other, it
......@@ -93,4 +97,13 @@ public class PolygonIntersectingRingsError implements CheckError {
public GmlElement getFeature() {
return getPolygon();
}
@Override
public Optional<ValidationError> convertToQualityAdeDatastructure() {
IntersectingRings err = new IntersectingRings();
err.setPolygonId(p.getGmlId().getGmlString());
err.setLinearRingId1(intersectingRings.getValue0().getGmlId().getGmlString());
err.setLinearRingId2(intersectingRings.getValue1().getGmlId().getGmlString());
return Optional.of(err);
}
}
......@@ -18,6 +18,8 @@
*/
package de.hft.stuttgart.citydoctor2.check.error;
import java.util.Optional;
import de.hft.stuttgart.citydoctor2.check.CheckError;
import de.hft.stuttgart.citydoctor2.check.ErrorId;
import de.hft.stuttgart.citydoctor2.check.ErrorReport;
......@@ -28,6 +30,8 @@ import de.hft.stuttgart.citydoctor2.check.ModificationListener;
import de.hft.stuttgart.citydoctor2.datastructure.GmlElement;
import de.hft.stuttgart.citydoctor2.datastructure.LinearRing;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
import de.hft.stuttgart.quality.model.OrientationRingsSame;
import de.hft.stuttgart.quality.model.ValidationError;
/**
* If the interior rings have the same orientation as the exterior ring, this
......@@ -91,4 +95,12 @@ public class PolygonSameOrientationError implements CheckError {
public GmlElement getFeature() {
return getPolygon();
}
@Override
public Optional<ValidationError> convertToQualityAdeDatastructure() {
OrientationRingsSame err = new OrientationRingsSame();
err.setPolygonId(p.getGmlId().getGmlString());
err.setLinearRingId(innerRing.getGmlId().getGmlString());
return Optional.of(err);
}
}
......@@ -20,6 +20,7 @@ package de.hft.stuttgart.citydoctor2.check.error;
import java.util.HashSet;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import de.hft.stuttgart.citydoctor2.check.CheckError;
......@@ -33,6 +34,9 @@ import de.hft.stuttgart.citydoctor2.datastructure.Edge;
import de.hft.stuttgart.citydoctor2.datastructure.Geometry;
import de.hft.stuttgart.citydoctor2.datastructure.GmlElement;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
import de.hft.stuttgart.citydoctor2.utils.QualityADEUtils;
import de.hft.stuttgart.quality.model.PolygonWrongOrientation;
import de.hft.stuttgart.quality.model.ValidationError;
/**