Commit 938e4b5a authored by Riegel's avatar Riegel
Browse files

Refactor: Rework selection of render color

parent 06712902
...@@ -7,6 +7,7 @@ import de.hft.stuttgart.citydoctor2.parser.ParserConfiguration; ...@@ -7,6 +7,7 @@ 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.CopyHandler;
import de.hft.stuttgart.citydoctor2.utils.Copyable; import de.hft.stuttgart.citydoctor2.utils.Copyable;
import javafx.scene.paint.Color;
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;
...@@ -94,7 +95,7 @@ public abstract class AbstractFurniture extends CityObject { ...@@ -94,7 +95,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) {
...@@ -134,6 +135,11 @@ public abstract class AbstractFurniture extends CityObject { ...@@ -134,6 +135,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);
......
...@@ -7,6 +7,7 @@ import de.hft.stuttgart.citydoctor2.parser.ParserConfiguration; ...@@ -7,6 +7,7 @@ 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.CopyHandler;
import de.hft.stuttgart.citydoctor2.utils.Copyable; import de.hft.stuttgart.citydoctor2.utils.Copyable;
import javafx.scene.paint.Color;
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,6 +55,11 @@ public abstract class AbstractTunnel extends CityObject { ...@@ -54,6 +55,11 @@ 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);
......
...@@ -25,6 +25,7 @@ import de.hft.stuttgart.citydoctor2.parser.ParserConfiguration; ...@@ -25,6 +25,7 @@ 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.CopyHandler;
import de.hft.stuttgart.citydoctor2.utils.Copyable; import de.hft.stuttgart.citydoctor2.utils.Copyable;
import javafx.scene.paint.Color;
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;
...@@ -86,6 +87,20 @@ public class BoundarySurface extends CityObject { ...@@ -86,6 +87,20 @@ public class BoundarySurface extends CityObject {
return openings; return openings;
} }
@Override
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 -> Color.WHITE;
};
}
@Override @Override
public void reCreateGeometries(GeometryFactory factory, ParserConfiguration config) { public void reCreateGeometries(GeometryFactory factory, ParserConfiguration config) {
if (gmlObject.getId() == null) { if (gmlObject.getId() == null) {
......
...@@ -25,6 +25,7 @@ import de.hft.stuttgart.citydoctor2.parser.ParserConfiguration; ...@@ -25,6 +25,7 @@ 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.CopyHandler;
import de.hft.stuttgart.citydoctor2.utils.Copyable; import de.hft.stuttgart.citydoctor2.utils.Copyable;
import javafx.scene.paint.Color;
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,6 +67,10 @@ public class BridgeConstructiveElement extends CityObject { ...@@ -66,6 +67,10 @@ public class BridgeConstructiveElement extends CityObject {
return parent; return parent;
} }
@Override
public Color getRenderColor() {
return parent.getRenderColor().brighter();
}
@Override @Override
public Copyable createCopyInstance() { public Copyable createCopyInstance() {
......
...@@ -25,6 +25,7 @@ import de.hft.stuttgart.citydoctor2.parser.ParserConfiguration; ...@@ -25,6 +25,7 @@ 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.CopyHandler;
import de.hft.stuttgart.citydoctor2.utils.Copyable; import de.hft.stuttgart.citydoctor2.utils.Copyable;
import javafx.scene.paint.Color;
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;
...@@ -97,6 +98,11 @@ public class BridgeObject extends CityObject { ...@@ -97,6 +98,11 @@ public class BridgeObject extends CityObject {
return bridgeFurniture; return bridgeFurniture;
} }
@Override
public Color getRenderColor() {
return Color.LIGHTSTEELBLUE;
}
@Override @Override
public void reCreateGeometries(GeometryFactory factory, ParserConfiguration config) { public void reCreateGeometries(GeometryFactory factory, ParserConfiguration config) {
for (Geometry geom : getGeometries()) { for (Geometry geom : getGeometries()) {
......
...@@ -2,6 +2,7 @@ package de.hft.stuttgart.citydoctor2.datastructure; ...@@ -2,6 +2,7 @@ package de.hft.stuttgart.citydoctor2.datastructure;
import de.hft.stuttgart.citydoctor2.utils.CopyHandler; import de.hft.stuttgart.citydoctor2.utils.CopyHandler;
import de.hft.stuttgart.citydoctor2.utils.Copyable; import de.hft.stuttgart.citydoctor2.utils.Copyable;
import javafx.scene.paint.Color;
import java.io.Serial; import java.io.Serial;
...@@ -39,7 +40,12 @@ public class BridgeRoom extends AbstractRoom { ...@@ -39,7 +40,12 @@ public class BridgeRoom extends AbstractRoom {
@Override @Override
public CityObject getTopLevelCityObject() { public CityObject getTopLevelCityObject() {
return getParent(); return parent.getTopLevelCityObject();
}
@Override
public Color getRenderColor() {
return parent.getRenderColor();
} }
@Override @Override
......
...@@ -2,6 +2,7 @@ package de.hft.stuttgart.citydoctor2.datastructure; ...@@ -2,6 +2,7 @@ package de.hft.stuttgart.citydoctor2.datastructure;
import de.hft.stuttgart.citydoctor2.utils.CopyHandler; import de.hft.stuttgart.citydoctor2.utils.CopyHandler;
import de.hft.stuttgart.citydoctor2.utils.Copyable; import de.hft.stuttgart.citydoctor2.utils.Copyable;
import javafx.scene.paint.Color;
import org.citygml4j.core.model.building.BuildingFurnitureProperty; import org.citygml4j.core.model.building.BuildingFurnitureProperty;
import java.io.Serial; import java.io.Serial;
...@@ -55,6 +56,11 @@ public class BuildingRoom extends AbstractRoom { ...@@ -55,6 +56,11 @@ public class BuildingRoom extends AbstractRoom {
return getParent().getTopLevelCityObject(); return getParent().getTopLevelCityObject();
} }
@Override
public Color getRenderColor() {
return parent.getRenderColor();
}
@Override @Override
public void collectInstances(CopyHandler handler) { public void collectInstances(CopyHandler handler) {
super.collectInstances(handler); super.collectInstances(handler);
......
...@@ -5,6 +5,7 @@ import de.hft.stuttgart.citydoctor2.parser.ParserConfiguration; ...@@ -5,6 +5,7 @@ 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.CopyHandler;
import de.hft.stuttgart.citydoctor2.utils.Copyable; import de.hft.stuttgart.citydoctor2.utils.Copyable;
import javafx.scene.paint.Color;
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;
...@@ -35,6 +36,11 @@ public class CityFurniture extends CityObject { ...@@ -35,6 +36,11 @@ public class CityFurniture extends CityObject {
return cgmlCityFurniture; return cgmlCityFurniture;
} }
@Override
public Color getRenderColor() {
return Color.THISTLE;
}
public void setGmlObject(org.citygml4j.core.model.cityfurniture.CityFurniture gmlCityFurniture) { public void setGmlObject(org.citygml4j.core.model.cityfurniture.CityFurniture gmlCityFurniture) {
cgmlCityFurniture = gmlCityFurniture; cgmlCityFurniture = gmlCityFurniture;
} }
......
...@@ -24,6 +24,7 @@ import de.hft.stuttgart.citydoctor2.check.CheckId; ...@@ -24,6 +24,7 @@ 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.CopyHandler; import de.hft.stuttgart.citydoctor2.utils.CopyHandler;
import de.hft.stuttgart.citydoctor2.utils.Copyable; import de.hft.stuttgart.citydoctor2.utils.Copyable;
import javafx.scene.paint.Color;
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;
...@@ -44,6 +45,7 @@ public abstract class CityObject extends GmlElement { ...@@ -44,6 +45,7 @@ public abstract class CityObject extends GmlElement {
@Serial @Serial
private static final long serialVersionUID = 651712070755024188L; private static final long serialVersionUID = 651712070755024188L;
private final List<Geometry> geometryList = new ArrayList<>(); private final List<Geometry> geometryList = new ArrayList<>();
private final List<GenericAttribute> genericAttributeList = new ArrayList<>(); private final List<GenericAttribute> genericAttributeList = new ArrayList<>();
/** /**
...@@ -107,6 +109,17 @@ public abstract class CityObject extends GmlElement { ...@@ -107,6 +109,17 @@ public abstract class CityObject extends GmlElement {
*/ */
public abstract CityObject getTopLevelCityObject(); public abstract CityObject getTopLevelCityObject();
/**
* Returns the display text for this object
*/
public String getDisplayText() {
return String.format("[%s] %s", this.getClass().getSimpleName(), this.getGmlId().toString());
}
public Color getRenderColor() {
return Color.WHITE;
}
public void addGenericAttribute(GenericAttribute genericAttribute) { public void addGenericAttribute(GenericAttribute genericAttribute) {
genericAttributeList.add(genericAttribute); genericAttributeList.add(genericAttribute);
} }
......
...@@ -7,6 +7,7 @@ import de.hft.stuttgart.citydoctor2.parser.ParserConfiguration; ...@@ -7,6 +7,7 @@ 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.CopyHandler;
import de.hft.stuttgart.citydoctor2.utils.Copyable; import de.hft.stuttgart.citydoctor2.utils.Copyable;
import javafx.scene.paint.Color;
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.AbstractCityObject; import org.citygml4j.core.model.core.AbstractCityObject;
...@@ -210,6 +211,11 @@ public class GenericCityObject extends CityObject { ...@@ -210,6 +211,11 @@ public class GenericCityObject extends CityObject {
return boundarySurfaceList; return boundarySurfaceList;
} }
@Override
public Color getRenderColor() {
return Color.DARKGOLDENROD;
}
@Override @Override
public void unsetGmlGeometries() { public void unsetGmlGeometries() {
cgmlGos.setLod1Solid(null); cgmlGos.setLod1Solid(null);
......
...@@ -25,6 +25,7 @@ import de.hft.stuttgart.citydoctor2.parser.ParserConfiguration; ...@@ -25,6 +25,7 @@ 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.CopyHandler;
import de.hft.stuttgart.citydoctor2.utils.Copyable; import de.hft.stuttgart.citydoctor2.utils.Copyable;
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;
...@@ -177,6 +178,11 @@ public class Installation extends CityObject { ...@@ -177,6 +178,11 @@ public class Installation extends CityObject {
return parent; return parent;
} }
@Override
public Color getRenderColor() {
return parent.getRenderColor().darker();
}
public void addBoundarySurface(BoundarySurface bs) { public void addBoundarySurface(BoundarySurface bs) {
boundarySurfaces.add(bs); boundarySurfaces.add(bs);
bs.setParent(this); bs.setParent(this);
......
...@@ -22,6 +22,7 @@ import de.hft.stuttgart.citydoctor2.check.Check; ...@@ -22,6 +22,7 @@ import de.hft.stuttgart.citydoctor2.check.Check;
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.Copyable; import de.hft.stuttgart.citydoctor2.utils.Copyable;
import javafx.scene.paint.Color;
import org.citygml4j.core.model.core.AbstractCityObject; import org.citygml4j.core.model.core.AbstractCityObject;
import org.citygml4j.core.model.landuse.LandUse; import org.citygml4j.core.model.landuse.LandUse;
import org.citygml4j.core.util.geometry.GeometryFactory; import org.citygml4j.core.util.geometry.GeometryFactory;
...@@ -63,6 +64,11 @@ public class LandObject extends CityObject { ...@@ -63,6 +64,11 @@ public class LandObject extends CityObject {
return FeatureType.LAND; return FeatureType.LAND;
} }
@Override
public Color getRenderColor() {
return Color.TAN;
}
private void setMultiSurfaceAccordingToLod(Geometry geom, MultiSurface ms) { private void setMultiSurfaceAccordingToLod(Geometry geom, MultiSurface ms) {
switch (geom.getLod()) { switch (geom.getLod()) {
case LOD0: case LOD0:
......
...@@ -24,6 +24,7 @@ import de.hft.stuttgart.citydoctor2.check.CheckId; ...@@ -24,6 +24,7 @@ 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.CopyHandler; import de.hft.stuttgart.citydoctor2.utils.CopyHandler;
import de.hft.stuttgart.citydoctor2.utils.Copyable; import de.hft.stuttgart.citydoctor2.utils.Copyable;
import javafx.scene.paint.Color;
import org.citygml4j.core.model.relief.ReliefFeature; import org.citygml4j.core.model.relief.ReliefFeature;
import org.citygml4j.core.util.geometry.GeometryFactory; import org.citygml4j.core.util.geometry.GeometryFactory;
...@@ -156,6 +157,11 @@ public class ReliefObject extends CityObject { ...@@ -156,6 +157,11 @@ public class ReliefObject extends CityObject {
return FeatureType.LAND; return FeatureType.LAND;
} }
@Override
public Color getRenderColor() {
return Color.TAN;
}
public void addComponent(TinObject component) { public void addComponent(TinObject component) {
components.add(component); components.add(component);
} }
......
...@@ -21,6 +21,7 @@ package de.hft.stuttgart.citydoctor2.datastructure; ...@@ -21,6 +21,7 @@ package de.hft.stuttgart.citydoctor2.datastructure;
import de.hft.stuttgart.citydoctor2.check.Check; import de.hft.stuttgart.citydoctor2.check.Check;
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 javafx.scene.paint.Color;
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.relief.TINRelief; import org.citygml4j.core.model.relief.TINRelief;
...@@ -101,4 +102,9 @@ public class TinObject extends CityObject { ...@@ -101,4 +102,9 @@ public class TinObject extends CityObject {
return FeatureType.LAND; return FeatureType.LAND;
} }
@Override
public Color getRenderColor() {
return Color.TAN;
}
} }
...@@ -65,10 +65,12 @@ public class TopLevelTransportFeature extends TransportationSpace { ...@@ -65,10 +65,12 @@ public class TopLevelTransportFeature extends TransportationSpace {
public void addSection(TransportSection section) { public void addSection(TransportSection section) {
sections.add(section); sections.add(section);
section.setParent(this);
} }
public void addIntersection(TransportSection section) { public void addIntersection(TransportSection section) {
intersections.add(section); intersections.add(section);
section.setParent(this);
} }
public List<TransportSection> getSections() { public List<TransportSection> getSections() {
......
...@@ -11,6 +11,9 @@ import org.xmlobjects.gml.model.geometry.aggregates.MultiSurfaceProperty; ...@@ -11,6 +11,9 @@ import org.xmlobjects.gml.model.geometry.aggregates.MultiSurfaceProperty;
public class TrafficAreaObject extends TransportationObject { public class TrafficAreaObject extends TransportationObject {
private TrafficSpaceObject parent;
public enum TrafficAreaType { public enum TrafficAreaType {
TRAFFIC_AREA, AUXILIARY_TRAFFIC_AREA TRAFFIC_AREA, AUXILIARY_TRAFFIC_AREA
} }
...@@ -116,7 +119,15 @@ public class TrafficAreaObject extends TransportationObject { ...@@ -116,7 +119,15 @@ public class TrafficAreaObject extends TransportationObject {
@Override @Override
public CityObject getTopLevelCityObject() { public CityObject getTopLevelCityObject() {
return this; return parent.getTopLevelCityObject();
}
public void setParent(TrafficSpaceObject parent) {
this.parent = parent;
}
public TrafficSpaceObject getParent() {
return parent;
} }
@Override @Override
......
...@@ -19,6 +19,8 @@ public class TrafficSpaceObject extends TransportationObject { ...@@ -19,6 +19,8 @@ public class TrafficSpaceObject extends TransportationObject {
private final List<TrafficAreaObject> trafficAreas = new ArrayList<>(); private final List<TrafficAreaObject> trafficAreas = new ArrayList<>();
private TransportationSpace parent;
public enum TrafficSpaceType { public enum TrafficSpaceType {
TRAFFIC_SPACE, AUXILIARY_TRAFFIC_SPACE TRAFFIC_SPACE, AUXILIARY_TRAFFIC_SPACE
} }
...@@ -37,6 +39,7 @@ public class TrafficSpaceObject extends TransportationObject { ...@@ -37,6 +39,7 @@ public class TrafficSpaceObject extends TransportationObject {
public void addTrafficArea(TrafficAreaObject trafficAreaObject) { public void addTrafficArea(TrafficAreaObject trafficAreaObject) {
trafficAreas.add(trafficAreaObject); trafficAreas.add(trafficAreaObject);
trafficAreaObject.setParent(this);
} }
@Override @Override
...@@ -138,10 +141,18 @@ public class TrafficSpaceObject extends TransportationObject { ...@@ -138,10 +141,18 @@ public class TrafficSpaceObject extends TransportationObject {
@Override @Override
public CityObject getTopLevelCityObject() { public CityObject getTopLevelCityObject() {
return this; return parent.getTopLevelCityObject();
} }
public void setParent(TransportationSpace parent) {
this.parent = parent;
}
public TransportationSpace getParent() {
return parent;
}
@Override @Override
public String toString() { public String toString() {
return "TransportationSpaceObject [id=" + getGmlId() + "]"; return "TransportationSpaceObject [id=" + getGmlId() + "]";
......
...@@ -2,6 +2,8 @@ package de.hft.stuttgart.citydoctor2.datastructure; ...@@ -2,6 +2,8 @@ package de.hft.stuttgart.citydoctor2.datastructure;
public class TransportSection extends TransportationSpace { public class TransportSection extends TransportationSpace {
private TopLevelTransportFeature parent;
public enum SectionType { public enum SectionType {
SECTION, INTERSECTION SECTION, INTERSECTION
} }
...@@ -13,5 +15,17 @@ public class TransportSection extends TransportationSpace { ...@@ -13,5 +15,17 @@ public class TransportSection extends TransportationSpace {
} }
} }
public void setParent(TopLevelTransportFeature parent) {
this.parent = parent;
}
public TopLevelTransportFeature getParent() {
return parent;
}
@Override
public CityObject getTopLevelCityObject() {
return parent.getTopLevelCityObject();
}
} }
...@@ -25,6 +25,7 @@ import de.hft.stuttgart.citydoctor2.parser.ParserConfiguration; ...@@ -25,6 +25,7 @@ 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.CopyHandler;
import de.hft.stuttgart.citydoctor2.utils.Copyable; import de.hft.stuttgart.citydoctor2.utils.Copyable;
import javafx.scene.paint.Color;
import org.citygml4j.core.model.core.AbstractCityObject; import org.citygml4j.core.model.core.AbstractCityObject;
import org.citygml4j.core.model.core.AbstractSpace; import org.citygml4j.core.model.core.AbstractSpace;
import org.citygml4j.core.model.transportation.AbstractTransportationSpace; import org.citygml4j.core.model.transportation.AbstractTransportationSpace;
...@@ -77,6 +78,17 @@ public abstract class TransportationObject extends CityObject { ...@@ -77,6 +78,17 @@ public abstract class TransportationObject extends CityObject {
return ato; return ato;
} }
@Override
public Color getRenderColor() {
return switch (type) {
case TRACK -> Color.BROWN;
case WATERWAY -> Color.NAVY;
case SQUARE -> Color.DARKSLATEGRAY;
case AUXILLIARY_TRAFFIC_AREA, AUXILLIARY_TRAFFIC_SPACE -> Color.LIGHTSLATEGREY;
default -> Color.DIMGRAY;
};
}
public void setGmlObject(AbstractCityObject tc) { public void setGmlObject(AbstractCityObject tc) {
ato = tc; ato = tc;
...@@ -92,6 +104,11 @@ public abstract class TransportationObject extends CityObject { ...@@ -92,6 +104,11 @@ public abstract class TransportationObject extends CityObject {
return "TransportationObject [id=" + getGmlId() + "]"; return "TransportationObject [id=" + getGmlId() + "]";
} }
@Override
public String getDisplayText() {
return String.format("[%s] %s", this.type.name(), this.getGmlId().toString());
}
@Override @Override
public void fillValues(Copyable original, CopyHandler handler) { public void fillValues(Copyable original, CopyHandler handler) {
......
...@@ -35,10 +35,12 @@ public abstract class TransportationSpace extends TransportationObject { ...@@ -35,10 +35,12 @@ public abstract class TransportationSpace extends TransportationObject {
public void addTrafficSpace(TrafficSpaceObject t) { public void addTrafficSpace(TrafficSpaceObject t) {
trafficSpaces.add(t); trafficSpaces.add(t);
t.setParent(this);
} }
public void addAuxTrafficSpace(TrafficSpaceObject t) { public void addAuxTrafficSpace(TrafficSpaceObject t) {
auxTrafficSpaces.add(t); auxTrafficSpaces.add(t);
t.setParent(this);
} }
@Override @Override
......
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