diff --git a/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/check/Checkable.java b/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/check/Checkable.java index 6f1c035da5d7c56a3464a92645894437ff81b623..fa3be69f0d7c62cb1eedfbfea98d487b529aed15 100644 --- a/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/check/Checkable.java +++ b/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/check/Checkable.java @@ -42,11 +42,11 @@ public abstract class Checkable implements Serializable { private EnumMap checkResults = new EnumMap<>(CheckId.class); private boolean isValidated = false; - + protected void setValidated(boolean validated) { isValidated = validated; } - + public boolean isValidated() { return isValidated; } @@ -75,6 +75,19 @@ public abstract class Checkable implements Serializable { */ public abstract GmlId getGmlId(); + /** + * This should be called before executing a check if low memory consumption + * method has been enabled. This should create edges and additional meta + * information necessary to perform checks. + */ + public abstract void prepareForChecking(); + + /** + * This should be called after checking has been done. This should remove any + * created meta information like edges to free up additional memory space + */ + public abstract void clearMetaInformation(); + /** * This method checks if the object or any object contained within this * checkable has an error. It counts as an error if the result status if the diff --git a/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/AbstractBuilding.java b/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/AbstractBuilding.java index 7b1442ece85cb454a3ea16219896c8fd79bf3618..b753f1812176ef5562ea485adb0f5cf313040f06 100644 --- a/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/AbstractBuilding.java +++ b/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/AbstractBuilding.java @@ -257,4 +257,26 @@ public abstract class AbstractBuilding extends CityObject { public List getBuildingInstallations() { return buildingInstallations; } + + @Override + public void prepareForChecking() { + super.prepareForChecking(); + for (BuildingInstallation bi : buildingInstallations) { + bi.prepareForChecking(); + } + for (BoundarySurface bs : boundarySurfaceList) { + bs.prepareForChecking(); + } + } + + @Override + public void clearMetaInformation() { + super.clearMetaInformation(); + for (BuildingInstallation bi : buildingInstallations) { + bi.clearMetaInformation(); + } + for (BoundarySurface bs : boundarySurfaceList) { + bs.clearMetaInformation(); + } + } } diff --git a/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/BoundarySurface.java b/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/BoundarySurface.java index ba4a1d1cae4ee781faf5ef81d5f7ae5a7bcc7191..2674457a7af685a18878c7bcdae8bf36fa4218fc 100644 --- a/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/BoundarySurface.java +++ b/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/BoundarySurface.java @@ -295,4 +295,20 @@ public class BoundarySurface extends CityObject { opening.setPartOfSurface(this); } + @Override + public void prepareForChecking() { + super.prepareForChecking(); + for (Opening o : openings) { + o.prepareForChecking(); + } + } + + @Override + public void clearMetaInformation() { + super.clearMetaInformation(); + for (Opening o : openings) { + o.clearMetaInformation(); + } + } + } diff --git a/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/BridgeObject.java b/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/BridgeObject.java index 6b8dbd533f1ad39cc284a5aa6299c1628129a44d..c155ab8bc5a322a5dde1e35ea6fb12c12200f2cd 100644 --- a/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/BridgeObject.java +++ b/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/BridgeObject.java @@ -214,5 +214,21 @@ public class BridgeObject extends CityObject { public String toString() { return "BridgeObject [type=" + type + ", id=" + getGmlId() + "]"; } + + @Override + public void prepareForChecking() { + super.prepareForChecking(); + for (BoundarySurface bs : boundarySurfaces) { + bs.prepareForChecking(); + } + } + + @Override + public void clearMetaInformation() { + super.clearMetaInformation(); + for (BoundarySurface bs : boundarySurfaces) { + bs.clearMetaInformation(); + } + } } diff --git a/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/Building.java b/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/Building.java index fea355ea837ab88b4a2c8044cbc524c94157feab..7b7190dd57a00bbc1ac8e03919dd958ed0806f35 100644 --- a/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/Building.java +++ b/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/Building.java @@ -134,4 +134,20 @@ public class Building extends AbstractBuilding { } setCityGmlBuilding(gmlB); } + + @Override + public void clearMetaInformation() { + super.clearMetaInformation(); + for (BuildingPart part : buildingParts) { + part.clearMetaInformation(); + } + } + + @Override + public void prepareForChecking() { + super.prepareForChecking(); + for (BuildingPart part : buildingParts) { + part.prepareForChecking(); + } + } } diff --git a/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/BuildingInstallation.java b/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/BuildingInstallation.java index 9d302fdd4542a1c7b02ee30841339a344c0afc1d..031c2acb8116516a97a7c6495ee2c645cbfb043c 100644 --- a/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/BuildingInstallation.java +++ b/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/BuildingInstallation.java @@ -193,6 +193,22 @@ public class BuildingInstallation extends CityObject { return boundarySurfaces; } + @Override + public void clearMetaInformation() { + super.clearMetaInformation(); + for (BoundarySurface bs : boundarySurfaces) { + bs.clearMetaInformation(); + } + } + + @Override + public void prepareForChecking() { + super.prepareForChecking(); + for (BoundarySurface bs : boundarySurfaces) { + bs.prepareForChecking(); + } + } + } diff --git a/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/CityObject.java b/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/CityObject.java index c1b5c95e380c8de747e1875b3641857e8ba2ad51..3aaeafe7b18a6cac8565206492cdaa63599aa4ae 100644 --- a/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/CityObject.java +++ b/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/CityObject.java @@ -172,4 +172,18 @@ public abstract class CityObject extends GmlElement { } return null; } + + @Override + public void prepareForChecking() { + for (Geometry geom : geometryList) { + geom.prepareForChecking(); + } + } + + @Override + public void clearMetaInformation() { + for (Geometry geom : geometryList) { + geom.clearMetaInformation(); + } + } } diff --git a/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/ConcretePolygon.java b/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/ConcretePolygon.java index a673ba10ef601adca90b68d3a55be995fd7a9518..556507718efb42dba4c27e896a830df08a0d24e3 100644 --- a/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/ConcretePolygon.java +++ b/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/ConcretePolygon.java @@ -440,4 +440,14 @@ public class ConcretePolygon extends Polygon { void setLinkedTo(LinkedPolygon linkedPolygon) { linkedFromPolygon = linkedPolygon; } + + @Override + public void prepareForChecking() { + parent.prepareForChecking(); + } + + @Override + public void clearMetaInformation() { + parent.clearMetaInformation(); + } } diff --git a/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/Geometry.java b/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/Geometry.java index fe6ce305f527e17e63e8cc185a52c67ba80c832b..ec554b63562407fc93aa84089910664ec58b0dc7 100644 --- a/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/Geometry.java +++ b/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/Geometry.java @@ -405,4 +405,16 @@ public class Geometry extends GmlElement { public Geometry copy() { return (Geometry) super.copy(); } + + @Override + public void prepareForChecking() { + updateEdgesAndVertices(); + } + + @Override + public void clearMetaInformation() { + edges = null; + vertices = null; + edgeMap = null; + } } diff --git a/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/LinearRing.java b/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/LinearRing.java index 8e2645edb1729b4c8db3f10539664ee4d6c72d8c..e7b3051dd92b1c985340fa9fd4b72c72a46646f5 100644 --- a/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/LinearRing.java +++ b/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/LinearRing.java @@ -246,5 +246,14 @@ public class LinearRing extends GmlElement { public void addAllVertices(List extRing) { vertices.addAll(extRing); } - + + @Override + public void prepareForChecking() { + parent.getParent().prepareForChecking(); + } + + @Override + public void clearMetaInformation() { + parent.getParent().clearMetaInformation(); + } } diff --git a/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/LinkedPolygon.java b/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/LinkedPolygon.java index 23d053aad0110bfcad4e963a93a45b030cd8000d..1c2784aec48d3a048c0644e616de6e2b39158c83 100644 --- a/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/LinkedPolygon.java +++ b/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/LinkedPolygon.java @@ -246,5 +246,15 @@ public class LinkedPolygon extends Polygon { public ConcretePolygon getOriginal() { return poly; } + + @Override + public void prepareForChecking() { + poly.prepareForChecking(); + } + + @Override + public void clearMetaInformation() { + poly.clearMetaInformation(); + } } diff --git a/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/TransportationObject.java b/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/TransportationObject.java index f24d072e24327e1db31090cd1a4d462f8b8bb417..3487869b6eafc64236fa32527d47c4eb752175f1 100644 --- a/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/TransportationObject.java +++ b/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/TransportationObject.java @@ -51,7 +51,7 @@ public class TransportationObject extends CityObject { } private AbstractTransportationObject ato; - private List composesOf = new ArrayList<>(); + private List composesOf = new ArrayList<>(1); private TransportationType type; public TransportationObject(TransportationType type) { @@ -253,5 +253,21 @@ public class TransportationObject extends CityObject { public String toString() { return "TransportationObject [id=" + getGmlId() + "]"; } + + @Override + public void prepareForChecking() { + super.prepareForChecking(); + for (TransportationObject child : composesOf) { + child.prepareForChecking(); + } + } + + @Override + public void clearMetaInformation() { + super.clearMetaInformation(); + for (TransportationObject child : composesOf) { + child.clearMetaInformation(); + } + } } diff --git a/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/mapper/FeatureMapper.java b/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/mapper/FeatureMapper.java index 989c4f687923fc854787ae8a1c34e7e37b2f7b1c..ebf0821acf83e806add036e20ee1f19e87334664 100644 --- a/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/mapper/FeatureMapper.java +++ b/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/mapper/FeatureMapper.java @@ -154,7 +154,6 @@ public class FeatureMapper extends FeatureWalker { } private void updateEdgesAndVertices(CityObject co) { - for (Geometry geom : co.getGeometries()) { geom.updateVertices(); KDTree tree = new KDTree(); @@ -170,8 +169,16 @@ public class FeatureMapper extends FeatureWalker { v.addNeighbor(neighbor); } } - - geom.updateEdges(); + + if (config.useLowMemoryConsumption()) { + // do not create edges and vertices + // vertices were already created because they were needed for the kd tree + // remove them again + geom.clearMetaInformation(); + } else { + // create edges + geom.updateEdges(); + } } } diff --git a/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/parser/ParserConfiguration.java b/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/parser/ParserConfiguration.java index 415dc50b7f881150a563ab6b4f5a457e256c1366..139bfd549760696b7448df3756167ab293ea283e 100644 --- a/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/parser/ParserConfiguration.java +++ b/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/parser/ParserConfiguration.java @@ -46,15 +46,21 @@ public class ParserConfiguration implements Serializable { private String targetTransformString; private String originalTransformString; private boolean hasTransformation = false; + private boolean useLowMemoryConsumption = false; private transient double fromMetres = 1.0; public ParserConfiguration(int numberOfRoundingPlaces, boolean validate) { + this(numberOfRoundingPlaces, validate, false); + } + + public ParserConfiguration(int numberOfRoundingPlaces, boolean validate, boolean lowMemory) { if (numberOfRoundingPlaces < 0) { throw new IllegalArgumentException("Number of rounding places must be a positive value"); } roundingPlaces = numberOfRoundingPlaces; this.validate = validate; + useLowMemoryConsumption = lowMemory; } public boolean getValidate() { @@ -107,5 +113,9 @@ public class ParserConfiguration implements Serializable { public double getFromMetres() { return fromMetres; } + + public boolean useLowMemoryConsumption() { + return useLowMemoryConsumption; + } } diff --git a/CityDoctorParent/CityDoctorModel/src/main/resources/CityDoctorLocalization.properties b/CityDoctorParent/CityDoctorModel/src/main/resources/CityDoctorLocalization.properties index 4ff2f4ac010a1515a5589e400e402179196c7917..92600e478658faa09e7b23e5f2b3a44feadf2e28 100644 --- a/CityDoctorParent/CityDoctorModel/src/main/resources/CityDoctorLocalization.properties +++ b/CityDoctorParent/CityDoctorModel/src/main/resources/CityDoctorLocalization.properties @@ -110,4 +110,5 @@ CityGmlParser.noEPSG=Could not read EPSG code, assuming metric system OpenFileDialog.loadFailed=Failed to load CityGML File MainWindow.memoryLabel=Memory: CheckDialog.checksReenabledAlert=Some checks have been reenabled so that other wanted checks can be executed\nSee the log for more information. -MainWindow.availableLabel=Available: \ No newline at end of file +MainWindow.availableLabel=Available: +OpenFileDialog.lowMemoryLabel=Low Memory Consumption Mode \ No newline at end of file diff --git a/CityDoctorParent/CityDoctorModel/src/main/resources/CityDoctorLocalization_de.properties b/CityDoctorParent/CityDoctorModel/src/main/resources/CityDoctorLocalization_de.properties index be6efc30d5aaa4b0925d583f17ffecd5c187f9d0..735fa1be2fcff967ebaf41c5be393b0f5b95b4b4 100644 --- a/CityDoctorParent/CityDoctorModel/src/main/resources/CityDoctorLocalization_de.properties +++ b/CityDoctorParent/CityDoctorModel/src/main/resources/CityDoctorLocalization_de.properties @@ -108,4 +108,5 @@ CityGmlParser.noEPSG=Konnte EPSG Code nicht lesen, nehme metrisches System an OpenFileDialog.loadFailed=Konnte CityGML Datei nicht laden MainWindow.memoryLabel=Speicher: CheckDialog.checksReenabledAlert=Manche Pr\u00fcfungen wurden reaktiviert damit andere gewollte Pr\u00fcfungen durchgef\u00fchrt werden k\u00f6nnen\nMehr Details sind im Log geschrieben -MainWindow.availableLabel=Verf\u00fcgbar: \ No newline at end of file +MainWindow.availableLabel=Verf\u00fcgbar: +OpenFileDialog.lowMemoryLabel=Reduzierter Speicherverbrauchsmodus \ No newline at end of file diff --git a/CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/check/Checker.java b/CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/check/Checker.java index f5d142d359208c3123e00d64bc0bc2e605f3db89..c406ae6209b4a95949b941c9aa80fa3fb68a28e5 100644 --- a/CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/check/Checker.java +++ b/CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/check/Checker.java @@ -362,8 +362,17 @@ public class Checker { // stupid lamda with final variable restrictions int[] currentFeature = new int[1]; features.forEach(co -> { + if (config.getParserConfiguration().useLowMemoryConsumption()) { + // no edges have been created yet, create them + co.prepareForChecking(); + } // check every feature executeChecksForCityObject(co); + + if (config.getParserConfiguration().useLowMemoryConsumption()) { + // low memory consumption, remove edges again + co.clearMetaInformation(); + } if (l != null) { currentFeature[0]++; l.updateProgress(currentFeature[0] / featureSum);