Commit 946bd130 authored by Riegel's avatar Riegel
Browse files

Feat: Added loading of ZipEntry into MainWindow

2 merge requests!28Version 3.17.0 Release,!26Add ZIP-archive support
Showing with 54 additions and 28 deletions
+54 -28
...@@ -148,7 +148,7 @@ public class CityDoctorController { ...@@ -148,7 +148,7 @@ public class CityDoctorController {
private void loadCityGmlZipFile(String path, int numberOfRoundingPlaces, ProgressListener l, boolean useValidation, private void loadCityGmlZipFile(String path, int numberOfRoundingPlaces, ProgressListener l, boolean useValidation,
boolean lowMemory) throws CityGmlParseException, InvalidGmlFileException { boolean lowMemory) throws CityGmlParseException, InvalidGmlFileException {
currentChecker = null;
currentConfig = new ParserConfiguration(numberOfRoundingPlaces, useValidation, lowMemory); currentConfig = new ParserConfiguration(numberOfRoundingPlaces, useValidation, lowMemory);
zipArchive = CityGmlZipArchive.register(path); zipArchive = CityGmlZipArchive.register(path);
...@@ -160,18 +160,39 @@ public class CityDoctorController { ...@@ -160,18 +160,39 @@ public class CityDoctorController {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
}); });
/**
model = CityGmlParser.parseCityGmlFile(path, currentConfig, l, handler, true);
if (!validationIssues.isEmpty()) {
StringJoiner sj = new StringJoiner("\n");
validationIssues.stream().forEach(sj::add);
throw new InvalidGmlFileException(sj.toString());
} }
public void decompressZipEntry(CityGmlZipEntry entry, ProgressListener l) {
entry.loadEntry(currentConfig, l);
}
public CityGmlZipArchive getZipArchive() {
return zipArchive;
}
public void loadZipEntry(CityGmlZipEntry entry) {
if (!entry.isDecompressed()) {
entry.loadEntry(currentConfig);
}
if (entry.getErrorType() != null) {
throw new IllegalArgumentException("Attempted to load erroneous zip entry");
}
try {
Platform.runLater(() -> {
mainWindow.getOpenBtn().setDisable(true);
mainWindow.getWriteReportButton().setDisable(true);
mainWindow.getMeshGroup().getChildren().clear();
clearTrees();
mainWindow.resetSearchBar();
mainWindow.resetFilterComboBox();
});
currentChecker = null;
model = entry.getModel();
mainWindow.getClickHandler().setConfig(currentConfig); mainWindow.getClickHandler().setConfig(currentConfig);
sourceFile = path; sourceFile = entry.getArchive().getArchivePath().toString();
renderer.reset(); renderer.reset();
Platform.runLater(() -> { Platform.runLater(() -> {
mainWindow.addFileNameToTitle(path); mainWindow.addFileNameToTitle(entry.getArchive().getArchivePath().toString());
mainWindow.getCheckButton().setDisable(false); mainWindow.getCheckButton().setDisable(false);
mainWindow.getLod1Btn().setDisable(false); mainWindow.getLod1Btn().setDisable(false);
mainWindow.getLod2Btn().setDisable(false); mainWindow.getLod2Btn().setDisable(false);
...@@ -186,15 +207,10 @@ public class CityDoctorController { ...@@ -186,15 +207,10 @@ public class CityDoctorController {
setupFeatureTabs(); setupFeatureTabs();
buildTrees(); buildTrees();
}); });
**/ } finally {
} Platform.runLater(() -> mainWindow.getOpenBtn().setDisable(false));
public void decompressZipEntry(CityGmlZipEntry entry, ProgressListener l) {
entry.loadEntry(currentConfig, l);
} }
public CityGmlZipArchive getZipArchive() {
return zipArchive;
} }
private void setupFeatureTabs() { private void setupFeatureTabs() {
......
...@@ -170,6 +170,16 @@ public class ZipEntryPicker { ...@@ -170,6 +170,16 @@ public class ZipEntryPicker {
loadBtn.setOnAction(e -> { loadBtn.setOnAction(e -> {
disableTaskButtons(); disableTaskButtons();
CityGmlZipEntry entry = entryList.getSelectionModel().getSelectedItem().getEntry(); CityGmlZipEntry entry = entryList.getSelectionModel().getSelectedItem().getEntry();
if (entry.getErrorType() != null) {
/**
* Button is disabled when an erroneous entry gets selected.
* Silently fail in case an erroneous entry is somehow selected on Action.
*/
logger.debug("IllegalState: loadBtn was pressed while an erroneous entry was selected");
return;
}
controller.loadZipEntry(entry);
stage.hide();
}); });
......
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