Commit c42d600d authored by Luna Riegel's avatar Luna Riegel
Browse files

Refactor: Unify methods

parent 2d2568b9
...@@ -1260,7 +1260,7 @@ public class MeshSurfaceUtilsTest { ...@@ -1260,7 +1260,7 @@ public class MeshSurfaceUtilsTest {
ParserConfiguration config = new ParserConfiguration(8, false); ParserConfiguration config = new ParserConfiguration(8, false);
CityDoctorModel model = CityGmlParser.parseCityGmlFile("src/test/resources/KaiserwallComplexBuilding.gml", config); CityDoctorModel model = CityGmlParser.parseCityGmlFile("src/test/resources/KaiserwallComplexBuilding.gml", config);
Building building = model.getBuildings().toList().get(0); Building building = model.getBuildings().toList().get(0);
Geometry geom = building.getBuildingInstallations().get(0).getGeometries().get(0); Geometry geom = building.getInstallations().get(0).getGeometries().get(0);
assertNotNull(geom); assertNotNull(geom);
MeshSurface surface = MeshSurface.of(geom); MeshSurface surface = MeshSurface.of(geom);
List<PolygonPolygonIntersection> selfIntersects = MeshSurfaceUtils.selfIntersects(surface, 0.000001, 0.001); List<PolygonPolygonIntersection> selfIntersects = MeshSurfaceUtils.selfIntersects(surface, 0.000001, 0.001);
......
...@@ -40,7 +40,7 @@ import java.util.List; ...@@ -40,7 +40,7 @@ import java.util.List;
* *
* @author Matthias Betz * @author Matthias Betz
*/ */
public abstract class AbstractBuilding extends CityObject { public abstract class AbstractBuilding extends CityObject implements ConstructionObject{
@Serial @Serial
private static final long serialVersionUID = -2196414503088741206L; private static final long serialVersionUID = -2196414503088741206L;
...@@ -61,6 +61,7 @@ public abstract class AbstractBuilding extends CityObject { ...@@ -61,6 +61,7 @@ public abstract class AbstractBuilding extends CityObject {
* *
* @return the boundary surfaces * @return the boundary surfaces
*/ */
@Override
public List<BoundarySurface> getBoundarySurfaces() { public List<BoundarySurface> getBoundarySurfaces() {
return boundarySurfaceList; return boundarySurfaceList;
} }
...@@ -75,10 +76,34 @@ public abstract class AbstractBuilding extends CityObject { ...@@ -75,10 +76,34 @@ public abstract class AbstractBuilding extends CityObject {
return FeatureType.BUILDING; return FeatureType.BUILDING;
} }
@Override
public List<BuildingConstructiveElement> getConstructiveElements() { public List<BuildingConstructiveElement> getConstructiveElements() {
return buildingConstructiveElements; return buildingConstructiveElements;
} }
@Override
public List<Installation> getInstallations() {
return buildingInstallations;
}
@Override
public List<BuildingRoom> getRooms() {
return buildingRooms;
}
@Override
public List<BuildingRoomFurniture> getFurniture() {
return buildingRoomFurnitureList;
}
public List<Storey> getStoreys() {
return buildingStoreys;
}
public List<BuildingUnit> getBuildingUnits() {
return buildingUnits;
}
@Override @Override
public void unsetGmlGeometries() { public void unsetGmlGeometries() {
ab.setLod1Solid(null); ab.setLod1Solid(null);
...@@ -202,17 +227,17 @@ public abstract class AbstractBuilding extends CityObject { ...@@ -202,17 +227,17 @@ public abstract class AbstractBuilding extends CityObject {
bs.setParent(this); bs.setParent(this);
} }
public void addBuildingInstallation(Installation coBi) { public void addInstallation(Installation coBi) {
buildingInstallations.add(coBi); buildingInstallations.add(coBi);
coBi.setParent(this); coBi.setParent(this);
} }
public void addBuildingRoom(BuildingRoom room) { public void addRoom(BuildingRoom room) {
buildingRooms.add(room); buildingRooms.add(room);
room.setParent(this); room.setParent(this);
} }
public void addBuildingRoomFurniture(BuildingRoomFurniture roomFurniture) { public void addFurniture(BuildingRoomFurniture roomFurniture) {
buildingRoomFurnitureList.add(roomFurniture); buildingRoomFurnitureList.add(roomFurniture);
roomFurniture.setParent(this); roomFurniture.setParent(this);
} }
...@@ -236,24 +261,5 @@ public abstract class AbstractBuilding extends CityObject { ...@@ -236,24 +261,5 @@ public abstract class AbstractBuilding extends CityObject {
this.ab = ab; this.ab = ab;
} }
public List<Installation> getBuildingInstallations() {
return buildingInstallations;
}
public List<BuildingRoom> getBuildingRooms() {
return buildingRooms;
}
public List<BuildingRoomFurniture> getBuildingRoomFurnitureList() {
return buildingRoomFurnitureList;
}
public List<Storey> getBuildingStoreys() {
return buildingStoreys;
}
public List<BuildingUnit> getBuildingUnits() {
return buildingUnits;
}
} }
...@@ -16,7 +16,7 @@ import java.io.Serial; ...@@ -16,7 +16,7 @@ import java.io.Serial;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
public abstract class AbstractBuildingSubdivision extends CityObject { public abstract class AbstractBuildingSubdivision extends CityObject implements ConstructionObject{
@Serial @Serial
private static final long serialVersionUID = 7033994252340571002L; private static final long serialVersionUID = 7033994252340571002L;
...@@ -26,19 +26,38 @@ public abstract class AbstractBuildingSubdivision extends CityObject { ...@@ -26,19 +26,38 @@ public abstract class AbstractBuildingSubdivision extends CityObject {
private final List<BoundarySurface> boundarySurfaceList = new ArrayList<>(); private final List<BoundarySurface> boundarySurfaceList = new ArrayList<>();
private final List<BuildingRoom> buildingRooms = new ArrayList<>(); private final List<BuildingRoom> buildingRooms = new ArrayList<>();
private final List<BuildingRoomFurniture> buildingRoomFurnitureList = new ArrayList<>(); private final List<BuildingRoomFurniture> buildingRoomFurnitureList = new ArrayList<>();
private final List<BuildingConstructiveElement> buildingConstructiveElements = new ArrayList<>();
private AbstractBuilding parent; private AbstractBuilding parent;
protected org.citygml4j.core.model.building.AbstractBuildingSubdivision abs; protected org.citygml4j.core.model.building.AbstractBuildingSubdivision abs;
/**
* Getter for all boundary surfaces contained in this building. @Override
*
* @return the boundary surfaces
*/
public List<BoundarySurface> getBoundarySurfaces() { public List<BoundarySurface> getBoundarySurfaces() {
return boundarySurfaceList; return boundarySurfaceList;
} }
@Override
public List<Installation> getInstallations() {
return buildingInstallations;
}
@Override
public List<BuildingRoom> getRooms() {
return buildingRooms;
}
@Override
public List<BuildingRoomFurniture> getFurniture() {
return buildingRoomFurnitureList;
}
@Override
public List<BuildingConstructiveElement> getConstructiveElements(){
return buildingConstructiveElements;
}
@Override @Override
public org.citygml4j.core.model.building.AbstractBuildingSubdivision getGmlObject() { public org.citygml4j.core.model.building.AbstractBuildingSubdivision getGmlObject() {
return abs; return abs;
...@@ -153,6 +172,9 @@ public abstract class AbstractBuildingSubdivision extends CityObject { ...@@ -153,6 +172,9 @@ public abstract class AbstractBuildingSubdivision extends CityObject {
for (BuildingRoomFurniture bfr : buildingRoomFurnitureList) { for (BuildingRoomFurniture bfr : buildingRoomFurnitureList) {
bfr.accept(c); bfr.accept(c);
} }
for (BuildingConstructiveElement bce : buildingConstructiveElements){
bce.accept(c);
}
} }
void setCityGmlBuilding(org.citygml4j.core.model.building.AbstractBuildingSubdivision abs) { void setCityGmlBuilding(org.citygml4j.core.model.building.AbstractBuildingSubdivision abs) {
...@@ -164,38 +186,30 @@ public abstract class AbstractBuildingSubdivision extends CityObject { ...@@ -164,38 +186,30 @@ public abstract class AbstractBuildingSubdivision extends CityObject {
bs.setParent(this); bs.setParent(this);
} }
public void addBuildingInstallation(Installation coBi) { public void addInstallation(Installation coBi) {
buildingInstallations.add(coBi); buildingInstallations.add(coBi);
coBi.setParent(this); coBi.setParent(this);
} }
public void addBuildingRoom(BuildingRoom room) { public void addRoom(BuildingRoom room) {
buildingRooms.add(room); buildingRooms.add(room);
room.setParent(this); room.setParent(this);
} }
public void addBuildingRoomFurniture(BuildingRoomFurniture roomFurniture) { public void addFurniture(BuildingRoomFurniture roomFurniture) {
buildingRoomFurnitureList.add(roomFurniture); buildingRoomFurnitureList.add(roomFurniture);
roomFurniture.setParent(this); roomFurniture.setParent(this);
} }
public void addConstructiveElement(BuildingConstructiveElement buildingConstructiveElement) {
buildingConstructiveElements.add(buildingConstructiveElement);
buildingConstructiveElement.setParent(this);
}
public void setGmlObject(org.citygml4j.core.model.building.AbstractBuildingSubdivision abs) { public void setGmlObject(org.citygml4j.core.model.building.AbstractBuildingSubdivision abs) {
this.abs = abs; this.abs = abs;
} }
public List<Installation> getBuildingInstallations() {
return buildingInstallations;
}
public List<BuildingRoom> getBuildingRooms() {
return buildingRooms;
}
public List<BuildingRoomFurniture> getBuildingRoomFurnitureList() {
return buildingRoomFurnitureList;
}
} }
package de.hft.stuttgart.citydoctor2.datastructure;
import de.hft.stuttgart.citydoctor2.check.CheckableVisitor;
import java.io.Serial;
import java.util.ArrayList;
import java.util.List;
public abstract class AbstractConstructiveElement extends CityObject implements ConstructiveElement {
@Serial
private static final long serialVersionUID = 5462268599786709637L;
private final List<BoundarySurface> boundarySurfaceList = new ArrayList<>();
private final List<AbstractConstructiveFillingElement> fillings = new ArrayList<>();
@Override
public void accept(CheckableVisitor c) {
super.accept(c);
if (c.canExecute(this)) {
c.check(this);
}
for (BoundarySurface bs : boundarySurfaceList) {
bs.accept(c);
}
for (AbstractConstructiveFillingElement f : fillings) {
f.accept(c);
}
}
public void addBoundarySurface(BoundarySurface bs) {
boundarySurfaceList.add(bs);
bs.setParent(this);
}
@Override
public List<BoundarySurface> getBoundarySurfaces() {
return boundarySurfaceList;
}
public void addFilling(AbstractConstructiveFillingElement fe) {
fillings.add(fe);
fe.setParent(this);
}
@Override
public List<AbstractConstructiveFillingElement> getFillings() {
return fillings;
}
}
...@@ -17,7 +17,7 @@ import java.io.Serial; ...@@ -17,7 +17,7 @@ import java.io.Serial;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
public abstract class AbstractConstructiveFillingElement extends CityObject { public abstract class AbstractConstructiveFillingElement extends CityObject implements BoundedSpace{
private static final String CANNOT_ADD = "Cannot add "; private static final String CANNOT_ADD = "Cannot add ";
...@@ -40,6 +40,16 @@ public abstract class AbstractConstructiveFillingElement extends CityObject { ...@@ -40,6 +40,16 @@ public abstract class AbstractConstructiveFillingElement extends CityObject {
} }
} }
public void addBoundarySurface(BoundarySurface bs) {
boundarySurfaceList.add(bs);
bs.setParent(this);
}
@Override
public List<BoundarySurface> getBoundarySurfaces() {
return boundarySurfaceList;
}
public void setParent(CityObject parent) { public void setParent(CityObject parent) {
this.parent = parent; this.parent = parent;
} }
...@@ -123,13 +133,6 @@ public abstract class AbstractConstructiveFillingElement extends CityObject { ...@@ -123,13 +133,6 @@ public abstract class AbstractConstructiveFillingElement extends CityObject {
return parent.getTopLevelCityObject(); return parent.getTopLevelCityObject();
} }
public void addBoundarySurface(BoundarySurface bs) {
boundarySurfaceList.add(bs);
bs.setParent(this);
}
public List<BoundarySurface> getBoundarySurfaces() {
return boundarySurfaceList;
}
} }
...@@ -17,14 +17,13 @@ import java.util.List; ...@@ -17,14 +17,13 @@ import java.util.List;
/** /**
* Represents all types of furniture used inside Buildings. * Represents all types of furniture used inside Buildings.
*/ */
public abstract class AbstractFurniture extends CityObject { public abstract class AbstractFurniture extends CityObject implements BoundedSpace{
@Serial @Serial
private static final long serialVersionUID = -9050689238027190674L; private static final long serialVersionUID = -9050689238027190674L;
private final List<BoundarySurface> boundarySurfaceList = new ArrayList<>(); private final List<BoundarySurface> boundarySurfaceList = new ArrayList<>();
private CityObject parent;
private org.citygml4j.core.model.construction.AbstractFurniture af; private org.citygml4j.core.model.construction.AbstractFurniture af;
...@@ -44,16 +43,13 @@ public abstract class AbstractFurniture extends CityObject { ...@@ -44,16 +43,13 @@ public abstract class AbstractFurniture extends CityObject {
return af; return af;
} }
@Override
public CityObject getTopLevelCityObject(){
return parent.getTopLevelCityObject();
}
public void addBoundarySurface(BoundarySurface boundarySurface) { public void addBoundarySurface(BoundarySurface boundarySurface) {
boundarySurfaceList.add(boundarySurface); boundarySurfaceList.add(boundarySurface);
boundarySurface.setParent(this); boundarySurface.setParent(this);
} }
@Override
public List<BoundarySurface> getBoundarySurfaces() { public List<BoundarySurface> getBoundarySurfaces() {
return boundarySurfaceList; return boundarySurfaceList;
} }
...@@ -78,18 +74,9 @@ public abstract class AbstractFurniture extends CityObject { ...@@ -78,18 +74,9 @@ public abstract class AbstractFurniture extends CityObject {
this.af = af; this.af = af;
} }
public void setParent(CityObject co) {
parent = co;
}
public CityObject getParent() { public abstract CityObject getParent();
return parent;
}
@Override
public Color getRenderColor() {
return parent.getRenderColor();
}
@Override @Override
public void unsetGmlGeometries() { public void unsetGmlGeometries() {
......
...@@ -17,7 +17,7 @@ import java.util.List; ...@@ -17,7 +17,7 @@ import java.util.List;
/** /**
* Abstract base class for rooms inside CityGML 3.0 construction objects. * Abstract base class for rooms inside CityGML 3.0 construction objects.
*/ */
public abstract class AbstractRoom extends CityObject { public abstract class AbstractRoom extends CityObject implements BoundedSpace{
@Serial @Serial
private static final long serialVersionUID = -1730625513988944329L; private static final long serialVersionUID = -1730625513988944329L;
...@@ -27,7 +27,6 @@ public abstract class AbstractRoom extends CityObject { ...@@ -27,7 +27,6 @@ public abstract class AbstractRoom extends CityObject {
private final List<BoundarySurface> boundarySurfaceList = new ArrayList<>(); private final List<BoundarySurface> boundarySurfaceList = new ArrayList<>();
protected org.citygml4j.core.model.core.AbstractUnoccupiedSpace cgmlRoom; protected org.citygml4j.core.model.core.AbstractUnoccupiedSpace cgmlRoom;
...@@ -111,16 +110,20 @@ public abstract class AbstractRoom extends CityObject { ...@@ -111,16 +110,20 @@ public abstract class AbstractRoom extends CityObject {
} }
public List<Installation> getRoomInstallations() { public List<Installation> getInstallations() {
return roomInstallations; return roomInstallations;
} }
public abstract List<? extends AbstractFurniture> getFurniture();
public abstract CityObject getParent();
@Override
public List<BoundarySurface> getBoundarySurfaces() { public List<BoundarySurface> getBoundarySurfaces() {
return boundarySurfaceList; return boundarySurfaceList;
} }
public void addRoomInstallation(Installation roomInstallation) { public void addInstallation(Installation roomInstallation) {
roomInstallations.add(roomInstallation); roomInstallations.add(roomInstallation);
roomInstallation.setParent(this); roomInstallation.setParent(this);
} }
......
...@@ -17,7 +17,7 @@ import java.io.Serial; ...@@ -17,7 +17,7 @@ import java.io.Serial;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
public abstract class AbstractTunnel extends CityObject { public abstract class AbstractTunnel extends CityObject implements ConstructionObject{
@Serial @Serial
private static final long serialVersionUID = -2196414503088741206L; private static final long serialVersionUID = -2196414503088741206L;
...@@ -37,6 +37,7 @@ public abstract class AbstractTunnel extends CityObject { ...@@ -37,6 +37,7 @@ public abstract class AbstractTunnel extends CityObject {
* *
* @return the boundary surfaces * @return the boundary surfaces
*/ */
@Override
public List<BoundarySurface> getBoundarySurfaces() { public List<BoundarySurface> getBoundarySurfaces() {
return boundarySurfaceList; return boundarySurfaceList;
} }
...@@ -178,22 +179,22 @@ public abstract class AbstractTunnel extends CityObject { ...@@ -178,22 +179,22 @@ public abstract class AbstractTunnel extends CityObject {
bs.setParent(this); bs.setParent(this);
} }
public void addTunnelInstallation(Installation coBi) { public void addInstallation(Installation coBi) {
tunnelInstallations.add(coBi); tunnelInstallations.add(coBi);
coBi.setParent(this); coBi.setParent(this);
} }
public void addTunnelHollow(TunnelHollow hollow) { public void addRoom(TunnelHollow hollow) {
tunnelHollows.add(hollow); tunnelHollows.add(hollow);
hollow.setParent(this); hollow.setParent(this);
} }
public void addTunnelFurniture(TunnelFurniture furniture) { public void addFurniture(TunnelFurniture furniture) {
tunnelFurnitureList.add(furniture); tunnelFurnitureList.add(furniture);
furniture.setParent(this); furniture.setParent(this);
} }
public void addTunnelConstructiveElement(TunnelConstructiveElement te) { public void addConstructiveElement(TunnelConstructiveElement te) {
tunnelConstructiveElements.add(te); tunnelConstructiveElements.add(te);
te.setParent(this); te.setParent(this);
} }
...@@ -206,15 +207,17 @@ public abstract class AbstractTunnel extends CityObject { ...@@ -206,15 +207,17 @@ public abstract class AbstractTunnel extends CityObject {
this.at = at; this.at = at;
} }
public List<Installation> getTunnelInstallations() { @Override
public List<Installation> getInstallations() {
return tunnelInstallations; return tunnelInstallations;
} }
public List<TunnelHollow> getTunnelHollows() { @Override
public List<TunnelHollow> getRooms() {
return tunnelHollows; return tunnelHollows;
} }
public List<TunnelFurniture> getTunnelFurniture() { public List<TunnelFurniture> getFurniture() {
return tunnelFurnitureList; return tunnelFurnitureList;
} }
...@@ -222,7 +225,8 @@ public abstract class AbstractTunnel extends CityObject { ...@@ -222,7 +225,8 @@ public abstract class AbstractTunnel extends CityObject {
return tunnelParts; return tunnelParts;
} }
public List<TunnelConstructiveElement> getTunnelConstructiveElements() { @Override
public List<TunnelConstructiveElement> getConstructiveElements() {
return tunnelConstructiveElements; return tunnelConstructiveElements;
} }
......
...@@ -36,7 +36,7 @@ import de.hft.stuttgart.citydoctor2.parser.ParserConfiguration; ...@@ -36,7 +36,7 @@ import de.hft.stuttgart.citydoctor2.parser.ParserConfiguration;
import de.hft.stuttgart.citydoctor2.utils.CityGmlUtils; import de.hft.stuttgart.citydoctor2.utils.CityGmlUtils;
import javafx.scene.paint.Color; import javafx.scene.paint.Color;
public class BridgeConstructiveElement extends CityObject { public class BridgeConstructiveElement extends AbstractConstructiveElement {
private static final String CANNOT_ADD = "Cannot add "; private static final String CANNOT_ADD = "Cannot add ";
...@@ -44,19 +44,17 @@ public class BridgeConstructiveElement extends CityObject { ...@@ -44,19 +44,17 @@ public class BridgeConstructiveElement extends CityObject {
private static final long serialVersionUID = 7353233899458901155L; private static final long serialVersionUID = 7353233899458901155L;
private final org.citygml4j.core.model.bridge.BridgeConstructiveElement gmlBridgeElement; private final org.citygml4j.core.model.bridge.BridgeConstructiveElement gmlBridgeElement;
private final List<BoundarySurface> boundarySurfaceList = new ArrayList<>(); private AbstractBridgeObject parent;
private final List<AbstractConstructiveFillingElement> fillings = new ArrayList<>();
private BridgeObject parent;
public BridgeConstructiveElement(org.citygml4j.core.model.bridge.BridgeConstructiveElement gmlObject) { public BridgeConstructiveElement(org.citygml4j.core.model.bridge.BridgeConstructiveElement gmlObject) {
this.gmlBridgeElement = gmlObject; this.gmlBridgeElement = gmlObject;
} }
public void setParent(BridgeObject parent) { public void setParent(AbstractBridgeObject parent) {
this.parent = parent; this.parent = parent;
} }
public BridgeObject getParent() { public AbstractBridgeObject getParent() {
return parent; return parent;
} }
...@@ -91,16 +89,6 @@ public class BridgeConstructiveElement extends CityObject { ...@@ -91,16 +89,6 @@ public class BridgeConstructiveElement extends CityObject {
} }
} }
@Override
public void accept(CheckableVisitor c) {
super.accept(c);
if (c.canExecute(this)) {
c.check(this);
}
for (BoundarySurface bs : boundarySurfaceList) {
bs.accept(c);
}
}
private void setCompositeSurfaceAccordingToLod(Geometry geom, CompositeSurface cs) { private void setCompositeSurfaceAccordingToLod(Geometry geom, CompositeSurface cs) {
switch (geom.getLod()) { switch (geom.getLod()) {
...@@ -192,22 +180,5 @@ public class BridgeConstructiveElement extends CityObject { ...@@ -192,22 +180,5 @@ public class BridgeConstructiveElement extends CityObject {
return FeatureType.BRIDGE_CONSTRUCTION_ELEMENT; return FeatureType.BRIDGE_CONSTRUCTION_ELEMENT;
} }
public void addBoundarySurface(BoundarySurface bs) {
boundarySurfaceList.add(bs);
bs.setParent(this);
}
public List<BoundarySurface> getBoundarySurfaces() {
return boundarySurfaceList;
}
public void addFilling(AbstractConstructiveFillingElement fe) {
fillings.add(fe);
fe.setParent(this);
}
public List<AbstractConstructiveFillingElement> getFillings() {
return fillings;
}
} }
...@@ -43,7 +43,7 @@ import java.util.List; ...@@ -43,7 +43,7 @@ import java.util.List;
* *
* @author Matthias Betz * @author Matthias Betz
*/ */
public class BridgeObject extends CityObject { public class BridgeObject extends AbstractBridgeObject implements ConstructionObject{
@Serial @Serial
private static final long serialVersionUID = 6301112640328373842L; private static final long serialVersionUID = 6301112640328373842L;
......
...@@ -3,6 +3,8 @@ package de.hft.stuttgart.citydoctor2.datastructure; ...@@ -3,6 +3,8 @@ package de.hft.stuttgart.citydoctor2.datastructure;
import javafx.scene.paint.Color; import javafx.scene.paint.Color;
import java.io.Serial; import java.io.Serial;
import java.util.ArrayList;
import java.util.List;
public class BridgeRoom extends AbstractRoom { public class BridgeRoom extends AbstractRoom {
...@@ -10,20 +12,24 @@ public class BridgeRoom extends AbstractRoom { ...@@ -10,20 +12,24 @@ public class BridgeRoom extends AbstractRoom {
private static final long serialVersionUID = -276088332165299253L; private static final long serialVersionUID = -276088332165299253L;
private BridgeObject parent; private BridgeObject parent;
private final List<BridgeRoomFurniture> furnitureList = new ArrayList<>();
private BridgeRoom() { public void setParent(BridgeObject parent) {
}
public BridgeRoom(BridgeObject parent) {
this.parent = parent; this.parent = parent;
parent.addBridgeRoom(this);
} }
public void setGmlObject(org.citygml4j.core.model.bridge.BridgeRoom cgmlRoom) { public void setGmlObject(org.citygml4j.core.model.bridge.BridgeRoom cgmlRoom) {
super.cgmlRoom = cgmlRoom; super.cgmlRoom = cgmlRoom;
} }
public void addFurniture(BridgeRoomFurniture furniture) {
furnitureList.add(furniture);
}
@Override
public List<BridgeRoomFurniture> getFurniture() {
return furnitureList;
}
public BridgeObject getParent() { public BridgeObject getParent() {
return parent; return parent;
......
...@@ -8,8 +8,28 @@ public class BridgeRoomFurniture extends AbstractFurniture { ...@@ -8,8 +8,28 @@ public class BridgeRoomFurniture extends AbstractFurniture {
@Serial @Serial
private static final long serialVersionUID = 2450802405053172352L; private static final long serialVersionUID = 2450802405053172352L;
private CityObject parent;
public void setGmlObject(BridgeFurniture gmlObject) { public void setGmlObject(BridgeFurniture gmlObject) {
super.setGmlObject(gmlObject); super.setGmlObject(gmlObject);
} }
public void setParent(AbstractBridgeObject parent) {
this.parent = parent;
}
public void setParent(BridgeRoom parent) {
this.parent = parent;
}
@Override
public CityObject getParent() {
return parent;
}
@Override
public CityObject getTopLevelCityObject() {
return parent.getTopLevelCityObject();
}
} }
...@@ -70,7 +70,7 @@ public class Building extends AbstractBuilding { ...@@ -70,7 +70,7 @@ public class Building extends AbstractBuilding {
} }
org.citygml4j.core.model.building.Building gmlB = new org.citygml4j.core.model.building.Building(); org.citygml4j.core.model.building.Building gmlB = new org.citygml4j.core.model.building.Building();
gmlB.setId(GmlId.generateId().getGmlString()); gmlB.setId(GmlId.generateId().getGmlString());
for (Installation bi : getBuildingInstallations()) { for (Installation bi : getInstallations()) {
bi.anonymize(); bi.anonymize();
gmlB.getBuildingInstallations().add(new BuildingInstallationProperty((BuildingInstallation) bi.getGmlObject())); gmlB.getBuildingInstallations().add(new BuildingInstallationProperty((BuildingInstallation) bi.getGmlObject()));
} }
......
...@@ -18,7 +18,7 @@ import de.hft.stuttgart.citydoctor2.parser.ParserConfiguration; ...@@ -18,7 +18,7 @@ import de.hft.stuttgart.citydoctor2.parser.ParserConfiguration;
import de.hft.stuttgart.citydoctor2.utils.CityGmlUtils; import de.hft.stuttgart.citydoctor2.utils.CityGmlUtils;
import javafx.scene.paint.Color; import javafx.scene.paint.Color;
public class BuildingConstructiveElement extends CityObject { public class BuildingConstructiveElement extends AbstractConstructiveElement{
private static final Logger logger = LogManager.getLogger(BuildingConstructiveElement.class); private static final Logger logger = LogManager.getLogger(BuildingConstructiveElement.class);
...@@ -28,9 +28,7 @@ public class BuildingConstructiveElement extends CityObject { ...@@ -28,9 +28,7 @@ public class BuildingConstructiveElement extends CityObject {
private static final long serialVersionUID = 7353233899458901155L; private static final long serialVersionUID = 7353233899458901155L;
private final org.citygml4j.core.model.building.BuildingConstructiveElement gmlBuildingElement; private final org.citygml4j.core.model.building.BuildingConstructiveElement gmlBuildingElement;
private final List<BoundarySurface> boundarySurfaceList = new ArrayList<>(); private CityObject parent;
private final List<AbstractConstructiveFillingElement> fillings = new ArrayList<>();
private AbstractBuilding parent;
public BuildingConstructiveElement(org.citygml4j.core.model.building.BuildingConstructiveElement gmlObject) { public BuildingConstructiveElement(org.citygml4j.core.model.building.BuildingConstructiveElement gmlObject) {
this.gmlBuildingElement = gmlObject; this.gmlBuildingElement = gmlObject;
...@@ -40,7 +38,11 @@ public class BuildingConstructiveElement extends CityObject { ...@@ -40,7 +38,11 @@ public class BuildingConstructiveElement extends CityObject {
this.parent = parent; this.parent = parent;
} }
public AbstractBuilding getParent() { public void setParent(AbstractBuildingSubdivision parent) {
this.parent = parent;
}
public CityObject getParent() {
return parent; return parent;
} }
...@@ -71,19 +73,6 @@ public class BuildingConstructiveElement extends CityObject { ...@@ -71,19 +73,6 @@ public class BuildingConstructiveElement extends CityObject {
} }
} }
@Override
public void accept(CheckableVisitor c) {
super.accept(c);
if (c.canExecute(this)) {
c.check(this);
}
for (BoundarySurface bs : boundarySurfaceList) {
bs.accept(c);
}
for (AbstractConstructiveFillingElement fe : fillings) {
fe.accept(c);
}
}
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()) {
...@@ -157,22 +146,4 @@ public class BuildingConstructiveElement extends CityObject { ...@@ -157,22 +146,4 @@ public class BuildingConstructiveElement extends CityObject {
return FeatureType.BRIDGE_CONSTRUCTION_ELEMENT; return FeatureType.BRIDGE_CONSTRUCTION_ELEMENT;
} }
public void addBoundarySurface(BoundarySurface bs) {
boundarySurfaceList.add(bs);
bs.setParent(this);
}
public List<BoundarySurface> getBoundarySurfaces() {
return boundarySurfaceList;
}
public void addFilling(AbstractConstructiveFillingElement fe) {
fillings.add(fe);
fe.setParent(this);
}
public List<AbstractConstructiveFillingElement> getFillings() {
return fillings;
}
} }
...@@ -41,7 +41,7 @@ public class BuildingPart extends AbstractBuilding { ...@@ -41,7 +41,7 @@ public class BuildingPart extends AbstractBuilding {
@Override @Override
public CityObject getTopLevelCityObject() { public CityObject getTopLevelCityObject() {
return getParent().getTopLevelCityObject(); return parent.getTopLevelCityObject();
} }
@Override @Override
......
package de.hft.stuttgart.citydoctor2.datastructure; package de.hft.stuttgart.citydoctor2.datastructure;
import javafx.scene.paint.Color; import javafx.scene.paint.Color;
import org.citygml4j.core.model.building.BuildingFurnitureProperty;
import java.io.Serial; import java.io.Serial;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -11,7 +10,7 @@ public class BuildingRoom extends AbstractRoom { ...@@ -11,7 +10,7 @@ public class BuildingRoom extends AbstractRoom {
@Serial @Serial
private static final long serialVersionUID = -276088332165299253L; private static final long serialVersionUID = -276088332165299253L;
private final List<BuildingFurnitureProperty> furnitureRefs = new ArrayList<>(2); private final List<BuildingRoomFurniture> furniture = new ArrayList<>(2);
private CityObject parent; private CityObject parent;
public void setGmlObject(org.citygml4j.core.model.building.BuildingRoom cgmlRoom) { public void setGmlObject(org.citygml4j.core.model.building.BuildingRoom cgmlRoom) {
...@@ -19,24 +18,25 @@ public class BuildingRoom extends AbstractRoom { ...@@ -19,24 +18,25 @@ public class BuildingRoom extends AbstractRoom {
} }
public void setParent(CityObject parent) { public void setParent(AbstractBuilding parent) {
this.parent = parent; this.parent = parent;
} }
public void addFurnitureRef(BuildingFurnitureProperty furnitureRef) { public void setParent(AbstractBuildingSubdivision parent) {
furnitureRefs.add(furnitureRef); this.parent = parent;
}
@Override
public List<BuildingRoomFurniture> getFurniture() {
return furniture;
} }
/** public void addFurniture(BuildingRoomFurniture furniture) {
* Returns the list of citygml3 furniture objects registered to this room. this.furniture.add(furniture);
* The reference objects only hold a HRef to the actual furniture object.
*
* @return
*/
public List<BuildingFurnitureProperty> getFurnitureRefs() {
return furnitureRefs;
} }
@Override
public CityObject getParent() { public CityObject getParent() {
return parent; return parent;
} }
...@@ -50,4 +50,6 @@ public class BuildingRoom extends AbstractRoom { ...@@ -50,4 +50,6 @@ public class BuildingRoom extends AbstractRoom {
public Color getRenderColor() { public Color getRenderColor() {
return parent.getRenderColor(); return parent.getRenderColor();
} }
} }
...@@ -9,10 +9,29 @@ public class BuildingRoomFurniture extends AbstractFurniture { ...@@ -9,10 +9,29 @@ public class BuildingRoomFurniture extends AbstractFurniture {
@Serial @Serial
private static final long serialVersionUID = -1046265159354525567L; private static final long serialVersionUID = -1046265159354525567L;
private CityObject parent;
public void setGmlObject(BuildingFurniture gmlObject) { public void setGmlObject(BuildingFurniture gmlObject) {
super.setGmlObject(gmlObject); super.setGmlObject(gmlObject);
} }
public void setParent(AbstractBuilding parent) {
this.parent = parent;
}
public void setParent(AbstractBuildingSubdivision parent) {
this.parent = parent;
}
@Override
public CityObject getParent() {
return parent;
}
@Override
public CityObject getTopLevelCityObject() {
return parent.getTopLevelCityObject();
}
} }
...@@ -22,8 +22,11 @@ public class BuildingUnit extends AbstractBuildingSubdivision { ...@@ -22,8 +22,11 @@ public class BuildingUnit extends AbstractBuildingSubdivision {
} }
public List<Storey> getStoreys() { public List<Storey> getStoreys() {
return storeys; return storeys;
} }
public void addStorey(Storey storey) {
storeys.add(storey);
}
} }
...@@ -12,20 +12,25 @@ import org.xmlobjects.gml.model.geometry.primitives.Solid; ...@@ -12,20 +12,25 @@ import org.xmlobjects.gml.model.geometry.primitives.Solid;
import org.xmlobjects.gml.model.geometry.primitives.SolidProperty; import org.xmlobjects.gml.model.geometry.primitives.SolidProperty;
import java.io.Serial; import java.io.Serial;
import java.util.List;
public class CityFurniture extends CityObject { public class CityFurniture extends CityObject implements BoundedSpace{
@Serial @Serial
private static final long serialVersionUID = 3325661061543962473L; private static final long serialVersionUID = 3325661061543962473L;
private List<BoundarySurface> boundarySurfaces;
private org.citygml4j.core.model.cityfurniture.CityFurniture cgmlCityFurniture; private org.citygml4j.core.model.cityfurniture.CityFurniture cgmlCityFurniture;
@Override @Override
public void accept(CheckableVisitor 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);
} }
for (BoundarySurface bs : boundarySurfaces) {
bs.accept(c);
}
} }
...@@ -113,6 +118,7 @@ public class CityFurniture extends CityObject { ...@@ -113,6 +118,7 @@ public class CityFurniture extends CityObject {
break; break;
case LOD4: case LOD4:
cgmlCityFurniture.getDeprecatedProperties().setLod4Geometry(new SolidProperty(solid)); cgmlCityFurniture.getDeprecatedProperties().setLod4Geometry(new SolidProperty(solid));
break;
default: default:
throw new IllegalStateException("Cannot add " + geom.getLod() + " solid to buildings"); throw new IllegalStateException("Cannot add " + geom.getLod() + " solid to buildings");
} }
...@@ -123,4 +129,13 @@ public class CityFurniture extends CityObject { ...@@ -123,4 +129,13 @@ public class CityFurniture extends CityObject {
return FeatureType.CITY_FURNITURE; return FeatureType.CITY_FURNITURE;
} }
@Override
public List<BoundarySurface> getBoundarySurfaces() {
return boundarySurfaces;
}
public void addBoundarySurface(BoundarySurface b) {
boundarySurfaces.add(b);
b.setParent(this);
}
} }
...@@ -21,7 +21,7 @@ import java.util.List; ...@@ -21,7 +21,7 @@ import java.util.List;
/** /**
* *
*/ */
public class GenericCityObject extends CityObject { public class GenericCityObject extends CityObject implements BoundedSpace{
@Serial @Serial
private static final long serialVersionUID = 5886527664552294353L; private static final long serialVersionUID = 5886527664552294353L;
...@@ -124,6 +124,7 @@ public class GenericCityObject extends CityObject { ...@@ -124,6 +124,7 @@ public class GenericCityObject extends CityObject {
return FeatureType.OTHER_CITY_OBJECT; return FeatureType.OTHER_CITY_OBJECT;
} }
@Override
public List<BoundarySurface> getBoundarySurfaces() { public List<BoundarySurface> getBoundarySurfaces() {
return boundarySurfaceList; return boundarySurfaceList;
} }
......
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