Commit 3fd5502f authored by Riegel's avatar Riegel
Browse files

Style: Rename function

2 merge requests!28Version 3.17.0 Release,!26Add ZIP-archive support
This commit is part of merge request !26. Comments created here will be created in the context of that merge request.
Showing with 16 additions and 12 deletions
+16 -12
...@@ -43,7 +43,7 @@ public class LibraryObject extends Geometry { ...@@ -43,7 +43,7 @@ public class LibraryObject extends Geometry {
} }
public static LibraryObject of(CityGmlZipEntry entry, ParserConfiguration config) { public static LibraryObject of(CityGmlZipEntry entry, ParserConfiguration config) {
String fileName = entry.getFullFileName(); String fileName = entry.getEntrySubPath();
if (libraryObjects.containsKey(fileName)){ if (libraryObjects.containsKey(fileName)){
return libraryObjects.get(fileName); return libraryObjects.get(fileName);
} }
...@@ -90,7 +90,7 @@ public class LibraryObject extends Geometry { ...@@ -90,7 +90,7 @@ public class LibraryObject extends Geometry {
logger.error(e.getStackTrace()); logger.error(e.getStackTrace());
} catch (CityGmlParseException e) { } catch (CityGmlParseException e) {
logger.error(String.format( logger.error(String.format(
"Encountered an error while parsing library object %s", entry.getFullFileName())); "Encountered an error while parsing library object %s", entry.getEntrySubPath()));
logger.error(e.getStackTrace()); logger.error(e.getStackTrace());
} }
return geo; return geo;
......
...@@ -96,7 +96,7 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -96,7 +96,7 @@ public class Citygml3FeatureMapper extends ObjectWalker {
this.config = config; this.config = config;
this.directory = null; this.directory = null;
this.zipEntry = entry; this.zipEntry = entry;
model = new CityDoctorModel(config, Path.of(entry.getFullFileName()).toFile()); model = new CityDoctorModel(config, Path.of(entry.getEntrySubPath()).toFile());
neighborDistance = 1.8d / Math.pow(10, config.getNumberOfRoundingPlaces()); neighborDistance = 1.8d / Math.pow(10, config.getNumberOfRoundingPlaces());
} }
......
...@@ -34,7 +34,7 @@ public class ArchivePacker { ...@@ -34,7 +34,7 @@ public class ArchivePacker {
continue; continue;
} }
CityDoctorModel model = entry.getModel(); CityDoctorModel model = entry.getModel();
Path filePath = tmpDir.resolve(entry.getFullFileName()); Path filePath = tmpDir.resolve(entry.getEntrySubPath());
Files.createDirectories(filePath.getParent()); Files.createDirectories(filePath.getParent());
model.saveAs(filePath.toString(), model.isValidated()); model.saveAs(filePath.toString(), model.isValidated());
} }
......
...@@ -90,7 +90,7 @@ public class CityGmlZipArchive implements Serializable { ...@@ -90,7 +90,7 @@ public class CityGmlZipArchive implements Serializable {
public CityGmlZipEntry getEntry(String fileName) { public CityGmlZipEntry getEntry(String fileName) {
fileName = stripArchivePath(fileName); fileName = stripArchivePath(fileName);
for (CityGmlZipEntry entry : entries) { for (CityGmlZipEntry entry : entries) {
String entryName = stripArchivePath(entry.getFullFileName()); String entryName = stripArchivePath(entry.getEntrySubPath());
if (entryName.equals(fileName)) { if (entryName.equals(fileName)) {
return entry; return entry;
} }
......
...@@ -111,7 +111,12 @@ public class CityGmlZipEntry implements Serializable { ...@@ -111,7 +111,12 @@ public class CityGmlZipEntry implements Serializable {
return parentArchive; return parentArchive;
} }
public String getFullFileName() { /**
* Gets this entry's sub-path in the archive.
*
* @return Relative sub-path from the archive root directory.
*/
public String getEntrySubPath() {
return fileName; return fileName;
} }
......
...@@ -16,7 +16,7 @@ public class CityGmlZipEntryFile implements AutoCloseable { ...@@ -16,7 +16,7 @@ public class CityGmlZipEntryFile implements AutoCloseable {
public CityGmlZipEntryFile(CityGmlZipEntry entry) throws IOException { public CityGmlZipEntryFile(CityGmlZipEntry entry) throws IOException {
CityGmlZipArchive archive = entry.getArchive(); CityGmlZipArchive archive = entry.getArchive();
zip = new ZipFile(archive.getArchivePath().toFile()); zip = new ZipFile(archive.getArchivePath().toFile());
zipEntry = zip.getEntry(entry.getFullFileName()); zipEntry = zip.getEntry(entry.getEntrySubPath());
this.cgmlZipEntry = entry; this.cgmlZipEntry = entry;
} }
......
...@@ -32,7 +32,7 @@ public class ZipTest { ...@@ -32,7 +32,7 @@ public class ZipTest {
assertEquals(5, cgmlArch.getEntries().size()); assertEquals(5, cgmlArch.getEntries().size());
for (CityGmlZipEntry entry : cgmlArch.getEntries()) { for (CityGmlZipEntry entry : cgmlArch.getEntries()) {
assertNotNull(entry); assertNotNull(entry);
assertTrue(entry.getFullFileName().matches("^mock[1-5].gml$")); assertTrue(entry.getEntrySubPath().matches("^mock[1-5].gml$"));
assertNull(entry.getErrorType()); assertNull(entry.getErrorType());
assertNotNull(entry.getModel()); assertNotNull(entry.getModel());
assertEquals(1, entry.getModel().getNumberOfFeatures()); assertEquals(1, entry.getModel().getNumberOfFeatures());
......
...@@ -787,7 +787,7 @@ public class Checker { ...@@ -787,7 +787,7 @@ public class Checker {
try (BufferedOutputStream xmlBos = getXmlOutputMaybe(xmlOutput); try (BufferedOutputStream xmlBos = getXmlOutputMaybe(xmlOutput);
BufferedOutputStream pdfBos = getPdfOutputMaybe(pdfOutput)) { BufferedOutputStream pdfBos = getPdfOutputMaybe(pdfOutput)) {
Checker c = new Checker(config, null); Checker c = new Checker(config, null);
String fileName = entry.getFullFileName(); String fileName = entry.getEntrySubPath();
// create reporter if available // create reporter if available
XmlStreamReporter xmlReporter = getXmlReporter(config, xmlBos, fileName); XmlStreamReporter xmlReporter = getXmlReporter(config, xmlBos, fileName);
......
...@@ -1029,7 +1029,7 @@ public class CityDoctorController { ...@@ -1029,7 +1029,7 @@ public class CityDoctorController {
model = entry.getModel(); model = entry.getModel();
if (model.isValidated()) { if (model.isValidated()) {
Checker checker = previousCheckers.get(model); Checker checker = previousCheckers.get(model);
Files.createDirectories(tempOutput.resolve(entry.getFullFileName()).getParent()); Files.createDirectories(tempOutput.resolve(entry.getEntrySubPath()).getParent());
checker.writeXmlReport(tempOutput.resolve(entry.getDisplayName() + "_report.xml").toString()); checker.writeXmlReport(tempOutput.resolve(entry.getDisplayName() + "_report.xml").toString());
checker.writePdfReport(tempOutput.resolve(entry.getDisplayName() + "_report.pdf").toString()); checker.writePdfReport(tempOutput.resolve(entry.getDisplayName() + "_report.pdf").toString());
} }
......
...@@ -2,7 +2,6 @@ package de.hft.stuttgart.citydoctor2.gui; ...@@ -2,7 +2,6 @@ package de.hft.stuttgart.citydoctor2.gui;
import de.hft.stuttgart.citydoctor2.gui.tree.ZipEntryListCell; import de.hft.stuttgart.citydoctor2.gui.tree.ZipEntryListCell;
import de.hft.stuttgart.citydoctor2.gui.tree.ZipEntryNode; import de.hft.stuttgart.citydoctor2.gui.tree.ZipEntryNode;
import de.hft.stuttgart.citydoctor2.utils.ArchivePacker;
import de.hft.stuttgart.citydoctor2.utils.Localization; import de.hft.stuttgart.citydoctor2.utils.Localization;
import de.hft.stuttgart.citydoctor2.zip.CityGmlZipArchive; import de.hft.stuttgart.citydoctor2.zip.CityGmlZipArchive;
import de.hft.stuttgart.citydoctor2.zip.CityGmlZipEntry; import de.hft.stuttgart.citydoctor2.zip.CityGmlZipEntry;
...@@ -354,7 +353,7 @@ public class ZipEntryManager { ...@@ -354,7 +353,7 @@ public class ZipEntryManager {
} }
private void showMetadata(CityGmlZipEntry entry) { private void showMetadata(CityGmlZipEntry entry) {
subpathValueTxt.setText(entry.getFullFileName()); subpathValueTxt.setText(entry.getEntrySubPath());
if (entry.getFileSize() != -1L) { if (entry.getFileSize() != -1L) {
long fileSize = entry.getFileSize(); long fileSize = entry.getFileSize();
long kb = 1024L; long kb = 1024L;
......
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