Commit 89433d80 authored by Riegel's avatar Riegel
Browse files

Add support for GenericCityObject objects

Showing with 34 additions and 2 deletions
+34 -2
......@@ -58,6 +58,7 @@ public class CityDoctorModel {
private final List<Vegetation> vegetation;
private final List<BridgeObject> bridges;
private final List<CityFurniture> cityfurniture;
private final List<GenericCityObject> genericObjects;
private final List<CityObject> land;
private final List<TransportationObject> roads;
private final List<WaterObject> water;
......@@ -84,6 +85,7 @@ public class CityDoctorModel {
roads = new ArrayList<>();
water = new ArrayList<>();
cityfurniture = new ArrayList<>();
genericObjects = new ArrayList<>();
globalErrors = new ArrayList<>();
}
......@@ -227,6 +229,7 @@ public class CityDoctorModel {
collectErrorsFromList(errors, roads);
collectErrorsFromList(errors, water);
collectErrorsFromList(errors, cityfurniture);
collectErrorsFromList(errors, genericObjects);
return new HashSet<>(errors);
}
......@@ -264,6 +267,14 @@ public class CityDoctorModel {
cityfurniture.add(coFurniture);
}
public List<GenericCityObject> getGenericCityObjects(){
return genericObjects;
}
public void addGenericCityObject(GenericCityObject coGenericCityObject){
genericObjects.add(coGenericCityObject);
}
public void setCityModel(CityModel cModel) {
this.cModel = cModel;
}
......@@ -327,6 +338,8 @@ public class CityDoctorModel {
replaceWaterObject(currentFeature, nextFeature);
} else if (nextFeature instanceof CityFurniture) {
replaceCityFurniture(currentFeature, nextFeature);
} else if (nextFeature instanceof GenericCityObject) {
replaceGenericCityObject(currentFeature, nextFeature);
}
}
......@@ -362,6 +375,14 @@ public class CityDoctorModel {
cityfurniture.set(index, (CityFurniture) nextFeature);
}
private void replaceGenericCityObject(CityObject currentFeature, CityObject nextFeature) {
int index = genericObjects.indexOf(currentFeature);
if (index == -1) {
throw new IllegalStateException(COULD_NOT_FIND_FEATURE + currentFeature + " in generic city objects");
}
genericObjects.set(index, (GenericCityObject) nextFeature);
}
private void replaceTransportationObject(CityObject currentFeature, CityObject nextFeature) {
int index = roads.indexOf(currentFeature);
if (index == -1) {
......@@ -403,6 +424,10 @@ public class CityDoctorModel {
land.add(co);
} else if (co instanceof TinObject) {
land.add(co);
} else if (co instanceof CityFurniture cf) {
cityfurniture.add(cf);
} else if (co instanceof GenericCityObject gco) {
genericObjects.add(gco);
}
}
......
......@@ -27,6 +27,6 @@ package de.hft.stuttgart.citydoctor2.datastructure;
public enum FeatureType {
BUILDING, TRANSPORTATION, VEGETATION, BRIDGE, LAND, WATER, BOUNDARY_SURFACE, INSTALLATION, OPENING,
BUILDING_PART, BRIDGE_CONSTRUCTION_ELEMENT, BRIDGE_INSTALLATION, ROOM, FURNITURE, CITY_FURNITURE
BUILDING_PART, BRIDGE_CONSTRUCTION_ELEMENT, BRIDGE_INSTALLATION, ROOM, FURNITURE, CITY_FURNITURE, GENERIC_CITY_OBJECT
}
......@@ -128,8 +128,15 @@ public class Citygml3FeatureMapper extends ObjectWalker {
model.addCityFurniture(cf);
}
@Override
public void visit(org.citygml4j.core.model.generics.GenericOccupiedSpace gos){
System.out.println(gos.toString());
GenericCityObject gco = new GenericCityObject();
gco.setGmlObject(gos);
mapAbstractOccupiedSpace(gos, gco);
resolveAndClearReferences();
gco.unsetGmlGeometries();
updateEdgesAndVertices(gco);
model.addGenericCityObject(gco);
}
......
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