Commit d1ff5020 authored by Beuster's avatar Beuster
Browse files

Merge remote-tracking branch 'origin/dev' into dev_cpp_code_conversion

parents 06ad5a8e b50c5f13
Pipeline #11130 passed with stage
in 1 minute and 28 seconds
...@@ -5,6 +5,21 @@ All notable changes to this project will be documented in this file. ...@@ -5,6 +5,21 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [3.17.2] (2025-06-05)
- Rework of AbstractCheck, allowing the implementation of Visitors that use the CheckEngine to traverse the internal
data model (#108)
- Reimplemented parsing of TINReliefs
- Fixed Tunnel features missing from the ErrorCollector and BBox calculatio
## [3.17.1] (2025-04-14)
### Fixes
- Fixed an oversight causing the CityDoctor CLI to ignore .xml files
## [3.17.0] (2025-03-13) ## [3.17.0] (2025-03-13)
### Added ### Added
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<parent> <parent>
<groupId>de.hft.stuttgart</groupId> <groupId>de.hft.stuttgart</groupId>
<artifactId>CityDoctorParent</artifactId> <artifactId>CityDoctorParent</artifactId>
<version>3.17.0</version> <version>3.17.2</version>
</parent> </parent>
<artifactId>CityDoctorCheckResult</artifactId> <artifactId>CityDoctorCheckResult</artifactId>
<dependencies> <dependencies>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<parent> <parent>
<groupId>de.hft.stuttgart</groupId> <groupId>de.hft.stuttgart</groupId>
<artifactId>CityDoctorParent</artifactId> <artifactId>CityDoctorParent</artifactId>
<version>3.17.0</version> <version>3.17.2</version>
</parent> </parent>
<artifactId>CityDoctorEdge</artifactId> <artifactId>CityDoctorEdge</artifactId>
<dependencies> <dependencies>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<parent> <parent>
<groupId>de.hft.stuttgart</groupId> <groupId>de.hft.stuttgart</groupId>
<artifactId>CityDoctorParent</artifactId> <artifactId>CityDoctorParent</artifactId>
<version>3.17.0</version> <version>3.17.2</version>
</parent> </parent>
<properties> <properties>
<versionString>${project.version}-${git.commit.id.abbrev}</versionString> <versionString>${project.version}-${git.commit.id.abbrev}</versionString>
...@@ -67,7 +67,6 @@ ...@@ -67,7 +67,6 @@
<dependency> <dependency>
<groupId>commons-io</groupId> <groupId>commons-io</groupId>
<artifactId>commons-io</artifactId> <artifactId>commons-io</artifactId>
<version>2.16.1</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
......
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CityDoctor2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package de.hft.stuttgart.citydoctor2.check;
import java.util.Collections;
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
*
* @author Matthias Betz
*
*/
public class AbstractCheck extends Check {
@Override
public Set<Requirement> appliesToRequirements() {
return Collections.emptySet();
}
@Override
public CheckId getCheckId() {
return null;
}
@Override
public RequirementType getType() {
return null;
}
@Override
public Check createNewInstance() {
return null;
}
}
...@@ -49,10 +49,11 @@ import de.hft.stuttgart.citydoctor2.parser.ParserConfiguration; ...@@ -49,10 +49,11 @@ import de.hft.stuttgart.citydoctor2.parser.ParserConfiguration;
* @author Matthias Betz * @author Matthias Betz
* *
*/ */
public abstract class Check { public abstract non-sealed class Check implements CheckableVisitor {
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();
...@@ -66,11 +67,6 @@ public abstract class Check { ...@@ -66,11 +67,6 @@ public abstract class Check {
} }
} }
/**
* Returns all classes for which the check needs to be executed
*
* @return a list of classes which the check applies to
*/
public List<Class<Checkable>> getApplicableToClasses() { public List<Class<Checkable>> getApplicableToClasses() {
return applicableToClasses; return applicableToClasses;
} }
...@@ -103,17 +99,25 @@ public abstract class Check { ...@@ -103,17 +99,25 @@ public abstract class Check {
public abstract RequirementType getType(); public abstract RequirementType getType();
/** /**
* Checks whether the check can be executed on this checkable, meaning the * Returns whether this check validates a feature.
* checkable or its content can not have any error of any check dependent on *
* this check. <br> * @return true if it validates, false otherwise
* If the check cannot be executed a CheckResult will be created with the */
@Override
public boolean isValidator() {
return true;
}
/**
* Checks whether this Check can execute on the Checkable, meaning the Checkable contains no error from
* this Check's dependencies and is applicable to this Check. <br/>
* If the check cannot be executed due to not fulfilling the dependencies a CheckResult will be created with the
* ResultStatus = DEPENDENCIES_NOT_MET. * ResultStatus = DEPENDENCIES_NOT_MET.
* *
* @param c the checkable * @param c the checkable
* @param crc container for all check results * @return true if the check can be executed, false otherwise
* @return true if the check can be executed, false if the checkable itself or
* one of its containing checkables have an error.
*/ */
@Override
public boolean canExecute(Checkable c) { public boolean canExecute(Checkable c) {
// ignore objects where this check doesn't apply to // ignore objects where this check doesn't apply to
if (!canBeApplied(c)) { if (!canBeApplied(c)) {
......
...@@ -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.ClearVisitorResultsVisitor;
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;
...@@ -67,12 +74,14 @@ public abstract class Checkable implements Serializable { ...@@ -67,12 +74,14 @@ public abstract class Checkable implements Serializable {
* @param c the check from which the check method is called with the Checkable * @param c the check from which the check method is called with the Checkable
* instance as parameter. * instance as parameter.
*/ */
public void accept(Check c) { public void accept(CheckableVisitor c) {
if (c.canExecute(this)) { if (c.canExecute(this)) {
c.check(this); c.check(this);
} }
if (c.isValidator()) {
setValidated(true); setValidated(true);
} }
}
/** /**
* The GML-ID of the checkable. This is necessary so specific features can be * The GML-ID of the checkable. This is necessary so specific features can be
...@@ -84,26 +93,44 @@ public abstract class Checkable implements Serializable { ...@@ -84,26 +93,44 @@ public abstract class Checkable implements Serializable {
/** /**
* 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 name of the check for which an error is searched * @param checkIdentifier the associated CheckID of this error
* @return true if an error has been found with the given check * @return true if the error was found, false otherwise
*/ */
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;
...@@ -134,7 +161,7 @@ public abstract class Checkable implements Serializable { ...@@ -134,7 +161,7 @@ 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 abstract void clearAllContainedCheckResults(); public final void clearAllContainedCheckResults() {
this.accept(new ClearVisitorResultsVisitor());
}
/** /**
* Checks if this checkable contains any error within its datastructure.
* *
* @return false if the checkable or all checkables contained in this one don't * @return true if any checkable of this datastructure contains an error, false otherwise
* have any error. */
public final boolean containsAnyError() {
try {
ContainsAnyErrorVisitor.checkObject(this);
} catch (CheckErrorFound c) {
return true;
}
return false;
}
/**
* Checks if this checkable has any error
* @return true if this checkable has any error, false otherwise
*/ */
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());
......
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CityDoctor2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package de.hft.stuttgart.citydoctor2.check;
import de.hft.stuttgart.citydoctor2.datastructure.AbstractBuilding;
import de.hft.stuttgart.citydoctor2.datastructure.BoundarySurface;
import de.hft.stuttgart.citydoctor2.datastructure.BridgeObject;
import de.hft.stuttgart.citydoctor2.datastructure.Building;
import de.hft.stuttgart.citydoctor2.datastructure.BuildingPart;
import de.hft.stuttgart.citydoctor2.datastructure.CityFurniture;
import de.hft.stuttgart.citydoctor2.datastructure.CityObject;
import de.hft.stuttgart.citydoctor2.datastructure.GenericCityObject;
import de.hft.stuttgart.citydoctor2.datastructure.Geometry;
import de.hft.stuttgart.citydoctor2.datastructure.Installation;
import de.hft.stuttgart.citydoctor2.datastructure.LandObject;
import de.hft.stuttgart.citydoctor2.datastructure.LinearRing;
import de.hft.stuttgart.citydoctor2.datastructure.Opening;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
import de.hft.stuttgart.citydoctor2.datastructure.ReliefObject;
import de.hft.stuttgart.citydoctor2.datastructure.TinObject;
import de.hft.stuttgart.citydoctor2.datastructure.TransportationObject;
import de.hft.stuttgart.citydoctor2.datastructure.Vegetation;
import de.hft.stuttgart.citydoctor2.datastructure.WaterObject;
/**
*
* This class serves as the base for CheckableVisitors which fulfill utility functions, like e.g. collecting all
* sub-CityObjects in the datastructure of a CityObject.
* </p>
* Visitors extending from this class will not change the validated-flag of the visited Checkables.
*
*/
public abstract non-sealed class CheckableUtilsVisitor implements CheckableVisitor {
/**
* This function is used for checking of dependencies in {@link Check}. Since UtilsVisitors do not have
* dependencies this function will always return true.
*
* @param c a Checkable
* @return true
*/
@Override
public boolean canExecute(Checkable c) {
return true;
}
@Override
public final boolean isValidator() {
return false;
}
@Override
public void check(Checkable checkable) {
}
@Override
public void check(AbstractBuilding ab) {
}
@Override
public void check(BoundarySurface bs) {
}
@Override
public void check(BridgeObject bo) {
}
@Override
public void check(Building b) {
}
@Override
public void check(Installation bi) {
}
@Override
public void check(BuildingPart bp) {
}
@Override
public void check(CityObject co) {
}
@Override
public void check(LandObject lo) {
}
@Override
public void check(Opening o) {
}
@Override
public void check(TransportationObject to) {
}
@Override
public void check(Vegetation veg) {
}
@Override
public void check(WaterObject wo) {
}
@Override
public void check(Geometry geom) {
}
@Override
public void check(Polygon poly) {
}
@Override
public void check(LinearRing ring) {
}
@Override
public void check(TinObject tin) {
}
@Override
public void check(ReliefObject relief) {
}
@Override
public void check(CityFurniture cf) {
}
@Override
public void check(GenericCityObject gco) {
}
}
package de.hft.stuttgart.citydoctor2.check;
import de.hft.stuttgart.citydoctor2.datastructure.AbstractBuilding;
import de.hft.stuttgart.citydoctor2.datastructure.BoundarySurface;
import de.hft.stuttgart.citydoctor2.datastructure.BridgeObject;
import de.hft.stuttgart.citydoctor2.datastructure.Building;
import de.hft.stuttgart.citydoctor2.datastructure.BuildingPart;
import de.hft.stuttgart.citydoctor2.datastructure.CityFurniture;
import de.hft.stuttgart.citydoctor2.datastructure.CityObject;
import de.hft.stuttgart.citydoctor2.datastructure.GenericCityObject;
import de.hft.stuttgart.citydoctor2.datastructure.Geometry;
import de.hft.stuttgart.citydoctor2.datastructure.Installation;
import de.hft.stuttgart.citydoctor2.datastructure.LandObject;
import de.hft.stuttgart.citydoctor2.datastructure.LinearRing;
import de.hft.stuttgart.citydoctor2.datastructure.Opening;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
import de.hft.stuttgart.citydoctor2.datastructure.ReliefObject;
import de.hft.stuttgart.citydoctor2.datastructure.TinObject;
import de.hft.stuttgart.citydoctor2.datastructure.TransportationObject;
import de.hft.stuttgart.citydoctor2.datastructure.Vegetation;
import de.hft.stuttgart.citydoctor2.datastructure.WaterObject;
public sealed interface CheckableVisitor permits Check, CheckableUtilsVisitor {
/**
* Returns whether a Checkable should be flagged as validated after accepting this Visitor.
*/
boolean isValidator();
boolean canExecute(Checkable c);
void check(Checkable checkable);
void check(AbstractBuilding ab);
void check(BoundarySurface bs);
void check(BridgeObject bo);
void check(Building b);
void check(Installation bi);
void check(BuildingPart bp);
void check(CityObject co);
void check(LandObject lo);
void check(Opening o);
void check(TransportationObject to);
void check(Vegetation veg);
void check(WaterObject wo);
void check(Geometry geom);
void check(Polygon poly);
void check(LinearRing ring);
void check(TinObject tin);
void check(ReliefObject relief);
void check(CityFurniture cf);
void check(GenericCityObject gco);
}
...@@ -18,13 +18,9 @@ ...@@ -18,13 +18,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.CheckableVisitor;
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,27 +101,11 @@ public abstract class AbstractBuilding extends CityObject { ...@@ -123,27 +101,11 @@ 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() {
for (BoundarySurface bs : boundarySurfaceList) {
if (bs.getGeometries().isEmpty()) { if (bs.getGeometries().isEmpty()) {
for (AbstractSpaceBoundaryProperty bsp : ab.getBoundaries()) { for (AbstractSpaceBoundaryProperty bsp : ab.getBoundaries()) {
if (bsp.getObject() != null && bsp.getObject() == bs.getGmlObject()) { if (bsp.getObject() != null && bsp.getObject() == bs.getGmlObject()) {
...@@ -152,9 +114,8 @@ public abstract class AbstractBuilding extends CityObject { ...@@ -152,9 +114,8 @@ public abstract class AbstractBuilding extends CityObject {
break; break;
} }
} }
return;
} }
bs.reCreateGeometries(factory, config); }
} }
private void setMultiSurfaceAccordingToLod(Geometry geom, MultiSurface ms) { private void setMultiSurfaceAccordingToLod(Geometry geom, MultiSurface ms) {
...@@ -199,7 +160,7 @@ public abstract class AbstractBuilding extends CityObject { ...@@ -199,7 +160,7 @@ public abstract class AbstractBuilding extends CityObject {
} }
@Override @Override
public void accept(Check c) { public void accept(CheckableVisitor c) {
super.accept(c); super.accept(c);
if (c.canExecute(this)) { if (c.canExecute(this)) {
c.check(this); c.check(this);
...@@ -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.CheckableVisitor;
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() {
for (BoundarySurface bs : boundarySurfaceList) {
if (bs.getGeometries().isEmpty()) { if (bs.getGeometries().isEmpty()) {
for (AbstractSpaceBoundaryProperty bsp : abs.getBoundaries()) { for (AbstractSpaceBoundaryProperty bsp : abs.getBoundaries()) {
if (bsp.getObject() != null && bsp.getObject() == bs.getGmlObject()) { if (bsp.getObject() != null && bsp.getObject() == bs.getGmlObject()) {
logger.warn("Found empty boundary surface: {}, removing from building", bs.getGmlId()); logger.warn("Found empty boundary surface: {}, removing from building-subdivision", bs.getGmlId());
abs.getBoundaries().remove(bsp); abs.getBoundaries().remove(bsp);
break; break;
} }
} }
return;
} }
bs.reCreateGeometries(factory, config); }
} }
private void setMultiSurfaceAccordingToLod(Geometry geom, MultiSurface ms) { private void setMultiSurfaceAccordingToLod(Geometry geom, MultiSurface ms) {
...@@ -163,7 +136,7 @@ public abstract class AbstractBuildingSubdivision extends CityObject { ...@@ -163,7 +136,7 @@ public abstract class AbstractBuildingSubdivision extends CityObject {
} }
@Override @Override
public void accept(Check c) { public void accept(CheckableVisitor c) {
super.accept(c); super.accept(c);
if (c.canExecute(this)) { if (c.canExecute(this)) {
c.check(this); c.check(this);
...@@ -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.CheckableVisitor;
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;
...@@ -32,7 +29,7 @@ public abstract class AbstractFurniture extends CityObject { ...@@ -32,7 +29,7 @@ public abstract class AbstractFurniture extends CityObject {
private org.citygml4j.core.model.construction.AbstractFurniture af; private org.citygml4j.core.model.construction.AbstractFurniture af;
@Override @Override
public void accept(Check c) { public void accept(CheckableVisitor c) {
super.accept(c); super.accept(c);
if (c.canExecute(this)) { if (c.canExecute(this)) {
c.check(this); c.check(this);
...@@ -42,51 +39,6 @@ public abstract class AbstractFurniture extends CityObject { ...@@ -42,51 +39,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 +46,7 @@ public abstract class AbstractFurniture extends CityObject { ...@@ -94,7 +46,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 +54,12 @@ public abstract class AbstractFurniture extends CityObject { ...@@ -102,12 +54,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 +86,11 @@ public abstract class AbstractFurniture extends CityObject { ...@@ -134,6 +86,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 +134,9 @@ public abstract class AbstractFurniture extends CityObject { ...@@ -177,32 +134,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.CheckableVisitor;
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<>();
...@@ -36,7 +32,7 @@ public abstract class AbstractRoom extends CityObject { ...@@ -36,7 +32,7 @@ public abstract class AbstractRoom extends CityObject {
@Override @Override
public void accept(Check c) { public void accept(CheckableVisitor c) {
super.accept(c); super.accept(c);
if (c.canExecute(this)) { if (c.canExecute(this)) {
c.check(this); c.check(this);
...@@ -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.CheckableVisitor;
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() {
for (BoundarySurface bs : boundarySurfaceList) {
if (bs.getGeometries().isEmpty()) { if (bs.getGeometries().isEmpty()) {
for (AbstractSpaceBoundaryProperty bsp : at.getBoundaries()) { for (AbstractSpaceBoundaryProperty bsp : at.getBoundaries()) {
if (bsp.getObject() != null && bsp.getObject() == bs.getGmlObject()) { if (bsp.getObject() != null && bsp.getObject() == bs.getGmlObject()) {
logger.warn("Found empty boundary surface: {}, removing from building", bs.getGmlId()); logger.warn("Found empty boundary surface: {}, removing from tunnel", bs.getGmlId());
at.getBoundaries().remove(bsp); at.getBoundaries().remove(bsp);
break; break;
} }
} }
return;
} }
bs.reCreateGeometries(factory, config); }
} }
private void setMultiSurfaceAccordingToLod(Geometry geom, MultiSurface ms) { private void setMultiSurfaceAccordingToLod(Geometry geom, MultiSurface ms) {
...@@ -175,7 +143,7 @@ public abstract class AbstractTunnel extends CityObject { ...@@ -175,7 +143,7 @@ public abstract class AbstractTunnel extends CityObject {
} }
@Override @Override
public void accept(Check c) { public void accept(CheckableVisitor c) {
super.accept(c); super.accept(c);
if (c.canExecute(this)) { if (c.canExecute(this)) {
c.check(this); c.check(this);
...@@ -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;
}
} }
...@@ -18,18 +18,14 @@ ...@@ -18,18 +18,14 @@
*/ */
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.CheckableVisitor;
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) {
...@@ -132,51 +145,7 @@ public class BoundarySurface extends CityObject { ...@@ -132,51 +145,7 @@ public class BoundarySurface extends CityObject {
} }
@Override @Override
public void clearAllContainedCheckResults() { public void accept(CheckableVisitor c) {
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
public void accept(Check c) {
super.accept(c); super.accept(c);
if (c.canExecute(this)) { if (c.canExecute(this)) {
c.check(this); c.check(this);
...@@ -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;
}
} }
...@@ -18,13 +18,10 @@ ...@@ -18,13 +18,10 @@
*/ */
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.CheckableVisitor;
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,13 +92,10 @@ public class BridgeConstructiveElement extends CityObject { ...@@ -96,13 +92,10 @@ public class BridgeConstructiveElement extends CityObject {
break; break;
} }
} }
for (BoundarySurface bs : boundarySurfaceList) {
reCreateBoundarySurface(factory, config, bs);
}
} }
@Override @Override
public void accept(Check c) { public void accept(CheckableVisitor c) {
super.accept(c); super.accept(c);
if (c.canExecute(this)) { if (c.canExecute(this)) {
c.check(this); c.check(this);
...@@ -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));
}
}
} }
...@@ -18,13 +18,12 @@ ...@@ -18,13 +18,12 @@
*/ */
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.CheckableVisitor;
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);
} }
} }
for (BoundarySurface bs : boundarySurfaces) { removeEmptyBoundarySurfaces();
bs.reCreateGeometries(factory, config);
}
for (Installation bi : bridgeInstallations) {
bi.reCreateGeometries(factory, config);
} }
for (BridgeObject part : parts) {
part.reCreateGeometries(factory, config); private void removeEmptyBoundarySurfaces() {
for (BoundarySurface bs : boundarySurfaces) {
if (bs.getGeometries().isEmpty()) {
for (AbstractSpaceBoundaryProperty bsp : ab.getBoundaries()) {
if (bsp.getObject() != null && bsp.getObject() == bs.getGmlObject()) {
logger.warn("Found empty boundary surface: {}, removing from bridge", bs.getGmlId());
ab.getBoundaries().remove(bsp);
break;
} }
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;
...@@ -185,148 +191,7 @@ public class BridgeObject extends CityObject { ...@@ -185,148 +191,7 @@ public class BridgeObject extends CityObject {
} }
@Override @Override
public void clearAllContainedCheckResults() { public void accept(CheckableVisitor c) {
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
public void accept(Check c) {
super.accept(c); super.accept(c);
if (c.canExecute(this)) { if (c.canExecute(this)) {
c.check(this); c.check(this);
...@@ -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();
}
} }
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