Commit 813914eb authored by Riegel's avatar Riegel
Browse files

Feat: Add short-term memory of previous Checkers

Adds a HashMap to allow CityDoctorController to remember the Checker of
a CityDoctorModel, to allow switching of models with ZipEntryManager
without having to rerun the Checks when an already validated model is
loaded again.

Short-term meaning, that the memory is only kept for this session and
only till the next CityGML source is loaded (even if the same zip file
gets loaded again).
2 merge requests!28Version 3.17.0 Release,!26Add ZIP-archive support
Showing with 12 additions and 1 deletion
+12 -1
......@@ -47,6 +47,7 @@ public class CityDoctorController {
private String sourceFile;
private CityGmlZipArchive zipArchive;
private ZipEntryManager currentZipEntryManager;
private HashMap<CityDoctorModel, Checker> previousCheckers = null;
private Checker currentChecker;
private HighlightController highlightController;
......@@ -92,6 +93,7 @@ public class CityDoctorController {
return;
}
currentZipEntryManager = null;
previousCheckers = null;
currentChecker = null;
currentConfig = new ParserConfiguration(numberOfRoundingPlaces, useValidation, lowMemory);
GMLValidationHandler handler = null;
......@@ -155,6 +157,7 @@ public class CityDoctorController {
currentConfig = new ParserConfiguration(numberOfRoundingPlaces, useValidation, lowMemory);
zipArchive = CityGmlZipArchive.register(path);
if (zipArchive != null) {
previousCheckers = new HashMap<>();
Platform.runLater(() -> {
try {
currentZipEntryManager = new ZipEntryManager(mainWindow.getMainStage(), this);
......@@ -191,11 +194,14 @@ public class CityDoctorController {
mainWindow.resetSearchBar();
mainWindow.resetFilterComboBox();
});
currentChecker = null;
model = entry.getModel();
currentChecker = previousCheckers.getOrDefault(model, null);
mainWindow.getClickHandler().setConfig(currentConfig);
sourceFile = entry.getArchive().getArchivePath().toString();
renderer.reset();
Platform.runLater(() -> {
mainWindow.addFileNameToTitle(entry.getArchive().getArchivePath().toString());
mainWindow.getCheckButton().setDisable(false);
......@@ -212,6 +218,8 @@ public class CityDoctorController {
mainWindow.alignNorthArrow();
setupFeatureTabs();
buildTrees();
updateFeatureTrees();
mainWindow.getWriteReportButton().setDisable(currentChecker == null);
});
} finally {
Platform.runLater(() -> mainWindow.getOpenBtn().setDisable(false));
......@@ -871,6 +879,9 @@ public class CityDoctorController {
config.setNumberOfRoundingPlacesInGlobalParameters(currentConfig.getNumberOfRoundingPlaces());
config.setParserConfig(currentConfig);
currentChecker = new Checker(config, model);
if (previousCheckers != null) {
previousCheckers.put(model, currentChecker);
}
currentChecker.runChecks(l);
Platform.runLater(() -> {
......
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