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 {
}
public static LibraryObject of(CityGmlZipEntry entry, ParserConfiguration config) {
String fileName = entry.getFullFileName();
String fileName = entry.getEntrySubPath();
if (libraryObjects.containsKey(fileName)){
return libraryObjects.get(fileName);
}
......@@ -90,7 +90,7 @@ public class LibraryObject extends Geometry {
logger.error(e.getStackTrace());
} catch (CityGmlParseException e) {
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());
}
return geo;
......
......@@ -96,7 +96,7 @@ public class Citygml3FeatureMapper extends ObjectWalker {
this.config = config;
this.directory = null;
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());
}
......
......@@ -34,7 +34,7 @@ public class ArchivePacker {
continue;
}
CityDoctorModel model = entry.getModel();
Path filePath = tmpDir.resolve(entry.getFullFileName());
Path filePath = tmpDir.resolve(entry.getEntrySubPath());
Files.createDirectories(filePath.getParent());
model.saveAs(filePath.toString(), model.isValidated());
}
......
......@@ -90,7 +90,7 @@ public class CityGmlZipArchive implements Serializable {
public CityGmlZipEntry getEntry(String fileName) {
fileName = stripArchivePath(fileName);
for (CityGmlZipEntry entry : entries) {
String entryName = stripArchivePath(entry.getFullFileName());
String entryName = stripArchivePath(entry.getEntrySubPath());
if (entryName.equals(fileName)) {
return entry;
}
......
......@@ -111,7 +111,12 @@ public class CityGmlZipEntry implements Serializable {
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;
}
......
......@@ -16,7 +16,7 @@ public class CityGmlZipEntryFile implements AutoCloseable {
public CityGmlZipEntryFile(CityGmlZipEntry entry) throws IOException {
CityGmlZipArchive archive = entry.getArchive();
zip = new ZipFile(archive.getArchivePath().toFile());
zipEntry = zip.getEntry(entry.getFullFileName());
zipEntry = zip.getEntry(entry.getEntrySubPath());
this.cgmlZipEntry = entry;
}
......
......@@ -32,7 +32,7 @@ public class ZipTest {
assertEquals(5, cgmlArch.getEntries().size());
for (CityGmlZipEntry entry : cgmlArch.getEntries()) {
assertNotNull(entry);
assertTrue(entry.getFullFileName().matches("^mock[1-5].gml$"));
assertTrue(entry.getEntrySubPath().matches("^mock[1-5].gml$"));
assertNull(entry.getErrorType());
assertNotNull(entry.getModel());
assertEquals(1, entry.getModel().getNumberOfFeatures());
......
......@@ -787,7 +787,7 @@ public class Checker {
try (BufferedOutputStream xmlBos = getXmlOutputMaybe(xmlOutput);
BufferedOutputStream pdfBos = getPdfOutputMaybe(pdfOutput)) {
Checker c = new Checker(config, null);
String fileName = entry.getFullFileName();
String fileName = entry.getEntrySubPath();
// create reporter if available
XmlStreamReporter xmlReporter = getXmlReporter(config, xmlBos, fileName);
......
......@@ -1029,7 +1029,7 @@ public class CityDoctorController {
model = entry.getModel();
if (model.isValidated()) {
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.writePdfReport(tempOutput.resolve(entry.getDisplayName() + "_report.pdf").toString());
}
......
......@@ -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.ZipEntryNode;
import de.hft.stuttgart.citydoctor2.utils.ArchivePacker;
import de.hft.stuttgart.citydoctor2.utils.Localization;
import de.hft.stuttgart.citydoctor2.zip.CityGmlZipArchive;
import de.hft.stuttgart.citydoctor2.zip.CityGmlZipEntry;
......@@ -354,7 +353,7 @@ public class ZipEntryManager {
}
private void showMetadata(CityGmlZipEntry entry) {
subpathValueTxt.setText(entry.getFullFileName());
subpathValueTxt.setText(entry.getEntrySubPath());
if (entry.getFileSize() != -1L) {
long fileSize = entry.getFileSize();
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