Commit 391a081b authored by Luna Riegel's avatar Luna Riegel
Browse files

Feat: Add parsing of ConstructionElementFilling

parent f57a3515
......@@ -45,6 +45,7 @@ public class BridgeConstructiveElement extends CityObject {
private final org.citygml4j.core.model.bridge.BridgeConstructiveElement gmlBridgeElement;
private final List<BoundarySurface> boundarySurfaceList = new ArrayList<>();
private final List<AbstractConstructiveFillingElement> fillings = new ArrayList<>();
private BridgeObject parent;
public BridgeConstructiveElement(org.citygml4j.core.model.bridge.BridgeConstructiveElement gmlObject) {
......@@ -200,4 +201,13 @@ public class BridgeConstructiveElement extends CityObject {
return boundarySurfaceList;
}
public void addFilling(AbstractConstructiveFillingElement fe) {
fillings.add(fe);
fe.setParent(this);
}
public List<AbstractConstructiveFillingElement> getFillings() {
return fillings;
}
}
......@@ -29,6 +29,7 @@ public class BuildingConstructiveElement extends CityObject {
private final org.citygml4j.core.model.building.BuildingConstructiveElement gmlBuildingElement;
private final List<BoundarySurface> boundarySurfaceList = new ArrayList<>();
private final List<AbstractConstructiveFillingElement> fillings = new ArrayList<>();
private AbstractBuilding parent;
public BuildingConstructiveElement(org.citygml4j.core.model.building.BuildingConstructiveElement gmlObject) {
......@@ -79,6 +80,9 @@ public class BuildingConstructiveElement extends CityObject {
for (BoundarySurface bs : boundarySurfaceList) {
bs.accept(c);
}
for (AbstractConstructiveFillingElement fe : fillings) {
fe.accept(c);
}
}
private void reCreateBoundarySurface(GeometryFactory factory, ParserConfiguration config, BoundarySurface bs) {
......@@ -161,4 +165,14 @@ public class BuildingConstructiveElement extends CityObject {
public List<BoundarySurface> getBoundarySurfaces() {
return boundarySurfaceList;
}
public void addFilling(AbstractConstructiveFillingElement fe) {
fillings.add(fe);
fe.setParent(this);
}
public List<AbstractConstructiveFillingElement> getFillings() {
return fillings;
}
}
......@@ -28,6 +28,7 @@ public class TunnelConstructiveElement extends CityObject {
private final org.citygml4j.core.model.tunnel.TunnelConstructiveElement gmlTunnelElement;
private final List<BoundarySurface> boundarySurfaceList = new ArrayList<>();
private final List<AbstractConstructiveFillingElement> fillings = new ArrayList<>();
private AbstractTunnel parent;
public TunnelConstructiveElement(org.citygml4j.core.model.tunnel.TunnelConstructiveElement gmlObject) {
......@@ -178,4 +179,14 @@ public class TunnelConstructiveElement extends CityObject {
return boundarySurfaceList;
}
public void addFilling(AbstractConstructiveFillingElement fe) {
fillings.add(fe);
fe.setParent(this);
}
public List<AbstractConstructiveFillingElement> getFillings() {
return fillings;
}
}
......@@ -24,12 +24,15 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.StringJoiner;
import java.util.function.Function;
import de.hft.stuttgart.citydoctor2.database.FeatureCache;
import de.hft.stuttgart.citydoctor2.database.UnconnectedCache;
import de.hft.stuttgart.citydoctor2.datastructure.AbstractConstructiveFillingElement;
import de.hft.stuttgart.citydoctor2.datastructure.BoundingBox;
import de.hft.stuttgart.citydoctor2.datastructure.DoorObject;
import de.hft.stuttgart.citydoctor2.datastructure.FeatureType;
import de.hft.stuttgart.citydoctor2.datastructure.OtherConstructionObject;
import de.hft.stuttgart.citydoctor2.datastructure.WindowObject;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.citygml4j.core.model.CityGMLVersion;
......@@ -51,7 +54,12 @@ import org.citygml4j.core.model.building.BuildingRoomProperty;
import org.citygml4j.core.model.building.BuildingUnit;
import org.citygml4j.core.model.building.Storey;
import org.citygml4j.core.model.construction.AbstractConstruction;
import org.citygml4j.core.model.construction.AbstractConstructiveElement;
import org.citygml4j.core.model.construction.AbstractFillingElement;
import org.citygml4j.core.model.construction.AbstractFillingElementProperty;
import org.citygml4j.core.model.construction.Door;
import org.citygml4j.core.model.construction.OtherConstruction;
import org.citygml4j.core.model.construction.Window;
import org.citygml4j.core.model.core.AbstractCityObject;
import org.citygml4j.core.model.core.AbstractFeatureWithLifespan;
import org.citygml4j.core.model.core.AbstractGenericAttributeProperty;
......@@ -798,23 +806,35 @@ public class Citygml3FeatureMapper extends ObjectWalker {
org.citygml4j.core.model.tunnel.TunnelConstructiveElement gmlTe) {
TunnelConstructiveElement te = new TunnelConstructiveElement(gmlTe);
mapAbstractOccupiedSpace(gmlTe, te, Orientation.OUTWARD);
List<BoundarySurface> boundarySurfaces = mapConstructiveElementSurfaces(gmlTe);
for (BoundarySurface bs : boundarySurfaces) {
te.addBoundarySurface(bs);
for (Geometry geom : bs.getGeometries()) {
for (Polygon p : geom.getPolygons()) {
p.setPartOfSurface(bs);
}
}
}
return te;
}
private List<BoundarySurface> mapConstructiveElementSurfaces(AbstractConstructiveElement ace) {
SurfaceMapper surfaceMapper = new SurfaceMapper(polygonMap, references, compositeMap, vertexMap, config);
for (AbstractSpaceBoundaryProperty surfaceProp : gmlTe.getBoundaries()) {
for (AbstractSpaceBoundaryProperty surfaceProp : ace.getBoundaries()) {
if (!surfaceProp.isSetObject()) {
continue;
}
AbstractSpaceBoundary surface = surfaceProp.getObject();
surface.accept(surfaceMapper);
}
for (BoundarySurface bs : surfaceMapper.getSurfaces()) {
te.addBoundarySurface(bs);
for (Geometry geom : bs.getGeometries()) {
for (Polygon p : geom.getPolygons()) {
p.setPartOfSurface(bs);
}
for (AbstractFillingElementProperty fillProp : ace.getFillings()) {
if (!fillProp.isSetObject()) {
continue;
}
AbstractFillingElement filling = fillProp.getObject();
filling.accept(surfaceMapper);
}
return te;
return surfaceMapper.getSurfaces();
}
private void updatePartOfSurface(BridgeObject bo, SurfaceMapper surfaceMapper) {
......@@ -840,11 +860,41 @@ public class Citygml3FeatureMapper extends ObjectWalker {
AbstractSpaceBoundary surface = surfaceProp.getObject();
surface.accept(surfaceMapper);
}
for (AbstractFillingElementProperty fillProp : ele.getFillings()) {
if (!fillProp.isSetObject()) {
continue;
}
AbstractFillingElement filling = fillProp.getObject();
bce.addFilling(mapAbstractFillingElement(filling));
}
for (BoundarySurface bs : surfaceMapper.getSurfaces()) {
bce.addBoundarySurface(bs);
}
}
private AbstractConstructiveFillingElement mapAbstractFillingElement(AbstractFillingElement ele){
AbstractConstructiveFillingElement fill;
if (ele instanceof Door d){
fill = new DoorObject(d);
} else if (ele instanceof Window w){
fill = new WindowObject(w);
} else {
fill = new AbstractConstructiveFillingElement(ele) {
@Override
public String getDisplayText(){
return String.format("[Unknown filling element] %s", this.getGmlId().toString());
}
@Override
public FeatureType getFeatureType() {
return null;
}
};
}
mapAbstractOccupiedSpace(ele,fill,Orientation.OUTWARD);
return fill;
}
private void mapAbstractConstructiveElement(org.citygml4j.core.model.bridge.BridgeConstructiveElement ele,
BridgeConstructiveElement bce) {
mapAbstractOccupiedSpace(ele, bce, Orientation.OUTWARD);
......@@ -1359,6 +1409,13 @@ public class Citygml3FeatureMapper extends ObjectWalker {
AbstractSpaceBoundary surface = surfaceProp.getObject();
surface.accept(surfaceMapper);
}
for (AbstractFillingElementProperty fillProp : ele.getFillings()) {
if (!fillProp.isSetObject()) {
continue;
}
AbstractFillingElement filling = fillProp.getObject();
bce.addFilling(mapAbstractFillingElement(filling));
}
for (BoundarySurface bs : surfaceMapper.getSurfaces()) {
bce.addBoundarySurface(bs);
}
......
......@@ -197,6 +197,21 @@ public class SurfaceMapper extends ObjectWalker {
surfaces.add(surface);
}
@Override
public void visit(WindowSurface windowSurface) {
BoundarySurface surface = new BoundarySurface(BoundarySurfaceType.WINDOW, windowSurface);
handleThematicSurface(windowSurface, surface);
surfaces.add(surface);
}
@Override
public void visit(DoorSurface doorSurface) {
BoundarySurface surface = new BoundarySurface(BoundarySurfaceType.DOOR, doorSurface);
handleThematicSurface(doorSurface, surface);
surfaces.add(surface);
}
public List<BoundarySurface> getSurfaces() {
return surfaces;
}
......
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