Commit 8087b4bb authored by Luna Riegel's avatar Luna Riegel
Browse files

Fix: Clear ImplicitGeometry Object maps before parsing

parent 8129283a
......@@ -24,6 +24,9 @@ public class ImplicitGeometryHolder extends Geometry {
private static final long serialVersionUID = -8938931081577196349L;
private static final Logger logger = LogManager.getLogger(ImplicitGeometryHolder.class);
public enum PrototypeGeometryType {
LIBRARY_OBJECT, RELATIVE_GEOMETRY
}
private ImplicitGeometry cgmlImplicitGeometry = null;
private static ConcurrentHashMap<ImplicitGeometryHolder, ImplicitGeometry> deferredRelGeomObjects = new ConcurrentHashMap<>();
......@@ -101,9 +104,12 @@ public class ImplicitGeometryHolder extends Geometry {
return type;
}
@Override
public void accept(CheckableVisitor c) {
prototypeGeometry.accept(c);
/**
* Resets the Object maps of {@link RelativeGeometry} and {@link LibraryObject} to prevent memory and data leaks
*/
public static void resetObjectMaps() {
RelativeGeometry.resetObjectMap();
LibraryObject.resetObjectMap();
}
@Override
......@@ -111,8 +117,5 @@ public class ImplicitGeometryHolder extends Geometry {
return prototypeGeometry.isValidated();
}
public enum PrototypeGeometryType {
LIBRARY_OBJECT, RELATIVE_GEOMETRY
}
}
......@@ -80,4 +80,7 @@ public class LibraryObject extends Geometry {
}
public static void resetObjectMap() {
libraryObjects.clear();
}
}
......@@ -34,4 +34,8 @@ public class RelativeGeometry extends Geometry {
private RelativeGeometry(GeometryType type, Lod lod, Orientation orientation) {
super(type, lod, orientation);
}
public static void resetObjectMap() {
relativeGeometries.clear();
}
}
......@@ -182,6 +182,7 @@ public class Citygml3FeatureMapper extends ObjectWalker {
model = new CityDoctorModel(config, path.toFile(), new UnconnectedCache());
} else {
featureCache.resetCache();
ImplicitGeometryHolder.resetObjectMaps();
model = new CityDoctorModel(config, path.toFile(), featureCache);
}
neighborDistance = 1.8d / Math.pow(10, config.getNumberOfRoundingPlaces());
......
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