Commit ffe66fd4 authored by Riegel's avatar Riegel
Browse files

Merge branch 'dev_visitor_rework' into 'dev'

Visitor rework

See merge request !30
parents d12da32a 120466a0
Pipeline #11077 passed with stage
in 1 minute and 20 seconds
...@@ -22,13 +22,15 @@ import java.util.Collections; ...@@ -22,13 +22,15 @@ import java.util.Collections;
import java.util.Set; import java.util.Set;
/** /**
* This is an empty implementation for a check. Can be used as a normal visitor *
* for the city doctor data model * This class serves as a Parent for non-validating checks that want to use the CheckEngine's Visitor-pattern for the
* implementation of utility functions like e.g. collecting the sub-CityObjects in a Feature.
*
* *
* @author Matthias Betz * @author Matthias Betz
* *
*/ */
public class AbstractCheck extends Check { public abstract class AbstractCheck extends Check {
@Override @Override
public Set<Requirement> appliesToRequirements() { public Set<Requirement> appliesToRequirements() {
...@@ -50,4 +52,9 @@ public class AbstractCheck extends Check { ...@@ -50,4 +52,9 @@ public class AbstractCheck extends Check {
return null; return null;
} }
@Override
public final boolean isValidator() {
return false;
}
} }
...@@ -53,6 +53,7 @@ public abstract class Check { ...@@ -53,6 +53,7 @@ public abstract class Check {
private final List<Class<Checkable>> applicableToClasses = new ArrayList<>(2); private final List<Class<Checkable>> applicableToClasses = new ArrayList<>(2);
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
protected Check() { protected Check() {
Method[] declaredMethods = getClass().getDeclaredMethods(); Method[] declaredMethods = getClass().getDeclaredMethods();
...@@ -102,6 +103,15 @@ public abstract class Check { ...@@ -102,6 +103,15 @@ public abstract class Check {
*/ */
public abstract RequirementType getType(); public abstract RequirementType getType();
/**
* Returns whether this check validates a feature.
*
* @return true if it validates, false otherwise
*/
public boolean isValidator() {
return true;
}
/** /**
* Checks whether the check can be executed on this checkable, meaning the * Checks whether the check can be executed on this checkable, meaning the
* checkable or its content can not have any error of any check dependent on * checkable or its content can not have any error of any check dependent on
......
...@@ -57,7 +57,6 @@ public record CheckId(String name) implements Serializable { ...@@ -57,7 +57,6 @@ public record CheckId(String name) implements Serializable {
public static final CheckId C_GE_P_ORIENTATION_RINGS_SAME = new CheckId("C_GE_P_ORIENTATION_RINGS_SAME"); public static final CheckId C_GE_P_ORIENTATION_RINGS_SAME = new CheckId("C_GE_P_ORIENTATION_RINGS_SAME");
public static final CheckId C_SE_POLYGON_WITHOUT_SURFACE = new CheckId("C_SE_POLYGON_WITHOUT_SURFACE"); public static final CheckId C_SE_POLYGON_WITHOUT_SURFACE = new CheckId("C_SE_POLYGON_WITHOUT_SURFACE");
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (this == obj) if (this == obj)
......
...@@ -24,6 +24,13 @@ import java.util.HashMap; ...@@ -24,6 +24,13 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import de.hft.stuttgart.citydoctor2.utils.CheckErrorFound;
import de.hft.stuttgart.citydoctor2.utils.visitors.CheckableErrorCollector;
import de.hft.stuttgart.citydoctor2.utils.visitors.ClearCheckResultsVisitor;
import de.hft.stuttgart.citydoctor2.utils.visitors.ClearMetaInformationVisitor;
import de.hft.stuttgart.citydoctor2.utils.visitors.ContainsAnyErrorVisitor;
import de.hft.stuttgart.citydoctor2.utils.visitors.ContainsErrorVisitor;
import de.hft.stuttgart.citydoctor2.utils.visitors.PrepareForCheckingVisitor;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
...@@ -71,7 +78,9 @@ public abstract class Checkable implements Serializable { ...@@ -71,7 +78,9 @@ public abstract class Checkable implements Serializable {
if (c.canExecute(this)) { if (c.canExecute(this)) {
c.check(this); c.check(this);
} }
setValidated(true); if (c.isValidator()) {
setValidated(true);
}
} }
/** /**
...@@ -81,29 +90,47 @@ public abstract class Checkable implements Serializable { ...@@ -81,29 +90,47 @@ public abstract class Checkable implements Serializable {
* @return the GML-ID * @return the GML-ID
*/ */
public abstract GmlId getGmlId(); public abstract GmlId getGmlId();
/** /**
* This should be called before executing a check if low memory consumption * This should be called before executing a check if low memory consumption
* method has been enabled. This should create edges and additional meta * method has been enabled. Creates edges and additional meta
* information necessary to perform checks. * information necessary to perform checks.
*/ */
public abstract void prepareForChecking(); public void prepareForChecking() {
this.accept(new PrepareForCheckingVisitor());
}
/** /**
* This should be called after checking has been done. This should remove any * This should be called after checking has been done. Removes any
* created meta information like edges to free up additional memory space * created meta information like edges to free up memory.
*/ */
public abstract void clearMetaInformation(); public void clearMetaInformation() {
this.accept(new ClearMetaInformationVisitor());
}
/** /**
* This method checks if the object or any object contained within this * Checks if the object, or any object in its datastructure, has a specific error or is not fulfilling the dependencies
* checkable has an error. It counts as an error if the result status if the * of it.
* given check is <code>DEPENDENCIES_NOT_MET<code>. *
* * @param checkIdentifier the associated CheckID of this error
* @param checkIdentifier the name of the check for which an error is searched * @return true if the error was found, false otherwise
* @return true if an error has been found with the given check
*/ */
public boolean containsError(CheckId checkIdentifier) { public boolean containsError(CheckId checkIdentifier) {
try {
ContainsErrorVisitor.checkObject(this, checkIdentifier);
} catch (CheckErrorFound c) {
return true;
}
return false;
}
/**
* Checks if this checkable has an error or is not meeting the dependencies for it.
*
* @param checkIdentifier the associated CheckID of this error
* @return true if the error was found, false otherwise
*/
public boolean hasError(CheckId checkIdentifier) {
CheckResult cs = getCheckResult(checkIdentifier); CheckResult cs = getCheckResult(checkIdentifier);
if (cs == null) { if (cs == null) {
return false; return false;
...@@ -133,8 +160,8 @@ public abstract class Checkable implements Serializable { ...@@ -133,8 +160,8 @@ public abstract class Checkable implements Serializable {
} }
/** /**
* *
* @return all check results for this checkable. * @return all check results of this checkable.
*/ */
public Map<CheckId, CheckResult> getAllCheckResults() { public Map<CheckId, CheckResult> getAllCheckResults() {
return checkResults; return checkResults;
...@@ -157,13 +184,11 @@ public abstract class Checkable implements Serializable { ...@@ -157,13 +184,11 @@ public abstract class Checkable implements Serializable {
} }
/** /**
* Checks whether this checkable has an error. Dependency errors are not * Checks whether this checkable has any error, barring dependency errors.
* considered for this function. This will only check this checkable and not
* traverse any checkables contained in this instance.
* *
* @return true if it has an error, otherwise false * @return true if it has an error, otherwise false
*/ */
public boolean hasAnyError() { public boolean hasAnyErrorWithoutDependencies() {
for (CheckResult cr : checkResults.values()) { for (CheckResult cr : checkResults.values()) {
if (cr.getResultStatus() == ResultStatus.ERROR) { if (cr.getResultStatus() == ResultStatus.ERROR) {
return true; return true;
...@@ -196,7 +221,7 @@ public abstract class Checkable implements Serializable { ...@@ -196,7 +221,7 @@ public abstract class Checkable implements Serializable {
} }
/** /**
* Clears all errors from this checkable * Clears the checkResults list of this checkable.
*/ */
public void clearCheckResults() { public void clearCheckResults() {
setValidated(false); setValidated(false);
...@@ -204,16 +229,31 @@ public abstract class Checkable implements Serializable { ...@@ -204,16 +229,31 @@ public abstract class Checkable implements Serializable {
} }
/** /**
* Removes all errors from this instance and all contained checkables. * Clears the checkResults list of this checkable and all child objects in its datastructure.
*/
public final void clearAllContainedCheckResults() {
this.accept(new ClearCheckResultsVisitor());
}
/**
* Checks if this checkable contains any error within its datastructure.
*
* @return true if any checkable of this datastructure contains an error, false otherwise
*/ */
public abstract void clearAllContainedCheckResults(); public final boolean containsAnyError() {
try {
ContainsAnyErrorVisitor.checkObject(this);
} catch (CheckErrorFound c) {
return true;
}
return false;
}
/** /**
* * Checks if this checkable has any error
* @return false if the checkable or all checkables contained in this one don't * @return true if this checkable has any error, false otherwise
* have any error.
*/ */
public boolean containsAnyError() { public boolean hasAnyError() {
for (CheckResult cr : checkResults.values()) { for (CheckResult cr : checkResults.values()) {
if (cr.getResultStatus() == ResultStatus.ERROR if (cr.getResultStatus() == ResultStatus.ERROR
|| cr.getResultStatus() == ResultStatus.DEPENDENCIES_NOT_MET) { || cr.getResultStatus() == ResultStatus.DEPENDENCIES_NOT_MET) {
...@@ -230,6 +270,16 @@ public abstract class Checkable implements Serializable { ...@@ -230,6 +270,16 @@ public abstract class Checkable implements Serializable {
* @param errors the collection in which the errors are added. * @param errors the collection in which the errors are added.
*/ */
public void collectContainedErrors(List<CheckError> errors) { public void collectContainedErrors(List<CheckError> errors) {
this.accept(new CheckableErrorCollector(errors));
}
/**
* Collects all errors from this checkable and adds
* them to the given list. DEPENDENCY_NOT_MET errors are excluded from this.
*
* @param errors the collection in which the errors are added.
*/
public void collectErrors(List<CheckError> errors) {
for (CheckResult cr : checkResults.values()) { for (CheckResult cr : checkResults.values()) {
if (cr.getResultStatus() == ResultStatus.ERROR) { if (cr.getResultStatus() == ResultStatus.ERROR) {
errors.add(cr.getError()); errors.add(cr.getError());
......
...@@ -19,12 +19,8 @@ ...@@ -19,12 +19,8 @@
package de.hft.stuttgart.citydoctor2.datastructure; package de.hft.stuttgart.citydoctor2.datastructure;
import de.hft.stuttgart.citydoctor2.check.Check; 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 org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.citygml4j.core.model.core.AbstractSpaceBoundaryProperty; import org.citygml4j.core.model.core.AbstractSpaceBoundaryProperty;
...@@ -83,34 +79,16 @@ public abstract class AbstractBuilding extends CityObject { ...@@ -83,34 +79,16 @@ public abstract class AbstractBuilding extends CityObject {
ab.setLod1Solid(null); ab.setLod1Solid(null);
ab.setLod2Solid(null); ab.setLod2Solid(null);
ab.setLod3Solid(null); ab.setLod3Solid(null);
ab.getDeprecatedProperties().setLod4Solid(null);
ab.setLod0MultiSurface(null);
ab.getDeprecatedProperties().setLod1MultiSurface(null);
ab.setLod2MultiSurface(null); ab.setLod2MultiSurface(null);
ab.setLod3MultiSurface(null); ab.setLod3MultiSurface(null);
ab.getDeprecatedProperties().setLod1MultiSurface(null);
ab.getDeprecatedProperties().setLod4MultiSurface(null); ab.getDeprecatedProperties().setLod4MultiSurface(null);
ab.getDeprecatedProperties().setLod4Solid(null);
for (BoundarySurface bs : boundarySurfaceList) {
bs.unsetGmlGeometries();
}
for (Installation bi : buildingInstallations) {
bi.unsetGmlGeometries();
}
for (BuildingRoom br : buildingRooms) {
br.unsetGmlGeometries();
}
for (BuildingRoomFurniture bfr : buildingRoomFurnitureList) {
bfr.unsetGmlGeometries();
}
for (Storey storey : buildingStoreys) {
storey.unsetGmlGeometries();
}
for (BuildingUnit bu : buildingUnits) {
bu.unsetGmlGeometries();
}
} }
@Override @Override
public void reCreateGeometries(GeometryFactory factory, ParserConfiguration config) { public void rebuildGeometries(GeometryFactory factory, ParserConfiguration config) {
for (Geometry geom : getGeometries()) { for (Geometry geom : getGeometries()) {
if (geom instanceof ImplicitGeometryHolder) { if (geom instanceof ImplicitGeometryHolder) {
continue; continue;
...@@ -123,38 +101,21 @@ public abstract class AbstractBuilding extends CityObject { ...@@ -123,38 +101,21 @@ public abstract class AbstractBuilding extends CityObject {
setSolidAccordingToLod(geom, solid); setSolidAccordingToLod(geom, solid);
} }
} }
for (BoundarySurface bs : boundarySurfaceList) { removeEmptyBoundarySurfaces();
reCreateBoundarySurface(factory, config, bs);
}
for (Installation bi : buildingInstallations) {
bi.reCreateGeometries(factory, config);
}
for (BuildingRoom br : buildingRooms) {
br.reCreateGeometries(factory, config);
}
for (BuildingRoomFurniture bfr : buildingRoomFurnitureList) {
bfr.reCreateGeometries(factory, config);
}
for (Storey storey : buildingStoreys) {
storey.reCreateGeometries(factory, config);
}
for (BuildingUnit bu : buildingUnits) {
bu.reCreateGeometries(factory, config);
}
} }
private void reCreateBoundarySurface(GeometryFactory factory, ParserConfiguration config, BoundarySurface bs) { private void removeEmptyBoundarySurfaces() {
if (bs.getGeometries().isEmpty()) { for (BoundarySurface bs : boundarySurfaceList) {
for (AbstractSpaceBoundaryProperty bsp : ab.getBoundaries()) { if (bs.getGeometries().isEmpty()) {
if (bsp.getObject() != null && bsp.getObject() == bs.getGmlObject()) { for (AbstractSpaceBoundaryProperty bsp : ab.getBoundaries()) {
logger.warn("Found empty boundary surface: {}, removing from building", bs.getGmlId()); if (bsp.getObject() != null && bsp.getObject() == bs.getGmlObject()) {
ab.getBoundaries().remove(bsp); logger.warn("Found empty boundary surface: {}, removing from building", bs.getGmlId());
break; ab.getBoundaries().remove(bsp);
break;
}
} }
} }
return;
} }
bs.reCreateGeometries(factory, config);
} }
private void setMultiSurfaceAccordingToLod(Geometry geom, MultiSurface ms) { private void setMultiSurfaceAccordingToLod(Geometry geom, MultiSurface ms) {
...@@ -224,130 +185,6 @@ public abstract class AbstractBuilding extends CityObject { ...@@ -224,130 +185,6 @@ public abstract class AbstractBuilding extends CityObject {
} }
} }
@Override
public void collectContainedErrors(List<CheckError> errors) {
super.collectContainedErrors(errors);
for (Installation bi : buildingInstallations) {
bi.collectContainedErrors(errors);
}
for (BoundarySurface bs : boundarySurfaceList) {
bs.collectContainedErrors(errors);
}
for (BuildingRoom br : buildingRooms) {
br.collectContainedErrors(errors);
}
for (BuildingRoomFurniture bfr : buildingRoomFurnitureList) {
bfr.collectContainedErrors(errors);
}
for (Storey storey : buildingStoreys) {
storey.collectContainedErrors(errors);
}
for (BuildingUnit bu : buildingUnits) {
bu.collectContainedErrors(errors);
}
}
@Override
public void clearAllContainedCheckResults() {
super.clearAllContainedCheckResults();
for (Installation bi : buildingInstallations) {
bi.clearAllContainedCheckResults();
}
for (BoundarySurface bs : boundarySurfaceList) {
bs.clearAllContainedCheckResults();
}
for (BuildingRoom br : buildingRooms) {
br.clearAllContainedCheckResults();
}
for (BuildingRoomFurniture bfr : buildingRoomFurnitureList) {
bfr.clearAllContainedCheckResults();
}
for (Storey storey : buildingStoreys) {
storey.clearAllContainedCheckResults();
}
for (BuildingUnit bu : buildingUnits) {
bu.clearAllContainedCheckResults();
}
}
@Override
public boolean containsError(CheckId checkIdentifier) {
boolean hasError = super.containsError(checkIdentifier);
if (hasError) {
return true;
}
for (Installation bi : buildingInstallations) {
if (bi.containsError(checkIdentifier)) {
return true;
}
}
for (BoundarySurface bs : boundarySurfaceList) {
if (bs.containsError(checkIdentifier)) {
return true;
}
}
for (BuildingRoom br : buildingRooms) {
if (br.containsError(checkIdentifier)) {
return true;
}
}
for (BuildingRoomFurniture bfr : buildingRoomFurnitureList) {
if (bfr.containsError(checkIdentifier)) {
return true;
}
}
for (Storey storey : buildingStoreys) {
if (storey.containsError(checkIdentifier)) {
return true;
}
}
for (BuildingUnit bu : buildingUnits) {
if (bu.containsError(checkIdentifier)) {
return true;
}
}
return false;
}
@Override
public boolean containsAnyError() {
boolean hasError = super.containsAnyError();
if (hasError) {
return true;
}
for (Installation bi : buildingInstallations) {
if (bi.containsAnyError()) {
return true;
}
}
for (BoundarySurface bs : boundarySurfaceList) {
if (bs.containsAnyError()) {
return true;
}
}
for (BuildingRoom br : buildingRooms) {
if (br.containsAnyError()) {
return true;
}
}
for (BuildingRoomFurniture bfr : buildingRoomFurnitureList) {
if (bfr.containsAnyError()) {
return true;
}
}
for (Storey storey : buildingStoreys) {
if (storey.containsAnyError()) {
return true;
}
}
for (BuildingUnit bu : buildingUnits) {
if (bu.containsAnyError()) {
return true;
}
}
return false;
}
void setCityGmlBuilding(org.citygml4j.core.model.building.AbstractBuilding ab) { void setCityGmlBuilding(org.citygml4j.core.model.building.AbstractBuilding ab) {
this.ab = ab; this.ab = ab;
} }
...@@ -406,86 +243,4 @@ public abstract class AbstractBuilding extends CityObject { ...@@ -406,86 +243,4 @@ public abstract class AbstractBuilding extends CityObject {
return buildingUnits; return buildingUnits;
} }
@Override
public void prepareForChecking() {
super.prepareForChecking();
for (Installation bi : buildingInstallations) {
bi.prepareForChecking();
}
for (BoundarySurface bs : boundarySurfaceList) {
bs.prepareForChecking();
}
for (BuildingRoom br : buildingRooms) {
br.prepareForChecking();
}
for (BuildingRoomFurniture bfr : buildingRoomFurnitureList) {
bfr.prepareForChecking();
}
for (Storey storey : buildingStoreys) {
storey.prepareForChecking();
}
for (BuildingUnit bu : buildingUnits) {
bu.prepareForChecking();
}
}
@Override
public void clearMetaInformation() {
super.clearMetaInformation();
for (Installation bi : buildingInstallations) {
bi.clearMetaInformation();
}
for (BoundarySurface bs : boundarySurfaceList) {
bs.clearMetaInformation();
}
for (BuildingRoom br : buildingRooms) {
br.clearMetaInformation();
}
for (BuildingRoomFurniture bfr : buildingRoomFurnitureList) {
bfr.clearMetaInformation();
}
for (Storey storey : buildingStoreys) {
storey.clearMetaInformation();
}
for (BuildingUnit bu : buildingUnits) {
bu.clearMetaInformation();
}
}
@Override
public void collectInstances(CopyHandler handler) {
super.collectInstances(handler);
handler.addInstance(boundarySurfaceList);
handler.addInstance(buildingInstallations);
handler.addInstance(buildingRooms);
handler.addInstance(buildingRoomFurnitureList);
handler.addInstance(buildingStoreys);
handler.addInstance(buildingUnits);
}
@Override
public void fillValues(Copyable original, CopyHandler handler) {
super.fillValues(original, handler);
AbstractBuilding originalAb = (AbstractBuilding) original;
for (BoundarySurface originalBs : originalAb.boundarySurfaceList) {
boundarySurfaceList.add(handler.getCopyInstance(originalBs));
}
for (Installation originalBi : originalAb.buildingInstallations) {
buildingInstallations.add(handler.getCopyInstance(originalBi));
}
for (BuildingRoom originalBr : originalAb.buildingRooms) {
buildingRooms.add(handler.getCopyInstance(originalBr));
}
for (BuildingRoomFurniture originalBFR : originalAb.buildingRoomFurnitureList) {
buildingRoomFurnitureList.add(handler.getCopyInstance(originalBFR));
}
for (Storey originalBStoreys : originalAb.buildingStoreys) {
buildingStoreys.add(handler.getCopyInstance(originalBStoreys));
}
for (BuildingUnit originalBun : originalAb.buildingUnits) {
buildingUnits.add(handler.getCopyInstance(originalBun));
}
ab = originalAb.ab;
}
} }
package de.hft.stuttgart.citydoctor2.datastructure; package de.hft.stuttgart.citydoctor2.datastructure;
import de.hft.stuttgart.citydoctor2.check.Check; 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 org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.citygml4j.core.model.core.AbstractSpaceBoundaryProperty; import org.citygml4j.core.model.core.AbstractSpaceBoundaryProperty;
...@@ -71,25 +67,13 @@ public abstract class AbstractBuildingSubdivision extends CityObject { ...@@ -71,25 +67,13 @@ public abstract class AbstractBuildingSubdivision extends CityObject {
abs.setLod1Solid(null); abs.setLod1Solid(null);
abs.setLod2Solid(null); abs.setLod2Solid(null);
abs.setLod3Solid(null); abs.setLod3Solid(null);
abs.setLod0MultiSurface(null);
abs.setLod2MultiSurface(null); abs.setLod2MultiSurface(null);
abs.setLod3MultiSurface(null); abs.setLod3MultiSurface(null);
for (BoundarySurface bs : boundarySurfaceList) {
bs.unsetGmlGeometries();
}
for (Installation bi : buildingInstallations) {
bi.unsetGmlGeometries();
}
for (BuildingRoom br : buildingRooms) {
br.unsetGmlGeometries();
}
for (BuildingRoomFurniture bfr : buildingRoomFurnitureList) {
bfr.unsetGmlGeometries();
}
} }
@Override @Override
public void reCreateGeometries(GeometryFactory factory, ParserConfiguration config) { public void rebuildGeometries(GeometryFactory factory, ParserConfiguration config) {
for (Geometry geom : getGeometries()) { for (Geometry geom : getGeometries()) {
if (geom instanceof ImplicitGeometryHolder) { if (geom instanceof ImplicitGeometryHolder) {
continue; continue;
...@@ -102,32 +86,21 @@ public abstract class AbstractBuildingSubdivision extends CityObject { ...@@ -102,32 +86,21 @@ public abstract class AbstractBuildingSubdivision extends CityObject {
setSolidAccordingToLod(geom, solid); setSolidAccordingToLod(geom, solid);
} }
} }
for (BoundarySurface bs : boundarySurfaceList) { removeEmptyBoundarySurfaces();
reCreateBoundarySurface(factory, config, bs);
}
for (Installation bi : buildingInstallations) {
bi.reCreateGeometries(factory, config);
}
for (BuildingRoom br : buildingRooms) {
br.reCreateGeometries(factory, config);
}
for (BuildingRoomFurniture bfr : buildingRoomFurnitureList) {
bfr.reCreateGeometries(factory, config);
}
} }
private void reCreateBoundarySurface(GeometryFactory factory, ParserConfiguration config, BoundarySurface bs) { private void removeEmptyBoundarySurfaces() {
if (bs.getGeometries().isEmpty()) { for (BoundarySurface bs : boundarySurfaceList) {
for (AbstractSpaceBoundaryProperty bsp : abs.getBoundaries()) { if (bs.getGeometries().isEmpty()) {
if (bsp.getObject() != null && bsp.getObject() == bs.getGmlObject()) { for (AbstractSpaceBoundaryProperty bsp : abs.getBoundaries()) {
logger.warn("Found empty boundary surface: {}, removing from building", bs.getGmlId()); if (bsp.getObject() != null && bsp.getObject() == bs.getGmlObject()) {
abs.getBoundaries().remove(bsp); logger.warn("Found empty boundary surface: {}, removing from building-subdivision", bs.getGmlId());
break; abs.getBoundaries().remove(bsp);
break;
}
} }
} }
return;
} }
bs.reCreateGeometries(factory, config);
} }
private void setMultiSurfaceAccordingToLod(Geometry geom, MultiSurface ms) { private void setMultiSurfaceAccordingToLod(Geometry geom, MultiSurface ms) {
...@@ -182,98 +155,6 @@ public abstract class AbstractBuildingSubdivision extends CityObject { ...@@ -182,98 +155,6 @@ public abstract class AbstractBuildingSubdivision extends CityObject {
} }
} }
@Override
public void collectContainedErrors(List<CheckError> errors) {
super.collectContainedErrors(errors);
for (Installation bi : buildingInstallations) {
bi.collectContainedErrors(errors);
}
for (BoundarySurface bs : boundarySurfaceList) {
bs.collectContainedErrors(errors);
}
for (BuildingRoom br : buildingRooms) {
br.collectContainedErrors(errors);
}
for (BuildingRoomFurniture bfr : buildingRoomFurnitureList) {
bfr.collectContainedErrors(errors);
}
}
@Override
public void clearAllContainedCheckResults() {
super.clearAllContainedCheckResults();
for (Installation bi : buildingInstallations) {
bi.clearAllContainedCheckResults();
}
for (BoundarySurface bs : boundarySurfaceList) {
bs.clearAllContainedCheckResults();
}
for (BuildingRoom br : buildingRooms) {
br.clearAllContainedCheckResults();
}
for (BuildingRoomFurniture bfr : buildingRoomFurnitureList) {
bfr.clearAllContainedCheckResults();
}
}
@Override
public boolean containsError(CheckId checkIdentifier) {
boolean hasError = super.containsError(checkIdentifier);
if (hasError) {
return true;
}
for (Installation bi : buildingInstallations) {
if (bi.containsError(checkIdentifier)) {
return true;
}
}
for (BoundarySurface bs : boundarySurfaceList) {
if (bs.containsError(checkIdentifier)) {
return true;
}
}
for (BuildingRoom br : buildingRooms) {
if (br.containsError(checkIdentifier)) {
return true;
}
}
for (BuildingRoomFurniture bfr : buildingRoomFurnitureList) {
if (bfr.containsError(checkIdentifier)) {
return true;
}
}
return false;
}
@Override
public boolean containsAnyError() {
boolean hasError = super.containsAnyError();
if (hasError) {
return true;
}
for (Installation bi : buildingInstallations) {
if (bi.containsAnyError()) {
return true;
}
}
for (BoundarySurface bs : boundarySurfaceList) {
if (bs.containsAnyError()) {
return true;
}
}
for (BuildingRoom br : buildingRooms) {
if (br.containsAnyError()) {
return true;
}
}
for (BuildingRoomFurniture bfr : buildingRoomFurnitureList) {
if (bfr.containsAnyError()) {
return true;
}
}
return false;
}
void setCityGmlBuilding(org.citygml4j.core.model.building.AbstractBuildingSubdivision abs) { void setCityGmlBuilding(org.citygml4j.core.model.building.AbstractBuildingSubdivision abs) {
this.abs = abs; this.abs = abs;
} }
...@@ -315,68 +196,6 @@ public abstract class AbstractBuildingSubdivision extends CityObject { ...@@ -315,68 +196,6 @@ public abstract class AbstractBuildingSubdivision extends CityObject {
return buildingRoomFurnitureList; return buildingRoomFurnitureList;
} }
@Override
public void prepareForChecking() {
super.prepareForChecking();
for (Installation bi : buildingInstallations) {
bi.prepareForChecking();
}
for (BoundarySurface bs : boundarySurfaceList) {
bs.prepareForChecking();
}
for (BuildingRoom br : buildingRooms) {
br.prepareForChecking();
}
for (BuildingRoomFurniture bfr : buildingRoomFurnitureList) {
bfr.prepareForChecking();
}
}
@Override
public void clearMetaInformation() {
super.clearMetaInformation();
for (Installation bi : buildingInstallations) {
bi.clearMetaInformation();
}
for (BoundarySurface bs : boundarySurfaceList) {
bs.clearMetaInformation();
}
for (BuildingRoom br : buildingRooms) {
br.clearMetaInformation();
}
for (BuildingRoomFurniture bfr : buildingRoomFurnitureList) {
bfr.clearMetaInformation();
}
}
@Override
public void collectInstances(CopyHandler handler) {
super.collectInstances(handler);
handler.addInstance(boundarySurfaceList);
handler.addInstance(buildingInstallations);
handler.addInstance(buildingRooms);
handler.addInstance(buildingRoomFurnitureList);
}
@Override
public void fillValues(Copyable original, CopyHandler handler) {
super.fillValues(original, handler);
AbstractBuildingSubdivision originalAbs = (AbstractBuildingSubdivision) original;
for (BoundarySurface originalBs : originalAbs.boundarySurfaceList) {
boundarySurfaceList.add(handler.getCopyInstance(originalBs));
}
for (Installation originalBi : originalAbs.buildingInstallations) {
buildingInstallations.add(handler.getCopyInstance(originalBi));
}
for (BuildingRoom originalBr : originalAbs.buildingRooms) {
buildingRooms.add(handler.getCopyInstance(originalBr));
}
for (BuildingRoomFurniture originalBFR : originalAbs.buildingRoomFurnitureList) {
buildingRoomFurnitureList.add(handler.getCopyInstance(originalBFR));
}
abs = originalAbs.abs;
}
} }
package de.hft.stuttgart.citydoctor2.datastructure; package de.hft.stuttgart.citydoctor2.datastructure;
import de.hft.stuttgart.citydoctor2.check.Check; 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 javafx.scene.paint.Color;
import de.hft.stuttgart.citydoctor2.utils.Copyable;
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;
...@@ -42,51 +40,6 @@ public abstract class AbstractFurniture extends CityObject { ...@@ -42,51 +40,6 @@ public abstract class AbstractFurniture extends CityObject {
} }
} }
@Override
public void collectContainedErrors(List<CheckError> errors) {
super.collectContainedErrors(errors);
for (BoundarySurface boundarySurface : boundarySurfaceList) {
boundarySurface.collectContainedErrors(errors);
}
}
@Override
public void clearAllContainedCheckResults() {
super.clearAllContainedCheckResults();
for (BoundarySurface boundarySurface : boundarySurfaceList) {
boundarySurface.clearAllContainedCheckResults();
}
}
@Override
public boolean containsError(CheckId checkIdentifier) {
boolean hasError = super.containsError(checkIdentifier);
if (hasError) {
return true;
}
for (BoundarySurface boundarySurface : boundarySurfaceList) {
if (boundarySurface.containsError(checkIdentifier)) {
return true;
}
}
return false;
}
@Override
public boolean containsAnyError() {
boolean hasError = super.containsAnyError();
if (hasError) {
return true;
}
for (BoundarySurface boundarySurface : boundarySurfaceList) {
if (boundarySurface.containsAnyError()) {
return true;
}
}
return false;
}
@Override @Override
public org.citygml4j.core.model.construction.AbstractFurniture getGmlObject() { public org.citygml4j.core.model.construction.AbstractFurniture getGmlObject() {
return af; return af;
...@@ -94,7 +47,7 @@ public abstract class AbstractFurniture extends CityObject { ...@@ -94,7 +47,7 @@ public abstract class AbstractFurniture extends CityObject {
@Override @Override
public CityObject getTopLevelCityObject(){ public CityObject getTopLevelCityObject(){
return parent; return parent.getTopLevelCityObject();
} }
public void addBoundarySurface(BoundarySurface boundarySurface) { public void addBoundarySurface(BoundarySurface boundarySurface) {
...@@ -102,12 +55,12 @@ public abstract class AbstractFurniture extends CityObject { ...@@ -102,12 +55,12 @@ public abstract class AbstractFurniture extends CityObject {
boundarySurface.setParent(this); boundarySurface.setParent(this);
} }
public List<BoundarySurface> getBoundarySurfaceList() { public List<BoundarySurface> getBoundarySurfaces() {
return boundarySurfaceList; return boundarySurfaceList;
} }
@Override @Override
public void reCreateGeometries(GeometryFactory factory, ParserConfiguration config) { public void rebuildGeometries(GeometryFactory factory, ParserConfiguration config) {
for (Geometry geom : getGeometries()) { for (Geometry geom : getGeometries()) {
if (geom instanceof ImplicitGeometryHolder) { if (geom instanceof ImplicitGeometryHolder) {
continue; continue;
...@@ -134,6 +87,11 @@ public abstract class AbstractFurniture extends CityObject { ...@@ -134,6 +87,11 @@ public abstract class AbstractFurniture extends CityObject {
return parent; return parent;
} }
@Override
public Color getRenderColor() {
return parent.getRenderColor();
}
@Override @Override
public void unsetGmlGeometries() { public void unsetGmlGeometries() {
af.setLod0MultiSurface(null); af.setLod0MultiSurface(null);
...@@ -177,32 +135,9 @@ public abstract class AbstractFurniture extends CityObject { ...@@ -177,32 +135,9 @@ public abstract class AbstractFurniture extends CityObject {
} }
@Override
public void prepareForChecking() {
super.prepareForChecking();
for (BoundarySurface boundarySurface : boundarySurfaceList) {
boundarySurface.prepareForChecking();
}
}
@Override
public void clearMetaInformation() {
super.clearMetaInformation();
for (BoundarySurface boundarySurface : boundarySurfaceList) {
boundarySurface.clearMetaInformation();
}
}
@Override @Override
public FeatureType getFeatureType() { public FeatureType getFeatureType() {
return FeatureType.FURNITURE; return FeatureType.FURNITURE;
} }
@Override
public void fillValues(Copyable original, CopyHandler handler) {
super.fillValues(original, handler);
AbstractFurniture originalAf = (AbstractFurniture) original;
af = originalAf.af;
}
} }
package de.hft.stuttgart.citydoctor2.datastructure; package de.hft.stuttgart.citydoctor2.datastructure;
import de.hft.stuttgart.citydoctor2.check.Check; 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 org.citygml4j.core.model.core.AbstractCityObject; import org.citygml4j.core.model.core.AbstractCityObject;
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;
...@@ -27,7 +23,7 @@ public abstract class AbstractRoom extends CityObject { ...@@ -27,7 +23,7 @@ public abstract class AbstractRoom extends CityObject {
private static final long serialVersionUID = -1730625513988944329L; private static final long serialVersionUID = -1730625513988944329L;
private final List<Installation> roomInstallations = new ArrayList<>(2); private final List<Installation> roomInstallations = new ArrayList<>(2);
// Rooms have a Href list of furniture, the actual object is saved in the Building // Rooms have a Href list of furniture, the furniture-objects are saved in the TopLevelFeature
private final List<BoundarySurface> boundarySurfaceList = new ArrayList<>(); private final List<BoundarySurface> boundarySurfaceList = new ArrayList<>();
...@@ -50,67 +46,7 @@ public abstract class AbstractRoom extends CityObject { ...@@ -50,67 +46,7 @@ public abstract class AbstractRoom extends CityObject {
} }
@Override @Override
public void collectContainedErrors(List<CheckError> errors) { public void rebuildGeometries(GeometryFactory factory, ParserConfiguration config) {
super.collectContainedErrors(errors);
for (Installation roomInstallation : roomInstallations) {
roomInstallation.collectContainedErrors(errors);
}
for (BoundarySurface boundarySurface : boundarySurfaceList) {
boundarySurface.collectContainedErrors(errors);
}
}
@Override
public void clearAllContainedCheckResults() {
super.clearAllContainedCheckResults();
for (Installation roomInstallation : roomInstallations) {
roomInstallation.clearAllContainedCheckResults();
}
for (BoundarySurface boundarySurface : boundarySurfaceList) {
boundarySurface.clearAllContainedCheckResults();
}
}
@Override
public boolean containsError(CheckId checkIdentifier) {
boolean hasError = super.containsError(checkIdentifier);
if (hasError) {
return true;
}
for (Installation roomInstallation : roomInstallations) {
if (roomInstallation.containsError(checkIdentifier)) {
return true;
}
}
for (BoundarySurface boundarySurface : boundarySurfaceList) {
if (boundarySurface.containsError(checkIdentifier)) {
return true;
}
}
return false;
}
@Override
public boolean containsAnyError() {
boolean hasError = super.containsAnyError();
if (hasError) {
return true;
}
for (Installation roomInstallation : roomInstallations) {
if (roomInstallation.containsAnyError()) {
return true;
}
}
for (BoundarySurface boundarySurface : boundarySurfaceList) {
if (boundarySurface.containsAnyError()) {
return true;
}
}
return false;
}
@Override
public void reCreateGeometries(GeometryFactory factory, ParserConfiguration config) {
for (Geometry geom : getGeometries()) { for (Geometry geom : getGeometries()) {
if (geom instanceof ImplicitGeometryHolder) { if (geom instanceof ImplicitGeometryHolder) {
continue; continue;
...@@ -123,12 +59,6 @@ public abstract class AbstractRoom extends CityObject { ...@@ -123,12 +59,6 @@ public abstract class AbstractRoom extends CityObject {
setSolidAccordingToLod(geom, solid); setSolidAccordingToLod(geom, solid);
} }
} }
for (BoundarySurface boundarySurface : boundarySurfaceList) {
boundarySurface.reCreateGeometries(factory, config);
}
for (Installation roomInstallation : roomInstallations) {
roomInstallation.reCreateGeometries(factory, config);
}
} }
...@@ -173,37 +103,8 @@ public abstract class AbstractRoom extends CityObject { ...@@ -173,37 +103,8 @@ public abstract class AbstractRoom extends CityObject {
cgmlRoom.setLod1Solid(null); cgmlRoom.setLod1Solid(null);
cgmlRoom.setLod2Solid(null); cgmlRoom.setLod2Solid(null);
cgmlRoom.setLod3Solid(null); cgmlRoom.setLod3Solid(null);
for (Installation roomInstallation : roomInstallations) {
roomInstallation.unsetGmlGeometries();
}
for (BoundarySurface boundarySurface : boundarySurfaceList) {
boundarySurface.unsetGmlGeometries();
}
}
@Override
public void prepareForChecking() {
super.prepareForChecking();
for (Installation roomInstallation : roomInstallations) {
roomInstallation.prepareForChecking();
}
for (BoundarySurface boundarySurface : boundarySurfaceList) {
boundarySurface.prepareForChecking();
}
} }
@Override
public void clearMetaInformation() {
super.clearMetaInformation();
for (Installation roomInstallation : roomInstallations) {
roomInstallation.clearMetaInformation();
}
for (BoundarySurface boundarySurface : boundarySurfaceList) {
boundarySurface.clearMetaInformation();
}
}
@Override @Override
public AbstractCityObject getGmlObject() { public AbstractCityObject getGmlObject() {
return cgmlRoom; return cgmlRoom;
...@@ -235,24 +136,4 @@ public abstract class AbstractRoom extends CityObject { ...@@ -235,24 +136,4 @@ public abstract class AbstractRoom extends CityObject {
return FeatureType.ROOM; return FeatureType.ROOM;
} }
@Override
public void collectInstances(CopyHandler handler) {
super.collectInstances(handler);
handler.addInstance(roomInstallations);
handler.addInstance(boundarySurfaceList);
}
@Override
public void fillValues(Copyable original, CopyHandler handler) {
super.fillValues(original, handler);
AbstractRoom originalAr = (AbstractRoom) original;
for (BoundarySurface originalBs : originalAr.boundarySurfaceList) {
boundarySurfaceList.add(handler.getCopyInstance(originalBs));
}
for (Installation originalRi : originalAr.roomInstallations) {
roomInstallations.add(handler.getCopyInstance(originalRi));
}
cgmlRoom = originalAr.cgmlRoom;
}
} }
package de.hft.stuttgart.citydoctor2.datastructure; package de.hft.stuttgart.citydoctor2.datastructure;
import de.hft.stuttgart.citydoctor2.check.Check; 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 javafx.scene.paint.Color;
import de.hft.stuttgart.citydoctor2.utils.Copyable;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.citygml4j.core.model.core.AbstractSpaceBoundaryProperty; import org.citygml4j.core.model.core.AbstractSpaceBoundaryProperty;
...@@ -54,39 +51,27 @@ public abstract class AbstractTunnel extends CityObject { ...@@ -54,39 +51,27 @@ public abstract class AbstractTunnel extends CityObject {
return FeatureType.TUNNEL; return FeatureType.TUNNEL;
} }
@Override
public Color getRenderColor() {
return Color.SLATEGRAY;
}
@Override @Override
public void unsetGmlGeometries() { public void unsetGmlGeometries() {
at.setLod1Solid(null); at.setLod1Solid(null);
at.setLod2Solid(null); at.setLod2Solid(null);
at.setLod3Solid(null); at.setLod3Solid(null);
at.getDeprecatedProperties().setLod4Solid(null);
at.setLod0MultiSurface(null);
at.getDeprecatedProperties().setLod1MultiSurface(null);
at.setLod2MultiSurface(null); at.setLod2MultiSurface(null);
at.setLod3MultiSurface(null); at.setLod3MultiSurface(null);
at.getDeprecatedProperties().setLod1MultiSurface(null);
at.getDeprecatedProperties().setLod4MultiSurface(null); at.getDeprecatedProperties().setLod4MultiSurface(null);
at.getDeprecatedProperties().setLod4Solid(null);
for (BoundarySurface bs : boundarySurfaceList) {
bs.unsetGmlGeometries();
}
for (Installation bi : tunnelInstallations) {
bi.unsetGmlGeometries();
}
for (TunnelHollow th : tunnelHollows) {
th.unsetGmlGeometries();
}
for (TunnelFurniture tfr : tunnelFurnitureList) {
tfr.unsetGmlGeometries();
}
for (TunnelConstructiveElement te : tunnelConstructiveElements) {
te.unsetGmlGeometries();
}
for (TunnelPart tp : tunnelParts) {
tp.unsetGmlGeometries();
}
} }
@Override @Override
public void reCreateGeometries(GeometryFactory factory, ParserConfiguration config) { public void rebuildGeometries(GeometryFactory factory, ParserConfiguration config) {
for (Geometry geom : getGeometries()) { for (Geometry geom : getGeometries()) {
if (geom instanceof ImplicitGeometryHolder) { if (geom instanceof ImplicitGeometryHolder) {
continue; continue;
...@@ -99,38 +84,21 @@ public abstract class AbstractTunnel extends CityObject { ...@@ -99,38 +84,21 @@ public abstract class AbstractTunnel extends CityObject {
setSolidAccordingToLod(geom, solid); setSolidAccordingToLod(geom, solid);
} }
} }
for (BoundarySurface bs : boundarySurfaceList) { removeEmptyBoundarySurfaces();
reCreateBoundarySurface(factory, config, bs);
}
for (Installation bi : tunnelInstallations) {
bi.reCreateGeometries(factory, config);
}
for (TunnelHollow th : tunnelHollows) {
th.reCreateGeometries(factory, config);
}
for (TunnelFurniture tfr : tunnelFurnitureList) {
tfr.reCreateGeometries(factory, config);
}
for (TunnelConstructiveElement te : tunnelConstructiveElements) {
te.reCreateGeometries(factory, config);
}
for (TunnelPart tp : tunnelParts) {
tp.reCreateGeometries(factory, config);
}
} }
private void reCreateBoundarySurface(GeometryFactory factory, ParserConfiguration config, BoundarySurface bs) { private void removeEmptyBoundarySurfaces() {
if (bs.getGeometries().isEmpty()) { for (BoundarySurface bs : boundarySurfaceList) {
for (AbstractSpaceBoundaryProperty bsp : at.getBoundaries()) { if (bs.getGeometries().isEmpty()) {
if (bsp.getObject() != null && bsp.getObject() == bs.getGmlObject()) { for (AbstractSpaceBoundaryProperty bsp : at.getBoundaries()) {
logger.warn("Found empty boundary surface: {}, removing from building", bs.getGmlId()); if (bsp.getObject() != null && bsp.getObject() == bs.getGmlObject()) {
at.getBoundaries().remove(bsp); logger.warn("Found empty boundary surface: {}, removing from tunnel", bs.getGmlId());
break; at.getBoundaries().remove(bsp);
break;
}
} }
} }
return;
} }
bs.reCreateGeometries(factory, config);
} }
private void setMultiSurfaceAccordingToLod(Geometry geom, MultiSurface ms) { private void setMultiSurfaceAccordingToLod(Geometry geom, MultiSurface ms) {
...@@ -200,129 +168,6 @@ public abstract class AbstractTunnel extends CityObject { ...@@ -200,129 +168,6 @@ public abstract class AbstractTunnel extends CityObject {
} }
} }
@Override
public void collectContainedErrors(List<CheckError> errors) {
super.collectContainedErrors(errors);
for (Installation bi : tunnelInstallations) {
bi.collectContainedErrors(errors);
}
for (BoundarySurface bs : boundarySurfaceList) {
bs.collectContainedErrors(errors);
}
for (TunnelHollow th : tunnelHollows) {
th.collectContainedErrors(errors);
}
for (TunnelFurniture tfr : tunnelFurnitureList) {
tfr.collectContainedErrors(errors);
}
for (TunnelConstructiveElement te : tunnelConstructiveElements) {
te.collectContainedErrors(errors);
}
for (TunnelPart tp : tunnelParts) {
tp.collectContainedErrors(errors);
}
}
@Override
public void clearAllContainedCheckResults() {
super.clearAllContainedCheckResults();
for (Installation bi : tunnelInstallations) {
bi.clearAllContainedCheckResults();
}
for (BoundarySurface bs : boundarySurfaceList) {
bs.clearAllContainedCheckResults();
}
for (TunnelHollow th : tunnelHollows) {
th.clearAllContainedCheckResults();
}
for (TunnelFurniture tfr : tunnelFurnitureList) {
tfr.clearAllContainedCheckResults();
}
for (TunnelConstructiveElement te : tunnelConstructiveElements) {
te.clearAllContainedCheckResults();
}
for (TunnelPart tp : tunnelParts) {
tp.clearAllContainedCheckResults();
}
}
@Override
public boolean containsError(CheckId checkIdentifier) {
boolean hasError = super.containsError(checkIdentifier);
if (hasError) {
return true;
}
for (Installation bi : tunnelInstallations) {
if (bi.containsError(checkIdentifier)) {
return true;
}
}
for (BoundarySurface bs : boundarySurfaceList) {
if (bs.containsError(checkIdentifier)) {
return true;
}
}
for (TunnelHollow th : tunnelHollows) {
if (th.containsError(checkIdentifier)) {
return true;
}
}
for (TunnelFurniture tfr : tunnelFurnitureList) {
if (tfr.containsError(checkIdentifier)) {
return true;
}
}
for (TunnelConstructiveElement te : tunnelConstructiveElements) {
if (te.containsError(checkIdentifier)) {
return true;
}
}
for (TunnelPart tp : tunnelParts) {
if (tp.containsError(checkIdentifier)) {
return true;
}
}
return false;
}
@Override
public boolean containsAnyError() {
boolean hasError = super.containsAnyError();
if (hasError) {
return true;
}
for (Installation bi : tunnelInstallations) {
if (bi.containsAnyError()) {
return true;
}
}
for (BoundarySurface bs : boundarySurfaceList) {
if (bs.containsAnyError()) {
return true;
}
}
for (TunnelHollow th : tunnelHollows) {
if (th.containsAnyError()) {
return true;
}
}
for (TunnelFurniture tfr : tunnelFurnitureList) {
if (tfr.containsAnyError()) {
return true;
}
}
for (TunnelConstructiveElement te : tunnelConstructiveElements) {
if (te.containsAnyError()) {
return true;
}
}
for (TunnelPart tp : tunnelParts) {
if (tp.containsAnyError()) {
return true;
}
}
return false;
}
void setCityGmlBuilding(org.citygml4j.core.model.tunnel.AbstractTunnel at) { void setCityGmlBuilding(org.citygml4j.core.model.tunnel.AbstractTunnel at) {
this.at = at; this.at = at;
...@@ -381,85 +226,4 @@ public abstract class AbstractTunnel extends CityObject { ...@@ -381,85 +226,4 @@ public abstract class AbstractTunnel extends CityObject {
return tunnelConstructiveElements; return tunnelConstructiveElements;
} }
@Override
public void prepareForChecking() {
super.prepareForChecking();
for (Installation bi : tunnelInstallations) {
bi.prepareForChecking();
}
for (BoundarySurface bs : boundarySurfaceList) {
bs.prepareForChecking();
}
for (TunnelHollow th : tunnelHollows) {
th.prepareForChecking();
}
for (TunnelFurniture tfr : tunnelFurnitureList) {
tfr.prepareForChecking();
}
for (TunnelConstructiveElement te : tunnelConstructiveElements) {
te.prepareForChecking();
}
for (TunnelPart tp : tunnelParts) {
tp.prepareForChecking();
}
}
@Override
public void clearMetaInformation() {
super.clearMetaInformation();
for (Installation bi : tunnelInstallations) {
bi.clearMetaInformation();
}
for (BoundarySurface bs : boundarySurfaceList) {
bs.clearMetaInformation();
}
for (TunnelHollow th : tunnelHollows) {
th.clearMetaInformation();
}
for (TunnelFurniture tfr : tunnelFurnitureList) {
tfr.clearMetaInformation();
}
for (TunnelConstructiveElement te : tunnelConstructiveElements) {
te.clearMetaInformation();
}
for (TunnelPart tp : tunnelParts) {
tp.clearMetaInformation();
}
}
@Override
public void collectInstances(CopyHandler handler) {
super.collectInstances(handler);
handler.addInstance(boundarySurfaceList);
handler.addInstance(tunnelInstallations);
handler.addInstance(tunnelHollows);
handler.addInstance(tunnelFurnitureList);
handler.addInstance(tunnelConstructiveElements);
handler.addInstance(tunnelParts);
}
@Override
public void fillValues(Copyable original, CopyHandler handler) {
super.fillValues(original, handler);
AbstractTunnel originalAt = (AbstractTunnel) original;
for (BoundarySurface originalBs : originalAt.boundarySurfaceList) {
boundarySurfaceList.add(handler.getCopyInstance(originalBs));
}
for (Installation originalTi : originalAt.tunnelInstallations) {
tunnelInstallations.add(handler.getCopyInstance(originalTi));
}
for (TunnelHollow originalTh : originalAt.tunnelHollows) {
tunnelHollows.add(handler.getCopyInstance(originalTh));
}
for (TunnelFurniture originalTFR : originalAt.tunnelFurnitureList) {
tunnelFurnitureList.add(handler.getCopyInstance(originalTFR));
}
for (TunnelConstructiveElement originalTE : originalAt.tunnelConstructiveElements) {
tunnelConstructiveElements.add(handler.getCopyInstance(originalTE));
}
for (TunnelPart originalTp : originalAt.tunnelParts) {
tunnelParts.add(handler.getCopyInstance(originalTp));
}
at = originalAt.at;
}
} }
...@@ -19,17 +19,13 @@ ...@@ -19,17 +19,13 @@
package de.hft.stuttgart.citydoctor2.datastructure; package de.hft.stuttgart.citydoctor2.datastructure;
import de.hft.stuttgart.citydoctor2.check.Check; 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 javafx.scene.paint.Color;
import de.hft.stuttgart.citydoctor2.utils.Copyable;
import org.citygml4j.core.model.core.AbstractThematicSurface; import org.citygml4j.core.model.core.AbstractThematicSurface;
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;
import java.io.Serial; import java.io.Serial;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -87,7 +83,27 @@ public class BoundarySurface extends CityObject { ...@@ -87,7 +83,27 @@ public class BoundarySurface extends CityObject {
} }
@Override @Override
public void reCreateGeometries(GeometryFactory factory, ParserConfiguration config) { public String getDisplayText() {
return String.format("[%s] %s", this.type.name(), this.getGmlId().toString());
}
@Override
public Color getRenderColor() {
return switch (type) {
case ROOF -> Color.RED;
case GROUND -> Color.KHAKI;
default -> {
if (parent != null) {
yield parent.getRenderColor();
} else {
yield Color.WHITE;
}
}
};
}
@Override
public void rebuildGeometries(GeometryFactory factory, ParserConfiguration config) {
if (gmlObject.getId() == null) { if (gmlObject.getId() == null) {
gmlObject.setId(getGmlId().getGmlString()); gmlObject.setId(getGmlId().getGmlString());
} }
...@@ -104,9 +120,6 @@ public class BoundarySurface extends CityObject { ...@@ -104,9 +120,6 @@ public class BoundarySurface extends CityObject {
throw new IllegalStateException("BoundarySurfaces can only have MultiSurface geometries"); throw new IllegalStateException("BoundarySurfaces can only have MultiSurface geometries");
} }
} }
for (Opening o : openings) {
o.reCreateGeometries(factory, config);
}
} }
private void setGeometryAccordingToLod(Lod lod, MultiSurfaceProperty ms) { private void setGeometryAccordingToLod(Lod lod, MultiSurfaceProperty ms) {
...@@ -131,50 +144,6 @@ public class BoundarySurface extends CityObject { ...@@ -131,50 +144,6 @@ public class BoundarySurface extends CityObject {
} }
} }
@Override
public void clearAllContainedCheckResults() {
super.clearAllContainedCheckResults();
for (Opening o : openings) {
o.clearAllContainedCheckResults();
}
}
@Override
public void collectContainedErrors(List<CheckError> errors) {
super.collectContainedErrors(errors);
for (Opening o : openings) {
o.collectContainedErrors(errors);
}
}
@Override
public boolean containsAnyError() {
boolean hasError = super.containsAnyError();
if (hasError) {
return true;
}
for (Opening o : openings) {
if (o.containsAnyError()) {
return true;
}
}
return false;
}
@Override
public boolean containsError(CheckId checkIdentifier) {
boolean hasError = super.containsError(checkIdentifier);
if (hasError) {
return true;
}
for (Opening o : openings) {
if (o.containsError(checkIdentifier)) {
return true;
}
}
return false;
}
@Override @Override
public void accept(Check c) { public void accept(Check c) {
super.accept(c); super.accept(c);
...@@ -201,10 +170,6 @@ public class BoundarySurface extends CityObject { ...@@ -201,10 +170,6 @@ public class BoundarySurface extends CityObject {
gmlObject.setLod2MultiSurface(null); gmlObject.setLod2MultiSurface(null);
gmlObject.setLod3MultiSurface(null); gmlObject.setLod3MultiSurface(null);
gmlObject.getDeprecatedProperties().setLod4MultiSurface(null); gmlObject.getDeprecatedProperties().setLod4MultiSurface(null);
for (Opening o : openings) {
o.unsetGmlGeometries();
}
} }
@Override @Override
...@@ -244,48 +209,4 @@ public class BoundarySurface extends CityObject { ...@@ -244,48 +209,4 @@ public class BoundarySurface extends CityObject {
openings.add(opening); openings.add(opening);
opening.setPartOfSurface(this); opening.setPartOfSurface(this);
} }
@Override
public void prepareForChecking() {
super.prepareForChecking();
for (Opening o : openings) {
o.prepareForChecking();
}
}
@Override
public void clearMetaInformation() {
super.clearMetaInformation();
for (Opening o : openings) {
o.clearMetaInformation();
}
}
@Override
public Copyable createCopyInstance() {
return new BoundarySurface(gmlObject);
}
@Override
public void collectInstances(CopyHandler handler) {
super.collectInstances(handler);
for (Opening o : openings) {
handler.addInstance(o);
}
handler.addInstance(parent);
}
@Override
public void fillValues(Copyable original, CopyHandler handler) {
super.fillValues(original, handler);
BoundarySurface originalBs = (BoundarySurface) original;
featureType = originalBs.featureType;
type = originalBs.type;
for (Opening originalOpening : originalBs.openings) {
openings.add(handler.getCopyInstance(originalOpening));
}
parent = handler.getCopyInstance(originalBs.parent);
gmlObject = originalBs.gmlObject;
}
} }
...@@ -19,12 +19,9 @@ ...@@ -19,12 +19,9 @@
package de.hft.stuttgart.citydoctor2.datastructure; package de.hft.stuttgart.citydoctor2.datastructure;
import de.hft.stuttgart.citydoctor2.check.Check; 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 javafx.scene.paint.Color;
import de.hft.stuttgart.citydoctor2.utils.Copyable;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.citygml4j.core.model.core.AbstractSpaceBoundaryProperty; import org.citygml4j.core.model.core.AbstractSpaceBoundaryProperty;
...@@ -66,14 +63,13 @@ public class BridgeConstructiveElement extends CityObject { ...@@ -66,14 +63,13 @@ public class BridgeConstructiveElement extends CityObject {
return parent; return parent;
} }
@Override @Override
public Copyable createCopyInstance() { public Color getRenderColor() {
return new BridgeConstructiveElement(gmlBridgeElement); return parent.getRenderColor().brighter();
} }
@Override @Override
public void reCreateGeometries(GeometryFactory factory, ParserConfiguration config) { public void rebuildGeometries(GeometryFactory factory, ParserConfiguration config) {
// only handles CityGML2 for now // only handles CityGML2 for now
// unknown which CityGML is handled here // unknown which CityGML is handled here
// need context information to decide // need context information to decide
...@@ -96,9 +92,6 @@ public class BridgeConstructiveElement extends CityObject { ...@@ -96,9 +92,6 @@ public class BridgeConstructiveElement extends CityObject {
break; break;
} }
} }
for (BoundarySurface bs : boundarySurfaceList) {
reCreateBoundarySurface(factory, config, bs);
}
} }
@Override @Override
...@@ -112,50 +105,6 @@ public class BridgeConstructiveElement extends CityObject { ...@@ -112,50 +105,6 @@ public class BridgeConstructiveElement extends CityObject {
} }
} }
@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) { private void reCreateBoundarySurface(GeometryFactory factory, ParserConfiguration config, BoundarySurface bs) {
if (bs.getGeometries().isEmpty()) { if (bs.getGeometries().isEmpty()) {
for (AbstractSpaceBoundaryProperty bsp : gmlBridgeElement.getBoundaries()) { for (AbstractSpaceBoundaryProperty bsp : gmlBridgeElement.getBoundaries()) {
...@@ -248,9 +197,6 @@ public class BridgeConstructiveElement extends CityObject { ...@@ -248,9 +197,6 @@ 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
...@@ -272,35 +218,4 @@ public class BridgeConstructiveElement extends CityObject { ...@@ -272,35 +218,4 @@ public class BridgeConstructiveElement extends CityObject {
return boundarySurfaceList; 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));
}
}
} }
...@@ -19,12 +19,11 @@ ...@@ -19,12 +19,11 @@
package de.hft.stuttgart.citydoctor2.datastructure; package de.hft.stuttgart.citydoctor2.datastructure;
import de.hft.stuttgart.citydoctor2.check.Check; 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 javafx.scene.paint.Color;
import de.hft.stuttgart.citydoctor2.utils.Copyable; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
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.BridgeInstallation;
import org.citygml4j.core.model.bridge.BridgeInstallationProperty; import org.citygml4j.core.model.bridge.BridgeInstallationProperty;
...@@ -48,6 +47,9 @@ public class BridgeObject extends CityObject { ...@@ -48,6 +47,9 @@ public class BridgeObject extends CityObject {
@Serial @Serial
private static final long serialVersionUID = 6301112640328373842L; private static final long serialVersionUID = 6301112640328373842L;
private static final Logger logger = LogManager.getLogger(BridgeObject.class);
private final List<BridgeObject> parts = new ArrayList<>(2); private final List<BridgeObject> parts = new ArrayList<>(2);
private final List<BridgeConstructiveElement> elements = new ArrayList<>(2); private final List<BridgeConstructiveElement> elements = new ArrayList<>(2);
private final List<BoundarySurface> boundarySurfaces = new ArrayList<>(2); private final List<BoundarySurface> boundarySurfaces = new ArrayList<>(2);
...@@ -98,7 +100,12 @@ public class BridgeObject extends CityObject { ...@@ -98,7 +100,12 @@ public class BridgeObject extends CityObject {
} }
@Override @Override
public void reCreateGeometries(GeometryFactory factory, ParserConfiguration config) { public Color getRenderColor() {
return Color.LIGHTSTEELBLUE;
}
@Override
public void rebuildGeometries(GeometryFactory factory, ParserConfiguration config) {
for (Geometry geom : getGeometries()) { for (Geometry geom : getGeometries()) {
if (geom instanceof ImplicitGeometryHolder) { if (geom instanceof ImplicitGeometryHolder) {
continue; continue;
...@@ -111,29 +118,28 @@ public class BridgeObject extends CityObject { ...@@ -111,29 +118,28 @@ public class BridgeObject extends CityObject {
setSolidAccordingToLod(geom, solid); setSolidAccordingToLod(geom, solid);
} }
} }
removeEmptyBoundarySurfaces();
}
private void removeEmptyBoundarySurfaces() {
for (BoundarySurface bs : boundarySurfaces) { for (BoundarySurface bs : boundarySurfaces) {
bs.reCreateGeometries(factory, config); if (bs.getGeometries().isEmpty()) {
} for (AbstractSpaceBoundaryProperty bsp : ab.getBoundaries()) {
for (Installation bi : bridgeInstallations) { if (bsp.getObject() != null && bsp.getObject() == bs.getGmlObject()) {
bi.reCreateGeometries(factory, config); logger.warn("Found empty boundary surface: {}, removing from bridge", bs.getGmlId());
} ab.getBoundaries().remove(bsp);
for (BridgeObject part : parts) { break;
part.reCreateGeometries(factory, config); }
} }
for (BridgeConstructiveElement ele : elements) { }
ele.reCreateGeometries(factory, config);
}
for (BridgeRoom br : bridgeRooms) {
br.reCreateGeometries(factory, config);
}
for (BridgeRoomFurniture bri : bridgeFurniture) {
bri.reCreateGeometries(factory, config);
} }
} }
private void setMultiSurfaceAccordingToLod(Geometry geom, MultiSurface ms) { private void setMultiSurfaceAccordingToLod(Geometry geom, MultiSurface ms) {
switch (geom.getLod()) { switch (geom.getLod()) {
case LOD0:
ab.setLod0MultiSurface(new MultiSurfaceProperty(ms));
break;
case LOD1: case LOD1:
ab.getDeprecatedProperties().setLod1MultiSurface(new MultiSurfaceProperty(ms)); ab.getDeprecatedProperties().setLod1MultiSurface(new MultiSurfaceProperty(ms));
break; break;
...@@ -184,147 +190,6 @@ public class BridgeObject extends CityObject { ...@@ -184,147 +190,6 @@ public class BridgeObject extends CityObject {
furniture.setParent(this); furniture.setParent(this);
} }
@Override
public void clearAllContainedCheckResults() {
super.clearAllContainedCheckResults();
for (BoundarySurface bs : boundarySurfaces) {
bs.clearAllContainedCheckResults();
}
for (Installation bi : bridgeInstallations) {
bi.clearAllContainedCheckResults();
}
for (BridgeObject part : parts) {
part.clearAllContainedCheckResults();
}
for (BridgeConstructiveElement ele : elements) {
ele.clearAllContainedCheckResults();
}
for (BridgeRoom br : bridgeRooms) {
br.clearAllContainedCheckResults();
}
for (BridgeRoomFurniture bri : bridgeFurniture) {
bri.clearAllContainedCheckResults();
}
}
@Override
public void collectContainedErrors(List<CheckError> errors) {
super.collectContainedErrors(errors);
for (BoundarySurface bs : boundarySurfaces) {
bs.collectContainedErrors(errors);
}
for (Installation bi : bridgeInstallations) {
bi.collectContainedErrors(errors);
}
for (BridgeObject part : parts) {
part.collectContainedErrors(errors);
}
for (BridgeConstructiveElement ele : elements) {
ele.collectContainedErrors(errors);
}
for (BridgeRoom br : bridgeRooms) {
br.collectContainedErrors(errors);
}
for (BridgeRoomFurniture bri : bridgeFurniture) {
bri.collectContainedErrors(errors);
}
}
@Override
public boolean containsAnyError() {
boolean hasError = super.containsAnyError();
if (hasError) {
return true;
}
for (Installation bi : bridgeInstallations) {
if (bi.containsAnyError()) {
return true;
}
}
for (BoundarySurface bs : boundarySurfaces) {
if (bs.containsAnyError()) {
return true;
}
}
if (doPartsContainAnyError()) {
return true;
}
for (BridgeConstructiveElement ele : elements) {
if (ele.containsAnyError()) {
return true;
}
}
for (BridgeRoom br : bridgeRooms) {
if (br.containsAnyError()) {
return true;
}
}
for (BridgeRoomFurniture bri : bridgeFurniture) {
if (bri.containsAnyError()) {
return true;
}
}
return false;
}
private boolean doPartsContainAnyError() {
for (BridgeObject part : parts) {
if (part.containsAnyError()) {
return true;
}
}
return false;
}
@Override
public boolean containsError(CheckId checkIdentifier) {
boolean hasError = super.containsError(checkIdentifier);
if (hasError) {
return true;
}
for (Installation bi : bridgeInstallations) {
if (bi.containsError(checkIdentifier)) {
return true;
}
}
for (BoundarySurface bs : boundarySurfaces) {
if (bs.containsError(checkIdentifier)) {
return true;
}
}
if (doPartsContainError(checkIdentifier)) {
return true;
}
for (BridgeConstructiveElement ele : elements) {
if (ele.containsError(checkIdentifier)) {
return true;
}
}
for (BridgeRoom br : bridgeRooms) {
if (br.containsError(checkIdentifier)) {
return true;
}
}
for (BridgeRoomFurniture bri : bridgeFurniture) {
if (bri.containsError(checkIdentifier)) {
return true;
}
}
return false;
}
private boolean doPartsContainError(CheckId checkIdentifier) {
for (BridgeObject part : parts) {
if (part.containsError(checkIdentifier)) {
return true;
}
}
return false;
}
@Override @Override
public void accept(Check c) { public void accept(Check c) {
super.accept(c); super.accept(c);
...@@ -389,29 +254,12 @@ public class BridgeObject extends CityObject { ...@@ -389,29 +254,12 @@ public class BridgeObject extends CityObject {
ab.setLod1Solid(null); ab.setLod1Solid(null);
ab.setLod2Solid(null); ab.setLod2Solid(null);
ab.setLod3Solid(null); ab.setLod3Solid(null);
ab.getDeprecatedProperties().setLod4Solid(null);
ab.setLod0MultiSurface(null);
ab.getDeprecatedProperties().setLod1MultiSurface(null);
ab.setLod2MultiSurface(null); ab.setLod2MultiSurface(null);
ab.setLod3MultiSurface(null); ab.setLod3MultiSurface(null);
ab.getDeprecatedProperties().setLod1MultiSurface(null);
ab.getDeprecatedProperties().setLod4MultiSurface(null); ab.getDeprecatedProperties().setLod4MultiSurface(null);
ab.getDeprecatedProperties().setLod4Solid(null);
for (BoundarySurface bs : boundarySurfaces) {
bs.unsetGmlGeometries();
}
for (Installation bi : bridgeInstallations) {
bi.unsetGmlGeometries();
}
for (BridgeObject part : parts) {
part.unsetGmlGeometries();
}
for (BridgeConstructiveElement ele : elements) {
ele.unsetGmlGeometries();
}
for (BridgeRoom br : bridgeRooms) {
br.unsetGmlGeometries();
}
for (BridgeRoomFurniture bri : bridgeFurniture) {
bri.unsetGmlGeometries();
}
} }
...@@ -428,89 +276,6 @@ public class BridgeObject extends CityObject { ...@@ -428,89 +276,6 @@ public class BridgeObject extends CityObject {
return "BridgeObject [type=" + type + ", id=" + getGmlId() + "]"; return "BridgeObject [type=" + type + ", id=" + getGmlId() + "]";
} }
@Override
public void prepareForChecking() {
super.prepareForChecking();
for (BridgeConstructiveElement e : elements) {
e.prepareForChecking();
}
for (BridgeObject part : parts) {
part.prepareForChecking();
}
for (BoundarySurface bs : boundarySurfaces) {
bs.prepareForChecking();
}
for (Installation bi : bridgeInstallations) {
bi.prepareForChecking();
}
for (BridgeObject part : parts) {
part.prepareForChecking();
}
for (BridgeRoom br : bridgeRooms) {
br.prepareForChecking();
}
for (BridgeRoomFurniture bri : bridgeFurniture) {
bri.prepareForChecking();
}
}
@Override
public void clearMetaInformation() {
super.clearMetaInformation();
for (BoundarySurface bs : boundarySurfaces) {
bs.clearMetaInformation();
}
for (Installation bi : bridgeInstallations) {
bi.clearMetaInformation();
}
for (BridgeObject part : parts) {
part.clearMetaInformation();
}
for (BridgeConstructiveElement ele : elements) {
ele.clearMetaInformation();
}
for (BridgeRoom br : bridgeRooms) {
br.clearMetaInformation();
}
for (BridgeRoomFurniture bri : bridgeFurniture) {
bri.clearMetaInformation();
}
}
@Override
public void collectInstances(CopyHandler handler) {
super.collectInstances(handler);
for (BoundarySurface bs : boundarySurfaces) {
handler.addInstance(bs);
}
for (Installation bi : bridgeInstallations) {
handler.addInstance(bi);
}
for (BridgeObject part : parts) {
handler.addInstance(part);
}
for (BridgeConstructiveElement ele : elements) {
handler.addInstance(ele);
}
for (BridgeRoom br : bridgeRooms) {
handler.addInstance(br);
}
for (BridgeRoomFurniture bri : bridgeFurniture) {
handler.addInstance(bri);
}
}
public void anonymize() { public void anonymize() {
for (Geometry geom : getGeometries()) { for (Geometry geom : getGeometries()) {
...@@ -529,36 +294,6 @@ public class BridgeObject extends CityObject { ...@@ -529,36 +294,6 @@ public class BridgeObject extends CityObject {
this.ab = gmlB; this.ab = gmlB;
} }
@Override
public void fillValues(Copyable original, CopyHandler handler) {
super.fillValues(original, handler);
BridgeObject originalBo = (BridgeObject) original;
for (BoundarySurface originalBs : originalBo.boundarySurfaces) {
boundarySurfaces.add(handler.getCopyInstance(originalBs));
}
for (Installation originalBi : originalBo.bridgeInstallations) {
bridgeInstallations.add(handler.getCopyInstance(originalBi));
}
for (BridgeObject part : originalBo.parts) {
getParts().add(handler.getCopyInstance(part));
}
for (BridgeConstructiveElement ele : originalBo.elements) {
getConstructiveElements().add(handler.getCopyInstance(ele));
}
for (BridgeRoom br : originalBo.bridgeRooms) {
getBridgeRooms().add(handler.getCopyInstance(br));
}
for (BridgeRoomFurniture bri : originalBo.bridgeFurniture) {
getBridgeFurniture().add(handler.getCopyInstance(bri));
}
}
public List<BoundarySurface> getBoundarySurfaces() { public List<BoundarySurface> getBoundarySurfaces() {
return boundarySurfaces; return boundarySurfaces;
} }
...@@ -568,11 +303,6 @@ public class BridgeObject extends CityObject { ...@@ -568,11 +303,6 @@ public class BridgeObject extends CityObject {
element.setParent(this); element.setParent(this);
} }
@Override
public Copyable createCopyInstance() {
return new BridgeObject(type, ab, parent);
}
public List<BridgeObject> getParts() { public List<BridgeObject> getParts() {
return parts; return parts;
} }
......
package de.hft.stuttgart.citydoctor2.datastructure; package de.hft.stuttgart.citydoctor2.datastructure;
import de.hft.stuttgart.citydoctor2.utils.CopyHandler; import javafx.scene.paint.Color;
import de.hft.stuttgart.citydoctor2.utils.Copyable;
import java.io.Serial; import java.io.Serial;
...@@ -30,26 +29,14 @@ public class BridgeRoom extends AbstractRoom { ...@@ -30,26 +29,14 @@ public class BridgeRoom extends AbstractRoom {
return parent; return parent;
} }
@Override
public void fillValues(Copyable original, CopyHandler handler) {
super.fillValues(original, handler);
BridgeRoom oRoom = (BridgeRoom) original;
parent = handler.getCopyInstance(oRoom.getParent());
}
@Override @Override
public CityObject getTopLevelCityObject() { public CityObject getTopLevelCityObject() {
return getParent(); return parent.getTopLevelCityObject();
} }
@Override @Override
public void collectInstances(CopyHandler handler) { public Color getRenderColor() {
super.collectInstances(handler); return parent.getRenderColor();
handler.addInstance(parent);
} }
@Override
public Copyable createCopyInstance() {
return new BridgeRoom();
}
} }
package de.hft.stuttgart.citydoctor2.datastructure; package de.hft.stuttgart.citydoctor2.datastructure;
import de.hft.stuttgart.citydoctor2.utils.Copyable;
import org.citygml4j.core.model.bridge.BridgeFurniture; import org.citygml4j.core.model.bridge.BridgeFurniture;
import java.io.Serial; import java.io.Serial;
...@@ -13,9 +12,4 @@ public class BridgeRoomFurniture extends AbstractFurniture { ...@@ -13,9 +12,4 @@ public class BridgeRoomFurniture extends AbstractFurniture {
public void setGmlObject(BridgeFurniture gmlObject) { public void setGmlObject(BridgeFurniture gmlObject) {
super.setGmlObject(gmlObject); super.setGmlObject(gmlObject);
} }
@Override
public Copyable createCopyInstance() {
return new BridgeRoomFurniture();
}
} }
...@@ -19,15 +19,9 @@ ...@@ -19,15 +19,9 @@
package de.hft.stuttgart.citydoctor2.datastructure; package de.hft.stuttgart.citydoctor2.datastructure;
import de.hft.stuttgart.citydoctor2.check.Check; 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.utils.CopyHandler;
import de.hft.stuttgart.citydoctor2.utils.Copyable;
import org.citygml4j.core.model.building.BuildingInstallation; 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 java.io.Serial; import java.io.Serial;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -44,13 +38,6 @@ public class Building extends AbstractBuilding { ...@@ -44,13 +38,6 @@ public class Building extends AbstractBuilding {
return buildingParts; return buildingParts;
} }
@Override
public void reCreateGeometries(GeometryFactory factory, ParserConfiguration config) {
super.reCreateGeometries(factory, config);
for (BuildingPart bp : buildingParts) {
bp.reCreateGeometries(factory, config);
}
}
@Override @Override
public CityObject getTopLevelCityObject() { public CityObject getTopLevelCityObject() {
...@@ -68,50 +55,6 @@ public class Building extends AbstractBuilding { ...@@ -68,50 +55,6 @@ public class Building extends AbstractBuilding {
} }
} }
@Override
public void clearAllContainedCheckResults() {
super.clearAllContainedCheckResults();
for (BuildingPart bp : buildingParts) {
bp.clearAllContainedCheckResults();
}
}
@Override
public void collectContainedErrors(List<CheckError> errors) {
super.collectContainedErrors(errors);
for (BuildingPart bp : buildingParts) {
bp.collectContainedErrors(errors);
}
}
@Override
public boolean containsAnyError() {
boolean hasError = super.containsAnyError();
if (hasError) {
return true;
}
for (BuildingPart bp : buildingParts) {
if (bp.containsAnyError()) {
return true;
}
}
return false;
}
@Override
public boolean containsError(CheckId checkIdentifier) {
boolean hasError = super.containsError(checkIdentifier);
if (hasError) {
return true;
}
for (BuildingPart bp : buildingParts) {
if (bp.containsError(checkIdentifier)) {
return true;
}
}
return false;
}
public void addBuildingPart(BuildingPart buildingPart) { public void addBuildingPart(BuildingPart buildingPart) {
buildingParts.add(buildingPart); buildingParts.add(buildingPart);
} }
...@@ -138,42 +81,4 @@ public class Building extends AbstractBuilding { ...@@ -138,42 +81,4 @@ public class Building extends AbstractBuilding {
setCityGmlBuilding(gmlB); setCityGmlBuilding(gmlB);
} }
@Override
public void clearMetaInformation() {
super.clearMetaInformation();
for (BuildingPart part : buildingParts) {
part.clearMetaInformation();
}
}
@Override
public void prepareForChecking() {
super.prepareForChecking();
for (BuildingPart part : buildingParts) {
part.prepareForChecking();
}
}
@Override
public void fillValues(Copyable original, CopyHandler handler) {
super.fillValues(original, handler);
Building originalBuilding = (Building) original;
for (BuildingPart originalBp : originalBuilding.buildingParts) {
buildingParts.add(handler.getCopyInstance(originalBp));
}
}
@Override
public void collectInstances(CopyHandler handler) {
super.collectInstances(handler);
for (BuildingPart bp : buildingParts) {
handler.addInstance(bp);
}
}
@Override
public Copyable createCopyInstance() {
return new Building();
}
} }
...@@ -18,9 +18,6 @@ ...@@ -18,9 +18,6 @@
*/ */
package de.hft.stuttgart.citydoctor2.datastructure; package de.hft.stuttgart.citydoctor2.datastructure;
import de.hft.stuttgart.citydoctor2.utils.CopyHandler;
import de.hft.stuttgart.citydoctor2.utils.Copyable;
import java.io.Serial; import java.io.Serial;
public class BuildingPart extends AbstractBuilding { public class BuildingPart extends AbstractBuilding {
...@@ -57,22 +54,4 @@ public class BuildingPart extends AbstractBuilding { ...@@ -57,22 +54,4 @@ public class BuildingPart extends AbstractBuilding {
return "BuildingPart [id=" + getGmlId() + "]"; return "BuildingPart [id=" + getGmlId() + "]";
} }
@Override
public void fillValues(Copyable original, CopyHandler handler) {
super.fillValues(original, handler);
BuildingPart originalPart = (BuildingPart) original;
parent = handler.getCopyInstance(originalPart.parent);
}
@Override
public void collectInstances(CopyHandler handler) {
super.collectInstances(handler);
handler.addInstance(parent);
}
@Override
public Copyable createCopyInstance() {
return new BuildingPart();
}
} }
package de.hft.stuttgart.citydoctor2.datastructure; package de.hft.stuttgart.citydoctor2.datastructure;
import de.hft.stuttgart.citydoctor2.utils.CopyHandler; import javafx.scene.paint.Color;
import de.hft.stuttgart.citydoctor2.utils.Copyable;
import org.citygml4j.core.model.building.BuildingFurnitureProperty; import org.citygml4j.core.model.building.BuildingFurnitureProperty;
import java.io.Serial; import java.io.Serial;
...@@ -42,27 +41,13 @@ public class BuildingRoom extends AbstractRoom { ...@@ -42,27 +41,13 @@ public class BuildingRoom extends AbstractRoom {
return parent; return parent;
} }
@Override
public void fillValues(Copyable original, CopyHandler handler) {
super.fillValues(original, handler);
BuildingRoom oRoom = (BuildingRoom) original;
parent = handler.getCopyInstance(oRoom.getParent());
}
@Override @Override
public CityObject getTopLevelCityObject() { public CityObject getTopLevelCityObject() {
return getParent().getTopLevelCityObject(); return getParent().getTopLevelCityObject();
} }
@Override @Override
public void collectInstances(CopyHandler handler) { public Color getRenderColor() {
super.collectInstances(handler); return parent.getRenderColor();
handler.addInstance(parent);
}
@Override
public Copyable createCopyInstance() {
return new BuildingRoom();
} }
} }
package de.hft.stuttgart.citydoctor2.datastructure; package de.hft.stuttgart.citydoctor2.datastructure;
import de.hft.stuttgart.citydoctor2.utils.Copyable;
import org.citygml4j.core.model.building.BuildingFurniture; import org.citygml4j.core.model.building.BuildingFurniture;
import java.io.Serial; import java.io.Serial;
...@@ -15,10 +14,5 @@ public class BuildingRoomFurniture extends AbstractFurniture { ...@@ -15,10 +14,5 @@ public class BuildingRoomFurniture extends AbstractFurniture {
super.setGmlObject(gmlObject); super.setGmlObject(gmlObject);
} }
@Override
public Copyable createCopyInstance() {
return new BuildingRoomFurniture();
}
} }
package de.hft.stuttgart.citydoctor2.datastructure; package de.hft.stuttgart.citydoctor2.datastructure;
import de.hft.stuttgart.citydoctor2.check.Check; 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.CopyHandler;
import de.hft.stuttgart.citydoctor2.utils.Copyable;
import org.citygml4j.core.util.geometry.GeometryFactory; import org.citygml4j.core.util.geometry.GeometryFactory;
import java.io.Serial; import java.io.Serial;
...@@ -19,28 +15,6 @@ public class BuildingUnit extends AbstractBuildingSubdivision { ...@@ -19,28 +15,6 @@ public class BuildingUnit extends AbstractBuildingSubdivision {
private final List<Storey> storeys = new ArrayList<>(); private final List<Storey> storeys = new ArrayList<>();
@Override
public Copyable createCopyInstance() {
return new BuildingUnit();
}
@Override
public void unsetGmlGeometries() {
super.unsetGmlGeometries();
for (Storey storey : storeys) {
storey.unsetGmlGeometries();
}
}
@Override
public void reCreateGeometries(GeometryFactory factory, ParserConfiguration config) {
super.reCreateGeometries(factory, config);
for (Storey storey : storeys) {
storey.reCreateGeometries(factory, config);
}
}
@Override @Override
public void accept(Check c) { public void accept(Check c) {
super.accept(c); super.accept(c);
...@@ -49,83 +23,7 @@ public class BuildingUnit extends AbstractBuildingSubdivision { ...@@ -49,83 +23,7 @@ public class BuildingUnit extends AbstractBuildingSubdivision {
} }
} }
@Override
public void collectContainedErrors(List<CheckError> errors) {
super.collectContainedErrors(errors);
for (Storey storey : storeys) {
storey.collectContainedErrors(errors);
}
}
@Override
public void clearAllContainedCheckResults() {
super.clearAllContainedCheckResults();
for (Storey storey : storeys) {
storey.clearAllContainedCheckResults();
}
}
@Override
public boolean containsError(CheckId checkIdentifier) {
boolean hasError = super.containsError(checkIdentifier);
if (hasError) {
return true;
}
for (Storey storey : storeys) {
if (storey.containsError(checkIdentifier)) {
return true;
}
}
return false;
}
@Override
public boolean containsAnyError() {
boolean hasError = super.containsAnyError();
if (hasError) {
return true;
}
for (Storey storey : storeys) {
if (storey.containsAnyError()) {
return true;
}
}
return false;
}
@Override
public void prepareForChecking() {
super.prepareForChecking();
for (Storey storey : storeys) {
storey.prepareForChecking();
}
}
@Override
public void clearMetaInformation() {
super.clearMetaInformation();
for (Storey storey : storeys) {
storey.clearMetaInformation();
}
}
@Override
public void collectInstances(CopyHandler handler) {
super.collectInstances(handler);
for (Storey storey : storeys) {
storey.collectInstances(handler);
}
}
@Override
public void fillValues(Copyable original, CopyHandler handler) {
super.fillValues(original, handler);
BuildingUnit originalBu = (BuildingUnit) original;
for (Storey storey : originalBu.storeys) {
storeys.add(handler.getCopyInstance(storey));
}
this.abs = originalBu.abs;
}
public List<Storey> getStoreys() { public List<Storey> getStoreys() {
return storeys; return storeys;
......
...@@ -3,8 +3,7 @@ package de.hft.stuttgart.citydoctor2.datastructure; ...@@ -3,8 +3,7 @@ package de.hft.stuttgart.citydoctor2.datastructure;
import de.hft.stuttgart.citydoctor2.check.Check; import de.hft.stuttgart.citydoctor2.check.Check;
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 javafx.scene.paint.Color;
import de.hft.stuttgart.citydoctor2.utils.Copyable;
import org.citygml4j.core.model.core.AbstractCityObject; import org.citygml4j.core.model.core.AbstractCityObject;
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;
...@@ -35,6 +34,11 @@ public class CityFurniture extends CityObject { ...@@ -35,6 +34,11 @@ public class CityFurniture extends CityObject {
return cgmlCityFurniture; return cgmlCityFurniture;
} }
@Override
public Color getRenderColor() {
return Color.THISTLE;
}
public void setGmlObject(org.citygml4j.core.model.cityfurniture.CityFurniture gmlCityFurniture) { public void setGmlObject(org.citygml4j.core.model.cityfurniture.CityFurniture gmlCityFurniture) {
cgmlCityFurniture = gmlCityFurniture; cgmlCityFurniture = gmlCityFurniture;
} }
...@@ -47,6 +51,9 @@ public class CityFurniture extends CityObject { ...@@ -47,6 +51,9 @@ public class CityFurniture extends CityObject {
cgmlCityFurniture.setLod1Solid(null); cgmlCityFurniture.setLod1Solid(null);
cgmlCityFurniture.setLod2Solid(null); cgmlCityFurniture.setLod2Solid(null);
cgmlCityFurniture.setLod3Solid(null); cgmlCityFurniture.setLod3Solid(null);
cgmlCityFurniture.getDeprecatedProperties().setLod1Geometry(null);
cgmlCityFurniture.getDeprecatedProperties().setLod2Geometry(null);
cgmlCityFurniture.getDeprecatedProperties().setLod3Geometry(null);
cgmlCityFurniture.getDeprecatedProperties().setLod4Geometry(null); cgmlCityFurniture.getDeprecatedProperties().setLod4Geometry(null);
} }
...@@ -56,7 +63,7 @@ public class CityFurniture extends CityObject { ...@@ -56,7 +63,7 @@ public class CityFurniture extends CityObject {
} }
@Override @Override
public void reCreateGeometries(GeometryFactory factory, ParserConfiguration config) { public void rebuildGeometries(GeometryFactory factory, ParserConfiguration config) {
for (Geometry geom : getGeometries()) { for (Geometry geom : getGeometries()) {
if (geom instanceof ImplicitGeometryHolder) { if (geom instanceof ImplicitGeometryHolder) {
continue; continue;
...@@ -116,15 +123,4 @@ public class CityFurniture extends CityObject { ...@@ -116,15 +123,4 @@ public class CityFurniture extends CityObject {
return FeatureType.CITY_FURNITURE; return FeatureType.CITY_FURNITURE;
} }
@Override
public Copyable createCopyInstance() {
return new CityFurniture();
}
@Override
public void fillValues(Copyable original, CopyHandler handler) {
super.fillValues(original, handler);
CityFurniture originalCF = (CityFurniture) original;
cgmlCityFurniture = originalCF.cgmlCityFurniture;
}
} }
Supports Markdown
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