Commit 0d2e9fd5 authored by Riegel's avatar Riegel
Browse files

Merge branch 'dev' into 'master'

Version 3.17.2

See merge request !32
parents 491a5dfd e0e40fdd
Pipeline #11127 canceled with stage
package de.hft.stuttgart.citydoctor2.datastructure; 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.check.CheckError;
import de.hft.stuttgart.citydoctor2.check.CheckId;
import de.hft.stuttgart.citydoctor2.parser.ParserConfiguration;
import de.hft.stuttgart.citydoctor2.utils.CopyHandler;
import de.hft.stuttgart.citydoctor2.utils.Copyable;
import org.citygml4j.core.model.deprecated.transportation.TransportationComplex; import org.citygml4j.core.model.deprecated.transportation.TransportationComplex;
import org.citygml4j.core.model.transportation.Railway; import org.citygml4j.core.model.transportation.Railway;
import org.citygml4j.core.model.transportation.Road; import org.citygml4j.core.model.transportation.Road;
import org.citygml4j.core.model.transportation.Square; import org.citygml4j.core.model.transportation.Square;
import org.citygml4j.core.model.transportation.Track; import org.citygml4j.core.model.transportation.Track;
import org.citygml4j.core.model.transportation.Waterway; import org.citygml4j.core.model.transportation.Waterway;
import org.citygml4j.core.util.geometry.GeometryFactory;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -65,10 +59,12 @@ public class TopLevelTransportFeature extends TransportationSpace { ...@@ -65,10 +59,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() {
...@@ -79,78 +75,6 @@ public class TopLevelTransportFeature extends TransportationSpace { ...@@ -79,78 +75,6 @@ public class TopLevelTransportFeature extends TransportationSpace {
return intersections; return intersections;
} }
@Override
public void reCreateGeometries(GeometryFactory factory, ParserConfiguration config) {
super.reCreateGeometries(factory, config);
for (TransportSection section : sections) {
section.reCreateGeometries(factory, config);
}
for (TransportSection section : intersections) {
section.reCreateGeometries(factory, config);
}
}
@Override
public boolean containsError(CheckId checkIdentifier) {
boolean hasError = super.containsError(checkIdentifier);
if (hasError) {
return true;
}
for (TransportSection section : sections) {
if (section.containsError(checkIdentifier)) {
return true;
}
}
for (TransportSection section : intersections) {
if (section.containsError(checkIdentifier)) {
return true;
}
}
return false;
}
@Override
public void clearAllContainedCheckResults() {
super.clearAllContainedCheckResults();
for (TransportSection section : sections) {
section.clearAllContainedCheckResults();
}
for (TransportSection section : intersections) {
section.clearAllContainedCheckResults();
}
}
@Override
public void collectContainedErrors(List<CheckError> errors) {
super.collectContainedErrors(errors);
for (TransportSection section : sections) {
section.collectContainedErrors(errors);
}
for (TransportSection section : intersections) {
section.collectContainedErrors(errors);
}
}
@Override
public boolean containsAnyError() {
boolean hasError = super.containsAnyError();
if (hasError) {
return true;
}
for (TransportSection section : sections) {
if (section.containsAnyError()) {
return true;
}
}
for (TransportSection section : intersections) {
if (section.containsAnyError()) {
return true;
}
}
return false;
}
@Override @Override
public void accept(Check c) { public void accept(Check c) {
super.accept(c); super.accept(c);
...@@ -165,78 +89,9 @@ public class TopLevelTransportFeature extends TransportationSpace { ...@@ -165,78 +89,9 @@ 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() + "]";
} }
@Override
public void prepareForChecking() {
super.prepareForChecking();
for (TransportSection section : sections) {
section.prepareForChecking();
}
for (TransportSection section : intersections) {
section.prepareForChecking();
}
}
@Override
public void clearMetaInformation() {
super.clearMetaInformation();
for (TransportSection section : sections) {
section.clearMetaInformation();
}
for (TransportSection section : intersections) {
section.clearMetaInformation();
}
}
@Override
public void collectInstances(CopyHandler handler) {
super.collectInstances(handler);
for (TransportSection section : sections) {
section.collectInstances(handler);
}
for (TransportSection section : intersections) {
section.collectInstances(handler);
}
}
@Override
public void fillValues(Copyable original, CopyHandler handler) {
super.fillValues(original, handler);
TransportationObject originalTo = (TransportationObject) original;
for (TransportSection section : sections) {
section.fillValues(originalTo, handler);
}
for (TransportSection section : intersections) {
section.fillValues(originalTo, handler);
}
}
@Override
public Copyable createCopyInstance() {
return new TopLevelTransportFeature(type);
}
} }
...@@ -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
} }
...@@ -24,7 +27,7 @@ public class TrafficAreaObject extends TransportationObject { ...@@ -24,7 +27,7 @@ public class TrafficAreaObject extends TransportationObject {
} }
@Override @Override
public void reCreateGeometries(GeometryFactory factory, ParserConfiguration config) { public void rebuildGeometries(GeometryFactory factory, ParserConfiguration config) {
for (Geometry geom : getGeometries()) { for (Geometry geom : getGeometries()) {
if (geom instanceof ImplicitGeometryHolder) { if (geom instanceof ImplicitGeometryHolder) {
continue; continue;
...@@ -40,6 +43,7 @@ public class TrafficAreaObject extends TransportationObject { ...@@ -40,6 +43,7 @@ public class TrafficAreaObject extends TransportationObject {
AuxiliaryTrafficArea ata = (AuxiliaryTrafficArea) super.getGmlObject(); AuxiliaryTrafficArea ata = (AuxiliaryTrafficArea) super.getGmlObject();
setMultiSurfaceAccordingToLod(ata, ms, geom.getLod()); setMultiSurfaceAccordingToLod(ata, ms, geom.getLod());
break; break;
} }
} else { } else {
throw new IllegalStateException("Geometry in TransportationObject cannot be of type " + geom.getType() throw new IllegalStateException("Geometry in TransportationObject cannot be of type " + geom.getType()
...@@ -99,6 +103,8 @@ public class TrafficAreaObject extends TransportationObject { ...@@ -99,6 +103,8 @@ public class TrafficAreaObject extends TransportationObject {
switch (type) { switch (type) {
case TRAFFIC_AREA: case TRAFFIC_AREA:
TrafficArea ta = (TrafficArea) super.getGmlObject(); TrafficArea ta = (TrafficArea) super.getGmlObject();
ta.setLod0MultiSurface(null);
ta.setLod1MultiSurface(null);
ta.setLod2MultiSurface(null); ta.setLod2MultiSurface(null);
ta.setLod3MultiSurface(null); ta.setLod3MultiSurface(null);
ta.getDeprecatedProperties().setLod4MultiSurface(null); ta.getDeprecatedProperties().setLod4MultiSurface(null);
...@@ -116,7 +122,15 @@ public class TrafficAreaObject extends TransportationObject { ...@@ -116,7 +122,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
......
package de.hft.stuttgart.citydoctor2.datastructure; 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.check.CheckError;
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.CityGmlUtils; import de.hft.stuttgart.citydoctor2.utils.CityGmlUtils;
import de.hft.stuttgart.citydoctor2.utils.CopyHandler;
import de.hft.stuttgart.citydoctor2.utils.Copyable;
import org.citygml4j.core.model.core.AbstractSpace; import org.citygml4j.core.model.core.AbstractSpace;
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;
import org.xmlobjects.gml.model.geometry.primitives.Solid;
import org.xmlobjects.gml.model.geometry.primitives.SolidProperty;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -19,6 +17,8 @@ public class TrafficSpaceObject extends TransportationObject { ...@@ -19,6 +17,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,20 +37,26 @@ public class TrafficSpaceObject extends TransportationObject { ...@@ -37,20 +37,26 @@ 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
public void reCreateGeometries(GeometryFactory factory, ParserConfiguration config) { public void rebuildGeometries(GeometryFactory factory, ParserConfiguration config) {
for (Geometry geom : getGeometries()) { for (Geometry geom : getGeometries()) {
if (geom instanceof ImplicitGeometryHolder) { if (geom instanceof ImplicitGeometryHolder) {
continue; continue;
} }
MultiSurface ms = CityGmlUtils.createMultiSurface(geom, factory, config);
AbstractSpace ats = (AbstractSpace) super.getGmlObject(); AbstractSpace ats = (AbstractSpace) super.getGmlObject();
if (geom.getType() == GeometryType.MULTI_SURFACE || geom.getType() == GeometryType.COMPOSITE_SURFACE) {
MultiSurface ms = CityGmlUtils.createMultiSurface(geom, factory, config);
setMultiSurfaceAccordingToLod(ats, ms, geom.getLod()); setMultiSurfaceAccordingToLod(ats, ms, geom.getLod());
} else if (geom.getType() == GeometryType.SOLID) {
Solid solid = CityGmlUtils.createSolid(geom, factory, config);
setSolidAccordingtoLod(ats, solid, geom.getLod());
} else {
throw new IllegalArgumentException("Unsupported geometry type: " + geom.getType());
} }
for (TrafficAreaObject tao : trafficAreas) {
tao.reCreateGeometries(factory, config);
} }
} }
...@@ -66,52 +72,26 @@ public class TrafficSpaceObject extends TransportationObject { ...@@ -66,52 +72,26 @@ public class TrafficSpaceObject extends TransportationObject {
ats.setLod3MultiSurface(new MultiSurfaceProperty(ms)); ats.setLod3MultiSurface(new MultiSurfaceProperty(ms));
break; break;
default: default:
throw new IllegalStateException("cannot set geometry with LOD for AuxiliaryTrafficSpace: " + lod); throw new IllegalStateException(String.format("Cannot set MultiSurface with LOD %s for " +
} "[GML]AbstractSpace in TrafficSpaceObject ", lod));
}
@Override
public boolean containsError(CheckId checkIdentifier) {
boolean hasError = super.containsError(checkIdentifier);
if (hasError) {
return true;
}
for (TrafficAreaObject tao : trafficAreas) {
if (tao.containsError(checkIdentifier)) {
return true;
}
}
return false;
}
@Override
public void clearAllContainedCheckResults() {
super.clearAllContainedCheckResults();
for (TrafficAreaObject tao : trafficAreas) {
tao.clearAllContainedCheckResults();
}
}
@Override
public void collectContainedErrors(List<CheckError> errors) {
super.collectContainedErrors(errors);
for (TrafficAreaObject tao : trafficAreas) {
tao.collectContainedErrors(errors);
} }
} }
@Override private void setSolidAccordingtoLod(AbstractSpace ats, Solid solid, Lod lod) {
public boolean containsAnyError() { switch (lod) {
boolean hasError = super.containsAnyError(); case LOD1:
if (hasError) { ats.setLod1Solid(new SolidProperty(solid));
return true; break;
} case LOD2:
for (TrafficAreaObject tao : trafficAreas) { ats.setLod2Solid(new SolidProperty(solid));
if (tao.containsAnyError()) { break;
return true; case LOD3:
} ats.setLod3Solid(new SolidProperty(solid));
break;
default:
throw new IllegalStateException(String.format("Cannot set MultiSurface with LOD %s for " +
"[GML]AbstractSpace in TrafficSpaceObject ", lod));
} }
return false;
} }
@Override @Override
...@@ -131,60 +111,28 @@ public class TrafficSpaceObject extends TransportationObject { ...@@ -131,60 +111,28 @@ 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) { ats.setLod1Solid(null);
tao.unsetGmlGeometries(); ats.setLod2Solid(null);
} ats.setLod3Solid(null);
} }
@Override @Override
public CityObject getTopLevelCityObject() { public CityObject getTopLevelCityObject() {
return this; return parent.getTopLevelCityObject();
} }
@Override public void setParent(TransportationSpace parent) {
public String toString() { this.parent = parent;
return "TransportationSpaceObject [id=" + getGmlId() + "]";
} }
@Override public TransportationSpace getParent() {
public void prepareForChecking() { return parent;
super.prepareForChecking();
for (TrafficAreaObject tao : trafficAreas) {
tao.prepareForChecking();
}
} }
@Override @Override
public void clearMetaInformation() { public String toString() {
super.clearMetaInformation(); return "TransportationSpaceObject [id=" + getGmlId() + "]";
for (TrafficAreaObject tao : trafficAreas) {
tao.clearMetaInformation();
}
}
@Override
public void collectInstances(CopyHandler handler) {
super.collectInstances(handler);
for (TrafficAreaObject tao : trafficAreas) {
handler.addInstance(tao);
}
}
@Override
public void fillValues(Copyable original, CopyHandler handler) {
super.fillValues(original, handler);
TrafficSpaceObject originalTao = (TrafficSpaceObject) original;
for (TrafficAreaObject tao : originalTao.trafficAreas) {
trafficAreas.add(handler.getCopyInstance(tao));
}
super.setGmlObject(originalTao.getGmlObject());
}
@Override
public Copyable createCopyInstance() {
return new TrafficSpaceObject(null);
} }
} }
...@@ -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();
}
} }
...@@ -18,21 +18,9 @@ ...@@ -18,21 +18,9 @@
*/ */
package de.hft.stuttgart.citydoctor2.datastructure; package de.hft.stuttgart.citydoctor2.datastructure;
import de.hft.stuttgart.citydoctor2.check.Check; import javafx.scene.paint.Color;
import de.hft.stuttgart.citydoctor2.check.CheckError;
import de.hft.stuttgart.citydoctor2.check.CheckId;
import de.hft.stuttgart.citydoctor2.parser.ParserConfiguration;
import de.hft.stuttgart.citydoctor2.utils.CityGmlUtils;
import de.hft.stuttgart.citydoctor2.utils.CopyHandler;
import de.hft.stuttgart.citydoctor2.utils.Copyable;
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.transportation.AbstractTransportationSpace;
import org.citygml4j.core.model.transportation.AuxiliaryTrafficArea;
import org.citygml4j.core.model.transportation.TrafficArea;
import org.citygml4j.core.util.geometry.GeometryFactory;
import org.xmlobjects.gml.model.geometry.aggregates.MultiSurface;
import org.xmlobjects.gml.model.geometry.aggregates.MultiSurfaceProperty;
import java.io.Serial; import java.io.Serial;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -77,6 +65,17 @@ public abstract class TransportationObject extends CityObject { ...@@ -77,6 +65,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,17 +91,9 @@ public abstract class TransportationObject extends CityObject { ...@@ -92,17 +91,9 @@ public abstract class TransportationObject extends CityObject {
return "TransportationObject [id=" + getGmlId() + "]"; return "TransportationObject [id=" + getGmlId() + "]";
} }
@Override
public void fillValues(Copyable original, CopyHandler handler) {
super.fillValues(original, handler);
TransportationObject originalTo = (TransportationObject) original;
ato = originalTo.ato;
}
@Override @Override
public Copyable createCopyInstance() { public String getDisplayText() {
return null; return String.format("[%s] %s", this.type.name(), this.getGmlId().toString());
} }
} }
package de.hft.stuttgart.citydoctor2.datastructure; 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.check.CheckError;
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.CityGmlUtils; import de.hft.stuttgart.citydoctor2.utils.CityGmlUtils;
import de.hft.stuttgart.citydoctor2.utils.CopyHandler;
import de.hft.stuttgart.citydoctor2.utils.Copyable;
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;
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;
import org.xmlobjects.gml.model.geometry.primitives.Solid;
import org.xmlobjects.gml.model.geometry.primitives.SolidProperty;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -35,36 +33,41 @@ public abstract class TransportationSpace extends TransportationObject { ...@@ -35,36 +33,41 @@ 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
public void reCreateGeometries(GeometryFactory factory, ParserConfiguration config) { public void rebuildGeometries(GeometryFactory factory, ParserConfiguration config) {
for (Geometry geom : getGeometries()) { for (Geometry geom : getGeometries()) {
if (geom instanceof ImplicitGeometryHolder) { if (geom instanceof ImplicitGeometryHolder) {
continue; continue;
} }
if (geom.getType() == GeometryType.MULTI_SURFACE) {
MultiSurface ms = CityGmlUtils.createMultiSurface(geom, factory, config);
if (super.getGmlObject() instanceof AbstractTransportationSpace ats) { if (super.getGmlObject() instanceof AbstractTransportationSpace ats) {
if (geom.getType() == GeometryType.MULTI_SURFACE || geom.getType() == GeometryType.COMPOSITE_SURFACE) {
MultiSurface ms = CityGmlUtils.createMultiSurface(geom, factory, config);
setMultiSurfaceAccordingToLod(ats, ms, geom.getLod()); setMultiSurfaceAccordingToLod(ats, ms, geom.getLod());
} else if (geom.getType() == GeometryType.SOLID) {
Solid solid = CityGmlUtils.createSolid(geom, factory, config);
setSolidAccordingToLod(ats, solid, geom.getLod());
} else { } else {
AbstractSpace as = (AbstractSpace) super.getGmlObject(); throw new IllegalArgumentException("Unsupported geometry type: " + geom.getType());
setMultiSurfaceAccordingToLod(as, ms, geom.getLod());
} }
} else if (super.getGmlObject() instanceof AbstractSpace as) {
if (geom.getType() == GeometryType.MULTI_SURFACE || geom.getType() == GeometryType.COMPOSITE_SURFACE) {
MultiSurface ms = CityGmlUtils.createMultiSurface(geom, factory, config);
setMultiSurfaceAccordingToLod(as, ms, geom.getLod());
} else if (geom.getType() == GeometryType.SOLID) {
Solid solid = CityGmlUtils.createSolid(geom, factory, config);
setSolidAccordingToLod(as, solid, geom.getLod());
} else { } else {
throw new IllegalStateException("Geometry in TransportationObject cannot be of type " + geom.getType() throw new IllegalArgumentException("Unsupported geometry type: " + geom.getType());
+ ". Only MultiSurface allowed");
} }
} }
for (TrafficSpaceObject spaces : trafficSpaces) {
spaces.reCreateGeometries(factory, config);
}
for (TrafficSpaceObject spaces : auxTrafficSpaces) {
spaces.reCreateGeometries(factory, config);
} }
} }
...@@ -75,8 +78,8 @@ public abstract class TransportationSpace extends TransportationObject { ...@@ -75,8 +78,8 @@ public abstract class TransportationSpace extends TransportationObject {
case LOD2 -> ats.setLod2MultiSurface(new MultiSurfaceProperty(ms)); case LOD2 -> ats.setLod2MultiSurface(new MultiSurfaceProperty(ms));
case LOD3 -> ats.setLod3MultiSurface(new MultiSurfaceProperty(ms)); case LOD3 -> ats.setLod3MultiSurface(new MultiSurfaceProperty(ms));
case LOD4 -> ats.getDeprecatedProperties().setLod4MultiSurface(new MultiSurfaceProperty(ms)); case LOD4 -> ats.getDeprecatedProperties().setLod4MultiSurface(new MultiSurfaceProperty(ms));
default -> default -> throw new IllegalStateException(String.format("Cannot set MultiSurface with LOD %s for " +
throw new IllegalStateException("cannot set geometry with LOD for AuxiliaryTrafficSpace: " + lod); "[GML]AbstractTransportationSpace in TransportationSpace ", lod));
} }
} }
...@@ -92,69 +95,29 @@ public abstract class TransportationSpace extends TransportationObject { ...@@ -92,69 +95,29 @@ public abstract class TransportationSpace extends TransportationObject {
as.setLod3MultiSurface(new MultiSurfaceProperty(ms)); as.setLod3MultiSurface(new MultiSurfaceProperty(ms));
break; break;
default: default:
throw new IllegalStateException("cannot set geometry with LOD for AuxiliaryTrafficSpace: " + lod); throw new IllegalStateException(String.format("Cannot set MultiSurface with LOD %s for [GML]AbstractSpace in TransportationSpace ", lod));
}
}
@Override
public boolean containsError(CheckId checkIdentifier) {
boolean hasError = super.containsError(checkIdentifier);
if (hasError) {
return true;
}
for (TrafficSpaceObject to : trafficSpaces) {
if (to.containsError(checkIdentifier)) {
return true;
}
}
for (TrafficSpaceObject to : auxTrafficSpaces) {
if (to.containsError(checkIdentifier)) {
return true;
}
} }
return false;
} }
@Override private void setSolidAccordingToLod(AbstractTransportationSpace ats, Solid solid, Lod lod) {
public void clearAllContainedCheckResults() { switch (lod) {
super.clearAllContainedCheckResults(); case LOD1 -> ats.setLod1Solid(new SolidProperty(solid));
for (TrafficSpaceObject to : trafficSpaces) { case LOD2 -> ats.setLod2Solid(new SolidProperty(solid));
to.clearAllContainedCheckResults(); case LOD3 -> ats.setLod3Solid(new SolidProperty(solid));
} default -> throw new IllegalStateException(String.format("Cannot set Solid with LOD %s for " +
for (TrafficSpaceObject to : auxTrafficSpaces) { "[GML]AbstractTransportationSpace in TransportationSpace ", lod));
to.clearAllContainedCheckResults();
}
}
@Override
public void collectContainedErrors(List<CheckError> errors) {
super.collectContainedErrors(errors);
for (TrafficSpaceObject to : trafficSpaces) {
to.collectContainedErrors(errors);
}
for (TrafficSpaceObject to : auxTrafficSpaces) {
to.collectContainedErrors(errors);
} }
} }
@Override private void setSolidAccordingToLod(AbstractSpace ats, Solid solid, Lod lod) {
public boolean containsAnyError() { switch (lod) {
boolean hasError = super.containsAnyError(); case LOD1 -> ats.setLod1Solid(new SolidProperty(solid));
if (hasError) { case LOD2 -> ats.setLod2Solid(new SolidProperty(solid));
return true; case LOD3 -> ats.setLod3Solid(new SolidProperty(solid));
} default ->
for (TrafficSpaceObject to : trafficSpaces) { throw new IllegalStateException(String.format("Cannot set Solid with LOD %s for [GML]AbstractSpace" +
if (to.containsAnyError()) { " in TransportationSpace ", lod));
return true;
}
}
for (TrafficSpaceObject to : auxTrafficSpaces) {
if (to.containsAnyError()) {
return true;
}
} }
return false;
} }
@Override @Override
...@@ -178,12 +141,9 @@ public abstract class TransportationSpace extends TransportationObject { ...@@ -178,12 +141,9 @@ 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) { ats.setLod1Solid(null);
to.unsetGmlGeometries(); ats.setLod2Solid(null);
} ats.setLod3Solid(null);
for (TrafficSpaceObject to : auxTrafficSpaces) {
to.unsetGmlGeometries();
}
} }
@Override @Override
...@@ -197,50 +157,4 @@ public abstract class TransportationSpace extends TransportationObject { ...@@ -197,50 +157,4 @@ public abstract class TransportationSpace extends TransportationObject {
return "TransportationSpace [id=" + getGmlId() + "]"; return "TransportationSpace [id=" + getGmlId() + "]";
} }
@Override
public void prepareForChecking() {
super.prepareForChecking();
for (TrafficSpaceObject to : trafficSpaces) {
to.prepareForChecking();
}
for (TrafficSpaceObject to : auxTrafficSpaces) {
to.prepareForChecking();
}
}
@Override
public void clearMetaInformation() {
super.clearMetaInformation();
for (TrafficSpaceObject to : trafficSpaces) {
to.clearMetaInformation();
}
for (TrafficSpaceObject to : auxTrafficSpaces) {
to.clearMetaInformation();
}
}
@Override
public void collectInstances(CopyHandler handler) {
super.collectInstances(handler);
for (TrafficSpaceObject to : trafficSpaces) {
to.collectInstances(handler);
}
for (TrafficSpaceObject to : auxTrafficSpaces) {
to.collectInstances(handler);
}
}
@Override
public void fillValues(Copyable original, CopyHandler handler) {
super.fillValues(original, handler);
TransportationObject originalTo = (TransportationObject) original;
for (TrafficSpaceObject to : trafficSpaces) {
to.fillValues(originalTo, handler);
}
for (TrafficSpaceObject to : auxTrafficSpaces) {
to.fillValues(originalTo, handler);
}
}
} }
package de.hft.stuttgart.citydoctor2.datastructure; package de.hft.stuttgart.citydoctor2.datastructure;
import de.hft.stuttgart.citydoctor2.utils.Copyable;
import java.io.Serial; import java.io.Serial;
...@@ -13,9 +12,4 @@ public class TunnelFurniture extends AbstractFurniture { ...@@ -13,9 +12,4 @@ public class TunnelFurniture extends AbstractFurniture {
super.setGmlObject(gmlObject); super.setGmlObject(gmlObject);
} }
@Override
public Copyable createCopyInstance() {
return new BuildingRoomFurniture();
}
} }
package de.hft.stuttgart.citydoctor2.datastructure; package de.hft.stuttgart.citydoctor2.datastructure;
import de.hft.stuttgart.citydoctor2.utils.CopyHandler; import javafx.scene.paint.Color;
import de.hft.stuttgart.citydoctor2.utils.Copyable;
import org.citygml4j.core.model.tunnel.TunnelFurnitureProperty; import org.citygml4j.core.model.tunnel.TunnelFurnitureProperty;
import java.io.Serial; import java.io.Serial;
...@@ -36,26 +35,13 @@ public class TunnelHollow extends AbstractRoom { ...@@ -36,26 +35,13 @@ public class TunnelHollow extends AbstractRoom {
} }
@Override @Override
public void fillValues(Copyable original, CopyHandler handler) { public Color getRenderColor() {
super.fillValues(original, handler); return parent.getRenderColor();
TunnelHollow oHollow = (TunnelHollow) original;
parent = handler.getCopyInstance(oHollow.getParent());
} }
@Override @Override
public CityObject getTopLevelCityObject() { public CityObject getTopLevelCityObject() {
return getParent().getTopLevelCityObject(); return parent.getTopLevelCityObject();
}
@Override
public void collectInstances(CopyHandler handler) {
super.collectInstances(handler);
handler.addInstance(parent);
} }
@Override
public Copyable createCopyInstance() {
return new TunnelHollow();
}
} }
package de.hft.stuttgart.citydoctor2.datastructure; package de.hft.stuttgart.citydoctor2.datastructure;
import de.hft.stuttgart.citydoctor2.utils.CopyHandler;
import de.hft.stuttgart.citydoctor2.utils.Copyable;
import java.io.Serial; import java.io.Serial;
public class TunnelPart extends AbstractTunnel { public class TunnelPart extends AbstractTunnel {
...@@ -37,24 +34,6 @@ public class TunnelPart extends AbstractTunnel { ...@@ -37,24 +34,6 @@ public class TunnelPart extends AbstractTunnel {
return "TunnelPart [id=" + getGmlId() + "]"; return "TunnelPart [id=" + getGmlId() + "]";
} }
@Override
public void fillValues(Copyable original, CopyHandler handler) {
super.fillValues(original, handler);
TunnelPart originalPart = (TunnelPart) original;
parent = handler.getCopyInstance(originalPart.parent);
}
@Override
public void collectInstances(CopyHandler handler) {
super.collectInstances(handler);
handler.addInstance(parent);
}
@Override
public Copyable createCopyInstance() {
return new TunnelPart();
}
private TunnelPart() { private TunnelPart() {
} }
} }
...@@ -35,6 +35,7 @@ import org.xmlobjects.gml.visitor.GeometryWalker; ...@@ -35,6 +35,7 @@ import org.xmlobjects.gml.visitor.GeometryWalker;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -76,6 +77,11 @@ public class Citygml3GeometryMapper extends GeometryWalker { ...@@ -76,6 +77,11 @@ public class Citygml3GeometryMapper extends GeometryWalker {
public void visit(PolygonPatch patch) { public void visit(PolygonPatch patch) {
parsePolygonPatch(patch, patchCollection); parsePolygonPatch(patch, patchCollection);
} }
@Override
public void visit(Triangle tri) {
parsePolygon(null, tri.getExterior(), Collections.emptyList());
}
}; };
surface.getPatches().getObjects().forEach(abstractSurfacePatch -> abstractSurfacePatch.accept(patchCollector)); surface.getPatches().getObjects().forEach(abstractSurfacePatch -> abstractSurfacePatch.accept(patchCollector));
} }
......
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