Commit b9af569e authored by Matthias Betz's avatar Matthias Betz
Browse files

remove low memory mode

parent 8536ec35
Pipeline #12291 failed with stage
in 1 minute and 15 seconds
...@@ -91,9 +91,6 @@ public class IntersectionErrorsTest { ...@@ -91,9 +91,6 @@ public class IntersectionErrorsTest {
geom.addPolygon(p1); geom.addPolygon(p1);
geom.addPolygon(p2); geom.addPolygon(p2);
geom.prepareForChecking();
System.out.println(); System.out.println();
for (Vertex v : p1.getExteriorRing().getVertices()) { for (Vertex v : p1.getExteriorRing().getVertices()) {
System.out.println(v); System.out.println(v);
......
...@@ -24,17 +24,15 @@ import java.util.HashMap; ...@@ -24,17 +24,15 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import de.hft.stuttgart.citydoctor2.datastructure.GmlId;
import de.hft.stuttgart.citydoctor2.utils.CheckErrorFound; import de.hft.stuttgart.citydoctor2.utils.CheckErrorFound;
import de.hft.stuttgart.citydoctor2.utils.visitors.CheckableErrorCollector; import de.hft.stuttgart.citydoctor2.utils.visitors.CheckableErrorCollector;
import de.hft.stuttgart.citydoctor2.utils.visitors.ClearResultsVisitor; import de.hft.stuttgart.citydoctor2.utils.visitors.ClearResultsVisitor;
import de.hft.stuttgart.citydoctor2.utils.visitors.ClearMetaInformationVisitor;
import de.hft.stuttgart.citydoctor2.utils.visitors.ContainsAnyErrorVisitor; import de.hft.stuttgart.citydoctor2.utils.visitors.ContainsAnyErrorVisitor;
import de.hft.stuttgart.citydoctor2.utils.visitors.ContainsErrorVisitor; import de.hft.stuttgart.citydoctor2.utils.visitors.ContainsErrorVisitor;
import de.hft.stuttgart.citydoctor2.utils.visitors.PrepareForCheckingVisitor;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import de.hft.stuttgart.citydoctor2.datastructure.GmlId;
/** /**
* Interface to indicate that this object can be checked by Checks. * Interface to indicate that this object can be checked by Checks.
...@@ -91,23 +89,6 @@ public abstract class Checkable implements Serializable { ...@@ -91,23 +89,6 @@ public abstract class Checkable implements Serializable {
*/ */
public abstract GmlId getGmlId(); public abstract GmlId getGmlId();
/**
* This should be called before executing a check if low memory consumption
* method has been enabled. Creates edges and additional meta
* information necessary to perform checks.
*/
public void prepareForChecking() {
this.accept(new PrepareForCheckingVisitor());
}
/**
* This should be called after checking has been done. Removes any
* created meta information like edges to free up memory.
*/
public void clearMetaInformation() {
this.accept(new ClearMetaInformationVisitor());
}
/** /**
* Checks if the object, or any object in its datastructure, has a specific error or is not fulfilling the dependencies * Checks if the object, or any object in its datastructure, has a specific error or is not fulfilling the dependencies
* of it. * of it.
......
...@@ -362,15 +362,6 @@ public class Geometry extends GmlElement { ...@@ -362,15 +362,6 @@ public class Geometry extends GmlElement {
return false; return false;
} }
public void clearMetaData() {
if (vertices != null) {
adjacentRingsOfVertices = new HashMap<>();
vertices = null;
}
edges = null;
edgeMap = null;
}
public Color getRenderColor() { public Color getRenderColor() {
return parent.getRenderColor(); return parent.getRenderColor();
} }
......
...@@ -121,14 +121,6 @@ public class ImplicitGeometryHolder extends Geometry { ...@@ -121,14 +121,6 @@ public class ImplicitGeometryHolder extends Geometry {
LibraryObject.preparePrototypeGeometriesForChecking(); LibraryObject.preparePrototypeGeometriesForChecking();
} }
/**
* Clears metadata creating for checking of prototype geometries and releases the metadata lock
*/
public static void clearMetaDataOfPrototypeGeometries(){
RelativeGeometry.clearMetaDataOfPrototypeGeometries();
LibraryObject.clearMetaDataOfPrototypeGeometries();
}
@Override @Override
public void accept(CheckableVisitor c) { public void accept(CheckableVisitor c) {
prototypeGeometry.accept(c); prototypeGeometry.accept(c);
......
...@@ -89,11 +89,6 @@ public class LibraryObject extends Geometry { ...@@ -89,11 +89,6 @@ public class LibraryObject extends Geometry {
metadataLocked = true; metadataLocked = true;
} }
public static void clearMetaDataOfPrototypeGeometries() {
metadataLocked = false;
libraryObjects.values().forEach(LibraryObject::clearMetaData);
}
@Override @Override
public void updateEdgesAndVertices(){ public void updateEdgesAndVertices(){
if (!metadataLocked) { if (!metadataLocked) {
...@@ -101,11 +96,4 @@ public class LibraryObject extends Geometry { ...@@ -101,11 +96,4 @@ public class LibraryObject extends Geometry {
} }
} }
@Override
public void clearMetaData(){
if (!metadataLocked) {
super.clearMetaData();
}
}
} }
...@@ -45,22 +45,10 @@ public class RelativeGeometry extends Geometry { ...@@ -45,22 +45,10 @@ public class RelativeGeometry extends Geometry {
metadataLocked = true; metadataLocked = true;
} }
public static void clearMetaDataOfPrototypeGeometries() {
metadataLocked = false;
relativeGeometries.values().forEach(RelativeGeometry::clearMetaData);
}
@Override @Override
public void updateEdgesAndVertices(){ public void updateEdgesAndVertices(){
if (!metadataLocked) { if (!metadataLocked) {
super.updateEdgesAndVertices(); super.updateEdgesAndVertices();
} }
} }
@Override
public void clearMetaData(){
if (!metadataLocked) {
super.clearMetaData();
}
}
} }
...@@ -24,11 +24,7 @@ import java.util.HashMap; ...@@ -24,11 +24,7 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.StringJoiner; 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.OtherConstructionObject;
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.CityGMLVersion; import org.citygml4j.core.model.CityGMLVersion;
...@@ -113,6 +109,8 @@ import org.xmlobjects.gml.model.geometry.primitives.Solid; ...@@ -113,6 +109,8 @@ 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 org.xmlobjects.gml.model.geometry.primitives.SurfaceProperty; import org.xmlobjects.gml.model.geometry.primitives.SurfaceProperty;
import de.hft.stuttgart.citydoctor2.database.FeatureCache;
import de.hft.stuttgart.citydoctor2.database.UnconnectedCache;
import de.hft.stuttgart.citydoctor2.datastructure.AbstractBuilding; import de.hft.stuttgart.citydoctor2.datastructure.AbstractBuilding;
import de.hft.stuttgart.citydoctor2.datastructure.AbstractTunnel; import de.hft.stuttgart.citydoctor2.datastructure.AbstractTunnel;
import de.hft.stuttgart.citydoctor2.datastructure.BoundarySurface; import de.hft.stuttgart.citydoctor2.datastructure.BoundarySurface;
...@@ -142,6 +140,7 @@ import de.hft.stuttgart.citydoctor2.datastructure.LinearRing; ...@@ -142,6 +140,7 @@ import de.hft.stuttgart.citydoctor2.datastructure.LinearRing;
import de.hft.stuttgart.citydoctor2.datastructure.LinkedPolygon; import de.hft.stuttgart.citydoctor2.datastructure.LinkedPolygon;
import de.hft.stuttgart.citydoctor2.datastructure.Lod; import de.hft.stuttgart.citydoctor2.datastructure.Lod;
import de.hft.stuttgart.citydoctor2.datastructure.Opening; import de.hft.stuttgart.citydoctor2.datastructure.Opening;
import de.hft.stuttgart.citydoctor2.datastructure.OtherConstructionObject;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon; import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
import de.hft.stuttgart.citydoctor2.datastructure.RelativeGeometry; import de.hft.stuttgart.citydoctor2.datastructure.RelativeGeometry;
import de.hft.stuttgart.citydoctor2.datastructure.ReliefObject; import de.hft.stuttgart.citydoctor2.datastructure.ReliefObject;
...@@ -162,7 +161,6 @@ import de.hft.stuttgart.citydoctor2.datastructure.Vertex; ...@@ -162,7 +161,6 @@ import de.hft.stuttgart.citydoctor2.datastructure.Vertex;
import de.hft.stuttgart.citydoctor2.datastructure.WaterObject; import de.hft.stuttgart.citydoctor2.datastructure.WaterObject;
import de.hft.stuttgart.citydoctor2.math.graph.KDTree; import de.hft.stuttgart.citydoctor2.math.graph.KDTree;
import de.hft.stuttgart.citydoctor2.parser.ParserConfiguration; import de.hft.stuttgart.citydoctor2.parser.ParserConfiguration;
import de.hft.stuttgart.citydoctor2.utils.Localization;
public class Citygml3FeatureMapper extends ObjectWalker { public class Citygml3FeatureMapper extends ObjectWalker {
...@@ -172,7 +170,7 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -172,7 +170,7 @@ public class Citygml3FeatureMapper extends ObjectWalker {
private final CityDoctorModel model; private final CityDoctorModel model;
private final ParserConfiguration config; private final ParserConfiguration config;
private final Path directory; private final Path directory;
private final double neighborDistance; private final double neighborDistance;
private Map<String, ConcretePolygon> polygonMap = new HashMap<>(); private Map<String, ConcretePolygon> polygonMap = new HashMap<>();
private Map<String, CompositeCollection> compositeMap = new HashMap<>();; private Map<String, CompositeCollection> compositeMap = new HashMap<>();;
private List<ResolvableReference> references = new ArrayList<>(); private List<ResolvableReference> references = new ArrayList<>();
...@@ -181,19 +179,19 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -181,19 +179,19 @@ public class Citygml3FeatureMapper extends ObjectWalker {
private Map<String, List<GmlId>> unresolvedPolyRefIDMap = new HashMap<>(); private Map<String, List<GmlId>> unresolvedPolyRefIDMap = new HashMap<>();
private Map<String, GmlId> parsedPolygonsIdMap = new HashMap<>(); private Map<String, GmlId> parsedPolygonsIdMap = new HashMap<>();
public Citygml3FeatureMapper(ParserConfiguration config, Path path, boolean unconnected) { public Citygml3FeatureMapper(ParserConfiguration config, Path path, boolean unconnected) {
this.config = config; this.config = config;
this.directory = path.getParent(); this.directory = path.getParent();
if (unconnected){ if (unconnected) {
model = new CityDoctorModel(config, path.toFile(), new UnconnectedCache()); model = new CityDoctorModel(config, path.toFile(), new UnconnectedCache());
} else { } else {
featureCache.resetCache(); featureCache.resetCache();
ImplicitGeometryHolder.resetObjectMaps(); ImplicitGeometryHolder.resetObjectMaps();
model = new CityDoctorModel(config, path.toFile(), featureCache); model = new CityDoctorModel(config, path.toFile(), featureCache);
} }
neighborDistance = 1.8d / Math.pow(10, config.getNumberOfRoundingPlaces()); neighborDistance = 1.8d / Math.pow(10, config.getNumberOfRoundingPlaces());
} }
public static void parseId(AbstractGML gml, GmlElement gmlElement) { public static void parseId(AbstractGML gml, GmlElement gmlElement) {
String id = gml.getId(); String id = gml.getId();
...@@ -217,22 +215,23 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -217,22 +215,23 @@ public class Citygml3FeatureMapper extends ObjectWalker {
StringJoiner joiner = new StringJoiner(", "); StringJoiner joiner = new StringJoiner(", ");
gmlIds.forEach(gmlId -> joiner.add(gmlId.toString())); gmlIds.forEach(gmlId -> joiner.add(gmlId.toString()));
GmlId crossFeatureId = parsedPolygonsIdMap.get(id); GmlId crossFeatureId = parsedPolygonsIdMap.get(id);
//TODO: Localize String // TODO: Localize String
logger.warn("Polygon {} of Feature {} is being referenced in other Features: {}", id, crossFeatureId, joiner); logger.warn("Polygon {} of Feature {} is being referenced in other Features: {}", id, crossFeatureId,
joiner);
crossRefs.add(id); crossRefs.add(id);
} }
} }
if (xLinkGlobalError) { if (xLinkGlobalError) {
//TODO: Localize String // TODO: Localize String
logger.warn("Model has Features containing cross-feature references without their own copies of the referenced polygons"); logger.warn(
"Model has Features containing cross-feature references without their own copies of the referenced polygons");
} }
crossRefs.forEach(unresolvedPolyRefIDMap::remove); crossRefs.forEach(unresolvedPolyRefIDMap::remove);
if(!unresolvedPolyRefIDMap.isEmpty()) { if (!unresolvedPolyRefIDMap.isEmpty()) {
logger.warn("Model contains polygon references that could not be found"); logger.warn("Model contains polygon references that could not be found");
} }
} }
@Override @Override
public void visit(AbstractSpace space) { public void visit(AbstractSpace space) {
// if we are here, an AbstractSpace thing was read that is not handled in the // if we are here, an AbstractSpace thing was read that is not handled in the
...@@ -241,7 +240,7 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -241,7 +240,7 @@ public class Citygml3FeatureMapper extends ObjectWalker {
} }
@Override @Override
public void visit(OtherConstruction gmlOc){ public void visit(OtherConstruction gmlOc) {
OtherConstructionObject oco = new OtherConstructionObject(); OtherConstructionObject oco = new OtherConstructionObject();
oco.setGmlObject(gmlOc); oco.setGmlObject(gmlOc);
mapAbstractOccupiedSpace(gmlOc, oco, Orientation.OUTWARD); mapAbstractOccupiedSpace(gmlOc, oco, Orientation.OUTWARD);
...@@ -368,17 +367,17 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -368,17 +367,17 @@ public class Citygml3FeatureMapper extends ObjectWalker {
@Override @Override
public void visit(MassPointRelief rel) { public void visit(MassPointRelief rel) {
//Method stub for implementation if requested // Method stub for implementation if requested
} }
@Override @Override
public void visit(BreaklineRelief rel) { public void visit(BreaklineRelief rel) {
//Method stub for implementation if requested // Method stub for implementation if requested
} }
@Override @Override
public void visit(RasterRelief rel) { public void visit(RasterRelief rel) {
//Method stub for implementation if requested // Method stub for implementation if requested
} }
}; };
...@@ -391,11 +390,11 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -391,11 +390,11 @@ public class Citygml3FeatureMapper extends ObjectWalker {
public void mapTINRelief(TINRelief relief, ReliefObject reliefObject) { public void mapTINRelief(TINRelief relief, ReliefObject reliefObject) {
TinObject to = new TinObject(relief); TinObject to = new TinObject(relief);
Lod reliefLod = switch (relief.getLod()) { Lod reliefLod = switch (relief.getLod()) {
case 1 -> Lod.LOD1; case 1 -> Lod.LOD1;
case 2 -> Lod.LOD2; case 2 -> Lod.LOD2;
case 3 -> Lod.LOD3; case 3 -> Lod.LOD3;
case 4 -> null; case 4 -> null;
default -> throw new IllegalStateException("TINRelief has unexpected LOD value: " + relief.getLod()); default -> throw new IllegalStateException("TINRelief has unexpected LOD value: " + relief.getLod());
}; };
if (reliefLod == null) { if (reliefLod == null) {
logger.warn("IllegalState: TINRelief {} has LOD value 4!", relief.getId()); logger.warn("IllegalState: TINRelief {} has LOD value 4!", relief.getId());
...@@ -428,14 +427,14 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -428,14 +427,14 @@ public class Citygml3FeatureMapper extends ObjectWalker {
veg.setGmlObject(solitaryVegetationObject); veg.setGmlObject(solitaryVegetationObject);
mapAbstractVegetationObject(solitaryVegetationObject, veg); mapAbstractVegetationObject(solitaryVegetationObject, veg);
parseAndAddAbstractGeometry(solitaryVegetationObject.getDeprecatedProperties().getLod1Geometry(), Lod.LOD1, parseAndAddAbstractGeometry(solitaryVegetationObject.getDeprecatedProperties().getLod1Geometry(), Lod.LOD1, veg,
veg, Orientation.OUTWARD); Orientation.OUTWARD);
parseAndAddAbstractGeometry(solitaryVegetationObject.getDeprecatedProperties().getLod2Geometry(), Lod.LOD2, parseAndAddAbstractGeometry(solitaryVegetationObject.getDeprecatedProperties().getLod2Geometry(), Lod.LOD2, veg,
veg, Orientation.OUTWARD); Orientation.OUTWARD);
parseAndAddAbstractGeometry(solitaryVegetationObject.getDeprecatedProperties().getLod3Geometry(), Lod.LOD3, parseAndAddAbstractGeometry(solitaryVegetationObject.getDeprecatedProperties().getLod3Geometry(), Lod.LOD3, veg,
veg, Orientation.OUTWARD); Orientation.OUTWARD);
parseAndAddAbstractGeometry(solitaryVegetationObject.getDeprecatedProperties().getLod4Geometry(), Lod.LOD4, parseAndAddAbstractGeometry(solitaryVegetationObject.getDeprecatedProperties().getLod4Geometry(), Lod.LOD4, veg,
veg, Orientation.OUTWARD); Orientation.OUTWARD);
finishCityObjectConstruction(veg); finishCityObjectConstruction(veg);
model.addVegetation(veg); model.addVegetation(veg);
...@@ -647,7 +646,8 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -647,7 +646,8 @@ public class Citygml3FeatureMapper extends ObjectWalker {
} }
} }
private void parseTunnelConstructiveElements(org.citygml4j.core.model.tunnel.AbstractTunnel gmlTunnel, AbstractTunnel cdTunnel) { private void parseTunnelConstructiveElements(org.citygml4j.core.model.tunnel.AbstractTunnel gmlTunnel,
AbstractTunnel cdTunnel) {
for (TunnelConstructiveElementProperty teProp : gmlTunnel.getTunnelConstructiveElements()) { for (TunnelConstructiveElementProperty teProp : gmlTunnel.getTunnelConstructiveElements()) {
var gmlTc = teProp.getObject(); var gmlTc = teProp.getObject();
if (gmlTc == null) { if (gmlTc == null) {
...@@ -658,7 +658,8 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -658,7 +658,8 @@ public class Citygml3FeatureMapper extends ObjectWalker {
} }
} }
private void parseTunnelFurniture(org.citygml4j.core.model.tunnel.AbstractTunnel gmlTunnel, AbstractTunnel cdTunnel) { private void parseTunnelFurniture(org.citygml4j.core.model.tunnel.AbstractTunnel gmlTunnel,
AbstractTunnel cdTunnel) {
for (TunnelFurnitureProperty tfProp : gmlTunnel.getTunnelFurniture()) { for (TunnelFurnitureProperty tfProp : gmlTunnel.getTunnelFurniture()) {
var gmlTf = tfProp.getObject(); var gmlTf = tfProp.getObject();
if (gmlTf == null) { if (gmlTf == null) {
...@@ -680,7 +681,8 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -680,7 +681,8 @@ public class Citygml3FeatureMapper extends ObjectWalker {
} }
} }
private void parseTunnelInstallations(org.citygml4j.core.model.tunnel.AbstractTunnel gmlTunnel, AbstractTunnel cdTunnel) { private void parseTunnelInstallations(org.citygml4j.core.model.tunnel.AbstractTunnel gmlTunnel,
AbstractTunnel cdTunnel) {
for (TunnelInstallationProperty tiProp : gmlTunnel.getTunnelInstallations()) { for (TunnelInstallationProperty tiProp : gmlTunnel.getTunnelInstallations()) {
var gmlTi = tiProp.getObject(); var gmlTi = tiProp.getObject();
if (gmlTi == null) { if (gmlTi == null) {
...@@ -703,7 +705,6 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -703,7 +705,6 @@ public class Citygml3FeatureMapper extends ObjectWalker {
GeometryProperty<?> lod4Prop = gmlTi.getDeprecatedProperties().getLod4Geometry(); GeometryProperty<?> lod4Prop = gmlTi.getDeprecatedProperties().getLod4Geometry();
parseAndAddAbstractGeometry(lod4Prop, Lod.LOD4, ti, orientation); parseAndAddAbstractGeometry(lod4Prop, Lod.LOD4, ti, orientation);
SurfaceMapper surfaceMapper = new SurfaceMapper(polygonMap, references, compositeMap, vertexMap, config); SurfaceMapper surfaceMapper = new SurfaceMapper(polygonMap, references, compositeMap, vertexMap, config);
for (AbstractSpaceBoundaryProperty surfaceProp : gmlTi.getBoundaries()) { for (AbstractSpaceBoundaryProperty surfaceProp : gmlTi.getBoundaries()) {
if (!surfaceProp.isSetObject()) { if (!surfaceProp.isSetObject()) {
...@@ -900,7 +901,6 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -900,7 +901,6 @@ public class Citygml3FeatureMapper extends ObjectWalker {
finishTransportationMapping(top); finishTransportationMapping(top);
} }
private void mapAbstractThematicSurface(AbstractThematicSurface ats, CityObject co) { private void mapAbstractThematicSurface(AbstractThematicSurface ats, CityObject co) {
mapAbstractSpaceBoundary(ats, co); mapAbstractSpaceBoundary(ats, co);
parseAndAddMultiSurface(ats.getLod0MultiSurface(), Lod.LOD0, co); parseAndAddMultiSurface(ats.getLod0MultiSurface(), Lod.LOD0, co);
...@@ -930,7 +930,6 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -930,7 +930,6 @@ public class Citygml3FeatureMapper extends ObjectWalker {
parseId(ag, to); parseId(ag, to);
} }
private void finishTransportationMapping(TransportationObject to) { private void finishTransportationMapping(TransportationObject to) {
finishCityObjectConstruction(to); finishCityObjectConstruction(to);
model.addTransportation(to); model.addTransportation(to);
...@@ -954,15 +953,16 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -954,15 +953,16 @@ public class Citygml3FeatureMapper extends ObjectWalker {
} }
for (AuxiliaryTrafficSpaceProperty atsp : ats.getAuxiliaryTrafficSpaces()) { for (AuxiliaryTrafficSpaceProperty atsp : ats.getAuxiliaryTrafficSpaces()) {
if (atsp.isSetObject()) { if (atsp.isSetObject()) {
TrafficSpaceObject atso = new TrafficSpaceObject(TrafficSpaceObject.TrafficSpaceType.AUXILIARY_TRAFFIC_SPACE); TrafficSpaceObject atso = new TrafficSpaceObject(
TrafficSpaceObject.TrafficSpaceType.AUXILIARY_TRAFFIC_SPACE);
mapAuxiliaryTrafficSpace(atsp.getObject(), atso); mapAuxiliaryTrafficSpace(atsp.getObject(), atso);
trsp.addAuxTrafficSpace(atso); trsp.addAuxTrafficSpace(atso);
} }
} }
} }
private void mapSectionsAndIntersections(List<SectionProperty> sectionProps, List<IntersectionProperty> intersectionProps, private void mapSectionsAndIntersections(List<SectionProperty> sectionProps,
TopLevelTransportFeature top) { List<IntersectionProperty> intersectionProps, TopLevelTransportFeature top) {
for (SectionProperty sectionProp : sectionProps) { for (SectionProperty sectionProp : sectionProps) {
if (sectionProp.isSetObject()) { if (sectionProp.isSetObject()) {
TransportSection sect = new TransportSection(TransportSection.SectionType.SECTION); TransportSection sect = new TransportSection(TransportSection.SectionType.SECTION);
...@@ -983,7 +983,6 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -983,7 +983,6 @@ public class Citygml3FeatureMapper extends ObjectWalker {
} }
} }
private void mapTrafficSpace(TrafficSpace ts, TrafficSpaceObject tso) { private void mapTrafficSpace(TrafficSpace ts, TrafficSpaceObject tso) {
tso.setGmlObject(ts); tso.setGmlObject(ts);
mapAbstractUnoccupiedSpace(ts, tso, Orientation.OUTWARD); mapAbstractUnoccupiedSpace(ts, tso, Orientation.OUTWARD);
...@@ -1049,15 +1048,15 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -1049,15 +1048,15 @@ public class Citygml3FeatureMapper extends ObjectWalker {
co.addGeometry(geom); co.addGeometry(geom);
} }
private void parseAndAddSolid(SolidProperty sp, Lod lod, CityObject co, Orientation orientation) { private void parseAndAddSolid(SolidProperty sp, Lod lod, CityObject co, Orientation orientation) {
if (sp == null || sp.getObject() == null) { if (sp == null || sp.getObject() == null) {
return; return;
} }
Geometry geom = parseSolid(sp.getObject(), lod, orientation); Geometry geom = parseSolid(sp.getObject(), lod, orientation);
if (geom != null) { if (geom != null) {
co.addGeometry(geom); co.addGeometry(geom);
} }
} }
private void parseImplicitGeometry(AbstractOccupiedSpace aos, CityObject co, Orientation orientation) { private void parseImplicitGeometry(AbstractOccupiedSpace aos, CityObject co, Orientation orientation) {
for (int i = 1; i <= 3; i++) { for (int i = 1; i <= 3; i++) {
...@@ -1084,10 +1083,10 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -1084,10 +1083,10 @@ public class Citygml3FeatureMapper extends ObjectWalker {
ImplicitGeometryHolder igh = null; ImplicitGeometryHolder igh = null;
if (ig.getLibraryObject() != null) { if (ig.getLibraryObject() != null) {
LibraryObject libObj = null; LibraryObject libObj = null;
if (directory != null){ if (directory != null) {
Path libraryObjectPath = directory.resolve(ig.getLibraryObject()); Path libraryObjectPath = directory.resolve(ig.getLibraryObject());
libObj = LibraryObject.of(libraryObjectPath, config); libObj = LibraryObject.of(libraryObjectPath, config);
} }
if (libObj != null) { if (libObj != null) {
igh = new ImplicitGeometryHolder(ig, libObj); igh = new ImplicitGeometryHolder(ig, libObj);
} }
...@@ -1143,7 +1142,7 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -1143,7 +1142,7 @@ public class Citygml3FeatureMapper extends ObjectWalker {
handlePolygonReference(href, geom); handlePolygonReference(href, geom);
} }
} }
for(String polygonId: polygonMap.keySet()){ for (String polygonId : polygonMap.keySet()) {
parsedPolygonsIdMap.put(polygonId, co.getGmlId()); parsedPolygonsIdMap.put(polygonId, co.getGmlId());
} }
...@@ -1156,7 +1155,7 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -1156,7 +1155,7 @@ public class Citygml3FeatureMapper extends ObjectWalker {
private void handlePolygonReference(String href, Geometry geom) { private void handlePolygonReference(String href, Geometry geom) {
ConcretePolygon concPoly = polygonMap.get(href); ConcretePolygon concPoly = polygonMap.get(href);
if (concPoly == null) { if (concPoly == null) {
List<GmlId> featureList = unresolvedPolyRefIDMap.computeIfAbsent(href, k -> new ArrayList<>()); List<GmlId> featureList = unresolvedPolyRefIDMap.computeIfAbsent(href, k -> new ArrayList<>());
GmlId featureId = geom.getParent().getTopLevelCityObject().getGmlId(); GmlId featureId = geom.getParent().getTopLevelCityObject().getGmlId();
featureList.add(featureId); featureList.add(featureId);
// if (logger.isWarnEnabled()) { // if (logger.isWarnEnabled()) {
...@@ -1191,7 +1190,8 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -1191,7 +1190,8 @@ public class Citygml3FeatureMapper extends ObjectWalker {
parseBuildingFurniture(gmlAb, cdBuilding); parseBuildingFurniture(gmlAb, cdBuilding);
} }
private void parseBuildingFurniture(org.citygml4j.core.model.building.AbstractBuilding gmlAb, AbstractBuilding cdBuilding) { private void parseBuildingFurniture(org.citygml4j.core.model.building.AbstractBuilding gmlAb,
AbstractBuilding cdBuilding) {
for (BuildingFurnitureProperty bfProp : gmlAb.getBuildingFurniture()) { for (BuildingFurnitureProperty bfProp : gmlAb.getBuildingFurniture()) {
var gmlBf = bfProp.getObject(); var gmlBf = bfProp.getObject();
if (gmlBf == null) { if (gmlBf == null) {
...@@ -1202,7 +1202,8 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -1202,7 +1202,8 @@ public class Citygml3FeatureMapper extends ObjectWalker {
} }
} }
private void parseBoundarySurfaces(org.citygml4j.core.model.building.AbstractBuilding gmlAb, AbstractBuilding cdBuilding) { private void parseBoundarySurfaces(org.citygml4j.core.model.building.AbstractBuilding gmlAb,
AbstractBuilding cdBuilding) {
SurfaceMapper surfaceMapper = new SurfaceMapper(polygonMap, references, compositeMap, vertexMap, config); SurfaceMapper surfaceMapper = new SurfaceMapper(polygonMap, references, compositeMap, vertexMap, config);
for (AbstractSpaceBoundaryProperty surfaceProp : gmlAb.getBoundaries()) { for (AbstractSpaceBoundaryProperty surfaceProp : gmlAb.getBoundaries()) {
if (!surfaceProp.isSetObject()) { if (!surfaceProp.isSetObject()) {
...@@ -1221,7 +1222,8 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -1221,7 +1222,8 @@ public class Citygml3FeatureMapper extends ObjectWalker {
} }
} }
private void parseBuildingSubdivisions(org.citygml4j.core.model.building.AbstractBuilding gmlAb, AbstractBuilding cdBuilding) { private void parseBuildingSubdivisions(org.citygml4j.core.model.building.AbstractBuilding gmlAb,
AbstractBuilding cdBuilding) {
for (AbstractBuildingSubdivisionProperty abs : gmlAb.getBuildingSubdivisions()) { for (AbstractBuildingSubdivisionProperty abs : gmlAb.getBuildingSubdivisions()) {
var gmlABS = abs.getObject(); var gmlABS = abs.getObject();
if (gmlABS == null) { if (gmlABS == null) {
...@@ -1237,20 +1239,22 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -1237,20 +1239,22 @@ public class Citygml3FeatureMapper extends ObjectWalker {
} }
} }
private void parseBuildingConstructiveElements(org.citygml4j.core.model.building.AbstractBuilding gmlAb, AbstractBuilding cdBuilding) { private void parseBuildingConstructiveElements(org.citygml4j.core.model.building.AbstractBuilding gmlAb,
AbstractBuilding cdBuilding) {
for (BuildingConstructiveElementProperty bceProp : gmlAb.getBuildingConstructiveElements()) { for (BuildingConstructiveElementProperty bceProp : gmlAb.getBuildingConstructiveElements()) {
var gmlBCE = bceProp.getObject(); var gmlBCE = bceProp.getObject();
if (gmlBCE == null) { if (gmlBCE == null) {
continue; continue;
} }
de.hft.stuttgart.citydoctor2.datastructure.BuildingConstructiveElement bce = de.hft.stuttgart.citydoctor2.datastructure.BuildingConstructiveElement bce = new de.hft.stuttgart.citydoctor2.datastructure.BuildingConstructiveElement(
new de.hft.stuttgart.citydoctor2.datastructure.BuildingConstructiveElement(gmlBCE); gmlBCE);
mapBuildingConstructiveElement(bce, gmlBCE); mapBuildingConstructiveElement(bce, gmlBCE);
cdBuilding.addConstructiveElement(bce); cdBuilding.addConstructiveElement(bce);
} }
} }
private void parseBuildingRooms(org.citygml4j.core.model.building.AbstractBuilding gmlAb, AbstractBuilding cdBuilding) { private void parseBuildingRooms(org.citygml4j.core.model.building.AbstractBuilding gmlAb,
AbstractBuilding cdBuilding) {
for (BuildingRoomProperty brProp : gmlAb.getBuildingRooms()) { for (BuildingRoomProperty brProp : gmlAb.getBuildingRooms()) {
var gmlBr = brProp.getObject(); var gmlBr = brProp.getObject();
if (gmlBr == null) { if (gmlBr == null) {
...@@ -1261,7 +1265,8 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -1261,7 +1265,8 @@ public class Citygml3FeatureMapper extends ObjectWalker {
} }
} }
private void parseBuildingInstallations(org.citygml4j.core.model.building.AbstractBuilding gmlAb, AbstractBuilding cdBuilding) { private void parseBuildingInstallations(org.citygml4j.core.model.building.AbstractBuilding gmlAb,
AbstractBuilding cdBuilding) {
for (BuildingInstallationProperty biProp : gmlAb.getBuildingInstallations()) { for (BuildingInstallationProperty biProp : gmlAb.getBuildingInstallations()) {
var gmlBi = biProp.getObject(); var gmlBi = biProp.getObject();
if (gmlBi == null) { if (gmlBi == null) {
...@@ -1348,7 +1353,9 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -1348,7 +1353,9 @@ public class Citygml3FeatureMapper extends ObjectWalker {
} }
private void mapBuildingConstructiveElement(de.hft.stuttgart.citydoctor2.datastructure.BuildingConstructiveElement bce, BuildingConstructiveElement ele) { private void mapBuildingConstructiveElement(
de.hft.stuttgart.citydoctor2.datastructure.BuildingConstructiveElement bce,
BuildingConstructiveElement ele) {
mapAbstractOccupiedSpace(ele, bce, Orientation.OUTWARD); mapAbstractOccupiedSpace(ele, bce, Orientation.OUTWARD);
SurfaceMapper surfaceMapper = new SurfaceMapper(polygonMap, references, compositeMap, vertexMap, config); SurfaceMapper surfaceMapper = new SurfaceMapper(polygonMap, references, compositeMap, vertexMap, config);
for (AbstractSpaceBoundaryProperty surfaceProp : ele.getBoundaries()) { for (AbstractSpaceBoundaryProperty surfaceProp : ele.getBoundaries()) {
...@@ -1457,7 +1464,8 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -1457,7 +1464,8 @@ public class Citygml3FeatureMapper extends ObjectWalker {
return bi; return bi;
} }
private void parseAndAddAbstractGeometry(GeometryProperty<?> geomProp, Lod lod, CityObject co, Orientation orientation) { private void parseAndAddAbstractGeometry(GeometryProperty<?> geomProp, Lod lod, CityObject co,
Orientation orientation) {
if (geomProp == null || geomProp.getObject() == null) { if (geomProp == null || geomProp.getObject() == null) {
return; return;
} }
...@@ -1547,11 +1555,7 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -1547,11 +1555,7 @@ public class Citygml3FeatureMapper extends ObjectWalker {
updateRing(tree, innerRing); updateRing(tree, innerRing);
} }
} }
if (!config.useLowMemoryConsumption()) { geom.updateEdgesAndVertices();
// no low memory consumption mode meaning create all meta information in
// geometry
geom.updateEdgesAndVertices();
}
} }
} }
......
...@@ -149,9 +149,6 @@ public class Triangle3d implements Serializable { ...@@ -149,9 +149,6 @@ public class Triangle3d implements Serializable {
|| checkTriangleLineIntersection(this, other.p1, other.p2) || checkTriangleLineIntersection(this, other.p1, other.p2)
|| checkTriangleLineIntersection(this, other.p1, other.p3) || checkTriangleLineIntersection(this, other.p1, other.p3)
|| checkTriangleLineIntersection(this, other.p2, other.p3); || checkTriangleLineIntersection(this, other.p2, other.p3);
if (intersects) {
System.out.println();
}
return intersects; return intersects;
} }
...@@ -180,11 +177,7 @@ public class Triangle3d implements Serializable { ...@@ -180,11 +177,7 @@ public class Triangle3d implements Serializable {
private boolean doesIntersectCoplanarTriangle(Triangle3d other) { private boolean doesIntersectCoplanarTriangle(Triangle3d other) {
Triangle2d t1 = projectTo2d(); Triangle2d t1 = projectTo2d();
Triangle2d t2 = other.projectTo2d(); Triangle2d t2 = other.projectTo2d();
boolean intersects = t1.intersects(t2); return t1.intersects(t2);
if (intersects) {
System.out.println();
}
return intersects;
} }
public Triangle2d projectTo2d() { public Triangle2d projectTo2d() {
......
...@@ -48,21 +48,15 @@ public class ParserConfiguration implements Serializable { ...@@ -48,21 +48,15 @@ public class ParserConfiguration implements Serializable {
private String targetTransformString; private String targetTransformString;
private String originalTransformString; private String originalTransformString;
private boolean hasTransformation = false; private boolean hasTransformation = false;
private boolean useLowMemoryConsumption = false;
private transient double fromMeters = 1.0; private transient double fromMeters = 1.0;
public ParserConfiguration(int numberOfRoundingPlaces, boolean validate) { public ParserConfiguration(int numberOfRoundingPlaces, boolean validate) {
this(numberOfRoundingPlaces, validate, false);
}
public ParserConfiguration(int numberOfRoundingPlaces, boolean validate, boolean lowMemory) {
if (numberOfRoundingPlaces < 0) { if (numberOfRoundingPlaces < 0) {
throw new IllegalArgumentException("Number of rounding places must be a positive value"); throw new IllegalArgumentException("Number of rounding places must be a positive value");
} }
roundingPlaces = numberOfRoundingPlaces; roundingPlaces = numberOfRoundingPlaces;
this.validate = validate; this.validate = validate;
useLowMemoryConsumption = lowMemory;
} }
public boolean getValidate() { public boolean getValidate() {
...@@ -115,13 +109,5 @@ public class ParserConfiguration implements Serializable { ...@@ -115,13 +109,5 @@ public class ParserConfiguration implements Serializable {
public double getFromMeters() { public double getFromMeters() {
return fromMeters; return fromMeters;
} }
public boolean useLowMemoryConsumption() {
return useLowMemoryConsumption;
}
public void setUseLowMemoryConsumption(boolean useLowMemoryConsumption) {
this.useLowMemoryConsumption = useLowMemoryConsumption;
}
} }
package de.hft.stuttgart.citydoctor2.utils.visitors;
import de.hft.stuttgart.citydoctor2.check.CheckableUtilsVisitor;
import de.hft.stuttgart.citydoctor2.datastructure.Geometry;
/**
* This Visitor removes the metadata created by the {@link PrepareForCheckingVisitor} for the low-memory consumption mode.
*/
public class ClearMetaInformationVisitor extends CheckableUtilsVisitor {
@Override
public void check(Geometry geometry) {
geometry.clearMetaData();
}
}
package de.hft.stuttgart.citydoctor2.utils.visitors;
import de.hft.stuttgart.citydoctor2.check.CheckableUtilsVisitor;
import de.hft.stuttgart.citydoctor2.datastructure.Geometry;
/**
* This Visitor prepares the {@link Geometry Geometries} in a Checkable for low-memory consumption mode.
*/
public class PrepareForCheckingVisitor extends CheckableUtilsVisitor {
@Override
public void check(Geometry geom) {
geom.updateEdgesAndVertices();
}
}
...@@ -30,9 +30,6 @@ import java.util.ArrayList; ...@@ -30,9 +30,6 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import de.hft.stuttgart.citydoctor2.utils.visitors.ClearResultsVisitor;
import de.hft.stuttgart.citydoctor2.utils.visitors.GmlGeometryRebuilder;
import de.hft.stuttgart.citydoctor2.utils.visitors.UnsetGeometriesVisitor;
import org.citygml4j.core.model.construction.AbstractConstructionSurface; import org.citygml4j.core.model.construction.AbstractConstructionSurface;
import org.citygml4j.core.model.construction.WallSurface; import org.citygml4j.core.model.construction.WallSurface;
import org.citygml4j.core.model.core.AbstractThematicSurface; import org.citygml4j.core.model.core.AbstractThematicSurface;
...@@ -41,13 +38,15 @@ import org.junit.Test; ...@@ -41,13 +38,15 @@ import org.junit.Test;
import org.mockito.Mockito; import org.mockito.Mockito;
import org.xmlobjects.gml.model.geometry.aggregates.MultiSurfaceProperty; import org.xmlobjects.gml.model.geometry.aggregates.MultiSurfaceProperty;
import de.hft.stuttgart.citydoctor2.check.CheckableUtilsVisitor;
import de.hft.stuttgart.citydoctor2.check.CheckError; import de.hft.stuttgart.citydoctor2.check.CheckError;
import de.hft.stuttgart.citydoctor2.check.CheckId; import de.hft.stuttgart.citydoctor2.check.CheckId;
import de.hft.stuttgart.citydoctor2.check.CheckResult; import de.hft.stuttgart.citydoctor2.check.CheckResult;
import de.hft.stuttgart.citydoctor2.check.CheckableUtilsVisitor;
import de.hft.stuttgart.citydoctor2.check.ResultStatus; import de.hft.stuttgart.citydoctor2.check.ResultStatus;
import de.hft.stuttgart.citydoctor2.datastructure.Geometry.Orientation;
import de.hft.stuttgart.citydoctor2.parser.ParserConfiguration; import de.hft.stuttgart.citydoctor2.parser.ParserConfiguration;
import de.hft.stuttgart.citydoctor2.utils.visitors.ClearResultsVisitor;
import de.hft.stuttgart.citydoctor2.utils.visitors.GmlGeometryRebuilder;
import de.hft.stuttgart.citydoctor2.utils.visitors.UnsetGeometriesVisitor;
public class BoundarySurfaceTest { public class BoundarySurfaceTest {
...@@ -100,16 +99,6 @@ public class BoundarySurfaceTest { ...@@ -100,16 +99,6 @@ public class BoundarySurfaceTest {
assertEquals(0, bsCounter.intValue()); assertEquals(0, bsCounter.intValue());
} }
@Test
public void testPrepareForChecking() {
BoundarySurface bs = new BoundarySurface(BoundarySurfaceType.WALL, null);
Geometry geom = new Geometry(GeometryType.MULTI_SURFACE, Lod.LOD2, Orientation.OUTWARD);
Geometry spyGeom = Mockito.spy(geom);
bs.addGeometry(spyGeom);
bs.prepareForChecking();
verify(spyGeom).updateEdgesAndVertices();
}
@Test @Test
public void testContainsError() { public void testContainsError() {
BoundarySurface bs = new BoundarySurface(BoundarySurfaceType.WALL, null); BoundarySurface bs = new BoundarySurface(BoundarySurfaceType.WALL, null);
......
...@@ -37,7 +37,6 @@ import org.citygml4j.core.model.deprecated.bridge.DeprecatedPropertiesOfAbstract ...@@ -37,7 +37,6 @@ import org.citygml4j.core.model.deprecated.bridge.DeprecatedPropertiesOfAbstract
import org.citygml4j.core.util.geometry.GeometryFactory; import org.citygml4j.core.util.geometry.GeometryFactory;
import org.citygml4j.core.visitor.ObjectVisitor; import org.citygml4j.core.visitor.ObjectVisitor;
import org.junit.Test; import org.junit.Test;
import org.mockito.Mockito;
import de.hft.stuttgart.citydoctor2.check.CheckError; import de.hft.stuttgart.citydoctor2.check.CheckError;
import de.hft.stuttgart.citydoctor2.check.CheckId; import de.hft.stuttgart.citydoctor2.check.CheckId;
...@@ -45,7 +44,6 @@ import de.hft.stuttgart.citydoctor2.check.CheckResult; ...@@ -45,7 +44,6 @@ import de.hft.stuttgart.citydoctor2.check.CheckResult;
import de.hft.stuttgart.citydoctor2.check.CheckableUtilsVisitor; import de.hft.stuttgart.citydoctor2.check.CheckableUtilsVisitor;
import de.hft.stuttgart.citydoctor2.check.ResultStatus; import de.hft.stuttgart.citydoctor2.check.ResultStatus;
import de.hft.stuttgart.citydoctor2.datastructure.BridgeObject.BridgeType; import de.hft.stuttgart.citydoctor2.datastructure.BridgeObject.BridgeType;
import de.hft.stuttgart.citydoctor2.datastructure.Geometry.Orientation;
import de.hft.stuttgart.citydoctor2.parser.ParserConfiguration; import de.hft.stuttgart.citydoctor2.parser.ParserConfiguration;
import de.hft.stuttgart.citydoctor2.utils.visitors.UnsetGeometriesVisitor; import de.hft.stuttgart.citydoctor2.utils.visitors.UnsetGeometriesVisitor;
...@@ -114,18 +112,6 @@ public class BridgeObjectTest { ...@@ -114,18 +112,6 @@ public class BridgeObjectTest {
verify(geomMock).accept(c); verify(geomMock).accept(c);
} }
@Test
public void testPrepareForChecking() {
BridgeObject bo = new BridgeObject(mock(AbstractBridge.class));
Geometry geom = new Geometry(GeometryType.MULTI_SURFACE, Lod.LOD2, Orientation.OUTWARD);
Geometry spyGeom = Mockito.spy(geom);
bo.addGeometry(spyGeom);
bo.prepareForChecking();
verify(spyGeom).updateEdgesAndVertices();
}
@Test @Test
public void testContainsError() { public void testContainsError() {
BridgeObject bo = new BridgeObject(mock(AbstractBridge.class)); BridgeObject bo = new BridgeObject(mock(AbstractBridge.class));
...@@ -173,6 +159,8 @@ public class BridgeObjectTest { ...@@ -173,6 +159,8 @@ public class BridgeObjectTest {
@Test @Test
public void testReCreateGeometriesSolid() { public void testReCreateGeometriesSolid() {
org.citygml4j.core.model.bridge.AbstractBridge gmlBr = new AbstractBridge() { org.citygml4j.core.model.bridge.AbstractBridge gmlBr = new AbstractBridge() {
private static final long serialVersionUID = -6057032019199660174L;
@Override @Override
public void accept(ObjectVisitor visitor) { public void accept(ObjectVisitor visitor) {
...@@ -196,6 +184,8 @@ public class BridgeObjectTest { ...@@ -196,6 +184,8 @@ public class BridgeObjectTest {
@Test @Test
public void testReCreateGeometriesMultiSurface() { public void testReCreateGeometriesMultiSurface() {
org.citygml4j.core.model.bridge.AbstractBridge gmlBr = new AbstractBridge() { org.citygml4j.core.model.bridge.AbstractBridge gmlBr = new AbstractBridge() {
private static final long serialVersionUID = -423198873081228195L;
@Override @Override
public void accept(ObjectVisitor visitor) { public void accept(ObjectVisitor visitor) {
......
...@@ -76,7 +76,6 @@ public class BuildingTest { ...@@ -76,7 +76,6 @@ public class BuildingTest {
assertEquals(b.getGmlId(), copy.getGmlId()); assertEquals(b.getGmlId(), copy.getGmlId());
copy.prepareForChecking();
Geometry copyGeom = copy.getGeometries().get(0); Geometry copyGeom = copy.getGeometries().get(0);
assertNotSame(geom, copyGeom); assertNotSame(geom, copyGeom);
......
...@@ -252,7 +252,6 @@ public class GeometryTest { ...@@ -252,7 +252,6 @@ public class GeometryTest {
public void testUpdateEdges() { public void testUpdateEdges() {
Geometry geom = GeometryTestUtils.createDummyGeometryWithInnerRingWithNeighboringPolygon(GeometryType.SOLID, Geometry geom = GeometryTestUtils.createDummyGeometryWithInnerRingWithNeighboringPolygon(GeometryType.SOLID,
Lod.LOD2); Lod.LOD2);
geom.clearMetaInformation();
assertNull(geom.getEdges()); assertNull(geom.getEdges());
geom.updateEdges(); geom.updateEdges();
List<Edge> edges = geom.getEdges(); List<Edge> edges = geom.getEdges();
...@@ -454,17 +453,4 @@ public class GeometryTest { ...@@ -454,17 +453,4 @@ public class GeometryTest {
assertFalse(geom.containsPolygon(cdPoly4)); assertFalse(geom.containsPolygon(cdPoly4));
} }
@Test
public void testClearMetaInformation() {
Geometry geom = GeometryTestUtils.createDummyGeometryWithInnerRingWithNeighboringPolygon(GeometryType.SOLID,
Lod.LOD0);
assertNotNull(geom.getVertices());
geom.clearMetaInformation();
assertNull(geom.getVertices());
assertNull(geom.getEdges());
geom.clearMetaInformation();
assertNull(geom.getVertices());
assertNull(geom.getEdges());
}
} }
...@@ -714,7 +714,6 @@ public class Checker { ...@@ -714,7 +714,6 @@ public class Checker {
List<Future<GmlId>> futures = runChecksOnFeatures(exec, cache, features, checkedCount, l); List<Future<GmlId>> futures = runChecksOnFeatures(exec, cache, features, checkedCount, l);
List<GmlId> missedFeatures = getMissedFeatures(futures); List<GmlId> missedFeatures = getMissedFeatures(futures);
ImplicitGeometryHolder.clearMetaDataOfPrototypeGeometries();
if (!missedFeatures.isEmpty()){ if (!missedFeatures.isEmpty()){
logger.error(Localization.getText("Checker.dbUnresponsive")); logger.error(Localization.getText("Checker.dbUnresponsive"));
if (logger.isDebugEnabled()){ if (logger.isDebugEnabled()){
...@@ -765,9 +764,7 @@ public class Checker { ...@@ -765,9 +764,7 @@ public class Checker {
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();
return null; return null;
} }
co.prepareForChecking();
executeChecksForCityObject(co); executeChecksForCityObject(co);
co.clearMetaInformation();
cache.put(co); cache.put(co);
checkedCount.incrementAndGet(); checkedCount.incrementAndGet();
if (l!=null){ if (l!=null){
......
...@@ -24,16 +24,7 @@ import de.hft.stuttgart.citydoctor2.check.CheckError; ...@@ -24,16 +24,7 @@ import de.hft.stuttgart.citydoctor2.check.CheckError;
import de.hft.stuttgart.citydoctor2.check.ValidationConfiguration; import de.hft.stuttgart.citydoctor2.check.ValidationConfiguration;
import de.hft.stuttgart.citydoctor2.checkresult.utility.CheckReportWriteException; import de.hft.stuttgart.citydoctor2.checkresult.utility.CheckReportWriteException;
import de.hft.stuttgart.citydoctor2.checks.Checks; import de.hft.stuttgart.citydoctor2.checks.Checks;
import de.hft.stuttgart.citydoctor2.datastructure.BridgeObject;
import de.hft.stuttgart.citydoctor2.datastructure.Building;
import de.hft.stuttgart.citydoctor2.datastructure.CityDoctorModel; import de.hft.stuttgart.citydoctor2.datastructure.CityDoctorModel;
import de.hft.stuttgart.citydoctor2.datastructure.CityFurniture;
import de.hft.stuttgart.citydoctor2.datastructure.CityObject;
import de.hft.stuttgart.citydoctor2.datastructure.GenericCityObject;
import de.hft.stuttgart.citydoctor2.datastructure.TransportationObject;
import de.hft.stuttgart.citydoctor2.datastructure.Tunnel;
import de.hft.stuttgart.citydoctor2.datastructure.Vegetation;
import de.hft.stuttgart.citydoctor2.datastructure.WaterObject;
/** /**
* *
......
...@@ -118,13 +118,7 @@ public class CityDoctorController { ...@@ -118,13 +118,7 @@ public class CityDoctorController {
this.renderer = renderer; this.renderer = renderer;
} }
public void loadCityGml(String path, int numberOfRoundingPlaces, ProgressListener l, boolean useValidation) public void loadCityGml(String path, int numberOfRoundingPlaces, ProgressListener l, boolean useValidation) throws CityGmlParseException, InvalidGmlFileException {
throws CityGmlParseException, InvalidGmlFileException {
loadCityGml(path, numberOfRoundingPlaces, l, useValidation, false);
}
public void loadCityGml(String path, int numberOfRoundingPlaces, ProgressListener l, boolean useValidation,
boolean lowMemory) throws CityGmlParseException, InvalidGmlFileException {
try { try {
Platform.runLater(() -> { Platform.runLater(() -> {
mainWindow.getOpenBtn().setDisable(true); mainWindow.getOpenBtn().setDisable(true);
...@@ -137,7 +131,7 @@ public class CityDoctorController { ...@@ -137,7 +131,7 @@ public class CityDoctorController {
mainWindow.resetFilterComboBox(); mainWindow.resetFilterComboBox();
}); });
currentChecker = null; currentChecker = null;
currentConfig = new ParserConfiguration(numberOfRoundingPlaces, useValidation, lowMemory); currentConfig = new ParserConfiguration(numberOfRoundingPlaces, useValidation);
model = CityGmlParser.parseCityGmlFile(path, currentConfig, l); model = CityGmlParser.parseCityGmlFile(path, currentConfig, l);
mainWindow.getClickHandler().setConfig(currentConfig); mainWindow.getClickHandler().setConfig(currentConfig);
......
...@@ -68,12 +68,6 @@ public class OpenFileDialog { ...@@ -68,12 +68,6 @@ public class OpenFileDialog {
@FXML @FXML
private Label xmlValidationLabel; private Label xmlValidationLabel;
@FXML
private Label lowMemoryLabel;
@FXML
private CheckBox lowMemoryBox;
private CityDoctorController controller; private CityDoctorController controller;
private ExceptionDialog exDialog; private ExceptionDialog exDialog;
private FileChooser fc; private FileChooser fc;
...@@ -112,7 +106,6 @@ public class OpenFileDialog { ...@@ -112,7 +106,6 @@ public class OpenFileDialog {
roundingPlacesLabel.setText(Localization.getText("OpenFileDialog.roundingPlacesLabel")); roundingPlacesLabel.setText(Localization.getText("OpenFileDialog.roundingPlacesLabel"));
xmlValidationLabel.setText(Localization.getText("OpenFileDialog.xmlValidationLabel")); xmlValidationLabel.setText(Localization.getText("OpenFileDialog.xmlValidationLabel"));
cancelBtn.setText(Localization.getText("OpenFileDialog.cancelBtn")); cancelBtn.setText(Localization.getText("OpenFileDialog.cancelBtn"));
lowMemoryLabel.setText(Localization.getText("OpenFileDialog.lowMemoryLabel"));
} }
private void setupSelectButton() { private void setupSelectButton() {
...@@ -143,7 +136,6 @@ public class OpenFileDialog { ...@@ -143,7 +136,6 @@ public class OpenFileDialog {
loadBtn.setOnAction(ae -> { loadBtn.setOnAction(ae -> {
int numberOfRoundingPlaces = Integer.parseInt(precisionField.getText()); int numberOfRoundingPlaces = Integer.parseInt(precisionField.getText());
boolean useValidation = useValidationBox.isSelected(); boolean useValidation = useValidationBox.isSelected();
boolean lowMemory = lowMemoryBox.isSelected();
String path = pathField.getText(); String path = pathField.getText();
cancelBtn.setDisable(true); cancelBtn.setDisable(true);
loadBtn.setDisable(true); loadBtn.setDisable(true);
...@@ -153,8 +145,7 @@ public class OpenFileDialog { ...@@ -153,8 +145,7 @@ public class OpenFileDialog {
Thread t = new Thread(() -> { Thread t = new Thread(() -> {
try { try {
controller.loadCityGml(path, numberOfRoundingPlaces, progress::setProgress, useValidation, controller.loadCityGml(path, numberOfRoundingPlaces, progress::setProgress, useValidation);
lowMemory);
Platform.runLater(() -> stage.close()); Platform.runLater(() -> stage.close());
} catch (Exception e) { } catch (Exception e) {
if (logger.isErrorEnabled()) { if (logger.isErrorEnabled()) {
......
package de.hft.stuttgart.citydoctor2.gui; package de.hft.stuttgart.citydoctor2.gui;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import de.hft.stuttgart.citydoctor2.check.CheckError; import de.hft.stuttgart.citydoctor2.check.CheckError;
import de.hft.stuttgart.citydoctor2.check.Checkable; import de.hft.stuttgart.citydoctor2.check.Checkable;
import de.hft.stuttgart.citydoctor2.utils.visitors.CityObjectCollector; import de.hft.stuttgart.citydoctor2.datastructure.BoundarySurface;
import de.hft.stuttgart.citydoctor2.datastructure.*; import de.hft.stuttgart.citydoctor2.datastructure.BoundarySurfaceType;
import de.hft.stuttgart.citydoctor2.datastructure.BoundingBox;
import de.hft.stuttgart.citydoctor2.datastructure.BridgeObject;
import de.hft.stuttgart.citydoctor2.datastructure.Building;
import de.hft.stuttgart.citydoctor2.datastructure.CityDoctorModel;
import de.hft.stuttgart.citydoctor2.datastructure.CityFurniture;
import de.hft.stuttgart.citydoctor2.datastructure.CityObject;
import de.hft.stuttgart.citydoctor2.datastructure.ConcretePolygon;
import de.hft.stuttgart.citydoctor2.datastructure.Edge;
import de.hft.stuttgart.citydoctor2.datastructure.GenericAttribute;
import de.hft.stuttgart.citydoctor2.datastructure.Geometry;
import de.hft.stuttgart.citydoctor2.datastructure.LinearRing;
import de.hft.stuttgart.citydoctor2.datastructure.Lod;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
import de.hft.stuttgart.citydoctor2.datastructure.TransportationObject;
import de.hft.stuttgart.citydoctor2.datastructure.Tunnel;
import de.hft.stuttgart.citydoctor2.datastructure.Vegetation;
import de.hft.stuttgart.citydoctor2.datastructure.Vertex;
import de.hft.stuttgart.citydoctor2.datastructure.WaterObject;
import de.hft.stuttgart.citydoctor2.gui.filter.ViewFilter; import de.hft.stuttgart.citydoctor2.gui.filter.ViewFilter;
import de.hft.stuttgart.citydoctor2.gui.tree.*; import de.hft.stuttgart.citydoctor2.gui.tree.ErrorItemVisitor;
import de.hft.stuttgart.citydoctor2.gui.tree.Renderable;
import de.hft.stuttgart.citydoctor2.gui.tree.node.EdgeNode; import de.hft.stuttgart.citydoctor2.gui.tree.node.EdgeNode;
import de.hft.stuttgart.citydoctor2.gui.tree.node.ErrorNode; import de.hft.stuttgart.citydoctor2.gui.tree.node.ErrorNode;
import de.hft.stuttgart.citydoctor2.gui.tree.node.GenericAttributeNode; import de.hft.stuttgart.citydoctor2.gui.tree.node.GenericAttributeNode;
...@@ -13,23 +42,18 @@ import de.hft.stuttgart.citydoctor2.gui.tree.node.LinearRingNode; ...@@ -13,23 +42,18 @@ import de.hft.stuttgart.citydoctor2.gui.tree.node.LinearRingNode;
import de.hft.stuttgart.citydoctor2.gui.tree.node.PolygonNode; import de.hft.stuttgart.citydoctor2.gui.tree.node.PolygonNode;
import de.hft.stuttgart.citydoctor2.gui.tree.node.VertexNode; import de.hft.stuttgart.citydoctor2.gui.tree.node.VertexNode;
import de.hft.stuttgart.citydoctor2.math.Triangle3d; import de.hft.stuttgart.citydoctor2.math.Triangle3d;
import de.hft.stuttgart.citydoctor2.utils.visitors.CityObjectCollector;
import javafx.application.Platform; import javafx.application.Platform;
import javafx.scene.control.TreeItem; import javafx.scene.control.TreeItem;
import javafx.scene.paint.Color; import javafx.scene.paint.Color;
import javafx.scene.shape.CullFace; import javafx.scene.shape.CullFace;
import javafx.scene.shape.DrawMode; import javafx.scene.shape.DrawMode;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.IOException;
import java.util.*;
public class Renderer { public class Renderer {
private static final Logger logger = LogManager.getLogger(Renderer.class); private static final Logger logger = LogManager.getLogger(Renderer.class);
private TriangulatedGeometry currentTriGeom; private TriangulatedGeometry currentTriGeom;
private Geometry currentGeometry;
private CullFace currentCulling = CullFace.NONE; private CullFace currentCulling = CullFace.NONE;
private DrawMode currentDrawMode = DrawMode.FILL; private DrawMode currentDrawMode = DrawMode.FILL;
...@@ -245,20 +269,9 @@ public class Renderer { ...@@ -245,20 +269,9 @@ public class Renderer {
refresher = () -> { refresher = () -> {
Platform.runLater(this::clearGeometryTrees); Platform.runLater(this::clearGeometryTrees);
currentTriGeom = TriangulatedGeometry.of(geom); currentTriGeom = TriangulatedGeometry.of(geom);
if (geom.getEdges() == null && currentGeometry != null) {
// if there are no edges available low memory mode is enabled
// clear the old geometry of all meta information
currentGeometry.clearMetaData();
}
errVisitor.setGeometry(currentTriGeom); errVisitor.setGeometry(currentTriGeom);
Platform.runLater(() -> { Platform.runLater(() -> {
setupRenderState(); setupRenderState();
if (geom.getEdges() == null) {
// create edges and vertices so they can be listed in the gui
geom.prepareForChecking();
// remember the geometry, so it can be cleared if another is displayed
currentGeometry = geom;
}
addGeometryDataToView(geom); addGeometryDataToView(geom);
addGenericAttributesToView(geom.getParent()); addGenericAttributesToView(geom.getParent());
mainWindow.zoomOutForBoundingBox(BoundingBox.of(geom.getPolygons())); mainWindow.zoomOutForBoundingBox(BoundingBox.of(geom.getPolygons()));
......
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