Commit 7a2be924 authored by Riegel's avatar Riegel
Browse files

Refactor: Implement UnsetGeometries with Visitor

parent e093a95a
...@@ -88,25 +88,6 @@ public abstract class AbstractBuilding extends CityObject { ...@@ -88,25 +88,6 @@ public abstract class AbstractBuilding extends CityObject {
ab.getDeprecatedProperties().setLod1MultiSurface(null); ab.getDeprecatedProperties().setLod1MultiSurface(null);
ab.getDeprecatedProperties().setLod4MultiSurface(null); ab.getDeprecatedProperties().setLod4MultiSurface(null);
ab.getDeprecatedProperties().setLod4Solid(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
......
...@@ -73,19 +73,6 @@ public abstract class AbstractBuildingSubdivision extends CityObject { ...@@ -73,19 +73,6 @@ public abstract class AbstractBuildingSubdivision extends CityObject {
abs.setLod3Solid(null); abs.setLod3Solid(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
......
...@@ -173,12 +173,6 @@ public abstract class AbstractRoom extends CityObject { ...@@ -173,12 +173,6 @@ 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 @Override
......
...@@ -70,25 +70,6 @@ public abstract class AbstractTunnel extends CityObject { ...@@ -70,25 +70,6 @@ public abstract class AbstractTunnel extends CityObject {
at.getDeprecatedProperties().setLod1MultiSurface(null); at.getDeprecatedProperties().setLod1MultiSurface(null);
at.getDeprecatedProperties().setLod4MultiSurface(null); at.getDeprecatedProperties().setLod4MultiSurface(null);
at.getDeprecatedProperties().setLod4Solid(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
......
...@@ -216,10 +216,6 @@ public class BoundarySurface extends CityObject { ...@@ -216,10 +216,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
......
...@@ -253,9 +253,6 @@ public class BridgeConstructiveElement extends CityObject { ...@@ -253,9 +253,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
......
...@@ -400,25 +400,6 @@ public class BridgeObject extends CityObject { ...@@ -400,25 +400,6 @@ public class BridgeObject extends CityObject {
ab.getDeprecatedProperties().setLod1MultiSurface(null); ab.getDeprecatedProperties().setLod1MultiSurface(null);
ab.getDeprecatedProperties().setLod4MultiSurface(null); ab.getDeprecatedProperties().setLod4MultiSurface(null);
ab.getDeprecatedProperties().setLod4Solid(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();
}
} }
@Override @Override
......
...@@ -223,9 +223,6 @@ public class GenericCityObject extends CityObject { ...@@ -223,9 +223,6 @@ public class GenericCityObject extends CityObject {
cgmlGos.setLod3Solid(null); cgmlGos.setLod3Solid(null);
cgmlGos.setLod2MultiSurface(null); cgmlGos.setLod2MultiSurface(null);
cgmlGos.setLod3MultiSurface(null); cgmlGos.setLod3MultiSurface(null);
for (BoundarySurface bs : boundarySurfaceList) {
bs.unsetGmlGeometries();
}
} }
@Override @Override
......
...@@ -29,6 +29,7 @@ import javafx.scene.paint.Color; ...@@ -29,6 +29,7 @@ import javafx.scene.paint.Color;
import org.citygml4j.core.model.bridge.BridgeInstallation; import org.citygml4j.core.model.bridge.BridgeInstallation;
import org.citygml4j.core.model.construction.AbstractInstallation; import org.citygml4j.core.model.construction.AbstractInstallation;
import org.citygml4j.core.model.core.AbstractSpaceBoundaryProperty; import org.citygml4j.core.model.core.AbstractSpaceBoundaryProperty;
import org.citygml4j.core.model.tunnel.TunnelInstallation;
import org.citygml4j.core.util.geometry.GeometryFactory; import org.citygml4j.core.util.geometry.GeometryFactory;
import org.xmlobjects.gml.model.geometry.GeometryProperty; import org.xmlobjects.gml.model.geometry.GeometryProperty;
import org.xmlobjects.gml.model.geometry.aggregates.MultiSurface; import org.xmlobjects.gml.model.geometry.aggregates.MultiSurface;
...@@ -188,16 +189,26 @@ public class Installation extends CityObject { ...@@ -188,16 +189,26 @@ public class Installation extends CityObject {
bs.setParent(this); bs.setParent(this);
} }
@Override
public void unsetGmlGeometries() { public void unsetGmlGeometries() {
if (gmlBi instanceof org.citygml4j.core.model.building.BuildingInstallation localBi) { gmlBi.setLod0MultiSurface(null);
localBi.getDeprecatedProperties().setLod2Geometry(null); gmlBi.setLod2MultiSurface(null);
localBi.getDeprecatedProperties().setLod3Geometry(null); gmlBi.setLod3MultiSurface(null);
localBi.getDeprecatedProperties().setLod4Geometry(null); gmlBi.setLod1Solid(null);
} else if (gmlBi instanceof BridgeInstallation localBi) { gmlBi.setLod2Solid(null);
removeGeometriesFromBridgeInstallation(localBi); gmlBi.setLod3Solid(null);
} if (gmlBi instanceof org.citygml4j.core.model.building.BuildingInstallation buildingInstallation) {
for (BoundarySurface bs : boundarySurfaces) { buildingInstallation.getDeprecatedProperties().setLod2Geometry(null);
bs.unsetGmlGeometries(); buildingInstallation.getDeprecatedProperties().setLod3Geometry(null);
buildingInstallation.getDeprecatedProperties().setLod4Geometry(null);
} else if (gmlBi instanceof BridgeInstallation bridgeInstallation) {
bridgeInstallation.getDeprecatedProperties().setLod2Geometry(null);
bridgeInstallation.getDeprecatedProperties().setLod3Geometry(null);
bridgeInstallation.getDeprecatedProperties().setLod4Geometry(null);
} else if (gmlBi instanceof TunnelInstallation tunnelInstallation) {
tunnelInstallation.getDeprecatedProperties().setLod2Geometry(null);
tunnelInstallation.getDeprecatedProperties().setLod3Geometry(null);
tunnelInstallation.getDeprecatedProperties().setLod4Geometry(null);
} }
} }
...@@ -206,11 +217,6 @@ public class Installation extends CityObject { ...@@ -206,11 +217,6 @@ public class Installation extends CityObject {
return getParent().getTopLevelCityObject(); return getParent().getTopLevelCityObject();
} }
private void removeGeometriesFromBridgeInstallation(BridgeInstallation localBi) {
localBi.getDeprecatedProperties().setLod2Geometry(null);
localBi.getDeprecatedProperties().setLod3Geometry(null);
localBi.getDeprecatedProperties().setLod4Geometry(null);
}
public void setGmlObject(AbstractInstallation gmlBi) { public void setGmlObject(AbstractInstallation gmlBi) {
this.gmlBi = gmlBi; this.gmlBi = gmlBi;
......
...@@ -24,13 +24,6 @@ public class Storey extends AbstractBuildingSubdivision { ...@@ -24,13 +24,6 @@ public class Storey extends AbstractBuildingSubdivision {
return new Storey(); return new Storey();
} }
@Override
public void unsetGmlGeometries() {
super.unsetGmlGeometries();
for (BuildingUnit buildingUnit : buildingUnits) {
buildingUnit.unsetGmlGeometries();
}
}
@Override @Override
public void reCreateGeometries(GeometryFactory factory, ParserConfiguration config) { public void reCreateGeometries(GeometryFactory factory, ParserConfiguration config) {
......
...@@ -168,23 +168,6 @@ public class TopLevelTransportFeature extends TransportationSpace { ...@@ -168,23 +168,6 @@ public class TopLevelTransportFeature extends TransportationSpace {
} }
@Override
public void unsetGmlGeometries() {
super.unsetGmlGeometries();
for (TransportSection section : sections) {
section.unsetGmlGeometries();
}
for (TransportSection section : intersections) {
section.unsetGmlGeometries();
}
}
@Override
public CityObject getTopLevelCityObject() {
return this;
}
@Override @Override
public String toString() { public String toString() {
return "TopLevelTransportFeature [id=" + getGmlId() + "]"; return "TopLevelTransportFeature [id=" + getGmlId() + "]";
......
...@@ -134,9 +134,6 @@ public class TrafficSpaceObject extends TransportationObject { ...@@ -134,9 +134,6 @@ public class TrafficSpaceObject extends TransportationObject {
ats.setLod0MultiSurface(null); ats.setLod0MultiSurface(null);
ats.setLod2MultiSurface(null); ats.setLod2MultiSurface(null);
ats.setLod3MultiSurface(null); ats.setLod3MultiSurface(null);
for (TrafficAreaObject tao : trafficAreas) {
tao.unsetGmlGeometries();
}
} }
@Override @Override
......
...@@ -180,12 +180,6 @@ public abstract class TransportationSpace extends TransportationObject { ...@@ -180,12 +180,6 @@ public abstract class TransportationSpace extends TransportationObject {
ats.setLod0MultiSurface(null); ats.setLod0MultiSurface(null);
ats.setLod2MultiSurface(null); ats.setLod2MultiSurface(null);
ats.setLod3MultiSurface(null); ats.setLod3MultiSurface(null);
for (TrafficSpaceObject to : trafficSpaces) {
to.unsetGmlGeometries();
}
for (TrafficSpaceObject to : auxTrafficSpaces) {
to.unsetGmlGeometries();
}
} }
@Override @Override
......
...@@ -197,9 +197,6 @@ public class TunnelConstructiveElement extends CityObject { ...@@ -197,9 +197,6 @@ public class TunnelConstructiveElement extends CityObject {
gmlTunnelElement.setLod1Solid(null); gmlTunnelElement.setLod1Solid(null);
gmlTunnelElement.setLod2Solid(null); gmlTunnelElement.setLod2Solid(null);
gmlTunnelElement.setLod3Solid(null); gmlTunnelElement.setLod3Solid(null);
for (BoundarySurface bs : boundarySurfaceList) {
bs.unsetGmlGeometries();
}
} }
@Override @Override
......
...@@ -34,6 +34,7 @@ import de.hft.stuttgart.citydoctor2.datastructure.Vegetation.VegetationType; ...@@ -34,6 +34,7 @@ import de.hft.stuttgart.citydoctor2.datastructure.Vegetation.VegetationType;
import de.hft.stuttgart.citydoctor2.math.graph.KDTree; import de.hft.stuttgart.citydoctor2.math.graph.KDTree;
import de.hft.stuttgart.citydoctor2.parser.ParserConfiguration; import de.hft.stuttgart.citydoctor2.parser.ParserConfiguration;
import de.hft.stuttgart.citydoctor2.utils.Localization; import de.hft.stuttgart.citydoctor2.utils.Localization;
import de.hft.stuttgart.citydoctor2.utils.UnsetGeometriesVisitor;
import de.hft.stuttgart.citydoctor2.zip.CityGmlZipEntry; import de.hft.stuttgart.citydoctor2.zip.CityGmlZipEntry;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
...@@ -799,7 +800,7 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -799,7 +800,7 @@ public class Citygml3FeatureMapper extends ObjectWalker {
private void finishCityObjectConstruction(CityObject co) { private void finishCityObjectConstruction(CityObject co) {
parseId(co.getGmlObject(), co); parseId(co.getGmlObject(), co);
co.unsetGmlGeometries(); co.accept(new UnsetGeometriesVisitor());
resolveAndClearReferences(); resolveAndClearReferences();
updateEdgesAndVertices(co); updateEdgesAndVertices(co);
} }
......
package de.hft.stuttgart.citydoctor2.checks.util; package de.hft.stuttgart.citydoctor2.utils;
import de.hft.stuttgart.citydoctor2.check.AbstractCheck; import de.hft.stuttgart.citydoctor2.check.AbstractCheck;
import de.hft.stuttgart.citydoctor2.datastructure.CityObject; import de.hft.stuttgart.citydoctor2.datastructure.CityObject;
......
package de.hft.stuttgart.citydoctor2.utils;
import de.hft.stuttgart.citydoctor2.check.AbstractCheck;
import de.hft.stuttgart.citydoctor2.datastructure.CityObject;
public class UnsetGeometriesVisitor extends AbstractCheck {
@Override
public void check(CityObject cityObject) {
cityObject.unsetGmlGeometries();
}
}
...@@ -2,7 +2,7 @@ package de.hft.stuttgart.citydoctor2.gui; ...@@ -2,7 +2,7 @@ package de.hft.stuttgart.citydoctor2.gui;
import de.hft.stuttgart.citydoctor2.check.CheckError; import de.hft.stuttgart.citydoctor2.check.CheckError;
import de.hft.stuttgart.citydoctor2.check.Checkable; import de.hft.stuttgart.citydoctor2.check.Checkable;
import de.hft.stuttgart.citydoctor2.checks.util.CityObjectCollector; import de.hft.stuttgart.citydoctor2.utils.CityObjectCollector;
import de.hft.stuttgart.citydoctor2.datastructure.*; import de.hft.stuttgart.citydoctor2.datastructure.*;
import de.hft.stuttgart.citydoctor2.gui.filter.ViewFilter; import de.hft.stuttgart.citydoctor2.gui.filter.ViewFilter;
import de.hft.stuttgart.citydoctor2.gui.tree.*; import de.hft.stuttgart.citydoctor2.gui.tree.*;
......
package de.hft.stuttgart.citydoctor2.gui; package de.hft.stuttgart.citydoctor2.gui;
import de.hft.stuttgart.citydoctor2.checks.util.CityObjectCollector; import de.hft.stuttgart.citydoctor2.utils.CityObjectCollector;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon; import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
import de.hft.stuttgart.citydoctor2.datastructure.*; import de.hft.stuttgart.citydoctor2.datastructure.*;
import de.hft.stuttgart.citydoctor2.gui.filter.ViewFilter; import de.hft.stuttgart.citydoctor2.gui.filter.ViewFilter;
...@@ -13,7 +13,6 @@ import javafx.scene.paint.PhongMaterial; ...@@ -13,7 +13,6 @@ import javafx.scene.paint.PhongMaterial;
import javafx.scene.shape.*; import javafx.scene.shape.*;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
public class TriangulatedGeometry { public class TriangulatedGeometry {
......
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