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

Merge branch 'dev'

parents 7ebb95c1 fcafb694
Pipeline #7620 passed with stage
in 54 seconds
<project xmlns="http://maven.apache.org/POM/4.0.0" <?xml version="1.0" encoding="utf-8"?>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<groupId>de.hft.stuttgart</groupId> <groupId>de.hft.stuttgart</groupId>
<artifactId>CityDoctorParent</artifactId> <artifactId>CityDoctorParent</artifactId>
<version>3.13.0</version> <version>3.13.1</version>
</parent> </parent>
<artifactId>CityDoctorCheckResult</artifactId> <artifactId>CityDoctorCheckResult</artifactId>
<dependencies> <dependencies>
<!-- https://mvnrepository.com/artifact/junit/junit -->
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
<artifactId>junit</artifactId> <artifactId>junit</artifactId>
......
<project xmlns="http://maven.apache.org/POM/4.0.0" <?xml version="1.0" encoding="utf-8"?>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<groupId>de.hft.stuttgart</groupId> <groupId>de.hft.stuttgart</groupId>
<artifactId>CityDoctorParent</artifactId> <artifactId>CityDoctorParent</artifactId>
<version>3.13.0</version> <version>3.13.1</version>
</parent> </parent>
<artifactId>CityDoctorEdge</artifactId> <artifactId>CityDoctorEdge</artifactId>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.apache.logging.log4j</groupId> <groupId>org.apache.logging.log4j</groupId>
...@@ -29,7 +27,6 @@ ...@@ -29,7 +27,6 @@
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
......
<?xml version="1.0" encoding="utf-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<groupId>de.hft.stuttgart</groupId> <groupId>de.hft.stuttgart</groupId>
<artifactId>CityDoctorParent</artifactId> <artifactId>CityDoctorParent</artifactId>
<version>3.13.0</version> <version>3.13.1</version>
</parent> </parent>
<properties> <properties>
<versionString>${project.version}-${git.commit.id.abbrev}</versionString> <versionString>${project.version}-${git.commit.id.abbrev}</versionString>
</properties> </properties>
<artifactId>CityDoctorModel</artifactId> <artifactId>CityDoctorModel</artifactId>
<name>CityDoctorModel</name> <name>CityDoctorModel</name>
<dependencies> <dependencies>
...@@ -60,7 +59,6 @@ ...@@ -60,7 +59,6 @@
<artifactId>proj4j</artifactId> <artifactId>proj4j</artifactId>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>
<resources> <resources>
<resource> <resource>
......
...@@ -30,7 +30,7 @@ import de.hft.stuttgart.citydoctor2.datastructure.AbstractBuilding; ...@@ -30,7 +30,7 @@ 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.BridgeObject; import de.hft.stuttgart.citydoctor2.datastructure.BridgeObject;
import de.hft.stuttgart.citydoctor2.datastructure.Building; import de.hft.stuttgart.citydoctor2.datastructure.Building;
import de.hft.stuttgart.citydoctor2.datastructure.BuildingInstallation; import de.hft.stuttgart.citydoctor2.datastructure.Installation;
import de.hft.stuttgart.citydoctor2.datastructure.BuildingPart; import de.hft.stuttgart.citydoctor2.datastructure.BuildingPart;
import de.hft.stuttgart.citydoctor2.datastructure.CityObject; import de.hft.stuttgart.citydoctor2.datastructure.CityObject;
import de.hft.stuttgart.citydoctor2.datastructure.Geometry; import de.hft.stuttgart.citydoctor2.datastructure.Geometry;
...@@ -211,7 +211,7 @@ public abstract class Check { ...@@ -211,7 +211,7 @@ public abstract class Check {
* *
* @param bi a building installation * @param bi a building installation
*/ */
public void check(BuildingInstallation bi) { public void check(Installation bi) {
} }
......
...@@ -51,7 +51,7 @@ public abstract class AbstractBuilding extends CityObject { ...@@ -51,7 +51,7 @@ public abstract class AbstractBuilding extends CityObject {
private static final Logger logger = LogManager.getLogger(AbstractBuilding.class); private static final Logger logger = LogManager.getLogger(AbstractBuilding.class);
private List<BuildingInstallation> buildingInstallations = new ArrayList<>(2); private List<Installation> buildingInstallations = new ArrayList<>(2);
private List<BoundarySurface> boundarySurfaceList = new ArrayList<>(); private List<BoundarySurface> boundarySurfaceList = new ArrayList<>();
private org.citygml4j.core.model.building.AbstractBuilding ab; private org.citygml4j.core.model.building.AbstractBuilding ab;
...@@ -89,7 +89,7 @@ public abstract class AbstractBuilding extends CityObject { ...@@ -89,7 +89,7 @@ public abstract class AbstractBuilding extends CityObject {
for (BoundarySurface bs : boundarySurfaceList) { for (BoundarySurface bs : boundarySurfaceList) {
bs.unsetGmlGeometries(); bs.unsetGmlGeometries();
} }
for (BuildingInstallation bi : buildingInstallations) { for (Installation bi : buildingInstallations) {
bi.unsetGmlGeometries(); bi.unsetGmlGeometries();
} }
} }
...@@ -108,7 +108,7 @@ public abstract class AbstractBuilding extends CityObject { ...@@ -108,7 +108,7 @@ public abstract class AbstractBuilding extends CityObject {
for (BoundarySurface bs : boundarySurfaceList) { for (BoundarySurface bs : boundarySurfaceList) {
reCreateBoundarySurface(factory, config, bs); reCreateBoundarySurface(factory, config, bs);
} }
for (BuildingInstallation bi : buildingInstallations) { for (Installation bi : buildingInstallations) {
bi.reCreateGeometries(factory, config); bi.reCreateGeometries(factory, config);
} }
} }
...@@ -174,7 +174,7 @@ public abstract class AbstractBuilding extends CityObject { ...@@ -174,7 +174,7 @@ public abstract class AbstractBuilding extends CityObject {
if (c.canExecute(this)) { if (c.canExecute(this)) {
c.check(this); c.check(this);
} }
for (BuildingInstallation bi : buildingInstallations) { for (Installation bi : buildingInstallations) {
bi.accept(c); bi.accept(c);
} }
for (BoundarySurface bs : boundarySurfaceList) { for (BoundarySurface bs : boundarySurfaceList) {
...@@ -185,7 +185,7 @@ public abstract class AbstractBuilding extends CityObject { ...@@ -185,7 +185,7 @@ public abstract class AbstractBuilding extends CityObject {
@Override @Override
public void collectContainedErrors(List<CheckError> errors) { public void collectContainedErrors(List<CheckError> errors) {
super.collectContainedErrors(errors); super.collectContainedErrors(errors);
for (BuildingInstallation bi : buildingInstallations) { for (Installation bi : buildingInstallations) {
bi.collectContainedErrors(errors); bi.collectContainedErrors(errors);
} }
for (BoundarySurface bs : boundarySurfaceList) { for (BoundarySurface bs : boundarySurfaceList) {
...@@ -196,7 +196,7 @@ public abstract class AbstractBuilding extends CityObject { ...@@ -196,7 +196,7 @@ public abstract class AbstractBuilding extends CityObject {
@Override @Override
public void clearAllContainedCheckResults() { public void clearAllContainedCheckResults() {
super.clearAllContainedCheckResults(); super.clearAllContainedCheckResults();
for (BuildingInstallation bi : buildingInstallations) { for (Installation bi : buildingInstallations) {
bi.clearAllContainedCheckResults(); bi.clearAllContainedCheckResults();
} }
for (BoundarySurface bs : boundarySurfaceList) { for (BoundarySurface bs : boundarySurfaceList) {
...@@ -210,7 +210,7 @@ public abstract class AbstractBuilding extends CityObject { ...@@ -210,7 +210,7 @@ public abstract class AbstractBuilding extends CityObject {
if (hasError) { if (hasError) {
return true; return true;
} }
for (BuildingInstallation bi : buildingInstallations) { for (Installation bi : buildingInstallations) {
if (bi.containsError(checkIdentifier)) { if (bi.containsError(checkIdentifier)) {
return true; return true;
} }
...@@ -229,7 +229,7 @@ public abstract class AbstractBuilding extends CityObject { ...@@ -229,7 +229,7 @@ public abstract class AbstractBuilding extends CityObject {
if (hasError) { if (hasError) {
return true; return true;
} }
for (BuildingInstallation bi : buildingInstallations) { for (Installation bi : buildingInstallations) {
if (bi.containsAnyError()) { if (bi.containsAnyError()) {
return true; return true;
} }
...@@ -251,7 +251,7 @@ public abstract class AbstractBuilding extends CityObject { ...@@ -251,7 +251,7 @@ public abstract class AbstractBuilding extends CityObject {
bs.setParent(this); bs.setParent(this);
} }
public void addBuildingInstallation(BuildingInstallation coBi) { public void addBuildingInstallation(Installation coBi) {
buildingInstallations.add(coBi); buildingInstallations.add(coBi);
coBi.setParent(this); coBi.setParent(this);
} }
...@@ -260,14 +260,14 @@ public abstract class AbstractBuilding extends CityObject { ...@@ -260,14 +260,14 @@ public abstract class AbstractBuilding extends CityObject {
this.ab = ab; this.ab = ab;
} }
public List<BuildingInstallation> getBuildingInstallations() { public List<Installation> getBuildingInstallations() {
return buildingInstallations; return buildingInstallations;
} }
@Override @Override
public void prepareForChecking() { public void prepareForChecking() {
super.prepareForChecking(); super.prepareForChecking();
for (BuildingInstallation bi : buildingInstallations) { for (Installation bi : buildingInstallations) {
bi.prepareForChecking(); bi.prepareForChecking();
} }
for (BoundarySurface bs : boundarySurfaceList) { for (BoundarySurface bs : boundarySurfaceList) {
...@@ -278,7 +278,7 @@ public abstract class AbstractBuilding extends CityObject { ...@@ -278,7 +278,7 @@ public abstract class AbstractBuilding extends CityObject {
@Override @Override
public void clearMetaInformation() { public void clearMetaInformation() {
super.clearMetaInformation(); super.clearMetaInformation();
for (BuildingInstallation bi : buildingInstallations) { for (Installation bi : buildingInstallations) {
bi.clearMetaInformation(); bi.clearMetaInformation();
} }
for (BoundarySurface bs : boundarySurfaceList) { for (BoundarySurface bs : boundarySurfaceList) {
...@@ -300,7 +300,7 @@ public abstract class AbstractBuilding extends CityObject { ...@@ -300,7 +300,7 @@ public abstract class AbstractBuilding extends CityObject {
for (BoundarySurface originalBs : originalAb.boundarySurfaceList) { for (BoundarySurface originalBs : originalAb.boundarySurfaceList) {
boundarySurfaceList.add(handler.getCopyInstance(originalBs)); boundarySurfaceList.add(handler.getCopyInstance(originalBs));
} }
for (BuildingInstallation originalBi : originalAb.buildingInstallations) { for (Installation originalBi : originalAb.buildingInstallations) {
buildingInstallations.add(handler.getCopyInstance(originalBi)); buildingInstallations.add(handler.getCopyInstance(originalBi));
} }
ab = originalAb.ab; ab = originalAb.ab;
......
...@@ -18,6 +18,12 @@ ...@@ -18,6 +18,12 @@
*/ */
package de.hft.stuttgart.citydoctor2.datastructure; package de.hft.stuttgart.citydoctor2.datastructure;
import java.util.ArrayList;
import java.util.List;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.citygml4j.core.model.core.AbstractSpaceBoundaryProperty;
import org.citygml4j.core.model.deprecated.bridge.DeprecatedPropertiesOfBridgeConstructiveElement; import org.citygml4j.core.model.deprecated.bridge.DeprecatedPropertiesOfBridgeConstructiveElement;
import org.citygml4j.core.util.geometry.GeometryFactory; import org.citygml4j.core.util.geometry.GeometryFactory;
import org.xmlobjects.gml.model.geometry.GeometryProperty; import org.xmlobjects.gml.model.geometry.GeometryProperty;
...@@ -27,17 +33,25 @@ import org.xmlobjects.gml.model.geometry.complexes.CompositeSurface; ...@@ -27,17 +33,25 @@ import org.xmlobjects.gml.model.geometry.complexes.CompositeSurface;
import org.xmlobjects.gml.model.geometry.primitives.Solid; import org.xmlobjects.gml.model.geometry.primitives.Solid;
import org.xmlobjects.gml.model.geometry.primitives.SolidProperty; import org.xmlobjects.gml.model.geometry.primitives.SolidProperty;
import de.hft.stuttgart.citydoctor2.check.Check;
import de.hft.stuttgart.citydoctor2.check.CheckError;
import de.hft.stuttgart.citydoctor2.check.CheckId;
import de.hft.stuttgart.citydoctor2.parser.ParserConfiguration; import de.hft.stuttgart.citydoctor2.parser.ParserConfiguration;
import de.hft.stuttgart.citydoctor2.utils.CityGmlUtils; import de.hft.stuttgart.citydoctor2.utils.CityGmlUtils;
import de.hft.stuttgart.citydoctor2.utils.CopyHandler;
import de.hft.stuttgart.citydoctor2.utils.Copyable; import de.hft.stuttgart.citydoctor2.utils.Copyable;
public class BridgeConstructiveElement extends CityObject { public class BridgeConstructiveElement extends CityObject {
private static final Logger logger = LogManager.getLogger(BridgeConstructiveElement.class);
private static final String CANNOT_ADD = "Cannot add "; private static final String CANNOT_ADD = "Cannot add ";
private static final long serialVersionUID = 7353233899458901155L; private static final long serialVersionUID = 7353233899458901155L;
private org.citygml4j.core.model.bridge.BridgeConstructiveElement gmlBridgeElement; private org.citygml4j.core.model.bridge.BridgeConstructiveElement gmlBridgeElement;
private List<BoundarySurface> boundarySurfaceList = new ArrayList<>();
public BridgeConstructiveElement(org.citygml4j.core.model.bridge.BridgeConstructiveElement gmlObject) { public BridgeConstructiveElement(org.citygml4j.core.model.bridge.BridgeConstructiveElement gmlObject) {
this.gmlBridgeElement = gmlObject; this.gmlBridgeElement = gmlObject;
...@@ -69,6 +83,78 @@ public class BridgeConstructiveElement extends CityObject { ...@@ -69,6 +83,78 @@ public class BridgeConstructiveElement extends CityObject {
break; break;
} }
} }
for (BoundarySurface bs : boundarySurfaceList) {
reCreateBoundarySurface(factory, config, bs);
}
}
@Override
public void accept(Check c) {
super.accept(c);
if (c.canExecute(this)) {
c.check(this);
}
for (BoundarySurface bs : boundarySurfaceList) {
bs.accept(c);
}
}
@Override
public void collectContainedErrors(List<CheckError> errors) {
super.collectContainedErrors(errors);
for (BoundarySurface bs : boundarySurfaceList) {
bs.collectContainedErrors(errors);
}
}
@Override
public void clearAllContainedCheckResults() {
super.clearAllContainedCheckResults();
for (BoundarySurface bs : boundarySurfaceList) {
bs.clearAllContainedCheckResults();
}
}
@Override
public boolean containsError(CheckId checkIdentifier) {
boolean hasError = super.containsError(checkIdentifier);
if (hasError) {
return true;
}
for (BoundarySurface bs : boundarySurfaceList) {
if (bs.containsError(checkIdentifier)) {
return true;
}
}
return false;
}
@Override
public boolean containsAnyError() {
boolean hasError = super.containsAnyError();
if (hasError) {
return true;
}
for (BoundarySurface bs : boundarySurfaceList) {
if (bs.containsAnyError()) {
return true;
}
}
return false;
}
private void reCreateBoundarySurface(GeometryFactory factory, ParserConfiguration config, BoundarySurface bs) {
if (bs.getGeometries().isEmpty()) {
for (AbstractSpaceBoundaryProperty bsp : gmlBridgeElement.getBoundaries()) {
if (bsp.getObject() != null && bsp.getObject() == bs.getGmlObject()) {
logger.warn("Found empty boundary surface: {}, removing from BridgeConstructiveElement", bs.getGmlId());
gmlBridgeElement.getBoundaries().remove(bsp);
break;
}
}
return;
}
bs.reCreateGeometries(factory, config);
} }
private void setCompositeSurfaceAccordingToLod(Geometry geom, CompositeSurface cs) { private void setCompositeSurfaceAccordingToLod(Geometry geom, CompositeSurface cs) {
...@@ -149,6 +235,9 @@ public class BridgeConstructiveElement extends CityObject { ...@@ -149,6 +235,9 @@ public class BridgeConstructiveElement extends CityObject {
gmlBridgeElement.setLod1Solid(null); gmlBridgeElement.setLod1Solid(null);
gmlBridgeElement.setLod2Solid(null); gmlBridgeElement.setLod2Solid(null);
gmlBridgeElement.setLod3Solid(null); gmlBridgeElement.setLod3Solid(null);
for (BoundarySurface bs : boundarySurfaceList) {
bs.unsetGmlGeometries();
}
} }
@Override @Override
...@@ -156,4 +245,44 @@ public class BridgeConstructiveElement extends CityObject { ...@@ -156,4 +245,44 @@ public class BridgeConstructiveElement extends CityObject {
return FeatureType.BRIDGE_CONSTRUCTION_ELEMENT; return FeatureType.BRIDGE_CONSTRUCTION_ELEMENT;
} }
public void addBoundarySurface(BoundarySurface bs) {
boundarySurfaceList.add(bs);
bs.setParent(this);
}
public List<BoundarySurface> getBoundarySurfaces() {
return boundarySurfaceList;
}
@Override
public void prepareForChecking() {
super.prepareForChecking();
for (BoundarySurface bs : boundarySurfaceList) {
bs.prepareForChecking();
}
}
@Override
public void clearMetaInformation() {
super.clearMetaInformation();
for (BoundarySurface bs : boundarySurfaceList) {
bs.clearMetaInformation();
}
}
@Override
public void collectInstances(CopyHandler handler) {
super.collectInstances(handler);
handler.addInstance(boundarySurfaceList);
}
@Override
public void fillValues(Copyable original, CopyHandler handler) {
super.fillValues(original, handler);
BridgeConstructiveElement originalBce = (BridgeConstructiveElement) original;
for (BoundarySurface originalBs : originalBce.boundarySurfaceList) {
boundarySurfaceList.add(handler.getCopyInstance(originalBs));
}
}
} }
...@@ -22,6 +22,9 @@ import java.util.ArrayList; ...@@ -22,6 +22,9 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.citygml4j.core.model.bridge.AbstractBridge; import org.citygml4j.core.model.bridge.AbstractBridge;
import org.citygml4j.core.model.bridge.BridgeInstallation;
import org.citygml4j.core.model.bridge.BridgeInstallationProperty;
import org.citygml4j.core.model.core.AbstractSpaceBoundaryProperty;
import org.citygml4j.core.util.geometry.GeometryFactory; import org.citygml4j.core.util.geometry.GeometryFactory;
import org.xmlobjects.gml.model.geometry.aggregates.MultiSurface; import org.xmlobjects.gml.model.geometry.aggregates.MultiSurface;
import org.xmlobjects.gml.model.geometry.aggregates.MultiSurfaceProperty; import org.xmlobjects.gml.model.geometry.aggregates.MultiSurfaceProperty;
...@@ -54,9 +57,10 @@ public class BridgeObject extends CityObject { ...@@ -54,9 +57,10 @@ 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<BridgeConstructiveElement> elements = null;
private List<BoundarySurface> boundarySurfaces = new ArrayList<>(2); private List<BoundarySurface> boundarySurfaces = new ArrayList<>(2);
private List<Installation> bridgeInstallations = new ArrayList<>(2);
public BridgeObject(BridgeType type, AbstractBridge ab) { public BridgeObject(BridgeType type, AbstractBridge ab) {
this.ab = ab; this.ab = ab;
...@@ -74,6 +78,10 @@ public class BridgeObject extends CityObject { ...@@ -74,6 +78,10 @@ public class BridgeObject extends CityObject {
} }
return elements; return elements;
} }
public List<Installation> getBridgeInstallations() {
return bridgeInstallations;
}
@Override @Override
public void reCreateGeometries(GeometryFactory factory, ParserConfiguration config) { public void reCreateGeometries(GeometryFactory factory, ParserConfiguration config) {
...@@ -89,6 +97,9 @@ public class BridgeObject extends CityObject { ...@@ -89,6 +97,9 @@ public class BridgeObject extends CityObject {
for (BoundarySurface bs : boundarySurfaces) { for (BoundarySurface bs : boundarySurfaces) {
bs.reCreateGeometries(factory, config); bs.reCreateGeometries(factory, config);
} }
for (Installation bi : bridgeInstallations) {
bi.reCreateGeometries(factory, config);
}
if (parts != null) { if (parts != null) {
for (BridgeObject part : parts) { for (BridgeObject part : parts) {
part.reCreateGeometries(factory, config); part.reCreateGeometries(factory, config);
...@@ -138,6 +149,11 @@ public class BridgeObject extends CityObject { ...@@ -138,6 +149,11 @@ public class BridgeObject extends CityObject {
throw new IllegalStateException("Cannot add " + geom.getLod() + " solid to bridges"); throw new IllegalStateException("Cannot add " + geom.getLod() + " solid to bridges");
} }
} }
public void addBridgeInstallation(Installation coBi) {
bridgeInstallations.add(coBi);
coBi.setParent(this);
}
@Override @Override
public void clearAllContainedCheckResults() { public void clearAllContainedCheckResults() {
...@@ -145,6 +161,9 @@ public class BridgeObject extends CityObject { ...@@ -145,6 +161,9 @@ public class BridgeObject extends CityObject {
for (BoundarySurface bs : boundarySurfaces) { for (BoundarySurface bs : boundarySurfaces) {
bs.clearAllContainedCheckResults(); bs.clearAllContainedCheckResults();
} }
for (Installation bi : bridgeInstallations) {
bi.clearAllContainedCheckResults();
}
if (parts != null) { if (parts != null) {
for (BridgeObject part : parts) { for (BridgeObject part : parts) {
part.clearAllContainedCheckResults(); part.clearAllContainedCheckResults();
...@@ -163,6 +182,9 @@ public class BridgeObject extends CityObject { ...@@ -163,6 +182,9 @@ public class BridgeObject extends CityObject {
for (BoundarySurface bs : boundarySurfaces) { for (BoundarySurface bs : boundarySurfaces) {
bs.collectContainedErrors(errors); bs.collectContainedErrors(errors);
} }
for (Installation bi : bridgeInstallations) {
bi.collectContainedErrors(errors);
}
if (parts != null) { if (parts != null) {
for (BridgeObject part : parts) { for (BridgeObject part : parts) {
part.collectContainedErrors(errors); part.collectContainedErrors(errors);
...@@ -181,6 +203,11 @@ public class BridgeObject extends CityObject { ...@@ -181,6 +203,11 @@ public class BridgeObject extends CityObject {
if (hasError) { if (hasError) {
return true; return true;
} }
for (Installation bi : bridgeInstallations) {
if (bi.containsAnyError()) {
return true;
}
}
for (BoundarySurface bs : boundarySurfaces) { for (BoundarySurface bs : boundarySurfaces) {
if (bs.containsAnyError()) { if (bs.containsAnyError()) {
return true; return true;
...@@ -216,6 +243,11 @@ public class BridgeObject extends CityObject { ...@@ -216,6 +243,11 @@ public class BridgeObject extends CityObject {
if (hasError) { if (hasError) {
return true; return true;
} }
for (Installation bi : bridgeInstallations) {
if (bi.containsError(checkIdentifier)) {
return true;
}
}
for (BoundarySurface bs : boundarySurfaces) { for (BoundarySurface bs : boundarySurfaces) {
if (bs.containsError(checkIdentifier)) { if (bs.containsError(checkIdentifier)) {
return true; return true;
...@@ -254,6 +286,9 @@ public class BridgeObject extends CityObject { ...@@ -254,6 +286,9 @@ public class BridgeObject extends CityObject {
for (BoundarySurface bs : boundarySurfaces) { for (BoundarySurface bs : boundarySurfaces) {
bs.accept(c); bs.accept(c);
} }
for (Installation bi : bridgeInstallations) {
bi.accept(c);
}
if (parts != null) { if (parts != null) {
for (BridgeObject part : parts) { for (BridgeObject part : parts) {
part.accept(c); part.accept(c);
...@@ -307,6 +342,9 @@ public class BridgeObject extends CityObject { ...@@ -307,6 +342,9 @@ public class BridgeObject extends CityObject {
for (BoundarySurface bs : boundarySurfaces) { for (BoundarySurface bs : boundarySurfaces) {
bs.unsetGmlGeometries(); bs.unsetGmlGeometries();
} }
for (Installation bi : bridgeInstallations) {
bi.unsetGmlGeometries();
}
if (parts != null) { if (parts != null) {
for (BridgeObject part : parts) { for (BridgeObject part : parts) {
part.unsetGmlGeometries(); part.unsetGmlGeometries();
...@@ -331,9 +369,22 @@ public class BridgeObject extends CityObject { ...@@ -331,9 +369,22 @@ public class BridgeObject extends CityObject {
@Override @Override
public void prepareForChecking() { public void prepareForChecking() {
super.prepareForChecking(); super.prepareForChecking();
if (elements != null) {
for (BridgeConstructiveElement e : elements) {
e.prepareForChecking();
}
}
if (parts != null) {
for (BridgeObject part : parts) {
part.prepareForChecking();
}
}
for (BoundarySurface bs : boundarySurfaces) { for (BoundarySurface bs : boundarySurfaces) {
bs.prepareForChecking(); bs.prepareForChecking();
} }
for (Installation bi : bridgeInstallations) {
bi.prepareForChecking();
}
} }
@Override @Override
...@@ -342,6 +393,9 @@ public class BridgeObject extends CityObject { ...@@ -342,6 +393,9 @@ public class BridgeObject extends CityObject {
for (BoundarySurface bs : boundarySurfaces) { for (BoundarySurface bs : boundarySurfaces) {
bs.clearMetaInformation(); bs.clearMetaInformation();
} }
for (Installation bi : bridgeInstallations) {
bi.clearMetaInformation();
}
if (parts != null) { if (parts != null) {
for (BridgeObject part : parts) { for (BridgeObject part : parts) {
part.clearMetaInformation(); part.clearMetaInformation();
...@@ -360,6 +414,9 @@ public class BridgeObject extends CityObject { ...@@ -360,6 +414,9 @@ public class BridgeObject extends CityObject {
for (BoundarySurface bs : boundarySurfaces) { for (BoundarySurface bs : boundarySurfaces) {
handler.addInstance(bs); handler.addInstance(bs);
} }
for (Installation bi : bridgeInstallations) {
handler.addInstance(bi);
}
if (parts != null) { if (parts != null) {
for (BridgeObject part : parts) { for (BridgeObject part : parts) {
handler.addInstance(part); handler.addInstance(part);
...@@ -372,6 +429,24 @@ public class BridgeObject extends CityObject { ...@@ -372,6 +429,24 @@ public class BridgeObject extends CityObject {
} }
} }
public void anonymize() {
for (Geometry geom : getGeometries()) {
geom.anonymize();
}
org.citygml4j.core.model.bridge.Bridge gmlB = new org.citygml4j.core.model.bridge.Bridge();
gmlB.setId(GmlId.generateId().getGmlString());
for (Installation bi : getBridgeInstallations()) {
bi.anonymize();
gmlB.getBridgeInstallations().add(new BridgeInstallationProperty((BridgeInstallation) bi.getGmlObject()));
}
for (BoundarySurface bs : getBoundarySurfaces()) {
bs.anonymize();
gmlB.addBoundary(new AbstractSpaceBoundaryProperty(bs.getGmlObject()));
}
this.ab = gmlB;
}
@Override @Override
public void fillValues(Copyable original, CopyHandler handler) { public void fillValues(Copyable original, CopyHandler handler) {
super.fillValues(original, handler); super.fillValues(original, handler);
...@@ -379,14 +454,17 @@ public class BridgeObject extends CityObject { ...@@ -379,14 +454,17 @@ 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 (Installation originalBi : originalBo.bridgeInstallations) {
for (BridgeObject part : parts) { bridgeInstallations.add(handler.getCopyInstance(originalBi));
handler.addInstance(part); }
if (originalBo.parts != null) {
for (BridgeObject part : originalBo.parts) {
getParts().add(handler.getCopyInstance(part));
} }
} }
if (elements != null) { if (originalBo.elements != null) {
for (BridgeConstructiveElement ele : elements) { for (BridgeConstructiveElement ele : originalBo.elements) {
handler.addInstance(ele); getConstructiveElements().add(handler.getCopyInstance(ele));
} }
} }
} }
......
...@@ -21,6 +21,7 @@ package de.hft.stuttgart.citydoctor2.datastructure; ...@@ -21,6 +21,7 @@ package de.hft.stuttgart.citydoctor2.datastructure;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.citygml4j.core.model.building.BuildingInstallation;
import org.citygml4j.core.model.building.BuildingInstallationProperty; import org.citygml4j.core.model.building.BuildingInstallationProperty;
import org.citygml4j.core.model.core.AbstractSpaceBoundaryProperty; import org.citygml4j.core.model.core.AbstractSpaceBoundaryProperty;
import org.citygml4j.core.util.geometry.GeometryFactory; import org.citygml4j.core.util.geometry.GeometryFactory;
...@@ -120,9 +121,9 @@ public class Building extends AbstractBuilding { ...@@ -120,9 +121,9 @@ public class Building extends AbstractBuilding {
} }
org.citygml4j.core.model.building.Building gmlB = new org.citygml4j.core.model.building.Building(); org.citygml4j.core.model.building.Building gmlB = new org.citygml4j.core.model.building.Building();
gmlB.setId(GmlId.generateId().getGmlString()); gmlB.setId(GmlId.generateId().getGmlString());
for (BuildingInstallation bi : getBuildingInstallations()) { for (Installation bi : getBuildingInstallations()) {
bi.anonymize(); bi.anonymize();
gmlB.getBuildingInstallations().add(new BuildingInstallationProperty(bi.getGmlObject())); gmlB.getBuildingInstallations().add(new BuildingInstallationProperty((BuildingInstallation) bi.getGmlObject()));
} }
for (BoundarySurface bs : getBoundarySurfaces()) { for (BoundarySurface bs : getBoundarySurfaces()) {
bs.anonymize(); bs.anonymize();
......
...@@ -333,7 +333,7 @@ public class CityDoctorModel { ...@@ -333,7 +333,7 @@ public class CityDoctorModel {
if (index == -1) { if (index == -1) {
throw new IllegalStateException(COULD_NOT_FIND_FEATURE + currentFeature + " in land objects"); throw new IllegalStateException(COULD_NOT_FIND_FEATURE + currentFeature + " in land objects");
} }
land.set(index, (LandObject) nextFeature); land.set(index, nextFeature);
} }
private void replaceVegetation(CityObject currentFeature, CityObject nextFeature) { private void replaceVegetation(CityObject currentFeature, CityObject nextFeature) {
......
...@@ -46,7 +46,7 @@ public class ConcretePolygon extends Polygon { ...@@ -46,7 +46,7 @@ public class ConcretePolygon extends Polygon {
private LinearRing exterior; private LinearRing exterior;
private List<LinearRing> innerRings; private List<LinearRing> innerRings;
private BoundarySurface partOfSurface; private BoundarySurface partOfSurface;
private BuildingInstallation partfOfInstallation; private Installation partfOfInstallation;
private Geometry parent; private Geometry parent;
private LinkedPolygon linkedFromPolygon; private LinkedPolygon linkedFromPolygon;
...@@ -335,7 +335,7 @@ public class ConcretePolygon extends Polygon { ...@@ -335,7 +335,7 @@ public class ConcretePolygon extends Polygon {
* hft.stuttgart.citydoctor2.datastructure.BuildingInstallation) * hft.stuttgart.citydoctor2.datastructure.BuildingInstallation)
*/ */
@Override @Override
public void setPartOfInstallation(BuildingInstallation bi) { public void setPartOfInstallation(Installation bi) {
partfOfInstallation = bi; partfOfInstallation = bi;
} }
...@@ -346,7 +346,7 @@ public class ConcretePolygon extends Polygon { ...@@ -346,7 +346,7 @@ public class ConcretePolygon extends Polygon {
* de.hft.stuttgart.citydoctor2.datastructure.Polygon#getPartOfInstallation() * de.hft.stuttgart.citydoctor2.datastructure.Polygon#getPartOfInstallation()
*/ */
@Override @Override
public BuildingInstallation getPartOfInstallation() { public Installation getPartOfInstallation() {
return partfOfInstallation; return partfOfInstallation;
} }
......
...@@ -26,7 +26,7 @@ package de.hft.stuttgart.citydoctor2.datastructure; ...@@ -26,7 +26,7 @@ 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, INSTALLATION, OPENING,
BUILDING_PART, BRIDGE_CONSTRUCTION_ELEMENT; BUILDING_PART, BRIDGE_CONSTRUCTION_ELEMENT, BRIDGE_INSTALLATION;
} }
...@@ -97,10 +97,10 @@ public class Geometry extends GmlElement { ...@@ -97,10 +97,10 @@ public class Geometry extends GmlElement {
// set part of boundary surface or building installation or both // set part of boundary surface or building installation or both
if (parent instanceof BoundarySurface bs) { if (parent instanceof BoundarySurface bs) {
cdPoly.setPartOfSurface(bs); cdPoly.setPartOfSurface(bs);
if (bs.getParent() instanceof BuildingInstallation bi) { if (bs.getParent() instanceof Installation bi) {
cdPoly.setPartOfInstallation(bi); cdPoly.setPartOfInstallation(bi);
} }
} else if (parent instanceof BuildingInstallation bi) { } else if (parent instanceof Installation bi) {
cdPoly.setPartOfInstallation(bi); cdPoly.setPartOfInstallation(bi);
} }
} }
......
...@@ -21,6 +21,8 @@ package de.hft.stuttgart.citydoctor2.datastructure; ...@@ -21,6 +21,8 @@ package de.hft.stuttgart.citydoctor2.datastructure;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.citygml4j.core.model.bridge.BridgeInstallation;
import org.citygml4j.core.model.construction.AbstractInstallation;
import org.citygml4j.core.model.core.AbstractSpaceBoundaryProperty; import org.citygml4j.core.model.core.AbstractSpaceBoundaryProperty;
import org.citygml4j.core.util.geometry.GeometryFactory; import org.citygml4j.core.util.geometry.GeometryFactory;
import org.xmlobjects.gml.model.geometry.GeometryProperty; import org.xmlobjects.gml.model.geometry.GeometryProperty;
...@@ -37,15 +39,15 @@ import de.hft.stuttgart.citydoctor2.utils.CityGmlUtils; ...@@ -37,15 +39,15 @@ import de.hft.stuttgart.citydoctor2.utils.CityGmlUtils;
import de.hft.stuttgart.citydoctor2.utils.CopyHandler; import de.hft.stuttgart.citydoctor2.utils.CopyHandler;
import de.hft.stuttgart.citydoctor2.utils.Copyable; import de.hft.stuttgart.citydoctor2.utils.Copyable;
public class BuildingInstallation extends CityObject { public class Installation extends CityObject {
private static final long serialVersionUID = 1576237433322680191L; private static final long serialVersionUID = 1576237433322680191L;
private List<BoundarySurface> boundarySurfaces = new ArrayList<>(4); private List<BoundarySurface> boundarySurfaces = new ArrayList<>(4);
private org.citygml4j.core.model.building.BuildingInstallation gmlBi; private AbstractInstallation gmlBi;
private AbstractBuilding parent; private CityObject parent;
public void reCreateGeometries(GeometryFactory factory, ParserConfiguration config) { public void reCreateGeometries(GeometryFactory factory, ParserConfiguration config) {
for (Geometry geom : getGeometries()) { for (Geometry geom : getGeometries()) {
...@@ -69,16 +71,41 @@ public class BuildingInstallation extends CityObject { ...@@ -69,16 +71,41 @@ public class BuildingInstallation extends CityObject {
} }
private void setGeometryAccordingToLod(Lod lod, GeometryProperty<?> ms) { private void setGeometryAccordingToLod(Lod lod, GeometryProperty<?> ms) {
if (gmlBi instanceof org.citygml4j.core.model.building.BuildingInstallation localBi) {
addGeometryToBuildingInstallation(lod, ms, localBi);
} else if (gmlBi instanceof BridgeInstallation localBi) {
addGeometryToBridgeInstallation(lod, ms, localBi);
}
}
private void addGeometryToBuildingInstallation(Lod lod, GeometryProperty<?> ms,
org.citygml4j.core.model.building.BuildingInstallation localBi) {
switch (lod) { switch (lod) {
case LOD2: case LOD2:
gmlBi.getDeprecatedProperties().setLod2Geometry(ms); localBi.getDeprecatedProperties().setLod2Geometry(ms);
break; break;
case LOD3: case LOD3:
gmlBi.getDeprecatedProperties().setLod3Geometry(ms); localBi.getDeprecatedProperties().setLod3Geometry(ms);
break; break;
case LOD4: case LOD4:
gmlBi.getDeprecatedProperties().setLod4Geometry(ms); localBi.getDeprecatedProperties().setLod4Geometry(ms);
break;
default:
throw new IllegalStateException("Found geometry with LOD other than LOD2,"
+ " LOD3, LOD4, which is illegal for BuildingInstallations: " + lod);
}
}
private void addGeometryToBridgeInstallation(Lod lod, GeometryProperty<?> ms, BridgeInstallation localBi) {
switch (lod) {
case LOD2:
localBi.getDeprecatedProperties().setLod2Geometry(ms);
break;
case LOD3:
localBi.getDeprecatedProperties().setLod3Geometry(ms);
break;
case LOD4:
localBi.getDeprecatedProperties().setLod4Geometry(ms);
break; break;
default: default:
throw new IllegalStateException("Found geometry with LOD other than LOD2," throw new IllegalStateException("Found geometry with LOD other than LOD2,"
...@@ -141,11 +168,11 @@ public class BuildingInstallation extends CityObject { ...@@ -141,11 +168,11 @@ public class BuildingInstallation extends CityObject {
return false; return false;
} }
public void setParent(AbstractBuilding parent) { public void setParent(CityObject parent) {
this.parent = parent; this.parent = parent;
} }
public AbstractBuilding getParent() { public CityObject getParent() {
return parent; return parent;
} }
...@@ -155,15 +182,25 @@ public class BuildingInstallation extends CityObject { ...@@ -155,15 +182,25 @@ public class BuildingInstallation extends CityObject {
} }
public void unsetGmlGeometries() { public void unsetGmlGeometries() {
gmlBi.getDeprecatedProperties().setLod2Geometry(null); if (gmlBi instanceof org.citygml4j.core.model.building.BuildingInstallation localBi) {
gmlBi.getDeprecatedProperties().setLod3Geometry(null); localBi.getDeprecatedProperties().setLod2Geometry(null);
gmlBi.getDeprecatedProperties().setLod4Geometry(null); localBi.getDeprecatedProperties().setLod3Geometry(null);
localBi.getDeprecatedProperties().setLod4Geometry(null);
} else if (gmlBi instanceof BridgeInstallation localBi) {
removeGeometriesFromBridgeInstallation(localBi);
}
for (BoundarySurface bs : boundarySurfaces) { for (BoundarySurface bs : boundarySurfaces) {
bs.unsetGmlGeometries(); bs.unsetGmlGeometries();
} }
} }
public void setGmlObject(org.citygml4j.core.model.building.BuildingInstallation gmlBi) { private void removeGeometriesFromBridgeInstallation(BridgeInstallation localBi) {
localBi.getDeprecatedProperties().setLod2Geometry(null);
localBi.getDeprecatedProperties().setLod3Geometry(null);
localBi.getDeprecatedProperties().setLod4Geometry(null);
}
public void setGmlObject(AbstractInstallation gmlBi) {
this.gmlBi = gmlBi; this.gmlBi = gmlBi;
} }
...@@ -184,13 +221,13 @@ public class BuildingInstallation extends CityObject { ...@@ -184,13 +221,13 @@ public class BuildingInstallation extends CityObject {
@Override @Override
public org.citygml4j.core.model.building.BuildingInstallation getGmlObject() { public AbstractInstallation getGmlObject() {
return gmlBi; return gmlBi;
} }
@Override @Override
public FeatureType getFeatureType() { public FeatureType getFeatureType() {
return FeatureType.BUILDING_INSTALLATION; return FeatureType.INSTALLATION;
} }
public List<BoundarySurface> getBoundarySurfaces() { public List<BoundarySurface> getBoundarySurfaces() {
...@@ -219,7 +256,7 @@ public class BuildingInstallation extends CityObject { ...@@ -219,7 +256,7 @@ public class BuildingInstallation extends CityObject {
@Override @Override
public void fillValues(Copyable original, CopyHandler handler) { public void fillValues(Copyable original, CopyHandler handler) {
super.fillValues(original, handler); super.fillValues(original, handler);
BuildingInstallation originalBi = (BuildingInstallation) original; Installation originalBi = (Installation) original;
for (BoundarySurface originalBs : originalBi.boundarySurfaces) { for (BoundarySurface originalBs : originalBi.boundarySurfaces) {
boundarySurfaces.add(handler.getCopyInstance(originalBs)); boundarySurfaces.add(handler.getCopyInstance(originalBs));
} }
...@@ -238,7 +275,7 @@ public class BuildingInstallation extends CityObject { ...@@ -238,7 +275,7 @@ public class BuildingInstallation extends CityObject {
@Override @Override
public Copyable createCopyInstance() { public Copyable createCopyInstance() {
return new BuildingInstallation(); return new Installation();
} }
} }
...@@ -213,12 +213,12 @@ public class LinkedPolygon extends Polygon { ...@@ -213,12 +213,12 @@ public class LinkedPolygon extends Polygon {
} }
@Override @Override
public void setPartOfInstallation(BuildingInstallation bi) { public void setPartOfInstallation(Installation bi) {
poly.setPartOfInstallation(bi); poly.setPartOfInstallation(bi);
} }
@Override @Override
public BuildingInstallation getPartOfInstallation() { public Installation getPartOfInstallation() {
return poly.getPartOfInstallation(); return poly.getPartOfInstallation();
} }
......
...@@ -60,9 +60,9 @@ public abstract class Polygon extends GmlElement { ...@@ -60,9 +60,9 @@ public abstract class Polygon extends GmlElement {
public abstract void removeInnerRing(LinearRing ring); public abstract void removeInnerRing(LinearRing ring);
public abstract void setPartOfInstallation(BuildingInstallation bi); public abstract void setPartOfInstallation(Installation bi);
public abstract BuildingInstallation getPartOfInstallation(); public abstract Installation getPartOfInstallation();
public abstract boolean hasPointAsCorner(Vertex v); public abstract boolean hasPointAsCorner(Vertex v);
......
...@@ -64,7 +64,7 @@ public class WaterObject extends CityObject { ...@@ -64,7 +64,7 @@ public class WaterObject extends CityObject {
} }
} }
} }
/** /**
* Getter for all boundary surfaces contained in this building. * Getter for all boundary surfaces contained in this building.
* *
...@@ -73,7 +73,7 @@ public class WaterObject extends CityObject { ...@@ -73,7 +73,7 @@ public class WaterObject extends CityObject {
public List<BoundarySurface> getBoundarySurfaces() { public List<BoundarySurface> getBoundarySurfaces() {
return boundarySurfaceList; return boundarySurfaceList;
} }
public void addBoundarySurface(BoundarySurface bs) { public void addBoundarySurface(BoundarySurface bs) {
boundarySurfaceList.add(bs); boundarySurfaceList.add(bs);
bs.setParent(this); bs.setParent(this);
...@@ -90,6 +90,9 @@ public class WaterObject extends CityObject { ...@@ -90,6 +90,9 @@ public class WaterObject extends CityObject {
if (c.canExecute(this)) { if (c.canExecute(this)) {
c.check(this); c.check(this);
} }
for (BoundarySurface bs : boundarySurfaceList) {
bs.accept(c);
}
} }
@Override @Override
...@@ -120,7 +123,48 @@ public class WaterObject extends CityObject { ...@@ -120,7 +123,48 @@ public class WaterObject extends CityObject {
@Override @Override
public void fillValues(Copyable original, CopyHandler handler) { public void fillValues(Copyable original, CopyHandler handler) {
WaterObject wo = (WaterObject) original; WaterObject wo = (WaterObject) original;
WaterObject originalWaterObject = (WaterObject) original;
for (BoundarySurface originalBs : originalWaterObject.boundarySurfaceList) {
boundarySurfaceList.add(handler.getCopyInstance(originalBs));
}
gmlWater = wo.gmlWater; gmlWater = wo.gmlWater;
}
@Override
public boolean containsAnyError() {
boolean hasError = super.containsAnyError();
if (hasError) {
return true;
}
for (BoundarySurface bs : boundarySurfaceList) {
if (bs.containsAnyError()) {
return true;
}
}
return false;
}
@Override
public void collectInstances(CopyHandler handler) {
super.collectInstances(handler);
handler.addInstance(boundarySurfaceList);
}
@Override
public void clearMetaInformation() {
super.clearMetaInformation();
for (BoundarySurface bs : boundarySurfaceList) {
bs.clearMetaInformation();
}
}
@Override
public void prepareForChecking() {
super.prepareForChecking();
for (BoundarySurface bs : boundarySurfaceList) {
bs.prepareForChecking();
}
} }
} }
...@@ -30,6 +30,8 @@ import org.citygml4j.core.model.CityGMLVersion; ...@@ -30,6 +30,8 @@ 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.BridgeConstructiveElementProperty;
import org.citygml4j.core.model.bridge.BridgeInstallation;
import org.citygml4j.core.model.bridge.BridgeInstallationProperty;
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;
...@@ -83,7 +85,6 @@ import de.hft.stuttgart.citydoctor2.datastructure.BridgeConstructiveElement; ...@@ -83,7 +85,6 @@ 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;
import de.hft.stuttgart.citydoctor2.datastructure.BuildingInstallation;
import de.hft.stuttgart.citydoctor2.datastructure.BuildingPart; import de.hft.stuttgart.citydoctor2.datastructure.BuildingPart;
import de.hft.stuttgart.citydoctor2.datastructure.CityDoctorModel; import de.hft.stuttgart.citydoctor2.datastructure.CityDoctorModel;
import de.hft.stuttgart.citydoctor2.datastructure.CityObject; import de.hft.stuttgart.citydoctor2.datastructure.CityObject;
...@@ -92,6 +93,7 @@ import de.hft.stuttgart.citydoctor2.datastructure.Geometry; ...@@ -92,6 +93,7 @@ import de.hft.stuttgart.citydoctor2.datastructure.Geometry;
import de.hft.stuttgart.citydoctor2.datastructure.GeometryType; import de.hft.stuttgart.citydoctor2.datastructure.GeometryType;
import de.hft.stuttgart.citydoctor2.datastructure.GmlElement; import de.hft.stuttgart.citydoctor2.datastructure.GmlElement;
import de.hft.stuttgart.citydoctor2.datastructure.GmlId; import de.hft.stuttgart.citydoctor2.datastructure.GmlId;
import de.hft.stuttgart.citydoctor2.datastructure.Installation;
import de.hft.stuttgart.citydoctor2.datastructure.LandObject; import de.hft.stuttgart.citydoctor2.datastructure.LandObject;
import de.hft.stuttgart.citydoctor2.datastructure.LinearRing; import de.hft.stuttgart.citydoctor2.datastructure.LinearRing;
import de.hft.stuttgart.citydoctor2.datastructure.LinkedPolygon; import de.hft.stuttgart.citydoctor2.datastructure.LinkedPolygon;
...@@ -256,6 +258,15 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -256,6 +258,15 @@ public class Citygml3FeatureMapper extends ObjectWalker {
} }
for (BridgeConstructiveElement ele : bo.getConstructiveElements()) { for (BridgeConstructiveElement ele : bo.getConstructiveElements()) {
updateEdgesAndVertices(ele); updateEdgesAndVertices(ele);
for (BoundarySurface bs : ele.getBoundarySurfaces()) {
updateEdgesAndVertices(bs);
}
}
for (Installation bi : bo.getBridgeInstallations()) {
updateEdgesAndVertices(bi);
for (BoundarySurface bs : bi.getBoundarySurfaces()) {
updateEdgesAndVertices(bs);
}
} }
model.addBridge(bo); model.addBridge(bo);
} }
...@@ -272,6 +283,16 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -272,6 +283,16 @@ public class Citygml3FeatureMapper extends ObjectWalker {
bo.addConstructiveElement(cdEle); bo.addConstructiveElement(cdEle);
} }
List<BridgeInstallationProperty> bridgeInstallations = ab.getBridgeInstallations();
for (BridgeInstallationProperty installationProp : bridgeInstallations) {
var gmlBi = installationProp.getObject();
if (gmlBi == null) {
// ignore empty properties
continue;
}
Installation bi = mapBridgeInstallation(gmlBi);
bo.addBridgeInstallation(bi);
}
SurfaceMapper surfaceMapper = new SurfaceMapper(polygonMap, references, vertexMap, config); SurfaceMapper surfaceMapper = new SurfaceMapper(polygonMap, references, vertexMap, config);
for (AbstractSpaceBoundaryProperty surfaceProp : ab.getBoundaries()) { for (AbstractSpaceBoundaryProperty surfaceProp : ab.getBoundaries()) {
...@@ -290,6 +311,44 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -290,6 +311,44 @@ public class Citygml3FeatureMapper extends ObjectWalker {
bo.unsetGmlGeometries(); bo.unsetGmlGeometries();
} }
private Installation mapBridgeInstallation(BridgeInstallation gmlBi) {
Installation bi = new Installation();
bi.setGmlObject(gmlBi);
mapAbstractOccupiedSpace(gmlBi, bi);
GeometryProperty<?> lod2Prop = gmlBi.getDeprecatedProperties().getLod2Geometry();
parseAndAddAbstractGeometry(lod2Prop, Lod.LOD2, bi);
GeometryProperty<?> lod3Prop = gmlBi.getDeprecatedProperties().getLod3Geometry();
parseAndAddAbstractGeometry(lod3Prop, Lod.LOD3, bi);
GeometryProperty<?> lod4Prop = gmlBi.getDeprecatedProperties().getLod4Geometry();
parseAndAddAbstractGeometry(lod4Prop, Lod.LOD4, bi);
bi.unsetGmlGeometries();
SurfaceMapper surfaceMapper = new SurfaceMapper(polygonMap, references, vertexMap, config);
for (AbstractSpaceBoundaryProperty surfaceProp : gmlBi.getBoundaries()) {
if (!surfaceProp.isSetObject()) {
continue;
}
AbstractSpaceBoundary surface = surfaceProp.getObject();
surface.accept(surfaceMapper);
}
for (BoundarySurface bs : surfaceMapper.getSurfaces()) {
bi.addBoundarySurface(bs);
for (Geometry geom : bs.getGeometries()) {
for (Polygon p : geom.getPolygons()) {
p.setPartOfSurface(bs);
p.setPartOfInstallation(bi);
}
}
}
for (Geometry geom : bi.getGeometries()) {
for (Polygon p : geom.getPolygons()) {
p.setPartOfInstallation(bi);
}
}
return bi;
}
private void updatePartOfSurface(BridgeObject bo, SurfaceMapper surfaceMapper) { private void updatePartOfSurface(BridgeObject bo, SurfaceMapper surfaceMapper) {
for (BoundarySurface bs : surfaceMapper.getSurfaces()) { for (BoundarySurface bs : surfaceMapper.getSurfaces()) {
bo.addBoundarySurface(bs); bo.addBoundarySurface(bs);
...@@ -303,6 +362,18 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -303,6 +362,18 @@ public class Citygml3FeatureMapper extends ObjectWalker {
private void mapConstructiveElement(org.citygml4j.core.model.bridge.BridgeConstructiveElement ele, BridgeConstructiveElement bce) { private void mapConstructiveElement(org.citygml4j.core.model.bridge.BridgeConstructiveElement ele, BridgeConstructiveElement bce) {
mapAbstractConstructiveElement(ele, bce); mapAbstractConstructiveElement(ele, bce);
SurfaceMapper surfaceMapper = new SurfaceMapper(polygonMap, references, vertexMap, config);
for (AbstractSpaceBoundaryProperty surfaceProp : ele.getBoundaries()) {
if (!surfaceProp.isSetObject()) {
continue;
}
AbstractSpaceBoundary surface = surfaceProp.getObject();
surface.accept(surfaceMapper);
}
for (BoundarySurface bs : surfaceMapper.getSurfaces()) {
bce.addBoundarySurface(bs);
}
} }
private void mapAbstractConstructiveElement(org.citygml4j.core.model.bridge.BridgeConstructiveElement ele, BridgeConstructiveElement bce) { private void mapAbstractConstructiveElement(org.citygml4j.core.model.bridge.BridgeConstructiveElement ele, BridgeConstructiveElement bce) {
...@@ -486,7 +557,7 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -486,7 +557,7 @@ public class Citygml3FeatureMapper extends ObjectWalker {
LinkedPolygon lPoly = new LinkedPolygon(concPoly, geom); LinkedPolygon lPoly = new LinkedPolygon(concPoly, geom);
if (geom.getParent() instanceof BoundarySurface bs) { if (geom.getParent() instanceof BoundarySurface bs) {
lPoly.setPartOfSurface(bs); lPoly.setPartOfSurface(bs);
if (bs.getParent() instanceof BuildingInstallation bi) { if (bs.getParent() instanceof Installation bi) {
lPoly.setPartOfInstallation(bi); lPoly.setPartOfInstallation(bi);
} }
} }
...@@ -516,7 +587,7 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -516,7 +587,7 @@ public class Citygml3FeatureMapper extends ObjectWalker {
// ignore empty properties // ignore empty properties
continue; continue;
} }
BuildingInstallation bi = mapBuildingInstallation(gmlBi); Installation bi = mapBuildingInstallation(gmlBi);
cdBuilding.addBuildingInstallation(bi); cdBuilding.addBuildingInstallation(bi);
} }
...@@ -536,7 +607,7 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -536,7 +607,7 @@ public class Citygml3FeatureMapper extends ObjectWalker {
for (BoundarySurface bs : surfaceMapper.getSurfaces()) { for (BoundarySurface bs : surfaceMapper.getSurfaces()) {
updateEdgesAndVertices(bs); updateEdgesAndVertices(bs);
} }
for (BuildingInstallation bi : cdBuilding.getBuildingInstallations()) { for (Installation bi : cdBuilding.getBuildingInstallations()) {
updateEdgesAndVertices(bi); updateEdgesAndVertices(bi);
for (BoundarySurface bs : bi.getBoundarySurfaces()) { for (BoundarySurface bs : bi.getBoundarySurfaces()) {
updateEdgesAndVertices(bs); updateEdgesAndVertices(bs);
...@@ -562,8 +633,8 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -562,8 +633,8 @@ public class Citygml3FeatureMapper extends ObjectWalker {
} }
} }
private BuildingInstallation mapBuildingInstallation(org.citygml4j.core.model.building.BuildingInstallation gmlBi) { private Installation mapBuildingInstallation(org.citygml4j.core.model.building.BuildingInstallation gmlBi) {
BuildingInstallation bi = new BuildingInstallation(); Installation bi = new Installation();
bi.setGmlObject(gmlBi); bi.setGmlObject(gmlBi);
mapAbstractOccupiedSpace(gmlBi, bi); mapAbstractOccupiedSpace(gmlBi, bi);
GeometryProperty<?> lod2Prop = gmlBi.getDeprecatedProperties().getLod2Geometry(); GeometryProperty<?> lod2Prop = gmlBi.getDeprecatedProperties().getLod2Geometry();
......
...@@ -21,6 +21,7 @@ package de.hft.stuttgart.citydoctor2.writer; ...@@ -21,6 +21,7 @@ package de.hft.stuttgart.citydoctor2.writer;
import java.io.File; import java.io.File;
import java.time.ZonedDateTime; import java.time.ZonedDateTime;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
...@@ -93,6 +94,17 @@ public class CityGMLWriterUtils { ...@@ -93,6 +94,17 @@ public class CityGMLWriterUtils {
storeCityObjects(model.getWater(), gmlFactory, model, cModel, val); storeCityObjects(model.getWater(), gmlFactory, model, cModel, val);
writer.write(cModel); writer.write(cModel);
cModel.getCityObjectMembers().clear();
if (model.isValidated()) {
// remove validation plan again to not re-add it on recurring save
Iterator<AbstractFeatureProperty> it = cModel.getFeatureMembers().iterator();
while (it.hasNext()) {
AbstractFeatureProperty afp = it.next();
if (afp.getObject() == val || afp.getObject() == model.getValidationPlan()) {
it.remove();
}
}
}
} catch (CityGMLWriteException e) { } catch (CityGMLWriteException e) {
throw new CityDoctorWriteException(e); throw new CityDoctorWriteException(e);
} }
......
...@@ -55,5 +55,4 @@ public class AttributeInvalidErrorTest { ...@@ -55,5 +55,4 @@ public class AttributeInvalidErrorTest {
assertEquals("attr", adeErr.getAttributeName()); assertEquals("attr", adeErr.getAttributeName());
} }
} }
...@@ -57,8 +57,8 @@ public class AbstractBuildingTest { ...@@ -57,8 +57,8 @@ public class AbstractBuildingTest {
public void testAccept() { public void testAccept() {
AbstractBuilding ab = createAbstractBuilding(); AbstractBuilding ab = createAbstractBuilding();
ab.addBoundarySurface(new BoundarySurface(null)); ab.addBoundarySurface(new BoundarySurface(null));
ab.addBuildingInstallation(new BuildingInstallation()); ab.addBuildingInstallation(new Installation());
ab.addBuildingInstallation(new BuildingInstallation()); ab.addBuildingInstallation(new Installation());
AtomicInteger abCounter = new AtomicInteger(0); AtomicInteger abCounter = new AtomicInteger(0);
AtomicInteger bsCounter = new AtomicInteger(0); AtomicInteger bsCounter = new AtomicInteger(0);
AtomicInteger biCounter = new AtomicInteger(0); AtomicInteger biCounter = new AtomicInteger(0);
...@@ -82,7 +82,7 @@ public class AbstractBuildingTest { ...@@ -82,7 +82,7 @@ public class AbstractBuildingTest {
AbstractCheck c2 = new AbstractCheck() { AbstractCheck c2 = new AbstractCheck() {
@Override @Override
public void check(BuildingInstallation bi) { public void check(Installation bi) {
biCounter.incrementAndGet(); biCounter.incrementAndGet();
} }
}; };
...@@ -92,7 +92,7 @@ public class AbstractBuildingTest { ...@@ -92,7 +92,7 @@ public class AbstractBuildingTest {
@Test @Test
public void testPrepareForChecking() { public void testPrepareForChecking() {
BuildingInstallation biMock = mock(BuildingInstallation.class); Installation biMock = mock(Installation.class);
BoundarySurface bsMock = mock(BoundarySurface.class); BoundarySurface bsMock = mock(BoundarySurface.class);
AbstractBuilding ab = createAbstractBuilding(); AbstractBuilding ab = createAbstractBuilding();
...@@ -105,7 +105,7 @@ public class AbstractBuildingTest { ...@@ -105,7 +105,7 @@ public class AbstractBuildingTest {
@Test @Test
public void testClearMetaInformation() { public void testClearMetaInformation() {
BuildingInstallation biMock = mock(BuildingInstallation.class); Installation biMock = mock(Installation.class);
BoundarySurface bsMock = mock(BoundarySurface.class); BoundarySurface bsMock = mock(BoundarySurface.class);
AbstractBuilding ab = createAbstractBuilding(); AbstractBuilding ab = createAbstractBuilding();
...@@ -137,7 +137,7 @@ public class AbstractBuildingTest { ...@@ -137,7 +137,7 @@ public class AbstractBuildingTest {
@Test @Test
public void testContainsErrorInBi() { public void testContainsErrorInBi() {
AbstractBuilding ab = createAbstractBuilding(); AbstractBuilding ab = createAbstractBuilding();
BuildingInstallation biMock = mock(BuildingInstallation.class); Installation biMock = mock(Installation.class);
ab.addBuildingInstallation(biMock); ab.addBuildingInstallation(biMock);
assertFalse(ab.containsError(CheckId.C_GE_P_HOLE_OUTSIDE)); assertFalse(ab.containsError(CheckId.C_GE_P_HOLE_OUTSIDE));
Mockito.when(biMock.containsError(CheckId.C_GE_P_HOLE_OUTSIDE)).thenReturn(true); Mockito.when(biMock.containsError(CheckId.C_GE_P_HOLE_OUTSIDE)).thenReturn(true);
...@@ -146,7 +146,7 @@ public class AbstractBuildingTest { ...@@ -146,7 +146,7 @@ public class AbstractBuildingTest {
@Test @Test
public void testClearAllContainedCheckResults() { public void testClearAllContainedCheckResults() {
BuildingInstallation biMock = mock(BuildingInstallation.class); Installation biMock = mock(Installation.class);
BoundarySurface bsMock = mock(BoundarySurface.class); BoundarySurface bsMock = mock(BoundarySurface.class);
AbstractBuilding ab = createAbstractBuilding(); AbstractBuilding ab = createAbstractBuilding();
...@@ -185,7 +185,7 @@ public class AbstractBuildingTest { ...@@ -185,7 +185,7 @@ public class AbstractBuildingTest {
@Test @Test
public void testContainsAnyErrorInBi() { public void testContainsAnyErrorInBi() {
AbstractBuilding ab = createAbstractBuilding(); AbstractBuilding ab = createAbstractBuilding();
BuildingInstallation biMock = mock(BuildingInstallation.class); Installation biMock = mock(Installation.class);
ab.addBuildingInstallation(biMock); ab.addBuildingInstallation(biMock);
assertFalse(ab.containsAnyError()); assertFalse(ab.containsAnyError());
Mockito.when(biMock.containsAnyError()).thenReturn(true); Mockito.when(biMock.containsAnyError()).thenReturn(true);
...@@ -194,7 +194,7 @@ public class AbstractBuildingTest { ...@@ -194,7 +194,7 @@ public class AbstractBuildingTest {
@Test @Test
public void testCollectContainedErrors() { public void testCollectContainedErrors() {
BuildingInstallation biMock = mock(BuildingInstallation.class); Installation biMock = mock(Installation.class);
BoundarySurface bsMock = mock(BoundarySurface.class); BoundarySurface bsMock = mock(BoundarySurface.class);
AbstractBuilding ab = createAbstractBuilding(); AbstractBuilding ab = createAbstractBuilding();
...@@ -291,7 +291,7 @@ public class AbstractBuildingTest { ...@@ -291,7 +291,7 @@ public class AbstractBuildingTest {
@Test @Test
public void testReCreateGeometriesEmptyBi() { public void testReCreateGeometriesEmptyBi() {
BuildingInstallation biMock = mock(BuildingInstallation.class); Installation biMock = mock(Installation.class);
AbstractBuilding ab = createAbstractBuilding(); AbstractBuilding ab = createAbstractBuilding();
ab.addBuildingInstallation(biMock); ab.addBuildingInstallation(biMock);
GeometryFactory factory = GeometryFactory.newInstance(); GeometryFactory factory = GeometryFactory.newInstance();
...@@ -304,7 +304,7 @@ public class AbstractBuildingTest { ...@@ -304,7 +304,7 @@ public class AbstractBuildingTest {
@Test @Test
public void testUnsetGmlGeometries() { public void testUnsetGmlGeometries() {
BuildingInstallation biMock = mock(BuildingInstallation.class); Installation biMock = mock(Installation.class);
BoundarySurface bsMock = mock(BoundarySurface.class); BoundarySurface bsMock = mock(BoundarySurface.class);
AbstractBuilding ab = createAbstractBuilding(); AbstractBuilding ab = createAbstractBuilding();
......
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