Commit c1805c1f authored by Matthias Betz's avatar Matthias Betz
Browse files

switch to quality ade 1.0.0

added bridge constructive elements
fixed bridge related bugs
parent 259cbe7d
Pipeline #7238 failed with stage
in 17 seconds
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<parent> <parent>
<groupId>de.hft.stuttgart</groupId> <groupId>de.hft.stuttgart</groupId>
<artifactId>CityDoctorParent</artifactId> <artifactId>CityDoctorParent</artifactId>
<version>3.12.0</version> <version>3.13.0</version>
</parent> </parent>
<artifactId>CityDoctorCheckResult</artifactId> <artifactId>CityDoctorCheckResult</artifactId>
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<parent> <parent>
<groupId>de.hft.stuttgart</groupId> <groupId>de.hft.stuttgart</groupId>
<artifactId>CityDoctorParent</artifactId> <artifactId>CityDoctorParent</artifactId>
<version>3.12.0</version> <version>3.13.0</version>
</parent> </parent>
<artifactId>CityDoctorEdge</artifactId> <artifactId>CityDoctorEdge</artifactId>
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<parent> <parent>
<groupId>de.hft.stuttgart</groupId> <groupId>de.hft.stuttgart</groupId>
<artifactId>CityDoctorParent</artifactId> <artifactId>CityDoctorParent</artifactId>
<version>3.12.0</version> <version>3.13.0</version>
</parent> </parent>
<properties> <properties>
......
/*- /*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart * Copyright 2023 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
* *
* This file is part of CityDoctor2. * This file is part of CityDoctor2.
* *
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
package de.hft.stuttgart.citydoctor2.check; package de.hft.stuttgart.citydoctor2.check;
import de.hft.stuttgart.citydoctor2.check.error.AllPolygonsWrongOrientationError; import de.hft.stuttgart.citydoctor2.check.error.AllPolygonsWrongOrientationError;
import de.hft.stuttgart.citydoctor2.check.error.AttributeInvalidError;
import de.hft.stuttgart.citydoctor2.check.error.AttributeMissingError; import de.hft.stuttgart.citydoctor2.check.error.AttributeMissingError;
import de.hft.stuttgart.citydoctor2.check.error.AttributeValueWrongError; import de.hft.stuttgart.citydoctor2.check.error.AttributeValueWrongError;
import de.hft.stuttgart.citydoctor2.check.error.ConsecutivePointSameError; import de.hft.stuttgart.citydoctor2.check.error.ConsecutivePointSameError;
...@@ -129,4 +130,6 @@ public interface ErrorVisitor { ...@@ -129,4 +130,6 @@ public interface ErrorVisitor {
public void visit(AttributeValueWrongError err); public void visit(AttributeValueWrongError err);
public void visit(AttributeInvalidError cdErr);
} }
/*- /*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart * Copyright 2023 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
* *
* This file is part of CityDoctor2. * This file is part of CityDoctor2.
* *
...@@ -24,6 +24,7 @@ import org.xmlobjects.gml.model.measures.Angle; ...@@ -24,6 +24,7 @@ import org.xmlobjects.gml.model.measures.Angle;
import org.xmlobjects.gml.model.measures.Length; import org.xmlobjects.gml.model.measures.Length;
import de.hft.stuttgart.citydoctor2.check.error.AllPolygonsWrongOrientationError; import de.hft.stuttgart.citydoctor2.check.error.AllPolygonsWrongOrientationError;
import de.hft.stuttgart.citydoctor2.check.error.AttributeInvalidError;
import de.hft.stuttgart.citydoctor2.check.error.AttributeMissingError; import de.hft.stuttgart.citydoctor2.check.error.AttributeMissingError;
import de.hft.stuttgart.citydoctor2.check.error.AttributeValueWrongError; import de.hft.stuttgart.citydoctor2.check.error.AttributeValueWrongError;
import de.hft.stuttgart.citydoctor2.check.error.ConsecutivePointSameError; import de.hft.stuttgart.citydoctor2.check.error.ConsecutivePointSameError;
...@@ -80,6 +81,7 @@ import de.hft.stuttgart.quality.model.types.PlanarDistancePlaneError; ...@@ -80,6 +81,7 @@ import de.hft.stuttgart.quality.model.types.PlanarDistancePlaneError;
import de.hft.stuttgart.quality.model.types.PlanarNormalsDeviationError; import de.hft.stuttgart.quality.model.types.PlanarNormalsDeviationError;
import de.hft.stuttgart.quality.model.types.PolygonIdList; import de.hft.stuttgart.quality.model.types.PolygonIdList;
import de.hft.stuttgart.quality.model.types.RingSelfIntersectionError; import de.hft.stuttgart.quality.model.types.RingSelfIntersectionError;
import de.hft.stuttgart.quality.model.types.SemanticAttributeInvalidError;
import de.hft.stuttgart.quality.model.types.SemanticAttributeMissingError; import de.hft.stuttgart.quality.model.types.SemanticAttributeMissingError;
import de.hft.stuttgart.quality.model.types.SemanticAttributeWrongValueError; import de.hft.stuttgart.quality.model.types.SemanticAttributeWrongValueError;
import de.hft.stuttgart.quality.model.types.SolidSelfIntersectionError; import de.hft.stuttgart.quality.model.types.SolidSelfIntersectionError;
...@@ -377,7 +379,6 @@ public class QualityAdeErrorVisitor implements ErrorVisitor { ...@@ -377,7 +379,6 @@ public class QualityAdeErrorVisitor implements ErrorVisitor {
var err = new SemanticAttributeMissingError(); var err = new SemanticAttributeMissingError();
err.setChildId(cdErr.getChildId()); err.setChildId(cdErr.getChildId());
err.setAttributeName(cdErr.getNameOfAttribute()); err.setAttributeName(cdErr.getNameOfAttribute());
err.setGeneric(cdErr.isGeneric());
res.getErrors().add(new AbstractErrorProperty(err)); res.getErrors().add(new AbstractErrorProperty(err));
} }
...@@ -386,7 +387,14 @@ public class QualityAdeErrorVisitor implements ErrorVisitor { ...@@ -386,7 +387,14 @@ public class QualityAdeErrorVisitor implements ErrorVisitor {
SemanticAttributeWrongValueError err = new SemanticAttributeWrongValueError(); SemanticAttributeWrongValueError err = new SemanticAttributeWrongValueError();
err.setChildId(cdErr.getChildId()); err.setChildId(cdErr.getChildId());
err.setAttributeName(cdErr.getNameOfAttribute()); err.setAttributeName(cdErr.getNameOfAttribute());
err.setGeneric(cdErr.isGeneric()); res.getErrors().add(new AbstractErrorProperty(err));
}
@Override
public void visit(AttributeInvalidError cdErr) {
SemanticAttributeInvalidError err = new SemanticAttributeInvalidError();
err.setChildId(cdErr.getChildId());
err.setAttributeName(cdErr.getNameOfAttribute());
res.getErrors().add(new AbstractErrorProperty(err)); res.getErrors().add(new AbstractErrorProperty(err));
} }
......
/*-
* Copyright 2022 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CityDoctor2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package de.hft.stuttgart.citydoctor2.check.error;
import de.hft.stuttgart.citydoctor2.check.CheckError;
import de.hft.stuttgart.citydoctor2.check.ErrorId;
import de.hft.stuttgart.citydoctor2.check.ErrorReport;
import de.hft.stuttgart.citydoctor2.check.ErrorType;
import de.hft.stuttgart.citydoctor2.check.ErrorVisitor;
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;
public class AttributeInvalidError implements CheckError {
private static final long serialVersionUID = 346311592089394220L;
public static final ErrorId ID = new ErrorId("SE_ATTRIBUTE_INVALID");
private CityObject co;
private String childId;
private String nameOfAttribute;
public AttributeInvalidError(CityObject co, String childId, String nameOfAttribute) {
this.co = co;
this.childId = childId;
this.nameOfAttribute = nameOfAttribute;
}
@Override
public ErrorType getType() {
return ErrorType.ERROR;
}
@Override
public ErrorId getErrorId() {
return ID;
}
public String getChildId() {
return childId;
}
public String getNameOfAttribute() {
return nameOfAttribute;
}
@Override
public GmlElement getFeature() {
return co;
}
@Override
public void accept(ErrorVisitor errorVisitor) {
errorVisitor.visit(this);
}
@Override
public boolean accept(HealingMethod method, ModificationListener l) {
return method.visit(this, l);
}
@Override
public void report(ErrorReport report) {
report.add("childId", childId);
report.add("name", nameOfAttribute);
}
}
...@@ -35,15 +35,13 @@ public class AttributeMissingError implements CheckError { ...@@ -35,15 +35,13 @@ public class AttributeMissingError implements CheckError {
public static final ErrorId ID = new ErrorId("SE_ATTRIBUTE_MISSING"); public static final ErrorId ID = new ErrorId("SE_ATTRIBUTE_MISSING");
private CityObject co; private CityObject co;
private boolean generic;
private String childId; private String childId;
private String nameOfAttribute; private String nameOfAttribute;
public AttributeMissingError(CityObject co, String childId, String nameOfAttribute, boolean generic) { public AttributeMissingError(CityObject co, String childId, String nameOfAttribute) {
this.co = co; this.co = co;
this.childId = childId; this.childId = childId;
this.nameOfAttribute = nameOfAttribute; this.nameOfAttribute = nameOfAttribute;
this.generic = generic;
} }
@Override @Override
...@@ -60,10 +58,6 @@ public class AttributeMissingError implements CheckError { ...@@ -60,10 +58,6 @@ public class AttributeMissingError implements CheckError {
return childId; return childId;
} }
public boolean isGeneric() {
return generic;
}
public String getNameOfAttribute() { public String getNameOfAttribute() {
return nameOfAttribute; return nameOfAttribute;
} }
...@@ -87,7 +81,6 @@ public class AttributeMissingError implements CheckError { ...@@ -87,7 +81,6 @@ public class AttributeMissingError implements CheckError {
public void report(ErrorReport report) { public void report(ErrorReport report) {
report.add("childId", childId); report.add("childId", childId);
report.add("name", nameOfAttribute); report.add("name", nameOfAttribute);
report.add("generic", "" + generic);
} }
} }
...@@ -35,15 +35,13 @@ public class AttributeValueWrongError implements CheckError { ...@@ -35,15 +35,13 @@ public class AttributeValueWrongError implements CheckError {
public static final ErrorId ID = new ErrorId("SE_ATTRIBUTE_WRONG_VALUE"); public static final ErrorId ID = new ErrorId("SE_ATTRIBUTE_WRONG_VALUE");
private CityObject co; private CityObject co;
private boolean generic;
private String childId; private String childId;
private String nameOfAttribute; private String nameOfAttribute;
public AttributeValueWrongError(CityObject co, String childId, String nameOfAttribute, boolean generic) { public AttributeValueWrongError(CityObject co, String childId, String nameOfAttribute) {
this.co = co; this.co = co;
this.childId = childId; this.childId = childId;
this.nameOfAttribute = nameOfAttribute; this.nameOfAttribute = nameOfAttribute;
this.generic = generic;
} }
@Override @Override
...@@ -65,10 +63,6 @@ public class AttributeValueWrongError implements CheckError { ...@@ -65,10 +63,6 @@ public class AttributeValueWrongError implements CheckError {
return childId; return childId;
} }
public boolean isGeneric() {
return generic;
}
public String getNameOfAttribute() { public String getNameOfAttribute() {
return nameOfAttribute; return nameOfAttribute;
} }
...@@ -87,6 +81,5 @@ public class AttributeValueWrongError implements CheckError { ...@@ -87,6 +81,5 @@ public class AttributeValueWrongError implements CheckError {
public void report(ErrorReport report) { public void report(ErrorReport report) {
report.add("childId", childId); report.add("childId", childId);
report.add("name", nameOfAttribute); report.add("name", nameOfAttribute);
report.add("generic", "" + generic);
} }
} }
...@@ -28,22 +28,19 @@ import de.hft.stuttgart.citydoctor2.check.ModificationListener; ...@@ -28,22 +28,19 @@ import de.hft.stuttgart.citydoctor2.check.ModificationListener;
import de.hft.stuttgart.citydoctor2.datastructure.GmlElement; import de.hft.stuttgart.citydoctor2.datastructure.GmlElement;
public class SchematronError implements CheckError { public class SchematronError implements CheckError {
private static final long serialVersionUID = -2964084500589868928L; private static final long serialVersionUID = -2964084500589868928L;
private String errorId; private String errorId;
private String gmlId; private String gmlId;
private String childId; private String childId;
private String nameOfAttribute; private String nameOfAttribute;
private boolean generic;
public SchematronError(String errorId, String gmlId, String childId, String nameOfAttribute, boolean generic) { public SchematronError(String errorId, String gmlId, String childId, String nameOfAttribute) {
this.errorId = errorId; this.errorId = errorId;
this.gmlId = gmlId; this.gmlId = gmlId;
this.childId = childId; this.childId = childId;
this.nameOfAttribute = nameOfAttribute; this.nameOfAttribute = nameOfAttribute;
this.generic = generic;
} }
@Override @Override
...@@ -64,29 +61,25 @@ public class SchematronError implements CheckError { ...@@ -64,29 +61,25 @@ public class SchematronError implements CheckError {
@Override @Override
public String toString() { public String toString() {
return "SchematronError [errorId=" + errorId + ", gmlId=" + gmlId + ", childId=" + childId return "SchematronError [errorId=" + errorId + ", gmlId=" + gmlId + ", childId=" + childId
+ ", nameOfAttribute=" + nameOfAttribute + ", generic=" + generic + "]"; + ", nameOfAttribute=" + nameOfAttribute + "]";
} }
public String getChildId() { public String getChildId() {
return childId; return childId;
} }
public String getGmlId() { public String getGmlId() {
return gmlId; return gmlId;
} }
public String getNameOfAttribute() { public String getNameOfAttribute() {
return nameOfAttribute; return nameOfAttribute;
} }
public String getErrorIdString() { public String getErrorIdString() {
return errorId; return errorId;
} }
public boolean isGeneric() {
return generic;
}
@Override @Override
public ErrorType getType() { public ErrorType getType() {
return ErrorType.ERROR; return ErrorType.ERROR;
......
/*-
* Copyright 2022 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CityDoctor2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package de.hft.stuttgart.citydoctor2.datastructure;
import org.citygml4j.core.model.deprecated.bridge.DeprecatedPropertiesOfBridgeConstructiveElement;
import org.citygml4j.core.util.geometry.GeometryFactory;
import org.xmlobjects.gml.model.geometry.GeometryProperty;
import org.xmlobjects.gml.model.geometry.aggregates.MultiSurface;
import org.xmlobjects.gml.model.geometry.aggregates.MultiSurfaceProperty;
import org.xmlobjects.gml.model.geometry.complexes.CompositeSurface;
import org.xmlobjects.gml.model.geometry.primitives.Solid;
import org.xmlobjects.gml.model.geometry.primitives.SolidProperty;
import de.hft.stuttgart.citydoctor2.parser.ParserConfiguration;
import de.hft.stuttgart.citydoctor2.utils.CityGmlUtils;
import de.hft.stuttgart.citydoctor2.utils.Copyable;
public class BridgeConstructiveElement extends CityObject {
private static final String CANNOT_ADD = "Cannot add ";
private static final long serialVersionUID = 7353233899458901155L;
private org.citygml4j.core.model.bridge.BridgeConstructiveElement gmlBridgeElement;
public BridgeConstructiveElement(org.citygml4j.core.model.bridge.BridgeConstructiveElement gmlObject) {
this.gmlBridgeElement = gmlObject;
}
@Override
public Copyable createCopyInstance() {
return new BridgeConstructiveElement(gmlBridgeElement);
}
@Override
public void reCreateGeometries(GeometryFactory factory, ParserConfiguration config) {
// only handles CityGML2 for now
// unknown which CityGML is handled here
// need context information to decide
for (Geometry geom : getGeometries()) {
switch (geom.getType()) {
case SOLID:
Solid solid = CityGmlUtils.createSolid(geom, factory, config);
setSolidAccordingToLod(geom, solid);
break;
case MULTI_SURFACE:
MultiSurface ms = CityGmlUtils.createMultiSurface(geom, factory, config);
setMultiSurfaceAccordingToLod(geom, ms);
break;
case COMPOSITE_SURFACE:
CompositeSurface cs = CityGmlUtils.createCompositeSurface(geom, factory, config);
setCompositeSurfaceAccordingToLod(geom, cs);
break;
}
}
}
private void setCompositeSurfaceAccordingToLod(Geometry geom, CompositeSurface cs) {
switch (geom.getLod()) {
case LOD1:
gmlBridgeElement.getDeprecatedProperties().setLod1Geometry(new GeometryProperty<>(cs));
break;
case LOD2:
gmlBridgeElement.getDeprecatedProperties().setLod2Geometry(new GeometryProperty<>(cs));
break;
case LOD3:
gmlBridgeElement.getDeprecatedProperties().setLod3Geometry(new GeometryProperty<>(cs));
break;
case LOD4:
gmlBridgeElement.getDeprecatedProperties().setLod4Geometry(new GeometryProperty<>(cs));
break;
default:
throw new IllegalStateException(CANNOT_ADD + geom.getLod() + " composite surface to buildings");
}
}
private void setSolidAccordingToLod(Geometry geom, Solid solid) {
switch (geom.getLod()) {
case LOD1:
gmlBridgeElement.getDeprecatedProperties().setLod1Geometry(new SolidProperty(solid));
break;
case LOD2:
gmlBridgeElement.getDeprecatedProperties().setLod2Geometry(new SolidProperty(solid));
break;
case LOD3:
gmlBridgeElement.getDeprecatedProperties().setLod3Geometry(new SolidProperty(solid));
break;
case LOD4:
gmlBridgeElement.getDeprecatedProperties().setLod4Geometry(new SolidProperty(solid));
break;
default:
throw new IllegalStateException(CANNOT_ADD + geom.getLod() + " solid to buildings");
}
}
private void setMultiSurfaceAccordingToLod(Geometry geom, MultiSurface ms) {
switch (geom.getLod()) {
case LOD0:
gmlBridgeElement.getDeprecatedProperties().setLod1Geometry(new MultiSurfaceProperty(ms));
break;
case LOD1:
gmlBridgeElement.getDeprecatedProperties().setLod1Geometry(new MultiSurfaceProperty(ms));
break;
case LOD2:
gmlBridgeElement.getDeprecatedProperties().setLod1Geometry(new MultiSurfaceProperty(ms));
break;
case LOD3:
gmlBridgeElement.getDeprecatedProperties().setLod1Geometry(new MultiSurfaceProperty(ms));
break;
case LOD4:
gmlBridgeElement.getDeprecatedProperties().setLod1Geometry(new MultiSurfaceProperty(ms));
break;
default:
throw new IllegalStateException(CANNOT_ADD + geom.getLod() + " multi surface to buildings");
}
}
@Override
public org.citygml4j.core.model.bridge.BridgeConstructiveElement getGmlObject() {
return gmlBridgeElement;
}
@Override
public void unsetGmlGeometries() {
gmlBridgeElement.setLod0MultiSurface(null);
gmlBridgeElement.setLod2MultiSurface(null);
gmlBridgeElement.setLod3MultiSurface(null);
DeprecatedPropertiesOfBridgeConstructiveElement depProps = gmlBridgeElement.getDeprecatedProperties();
depProps.setLod1Geometry(null);
depProps.setLod2Geometry(null);
depProps.setLod3Geometry(null);
depProps.setLod4Geometry(null);
gmlBridgeElement.setLod1Solid(null);
gmlBridgeElement.setLod2Solid(null);
gmlBridgeElement.setLod3Solid(null);
}
@Override
public FeatureType getFeatureType() {
return FeatureType.BRIDGE_CONSTRUCTION_ELEMENT;
}
}
...@@ -54,8 +54,9 @@ public class BridgeObject extends CityObject { ...@@ -54,8 +54,9 @@ public class BridgeObject extends CityObject {
private BridgeType type; private BridgeType type;
private List<BridgeObject> parts = null; private List<BridgeObject> parts = null;
private List<BridgeConstructiveElement> elements = null;
private List<BoundarySurface> boundarySurfaces = new ArrayList<>(); private List<BoundarySurface> boundarySurfaces = new ArrayList<>(2);
public BridgeObject(BridgeType type, AbstractBridge ab) { public BridgeObject(BridgeType type, AbstractBridge ab) {
this.ab = ab; this.ab = ab;
...@@ -66,6 +67,13 @@ public class BridgeObject extends CityObject { ...@@ -66,6 +67,13 @@ public class BridgeObject extends CityObject {
public FeatureType getFeatureType() { public FeatureType getFeatureType() {
return FeatureType.BRIDGE; return FeatureType.BRIDGE;
} }
public List<BridgeConstructiveElement> getConstructiveElements() {
if (elements == null) {
elements = new ArrayList<>(2);
}
return elements;
}
@Override @Override
public void reCreateGeometries(GeometryFactory factory, ParserConfiguration config) { public void reCreateGeometries(GeometryFactory factory, ParserConfiguration config) {
...@@ -81,6 +89,16 @@ public class BridgeObject extends CityObject { ...@@ -81,6 +89,16 @@ public class BridgeObject extends CityObject {
for (BoundarySurface bs : boundarySurfaces) { for (BoundarySurface bs : boundarySurfaces) {
bs.reCreateGeometries(factory, config); bs.reCreateGeometries(factory, config);
} }
if (parts != null) {
for (BridgeObject part : parts) {
part.reCreateGeometries(factory, config);
}
}
if (elements != null) {
for (BridgeConstructiveElement ele : elements) {
ele.reCreateGeometries(factory, config);
}
}
} }
private void setMultiSurfaceAccordingToLod(Geometry geom, MultiSurface ms) { private void setMultiSurfaceAccordingToLod(Geometry geom, MultiSurface ms) {
...@@ -127,6 +145,16 @@ public class BridgeObject extends CityObject { ...@@ -127,6 +145,16 @@ public class BridgeObject extends CityObject {
for (BoundarySurface bs : boundarySurfaces) { for (BoundarySurface bs : boundarySurfaces) {
bs.clearAllContainedCheckResults(); bs.clearAllContainedCheckResults();
} }
if (parts != null) {
for (BridgeObject part : parts) {
part.clearAllContainedCheckResults();
}
}
if (elements != null) {
for (BridgeConstructiveElement ele : elements) {
ele.clearAllContainedCheckResults();
}
}
} }
@Override @Override
...@@ -135,6 +163,16 @@ public class BridgeObject extends CityObject { ...@@ -135,6 +163,16 @@ public class BridgeObject extends CityObject {
for (BoundarySurface bs : boundarySurfaces) { for (BoundarySurface bs : boundarySurfaces) {
bs.collectContainedErrors(errors); bs.collectContainedErrors(errors);
} }
if (parts != null) {
for (BridgeObject part : parts) {
part.collectContainedErrors(errors);
}
}
if (elements != null) {
for (BridgeConstructiveElement ele : elements) {
ele.collectContainedErrors(errors);
}
}
} }
@Override @Override
...@@ -148,6 +186,27 @@ public class BridgeObject extends CityObject { ...@@ -148,6 +186,27 @@ public class BridgeObject extends CityObject {
return true; return true;
} }
} }
if (doPartsContainAnyError()) {
return true;
}
if (elements != null) {
for (BridgeConstructiveElement ele : elements) {
if (ele.containsAnyError()) {
return true;
}
}
}
return false;
}
private boolean doPartsContainAnyError() {
if (parts != null) {
for (BridgeObject part : parts) {
if (part.containsAnyError()) {
return true;
}
}
}
return false; return false;
} }
...@@ -162,6 +221,27 @@ public class BridgeObject extends CityObject { ...@@ -162,6 +221,27 @@ public class BridgeObject extends CityObject {
return true; return true;
} }
} }
if (doPartsContainError(checkIdentifier)) {
return true;
}
if (elements != null) {
for (BridgeConstructiveElement ele : elements) {
if (ele.containsError(checkIdentifier)) {
return true;
}
}
}
return false;
}
private boolean doPartsContainError(CheckId checkIdentifier) {
if (parts != null) {
for (BridgeObject part : parts) {
if (part.containsError(checkIdentifier)) {
return true;
}
}
}
return false; return false;
} }
...@@ -174,6 +254,16 @@ public class BridgeObject extends CityObject { ...@@ -174,6 +254,16 @@ public class BridgeObject extends CityObject {
for (BoundarySurface bs : boundarySurfaces) { for (BoundarySurface bs : boundarySurfaces) {
bs.accept(c); bs.accept(c);
} }
if (parts != null) {
for (BridgeObject part : parts) {
part.accept(c);
}
}
if (elements != null) {
for (BridgeConstructiveElement ele : elements) {
ele.accept(c);
}
}
} }
/** /**
...@@ -217,6 +307,16 @@ public class BridgeObject extends CityObject { ...@@ -217,6 +307,16 @@ public class BridgeObject extends CityObject {
for (BoundarySurface bs : boundarySurfaces) { for (BoundarySurface bs : boundarySurfaces) {
bs.unsetGmlGeometries(); bs.unsetGmlGeometries();
} }
if (parts != null) {
for (BridgeObject part : parts) {
part.unsetGmlGeometries();
}
}
if (elements != null) {
for (BridgeConstructiveElement ele : elements) {
ele.unsetGmlGeometries();
}
}
} }
public void setGmlObject(AbstractBridge aBridge) { public void setGmlObject(AbstractBridge aBridge) {
...@@ -242,6 +342,16 @@ public class BridgeObject extends CityObject { ...@@ -242,6 +342,16 @@ public class BridgeObject extends CityObject {
for (BoundarySurface bs : boundarySurfaces) { for (BoundarySurface bs : boundarySurfaces) {
bs.clearMetaInformation(); bs.clearMetaInformation();
} }
if (parts != null) {
for (BridgeObject part : parts) {
part.clearMetaInformation();
}
}
if (elements != null) {
for (BridgeConstructiveElement ele : elements) {
ele.clearMetaInformation();
}
}
} }
@Override @Override
...@@ -250,6 +360,16 @@ public class BridgeObject extends CityObject { ...@@ -250,6 +360,16 @@ public class BridgeObject extends CityObject {
for (BoundarySurface bs : boundarySurfaces) { for (BoundarySurface bs : boundarySurfaces) {
handler.addInstance(bs); handler.addInstance(bs);
} }
if (parts != null) {
for (BridgeObject part : parts) {
handler.addInstance(part);
}
}
if (elements != null) {
for (BridgeConstructiveElement ele : elements) {
handler.addInstance(ele);
}
}
} }
@Override @Override
...@@ -259,6 +379,24 @@ public class BridgeObject extends CityObject { ...@@ -259,6 +379,24 @@ public class BridgeObject extends CityObject {
for (BoundarySurface originalBs : originalBo.boundarySurfaces) { for (BoundarySurface originalBs : originalBo.boundarySurfaces) {
boundarySurfaces.add(handler.getCopyInstance(originalBs)); boundarySurfaces.add(handler.getCopyInstance(originalBs));
} }
if (parts != null) {
for (BridgeObject part : parts) {
handler.addInstance(part);
}
}
if (elements != null) {
for (BridgeConstructiveElement ele : elements) {
handler.addInstance(ele);
}
}
}
public List<BoundarySurface> getBoundarySurfaces() {
return boundarySurfaces;
}
public void addConstructiveElement(BridgeConstructiveElement element) {
getConstructiveElements().add(element);
} }
@Override @Override
...@@ -274,10 +412,7 @@ public class BridgeObject extends CityObject { ...@@ -274,10 +412,7 @@ public class BridgeObject extends CityObject {
} }
public void addBridgePart(BridgeObject bPart) { public void addBridgePart(BridgeObject bPart) {
if (parts == null) { getParts().add(bPart);
parts = new ArrayList<>(2);
}
parts.add(bPart);
} }
} }
...@@ -27,6 +27,6 @@ package de.hft.stuttgart.citydoctor2.datastructure; ...@@ -27,6 +27,6 @@ package de.hft.stuttgart.citydoctor2.datastructure;
public enum FeatureType { public enum FeatureType {
BUILDING, TRANSPORTATION, VEGETATION, BRIDGE, LAND, WATER, BOUNDARY_SURFACE, BUILDING_INSTALLATION, OPENING, BUILDING, TRANSPORTATION, VEGETATION, BRIDGE, LAND, WATER, BOUNDARY_SURFACE, BUILDING_INSTALLATION, OPENING,
BUILDING_PART; BUILDING_PART, BRIDGE_CONSTRUCTION_ELEMENT;
} }
...@@ -29,6 +29,7 @@ import org.apache.logging.log4j.Logger; ...@@ -29,6 +29,7 @@ import org.apache.logging.log4j.Logger;
import org.citygml4j.core.model.CityGMLVersion; import org.citygml4j.core.model.CityGMLVersion;
import org.citygml4j.core.model.bridge.AbstractBridge; import org.citygml4j.core.model.bridge.AbstractBridge;
import org.citygml4j.core.model.bridge.Bridge; import org.citygml4j.core.model.bridge.Bridge;
import org.citygml4j.core.model.bridge.BridgeConstructiveElementProperty;
import org.citygml4j.core.model.bridge.BridgePart; import org.citygml4j.core.model.bridge.BridgePart;
import org.citygml4j.core.model.bridge.BridgePartProperty; import org.citygml4j.core.model.bridge.BridgePartProperty;
import org.citygml4j.core.model.building.BuildingInstallationProperty; import org.citygml4j.core.model.building.BuildingInstallationProperty;
...@@ -59,6 +60,7 @@ import org.citygml4j.core.model.transportation.TrafficSpace; ...@@ -59,6 +60,7 @@ import org.citygml4j.core.model.transportation.TrafficSpace;
import org.citygml4j.core.model.transportation.TrafficSpaceProperty; import org.citygml4j.core.model.transportation.TrafficSpaceProperty;
import org.citygml4j.core.model.vegetation.AbstractVegetationObject; import org.citygml4j.core.model.vegetation.AbstractVegetationObject;
import org.citygml4j.core.model.vegetation.PlantCover; import org.citygml4j.core.model.vegetation.PlantCover;
import org.citygml4j.core.model.vegetation.SolitaryVegetationObject;
import org.citygml4j.core.model.waterbody.WaterBody; import org.citygml4j.core.model.waterbody.WaterBody;
import org.citygml4j.core.visitor.ObjectWalker; import org.citygml4j.core.visitor.ObjectWalker;
import org.xmlobjects.gml.model.base.AbstractGML; import org.xmlobjects.gml.model.base.AbstractGML;
...@@ -77,6 +79,7 @@ import org.xmlobjects.gml.model.geometry.primitives.SurfaceProperty; ...@@ -77,6 +79,7 @@ import org.xmlobjects.gml.model.geometry.primitives.SurfaceProperty;
import de.hft.stuttgart.citydoctor2.datastructure.AbstractBuilding; import de.hft.stuttgart.citydoctor2.datastructure.AbstractBuilding;
import de.hft.stuttgart.citydoctor2.datastructure.BoundarySurface; import de.hft.stuttgart.citydoctor2.datastructure.BoundarySurface;
import de.hft.stuttgart.citydoctor2.datastructure.BridgeConstructiveElement;
import de.hft.stuttgart.citydoctor2.datastructure.BridgeObject; import de.hft.stuttgart.citydoctor2.datastructure.BridgeObject;
import de.hft.stuttgart.citydoctor2.datastructure.BridgeObject.BridgeType; import de.hft.stuttgart.citydoctor2.datastructure.BridgeObject.BridgeType;
import de.hft.stuttgart.citydoctor2.datastructure.Building; import de.hft.stuttgart.citydoctor2.datastructure.Building;
...@@ -140,7 +143,6 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -140,7 +143,6 @@ public class Citygml3FeatureMapper extends ObjectWalker {
} }
BuildingPart part = new BuildingPart(cdBuilding); BuildingPart part = new BuildingPart(cdBuilding);
readAbstractBuilding(bpProp.getObject(), part); readAbstractBuilding(bpProp.getObject(), part);
cdBuilding.addBuildingPart(part);
} }
model.addBuilding(cdBuilding); model.addBuilding(cdBuilding);
} }
...@@ -196,7 +198,22 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -196,7 +198,22 @@ public class Citygml3FeatureMapper extends ObjectWalker {
finishCityObjectConstruction(veg); finishCityObjectConstruction(veg);
model.addVegetation(veg); model.addVegetation(veg);
} }
@Override
public void visit(SolitaryVegetationObject solitaryVegetationObject) {
Vegetation veg = new Vegetation(VegetationType.SOLITARY_VEGETATION_OBJECT);
veg.setGmlObject(solitaryVegetationObject);
mapAbstractVegetationObject(solitaryVegetationObject, veg);
parseAndAddAbstractGeometry(solitaryVegetationObject.getDeprecatedProperties().getLod1Geometry(), Lod.LOD1, veg);
parseAndAddAbstractGeometry(solitaryVegetationObject.getDeprecatedProperties().getLod2Geometry(), Lod.LOD2, veg);
parseAndAddAbstractGeometry(solitaryVegetationObject.getDeprecatedProperties().getLod3Geometry(), Lod.LOD3, veg);
parseAndAddAbstractGeometry(solitaryVegetationObject.getDeprecatedProperties().getLod4Geometry(), Lod.LOD4, veg);
finishCityObjectConstruction(veg);
model.addVegetation(veg);
}
private void mapAbstractVegetationObject(AbstractVegetationObject avo, Vegetation veg) { private void mapAbstractVegetationObject(AbstractVegetationObject avo, Vegetation veg) {
mapAbstractOccupiedSpace(avo, veg); mapAbstractOccupiedSpace(avo, veg);
} }
...@@ -237,14 +254,61 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -237,14 +254,61 @@ public class Citygml3FeatureMapper extends ObjectWalker {
for (BridgeObject part : bo.getParts()) { for (BridgeObject part : bo.getParts()) {
updateEdgesAndVertices(part); updateEdgesAndVertices(part);
} }
for (BridgeConstructiveElement ele : bo.getConstructiveElements()) {
updateEdgesAndVertices(ele);
}
model.addBridge(bo); model.addBridge(bo);
} }
private void mapAbstractBridge(AbstractBridge ab, BridgeObject bo) { private void mapAbstractBridge(AbstractBridge ab, BridgeObject bo) {
mapAbstractConstruction(ab, bo); mapAbstractConstruction(ab, bo);
for (BridgeConstructiveElementProperty eleProp : ab.getBridgeConstructiveElements()) {
if (!eleProp.isSetObject()) {
continue;
}
org.citygml4j.core.model.bridge.BridgeConstructiveElement constructiveElement = eleProp.getObject();
BridgeConstructiveElement cdEle = new BridgeConstructiveElement(constructiveElement);
mapConstructiveElement(constructiveElement, cdEle);
bo.addConstructiveElement(cdEle);
}
SurfaceMapper surfaceMapper = new SurfaceMapper(polygonMap, references, vertexMap, config);
for (AbstractSpaceBoundaryProperty surfaceProp : ab.getBoundaries()) {
if (!surfaceProp.isSetObject()) {
continue;
}
AbstractSpaceBoundary surface = surfaceProp.getObject();
surface.accept(surfaceMapper);
}
updatePartOfSurface(bo, surfaceMapper);
for (BoundarySurface bs : bo.getBoundarySurfaces()) {
updateEdgesAndVertices(bs);
}
bo.unsetGmlGeometries(); bo.unsetGmlGeometries();
} }
private void updatePartOfSurface(BridgeObject bo, SurfaceMapper surfaceMapper) {
for (BoundarySurface bs : surfaceMapper.getSurfaces()) {
bo.addBoundarySurface(bs);
for (Geometry geom : bs.getGeometries()) {
for (Polygon p : geom.getPolygons()) {
p.setPartOfSurface(bs);
}
}
}
}
private void mapConstructiveElement(org.citygml4j.core.model.bridge.BridgeConstructiveElement ele, BridgeConstructiveElement bce) {
mapAbstractConstructiveElement(ele, bce);
}
private void mapAbstractConstructiveElement(org.citygml4j.core.model.bridge.BridgeConstructiveElement ele, BridgeConstructiveElement bce) {
mapAbstractOccupiedSpace(ele, bce);
}
private void mapAbstractConstruction(AbstractConstruction ac, BridgeObject bo) { private void mapAbstractConstruction(AbstractConstruction ac, BridgeObject bo) {
mapAbstractOccupiedSpace(ac, bo); mapAbstractOccupiedSpace(ac, bo);
} }
...@@ -464,14 +528,7 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -464,14 +528,7 @@ public class Citygml3FeatureMapper extends ObjectWalker {
AbstractSpaceBoundary surface = surfaceProp.getObject(); AbstractSpaceBoundary surface = surfaceProp.getObject();
surface.accept(surfaceMapper); surface.accept(surfaceMapper);
} }
for (BoundarySurface bs : surfaceMapper.getSurfaces()) { updatePartOfSurface(cdBuilding, surfaceMapper);
cdBuilding.addBoundarySurface(bs);
for (Geometry geom : bs.getGeometries()) {
for (Polygon p : geom.getPolygons()) {
p.setPartOfSurface(bs);
}
}
}
cdBuilding.unsetGmlGeometries(); cdBuilding.unsetGmlGeometries();
resolveAndClearReferences(); resolveAndClearReferences();
...@@ -487,6 +544,17 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -487,6 +544,17 @@ public class Citygml3FeatureMapper extends ObjectWalker {
} }
} }
private void updatePartOfSurface(AbstractBuilding cdBuilding, SurfaceMapper surfaceMapper) {
for (BoundarySurface bs : surfaceMapper.getSurfaces()) {
cdBuilding.addBoundarySurface(bs);
for (Geometry geom : bs.getGeometries()) {
for (Polygon p : geom.getPolygons()) {
p.setPartOfSurface(bs);
}
}
}
}
public static void parseId(AbstractGML gml, GmlElement gmlElement) { public static void parseId(AbstractGML gml, GmlElement gmlElement) {
String id = gml.getId(); String id = gml.getId();
if (id != null) { if (id != null) {
......
...@@ -62,7 +62,7 @@ public class QualityADEUtils { ...@@ -62,7 +62,7 @@ public class QualityADEUtils {
public static void writeQualityAde(CityObject co, Validation val) { public static void writeQualityAde(CityObject co, Validation val) {
ValidationResult res = new ValidationResult(); ValidationResult res = new ValidationResult();
res.setValidationPlanID(new Reference(val)); res.setValidationID(new Reference(val));
if (co.isValidated()) { if (co.isValidated()) {
List<CheckError> errors = new ArrayList<>(); List<CheckError> errors = new ArrayList<>();
co.collectContainedErrors(errors); co.collectContainedErrors(errors);
...@@ -128,6 +128,8 @@ public class QualityADEUtils { ...@@ -128,6 +128,8 @@ public class QualityADEUtils {
return de.hft.stuttgart.quality.model.enums.ErrorId.SE_ATTRIBUTE_WRONG_VALUE; return de.hft.stuttgart.quality.model.enums.ErrorId.SE_ATTRIBUTE_WRONG_VALUE;
case "SE_ATTRIBUTE_MISSING": case "SE_ATTRIBUTE_MISSING":
return de.hft.stuttgart.quality.model.enums.ErrorId.SE_ATTRIBUTE_MISSING; return de.hft.stuttgart.quality.model.enums.ErrorId.SE_ATTRIBUTE_MISSING;
case "SE_ATTRIBUTE_INVALID":
return de.hft.stuttgart.quality.model.enums.ErrorId.SE_ATTRIBUTE_INVALID;
default: default:
return null; return null;
} }
......
...@@ -28,6 +28,8 @@ import java.util.Set; ...@@ -28,6 +28,8 @@ import java.util.Set;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.citygml4j.core.model.CityGMLVersion; import org.citygml4j.core.model.CityGMLVersion;
import org.citygml4j.core.model.core.AbstractCityObjectProperty; import org.citygml4j.core.model.core.AbstractCityObjectProperty;
import org.citygml4j.core.model.core.AbstractFeatureProperty; import org.citygml4j.core.model.core.AbstractFeatureProperty;
...@@ -37,6 +39,7 @@ import org.citygml4j.xml.CityGMLContext; ...@@ -37,6 +39,7 @@ import org.citygml4j.xml.CityGMLContext;
import org.citygml4j.xml.writer.CityGMLOutputFactory; import org.citygml4j.xml.writer.CityGMLOutputFactory;
import org.citygml4j.xml.writer.CityGMLWriteException; import org.citygml4j.xml.writer.CityGMLWriteException;
import org.citygml4j.xml.writer.CityGMLWriter; import org.citygml4j.xml.writer.CityGMLWriter;
import org.xmlobjects.gml.model.base.Reference;
import de.hft.stuttgart.citydoctor2.check.CheckError; import de.hft.stuttgart.citydoctor2.check.CheckError;
import de.hft.stuttgart.citydoctor2.check.ErrorId; import de.hft.stuttgart.citydoctor2.check.ErrorId;
...@@ -50,13 +53,17 @@ import de.hft.stuttgart.quality.QualityADEModule; ...@@ -50,13 +53,17 @@ import de.hft.stuttgart.quality.QualityADEModule;
import de.hft.stuttgart.quality.model.properties.ErrorProperty; import de.hft.stuttgart.quality.model.properties.ErrorProperty;
import de.hft.stuttgart.quality.model.properties.FeatureStatisticsProperty; import de.hft.stuttgart.quality.model.properties.FeatureStatisticsProperty;
import de.hft.stuttgart.quality.model.properties.StatisticsProperty; import de.hft.stuttgart.quality.model.properties.StatisticsProperty;
import de.hft.stuttgart.quality.model.properties.ValidationPlanProperty;
import de.hft.stuttgart.quality.model.types.FeatureStatistics; import de.hft.stuttgart.quality.model.types.FeatureStatistics;
import de.hft.stuttgart.quality.model.types.Statistics; import de.hft.stuttgart.quality.model.types.Statistics;
import de.hft.stuttgart.quality.model.types.Validation; import de.hft.stuttgart.quality.model.types.Validation;
public class CityGMLWriterUtils { public class CityGMLWriterUtils {
private static final Logger logger = LogManager.getLogger(CityGMLWriterUtils.class);
private CityGMLWriterUtils() {
}
public static void writeCityModel(String file, CityDoctorModel model) throws CityDoctorWriteException { public static void writeCityModel(String file, CityDoctorModel model) throws CityDoctorWriteException {
CityGMLContext gmlContext = CityGmlParser.getContext(); CityGMLContext gmlContext = CityGmlParser.getContext();
CityModel cModel = model.getCityModel(); CityModel cModel = model.getCityModel();
...@@ -75,6 +82,7 @@ public class CityGMLWriterUtils { ...@@ -75,6 +82,7 @@ public class CityGMLWriterUtils {
// add to city model // add to city model
cModel.getFeatureMembers().add(new AbstractFeatureProperty(val)); cModel.getFeatureMembers().add(new AbstractFeatureProperty(val));
cModel.getFeatureMembers().add(new AbstractFeatureProperty(model.getValidationPlan()));
} }
GeometryFactory gmlFactory = GeometryFactory.newInstance(); GeometryFactory gmlFactory = GeometryFactory.newInstance();
storeCityObjects(model.getBuildings(), gmlFactory, model, cModel, val); storeCityObjects(model.getBuildings(), gmlFactory, model, cModel, val);
...@@ -113,6 +121,7 @@ public class CityGMLWriterUtils { ...@@ -113,6 +121,7 @@ public class CityGMLWriterUtils {
de.hft.stuttgart.quality.model.enums.ErrorId adeId = QualityADEUtils.mapErrorIdToAdeId(e.getKey()); de.hft.stuttgart.quality.model.enums.ErrorId adeId = QualityADEUtils.mapErrorIdToAdeId(e.getKey());
if (adeId == null) { if (adeId == null) {
// error that is not part of the ade standard // error that is not part of the ade standard
logger.warn("Found error {} that cannot be converted to ADE error. It will not be written", e.getKey().toString());
continue; continue;
} }
stats.setName(adeId); stats.setName(adeId);
...@@ -125,7 +134,7 @@ public class CityGMLWriterUtils { ...@@ -125,7 +134,7 @@ public class CityGMLWriterUtils {
statistics.setNumErrorVegetation(new FeatureStatisticsProperty(countValidatedCityObjects(model.getVegetation()))); statistics.setNumErrorVegetation(new FeatureStatisticsProperty(countValidatedCityObjects(model.getVegetation())));
statistics.setNumErrorWaterObjects(new FeatureStatisticsProperty(countValidatedCityObjects(model.getWater()))); statistics.setNumErrorWaterObjects(new FeatureStatisticsProperty(countValidatedCityObjects(model.getWater())));
val.setStatistics(new StatisticsProperty(statistics)); val.setStatistics(new StatisticsProperty(statistics));
val.setValidationPlan(new ValidationPlanProperty(model.getValidationPlan())); val.setValidationPlan(new Reference(model.getValidationPlan()));
return val; return val;
} }
......
...@@ -184,16 +184,16 @@ public class CheckTest { ...@@ -184,16 +184,16 @@ public class CheckTest {
}; };
Building b = new Building(); Building b = new Building();
assertTrue(c2.canExecute(b)); assertTrue(c2.canExecute(b));
b.addCheckResult(new CheckResult(CheckId.C_GE_P_HOLE_OUTSIDE, ResultStatus.ERROR, b.addCheckResult(new CheckResult(CheckId.C_GE_P_HOLE_OUTSIDE, ResultStatus.ERROR,
new AttributeMissingError(b, null, null, false))); new AttributeMissingError(b, null, null)));
assertEquals(1, b.getAllCheckResults().size()); assertEquals(1, b.getAllCheckResults().size());
assertTrue(b.getAllCheckResults().containsKey(CheckId.C_GE_P_HOLE_OUTSIDE)); assertTrue(b.getAllCheckResults().containsKey(CheckId.C_GE_P_HOLE_OUTSIDE));
assertFalse(c2.canExecute(b)); assertFalse(c2.canExecute(b));
assertEquals(2, b.getAllCheckResults().size()); assertEquals(2, b.getAllCheckResults().size());
assertTrue(b.getAllCheckResults().containsKey(CheckId.C_GE_P_INNER_RINGS_NESTED)); assertTrue(b.getAllCheckResults().containsKey(CheckId.C_GE_P_INNER_RINGS_NESTED));
assertFalse(c2.canExecute(b)); assertFalse(c2.canExecute(b));
Vegetation veg = new Vegetation(VegetationType.PLANT_COVER); Vegetation veg = new Vegetation(VegetationType.PLANT_COVER);
assertFalse(c2.canExecute(veg)); assertFalse(c2.canExecute(veg));
} }
......
...@@ -109,14 +109,14 @@ public class CheckableTest { ...@@ -109,14 +109,14 @@ public class CheckableTest {
assertFalse(b.containsError(CheckId.C_GE_P_HOLE_OUTSIDE)); assertFalse(b.containsError(CheckId.C_GE_P_HOLE_OUTSIDE));
assertFalse(b.containsAnyError()); assertFalse(b.containsAnyError());
geom.addCheckResult(new CheckResult(CheckId.C_GE_P_HOLE_OUTSIDE, ResultStatus.ERROR, geom.addCheckResult(new CheckResult(CheckId.C_GE_P_HOLE_OUTSIDE, ResultStatus.ERROR,
new SchematronError(null, null, null, null, false))); new SchematronError(null, null, null, null)));
assertTrue(b.containsAnyError()); assertTrue(b.containsAnyError());
assertTrue(b.containsError(CheckId.C_GE_P_HOLE_OUTSIDE)); assertTrue(b.containsError(CheckId.C_GE_P_HOLE_OUTSIDE));
geom.addCheckResult(new CheckResult(CheckId.C_GE_P_INNER_RINGS_NESTED, ResultStatus.DEPENDENCIES_NOT_MET, geom.addCheckResult(new CheckResult(CheckId.C_GE_P_INNER_RINGS_NESTED, ResultStatus.DEPENDENCIES_NOT_MET,
new SchematronError(null, null, null, null, false))); new SchematronError(null, null, null, null)));
assertTrue(b.containsError(CheckId.C_GE_P_INNER_RINGS_NESTED)); assertTrue(b.containsError(CheckId.C_GE_P_INNER_RINGS_NESTED));
geom.addCheckResult(new CheckResult(CheckId.C_GE_P_INTERIOR_DISCONNECTED, ResultStatus.OK, geom.addCheckResult(new CheckResult(CheckId.C_GE_P_INTERIOR_DISCONNECTED, ResultStatus.OK,
new SchematronError(null, null, null, null, false))); new SchematronError(null, null, null, null)));
assertFalse(b.containsError(CheckId.C_GE_P_INTERIOR_DISCONNECTED)); assertFalse(b.containsError(CheckId.C_GE_P_INTERIOR_DISCONNECTED));
} }
...@@ -131,7 +131,7 @@ public class CheckableTest { ...@@ -131,7 +131,7 @@ public class CheckableTest {
public void testContainsAnyErrorError() { public void testContainsAnyErrorError() {
Building b = new Building(); Building b = new Building();
b.addCheckResult(new CheckResult(CheckId.C_GE_P_HOLE_OUTSIDE, ResultStatus.ERROR, b.addCheckResult(new CheckResult(CheckId.C_GE_P_HOLE_OUTSIDE, ResultStatus.ERROR,
new SchematronError(null, null, null, null, false))); new SchematronError(null, null, null, null)));
assertTrue(b.containsAnyError()); assertTrue(b.containsAnyError());
} }
...@@ -139,7 +139,7 @@ public class CheckableTest { ...@@ -139,7 +139,7 @@ public class CheckableTest {
public void testContainsAnyErrorDependencyNotMetError() { public void testContainsAnyErrorDependencyNotMetError() {
Building b = new Building(); Building b = new Building();
b.addCheckResult(new CheckResult(CheckId.C_GE_P_HOLE_OUTSIDE, ResultStatus.DEPENDENCIES_NOT_MET, b.addCheckResult(new CheckResult(CheckId.C_GE_P_HOLE_OUTSIDE, ResultStatus.DEPENDENCIES_NOT_MET,
new SchematronError(null, null, null, null, false))); new SchematronError(null, null, null, null)));
assertTrue(b.containsAnyError()); assertTrue(b.containsAnyError());
} }
...@@ -155,7 +155,7 @@ public class CheckableTest { ...@@ -155,7 +155,7 @@ public class CheckableTest {
public void hasDependencyNotMetErrorError() { public void hasDependencyNotMetErrorError() {
Building b = new Building(); Building b = new Building();
b.addCheckResult(new CheckResult(CheckId.C_GE_P_HOLE_OUTSIDE, ResultStatus.ERROR, b.addCheckResult(new CheckResult(CheckId.C_GE_P_HOLE_OUTSIDE, ResultStatus.ERROR,
new SchematronError(null, null, null, null, false))); new SchematronError(null, null, null, null)));
assertFalse(b.hasDependencyNotMetError(CheckId.C_GE_P_HOLE_OUTSIDE)); assertFalse(b.hasDependencyNotMetError(CheckId.C_GE_P_HOLE_OUTSIDE));
} }
...@@ -165,11 +165,11 @@ public class CheckableTest { ...@@ -165,11 +165,11 @@ public class CheckableTest {
Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD0); Geometry geom = new Geometry(GeometryType.SOLID, Lod.LOD0);
b.addGeometry(geom); b.addGeometry(geom);
b.addCheckResult(new CheckResult(CheckId.C_GE_P_HOLE_OUTSIDE, ResultStatus.ERROR, b.addCheckResult(new CheckResult(CheckId.C_GE_P_HOLE_OUTSIDE, ResultStatus.ERROR,
new SchematronError(null, null, null, null, false))); new SchematronError(null, null, null, null)));
geom.addCheckResult(new CheckResult(CheckId.C_GE_P_INNER_RINGS_NESTED, ResultStatus.DEPENDENCIES_NOT_MET, geom.addCheckResult(new CheckResult(CheckId.C_GE_P_INNER_RINGS_NESTED, ResultStatus.DEPENDENCIES_NOT_MET,
new SchematronError(null, null, null, null, false))); new SchematronError(null, null, null, null)));
geom.addCheckResult(new CheckResult(CheckId.C_GE_P_INTERIOR_DISCONNECTED, ResultStatus.ERROR, geom.addCheckResult(new CheckResult(CheckId.C_GE_P_INTERIOR_DISCONNECTED, ResultStatus.ERROR,
new SchematronError(null, null, null, null, false))); new SchematronError(null, null, null, null)));
List<CheckError> errors = new ArrayList<>(); List<CheckError> errors = new ArrayList<>();
b.collectContainedErrors(errors); b.collectContainedErrors(errors);
assertEquals(2, errors.size()); assertEquals(2, errors.size());
......
/*-
* Copyright 2022 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CityDoctor2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package de.hft.stuttgart.citydoctor2.check.error;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.util.List;
import org.junit.Test;
import de.hft.stuttgart.citydoctor2.check.QualityAdeErrorVisitor;
import de.hft.stuttgart.citydoctor2.datastructure.Building;
import de.hft.stuttgart.citydoctor2.datastructure.GmlId;
import de.hft.stuttgart.quality.model.properties.AbstractErrorProperty;
import de.hft.stuttgart.quality.model.types.AbstractError;
import de.hft.stuttgart.quality.model.types.SemanticAttributeInvalidError;
import de.hft.stuttgart.quality.model.types.ValidationResult;
public class AttributeInvalidErrorTest {
@Test
public void testConvertToQualityAdeDatastructure() {
Building b = new Building();
GmlId id = new GmlId("testid");
b.setGmlId(id);
AttributeInvalidError err = new AttributeInvalidError(b, "childid", "attr");
ValidationResult result = new ValidationResult();
QualityAdeErrorVisitor visitor = new QualityAdeErrorVisitor(result);
err.accept(visitor);
List<AbstractErrorProperty> errors = result.getErrors();
assertEquals(1, errors.size());
AbstractError validationError = errors.get(0).getObject();
assertTrue(validationError instanceof SemanticAttributeInvalidError);
SemanticAttributeInvalidError adeErr = (SemanticAttributeInvalidError) validationError;
assertEquals("childid", adeErr.getChildId());
assertEquals("attr", adeErr.getAttributeName());
}
}
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
package de.hft.stuttgart.citydoctor2.check.error; package de.hft.stuttgart.citydoctor2.check.error;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import java.util.List; import java.util.List;
...@@ -41,7 +40,7 @@ public class AttributeMissingErrorTest { ...@@ -41,7 +40,7 @@ public class AttributeMissingErrorTest {
Building b = new Building(); Building b = new Building();
GmlId id = new GmlId("testid"); GmlId id = new GmlId("testid");
b.setGmlId(id); b.setGmlId(id);
AttributeMissingError err = new AttributeMissingError(b, "childid", "attr", false); AttributeMissingError err = new AttributeMissingError(b, "childid", "attr");
ValidationResult result = new ValidationResult(); ValidationResult result = new ValidationResult();
QualityAdeErrorVisitor visitor = new QualityAdeErrorVisitor(result); QualityAdeErrorVisitor visitor = new QualityAdeErrorVisitor(result);
...@@ -54,7 +53,6 @@ public class AttributeMissingErrorTest { ...@@ -54,7 +53,6 @@ public class AttributeMissingErrorTest {
SemanticAttributeMissingError adeErr = (SemanticAttributeMissingError) validationError; SemanticAttributeMissingError adeErr = (SemanticAttributeMissingError) validationError;
assertEquals("childid", adeErr.getChildId()); assertEquals("childid", adeErr.getChildId());
assertEquals("attr", adeErr.getAttributeName()); assertEquals("attr", adeErr.getAttributeName());
assertFalse(adeErr.isGeneric());
} }
} }
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
package de.hft.stuttgart.citydoctor2.check.error; package de.hft.stuttgart.citydoctor2.check.error;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import java.util.List; import java.util.List;
...@@ -41,7 +40,7 @@ public class AttributeValueWrongErrorTest { ...@@ -41,7 +40,7 @@ public class AttributeValueWrongErrorTest {
Building b = new Building(); Building b = new Building();
GmlId id = new GmlId("testid"); GmlId id = new GmlId("testid");
b.setGmlId(id); b.setGmlId(id);
AttributeValueWrongError err = new AttributeValueWrongError(b, "childid", "attr", false); AttributeValueWrongError err = new AttributeValueWrongError(b, "childid", "attr");
ValidationResult result = new ValidationResult(); ValidationResult result = new ValidationResult();
QualityAdeErrorVisitor visitor = new QualityAdeErrorVisitor(result); QualityAdeErrorVisitor visitor = new QualityAdeErrorVisitor(result);
...@@ -54,7 +53,6 @@ public class AttributeValueWrongErrorTest { ...@@ -54,7 +53,6 @@ public class AttributeValueWrongErrorTest {
SemanticAttributeWrongValueError adeErr = (SemanticAttributeWrongValueError) validationError; SemanticAttributeWrongValueError adeErr = (SemanticAttributeWrongValueError) validationError;
assertEquals("childid", adeErr.getChildId()); assertEquals("childid", adeErr.getChildId());
assertEquals("attr", adeErr.getAttributeName()); assertEquals("attr", adeErr.getAttributeName());
assertFalse(adeErr.isGeneric());
} }
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment