Commit 5571f382 authored by Luna Riegel's avatar Luna Riegel
Browse files

Merge branch 'dev' into 'master'

CityDoctor Version 3.18.0

See merge request !37
parents 87dba3fa 61859d4f
Pipeline #12247 passed with stage
in 2 minutes and 31 seconds
package de.hft.stuttgart.citydoctor2.utils;
import de.hft.stuttgart.citydoctor2.datastructure.CityDoctorModel;
import de.hft.stuttgart.citydoctor2.zip.CityGmlZipArchive;
import de.hft.stuttgart.citydoctor2.zip.CityGmlZipEntry;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.io.IOUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.*;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
public class ArchivePacker {
private static final Logger logger = LogManager.getLogger(ArchivePacker.class);
private ArchivePacker(){}
public static void packArchive(String targetPath, CityGmlZipArchive archive){
Path outputPath = Path.of(targetPath);
outputPath = outputPath.getParent().resolve(
FilenameUtils.removeExtension(outputPath.getFileName().toString()) + ".zip");
Path tmpDir = null;
try{
tmpDir = Files.createTempDirectory("zipTmp");
tmpDir.toFile().deleteOnExit();
for (CityGmlZipEntry entry : archive.getEntries()) {
if (entry.getErrorType() != null || !entry.isLoaded()) {
continue;
}
CityDoctorModel model = entry.getModel();
Path filePath = tmpDir.resolve(entry.getEntrySubPath());
Files.createDirectories(filePath.getParent());
model.saveAs(filePath.toString(), model.isValidated());
}
zipFolder(tmpDir.toFile(), outputPath.toFile());
}catch (Exception e){
logger.error(e);
} finally {
if (tmpDir != null) {
try {
FileUtils.deleteDirectory(tmpDir.toFile());
} catch (IOException e) {
logger.error(e);
}
}
}
}
public static void zipFolder(File folder, File zipFile) throws IOException {
zipFolder(folder, new FileOutputStream(zipFile));
}
public static void zipFolder(File folder, OutputStream outputStream) throws IOException {
try (ZipOutputStream zipOutputStream = new ZipOutputStream(outputStream)) {
processFolder(folder, zipOutputStream, folder.getPath().length() + 1);
}
}
private static void processFolder(File folder, ZipOutputStream zipOutputStream, int prefixLength)
throws IOException {
for (File file : folder.listFiles()) {
if (file.isFile()) {
ZipEntry zipEntry = new ZipEntry(file.getPath().substring(prefixLength));
zipOutputStream.putNextEntry(zipEntry);
try (FileInputStream inputStream = new FileInputStream(file)) {
IOUtils.copy(inputStream, zipOutputStream);
}
zipOutputStream.closeEntry();
} else if (file.isDirectory()) {
processFolder(file, zipOutputStream, prefixLength);
}
}
}
public static void packAndDeleteDirectory(String directoryPath) throws IOException {
Path sourcePath = Path.of(directoryPath);
if (!Files.exists(sourcePath)) {
throw new IllegalStateException("Directory " + directoryPath + " does not exist");
}
if (!Files.isDirectory(sourcePath)) {
throw new IllegalStateException("Path " + directoryPath + " is not a directory");
}
Path outputPath = sourcePath.getParent().resolve(sourcePath.getFileName() + ".zip");
zipFolder(sourcePath.toFile(), outputPath.toFile());
FileUtils.deleteDirectory(sourcePath.toFile());
}
}
......@@ -26,12 +26,10 @@ import de.hft.stuttgart.citydoctor2.datastructure.CityDoctorModel;
import de.hft.stuttgart.citydoctor2.datastructure.CityObject;
import de.hft.stuttgart.citydoctor2.datastructure.Geometry;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
import de.hft.stuttgart.citydoctor2.datastructure.TopLevelTransportFeature;
import de.hft.stuttgart.citydoctor2.datastructure.TrafficSpaceObject;
import de.hft.stuttgart.citydoctor2.datastructure.TransportationObject;
import de.hft.stuttgart.citydoctor2.datastructure.TransportationSpace;
import de.hft.stuttgart.citydoctor2.datastructure.Vertex;
import de.hft.stuttgart.citydoctor2.math.Vector3d;
import de.hft.stuttgart.citydoctor2.utils.visitors.CityObjectCollector;
import de.hft.stuttgart.citydoctor2.utils.visitors.MinMaxExtentVisitor;
/**
* Utility class for calculating axis aligned bounding boxes for different
......@@ -99,24 +97,10 @@ public class BoundingBoxCalculator {
* @return the bounding box of the model
*/
public static BoundingBox calculateBoundingBox(CityDoctorModel model) {
Vector3d low = new Vector3d(Double.MAX_VALUE, Double.MAX_VALUE, Double.MAX_VALUE);
Vector3d high = new Vector3d(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY);
MinMaxExtentVisitor mima = new MinMaxExtentVisitor();
model.accept(mima);
//TODO: Rework this using visitors
findMinMax(low, high, model.getBuildings());
findMinMax(low, high, model.getBridges());
findMinMax(low, high, model.getLand());
findMinMaxTransport(low, high, model.getTransportation());
findMinMax(low, high, model.getWater());
findMinMax(low, high, model.getVegetation());
findMinMax(low, high, model.getTunnels());
findMinMax(low, high, model.getCityFurniture());
findMinMax(low, high, model.getGenericCityObjects());
Vector3d[] result = new Vector3d[2];
result[0] = low;
result[1] = high;
return BoundingBox.of(result);
return BoundingBox.of(mima.getMinMaxExtent());
}
public static BoundingBox calculateBoundingBoxFromPoints(List<? extends Vector3d> points) {
......@@ -159,47 +143,39 @@ public class BoundingBoxCalculator {
}
}
//TODO: Implement this properly with visitor. Quick and dirty fix for the renderer
private static void findMinMaxTransport(Vector3d low, Vector3d high, List<? extends TransportationObject> features) {
for (TransportationObject to : features) {
findMinMax(low, high, to);
if (to instanceof TransportationSpace ts) {
findMinMaxTransport(low, high, ts.getTrafficSpaces());
findMinMaxTransport(low, high, ts.getAuxTrafficSpaces());
if (to instanceof TopLevelTransportFeature top) {
findMinMaxTransport(low, high, top.getSections());
findMinMaxTransport(low, high, top.getIntersections());
private static void findMinMax(Vector3d low, Vector3d high, CityObject co) {
CityObjectCollector collector = new CityObjectCollector();
co.accept(collector);
for (CityObject object : collector.getCityObjects()) {
for (Geometry geom : object.getGeometries()) {
if (geom.getVertices() == null) {
geom.updateVertices();
}
} else if (to instanceof TrafficSpaceObject tso) {
findMinMaxTransport(low, high, tso.getTrafficAreas());
findMinMax(low, high, geom);
}
}
}
private static void findMinMax(Vector3d low, Vector3d high, CityObject co) {
for (Geometry geom : co.getGeometries()) {
if (geom.getVertices() == null) {
geom.updateVertices();
private static void findMinMax(Vector3d low, Vector3d high, Geometry geom) {
for (Vertex v : geom.getVertices()) {
if (v.getX() < low.getX()) {
low.setX(v.getX());
}
for (Vertex v : geom.getVertices()) {
if (v.getX() < low.getX()) {
low.setX(v.getX());
}
if (v.getX() > high.getX()) {
high.setX(v.getX());
}
if (v.getY() < low.getY()) {
low.setY(v.getY());
}
if (v.getY() > high.getY()) {
high.setY(v.getY());
}
if (v.getZ() < low.getZ()) {
low.setZ(v.getZ());
}
if (v.getZ() > high.getZ()) {
high.setZ(v.getZ());
}
if (v.getX() > high.getX()) {
high.setX(v.getX());
}
if (v.getY() < low.getY()) {
low.setY(v.getY());
}
if (v.getY() > high.getY()) {
high.setY(v.getY());
}
if (v.getZ() < low.getZ()) {
low.setZ(v.getZ());
}
if (v.getZ() > high.getZ()) {
high.setZ(v.getZ());
}
}
}
......
package de.hft.stuttgart.citydoctor2.utils;
import java.text.ChoiceFormat;
public final class TimeFormatter {
private TimeFormatter(){}
private static final String LESS_THAN_A_SECOND =
Localization.getText("TimeFormatter.lessThanASecond");
private static final ChoiceFormat SECONDS =
new ChoiceFormat(
new double[]{1, 2},
new String[]{Localization.getText("TimeFormatter.oneSecond"),
Localization.getText("TimeFormatter.seconds")}
);
private static final ChoiceFormat MINUTES =
new ChoiceFormat(
new double[]{1, 2},
new String[]{Localization.getText("TimeFormatter.oneMinute"),
Localization.getText("TimeFormatter.minutes")}
);
private static final ChoiceFormat HOURS =
new ChoiceFormat(
new double[] {1, 2},
new String[]{Localization.getText("TimeFormatter.oneHour"),
Localization.getText("TimeFormatter.hours")}
);
/**
* Formats a time measurement in milliseconds as a localized String representation.
*
* <p>
* The String representation will return the time as a rounded down integer of the biggest fitting TimeUnit
* (seconds, minutes or hours), returning "< 1 second" for times under a second.
* <p/>
* @param millis
* @return A localized String representation of the timespan
*/
public static String format(long millis) {
if (millis < 1000) {
return LESS_THAN_A_SECOND;
}else if (millis < 60_000) {
long seconds = millis / 1000;
String pattern = SECONDS.format(seconds);
return pattern.replace("{0}", Long.toString(seconds));
}else if (millis < 3_600_000){
long minutes = millis / 60_000;
String pattern = MINUTES.format(minutes);
return pattern.replace("{0}", Long.toString(minutes));
} else {
long hours = millis / 3_600_000;
String pattern = HOURS.format(hours);
return pattern.replace("{0}", Long.toString(hours));
}
}
}
\ No newline at end of file
package de.hft.stuttgart.citydoctor2.utils.visitors;
import de.hft.stuttgart.citydoctor2.check.Checkable;
import de.hft.stuttgart.citydoctor2.check.CheckableUtilsVisitor;
import de.hft.stuttgart.citydoctor2.datastructure.CityObject;
import de.hft.stuttgart.citydoctor2.datastructure.Geometry;
import de.hft.stuttgart.citydoctor2.datastructure.ImplicitGeometryHolder;
import de.hft.stuttgart.citydoctor2.datastructure.Vertex;
import de.hft.stuttgart.citydoctor2.math.Vector3d;
public class MinMaxExtentVisitor extends CheckableUtilsVisitor {
Vector3d low;
Vector3d high;
public MinMaxExtentVisitor() {
low = new Vector3d(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY);
high = new Vector3d(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY);
}
public Vector3d[] getMinMaxExtent() {
Vector3d[] result = new Vector3d[2];
result[0] = low;
result[1] = high;
return result;
}
@Override
public void check(CityObject co) {
for (Geometry geom : co.getGeometries()) {
if (geom.getVertices() == null) {
geom.updateVertices();
}
for (Vertex v : geom.getVertices()) {
if (v.getX() < low.getX()) {
low.setX(v.getX());
}
if (v.getX() > high.getX()) {
high.setX(v.getX());
}
if (v.getY() < low.getY()) {
low.setY(v.getY());
}
if (v.getY() > high.getY()) {
high.setY(v.getY());
}
if (v.getZ() < low.getZ()) {
low.setZ(v.getZ());
}
if (v.getZ() > high.getZ()) {
high.setZ(v.getZ());
}
}
}
}
}
......@@ -22,12 +22,12 @@ import java.io.File;
import java.time.ZonedDateTime;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Stream;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
......@@ -92,7 +92,7 @@ public class CityGMLWriterUtils {
storeCityObjects(model.getTransportation(), gmlFactory, model, cModel, val);
storeCityObjects(model.getWater(), gmlFactory, model, cModel, val);
storeCityObjects(model.getCityFurniture(), gmlFactory, model, cModel, val);
storeCityObjects(model.getGenericCityObjects(), gmlFactory, model, cModel, val);
storeCityObjects(model.getOtherCityObjects(), gmlFactory, model, cModel, val);
storeCityObjects(model.getTunnels(), gmlFactory, model, cModel, val);
writer.write(cModel);
......@@ -135,12 +135,13 @@ public class CityGMLWriterUtils {
de.hft.stuttgart.quality.model.enums.ErrorId adeId = QualityADEUtils.mapErrorIdToAdeId(e.getKey());
if (adeId == null) {
// error that is not part of the ade standard
logger.warn("Found error {} that cannot be converted to ADE error. It will not be written", e.getKey());
logger.warn(Localization.getText("CityGmlWriterUtils.unknownADEError"), e.getKey());
continue;
}
stats.setName(adeId);
statistics.getErrors().add(new ErrorProperty(stats));
}
// TODO: Quality ADE update to CityGML 3.0
statistics.setNumErrorBuildings(new FeatureStatisticsProperty(countValidatedCityObjects(model.getBuildings())));
statistics.setNumErrorBridgeObjects(new FeatureStatisticsProperty(countValidatedCityObjects(model.getBridges())));
statistics.setNumErrorLandObjects(new FeatureStatisticsProperty(countValidatedCityObjects(model.getLand())));
......@@ -152,29 +153,30 @@ public class CityGMLWriterUtils {
return val;
}
private static FeatureStatistics countValidatedCityObjects(List<? extends CityObject> cos) {
int numChecked = 0;
int numError = 0;
for (CityObject co : cos) {
private static FeatureStatistics countValidatedCityObjects(Stream<? extends CityObject> cos) {
AtomicInteger numChecked = new AtomicInteger();
AtomicInteger numError = new AtomicInteger();
cos.forEach(co -> {
if (co.isValidated()) {
numChecked++;
numChecked.getAndIncrement();
if (co.containsAnyError()) {
numError++;
numError.getAndIncrement();
}
}
}
return new FeatureStatistics(numChecked, numError);
});
return new FeatureStatistics(numChecked.get(), numError.get());
}
private static void storeCityObjects(List<? extends CityObject> cos, GeometryFactory gmlFactory, CityDoctorModel model, CityModel cModel, Validation val) {
for (CityObject co : cos) {
private static void storeCityObjects(Stream<? extends CityObject> cos, GeometryFactory gmlFactory, CityDoctorModel model, CityModel cModel, Validation val) {
cos.forEach(co -> {
if (model.isValidated() && val != null) {
QualityADEUtils.writeQualityAde(co, val);
}
co.reCreateGeometries(gmlFactory, model.getParserConfig());
cModel.getCityObjectMembers().add(new AbstractCityObjectProperty(co.getGmlObject()));
}
});
}
}
package de.hft.stuttgart.citydoctor2.zip;
import de.hft.stuttgart.citydoctor2.parser.ParserConfiguration;
import de.hft.stuttgart.citydoctor2.utils.ArchivePacker;
import de.hft.stuttgart.citydoctor2.utils.Localization;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.Serial;
import java.io.Serializable;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import java.util.zip.ZipInputStream;
/**
* This class serves as a representation of a ZIP-archive containing CityGml files. The contained files are represented
* by {@link CityGmlZipEntry} objects.
*/
public class CityGmlZipArchive implements Serializable {
private static final Logger logger = LogManager.getLogger(CityGmlZipArchive.class);
@Serial
private static final long serialVersionUID = 2168389511043362615L;
private List<CityGmlZipEntry> entries;
private final Path archivePath;
private final String archiveNameRE;
/**
* Registers a ZIP-file as an archive. All contained XML and GML files will be registered as {@link CityGmlZipEntry} objects.
*
* @param zipFile path of the ZIP-file
* @return A {@link CityGmlZipArchive} object representing the archive, or null if read-access for the ZIP-file was denied
* @throws MalformedZipFileException if the ZIP-file has encoding errors
*/
public static CityGmlZipArchive register(String zipFile) throws MalformedZipFileException {
ArrayList<CityGmlZipEntry> archiveEntries = new ArrayList<>();
CityGmlZipArchive cgmlArchive = new CityGmlZipArchive(Path.of(zipFile));
try (ZipInputStream zis = new ZipInputStream(new FileInputStream(zipFile))) {
ZipEntry ze;
while ((ze = zis.getNextEntry()) != null) {
if (ze.isDirectory()) {
continue;
}
if (ze.getName().endsWith(".gml") || ze.getName().endsWith(".xml")) {
// Ignore report files generated by CityDoctor
if (ze.getName().endsWith("_report.xml")) {
continue;
}
archiveEntries.add(CityGmlZipEntry.register(ze, cgmlArchive));
}
}
cgmlArchive.setEntries(archiveEntries);
return cgmlArchive;
} catch (IOException e) {
logger.error(Localization.getText("CityGmlZipArchive.ioError"));
logger.debug(e.getMessage(), e);
return null;
} catch (IllegalArgumentException e) {
logger.error(Localization.getText("CityGmlZipArchive.malformedZipFile"));
throw new MalformedZipFileException(Localization.getText("CityGmlZipArchive.malformedZipFile"));
} catch (Exception e) {
logger.error(Localization.getText("CityGmlZipArchive.generalException"));
logger.debug(e.getMessage(), e);
throw (e);
}
}
/**
* Attempts to load all contained {@link CityGmlZipEntry} objects into memory.
*
* @param config Parser configuration for the entries
*/
public void mountArchive(ParserConfiguration config) {
try (ZipFile zip = new ZipFile(archivePath.toFile())) {
for (CityGmlZipEntry entry : entries) {
entry.loadEntry(config);
}
} catch (IOException e) {
logger.error(e);
}
}
private CityGmlZipArchive(Path archivePath) {
this.archivePath = archivePath;
this.archiveNameRE = archivePath.getFileName().toString().replace(".zip", "") + File.separator;
}
private void setEntries(List<CityGmlZipEntry> entries) {
this.entries = entries;
}
/**
* Saves this archive as a ZIP-file.
* @param path target path for the export
*/
public void exportToZipFile(String path) {
ArchivePacker.packArchive(path, this);
}
/**
* Gets an entry in this archive by its subpath.
*
* @param subpath subpath to the entry from this archive's root directory
* @return the corresponding entry, or null if entry could not be found
*/
public CityGmlZipEntry getEntry(String subpath) {
subpath = stripArchivePath(subpath);
for (CityGmlZipEntry entry : entries) {
String entryName = stripArchivePath(entry.getEntrySubPath());
if (entryName.equals(subpath)) {
return entry;
}
}
return null;
}
/**
* Strips the root directory name of this archive from an entry subpath.
* @param path the relative path to the entry
* @return String of the path without the root directory
*/
private String stripArchivePath(String path) {
Path systemPath = Path.of(path);
return systemPath.toString().replace(archiveNameRE, "");
}
/**
* Gets the path to the ZIP-file associated with this archive.
* @return path of the ZIP-file
*/
public Path getArchivePath() {
return archivePath;
}
/**
* Gets the entry list of this archive.
* @return the entry list
*/
public List<CityGmlZipEntry> getEntries() {
return entries;
}
}
package de.hft.stuttgart.citydoctor2.zip;
import de.hft.stuttgart.citydoctor2.datastructure.CityDoctorModel;
import de.hft.stuttgart.citydoctor2.parser.CityGmlParseException;
import de.hft.stuttgart.citydoctor2.parser.CityGmlParser;
import de.hft.stuttgart.citydoctor2.parser.InvalidGmlFileException;
import de.hft.stuttgart.citydoctor2.parser.ParserConfiguration;
import de.hft.stuttgart.citydoctor2.parser.ProgressListener;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.IOException;
import java.io.Serial;
import java.io.Serializable;
import java.nio.file.Path;
import java.util.zip.ZipEntry;
/**
* This class serves as a representation of a CityGml file in a ZIP archive.
* <p/>
* The {@link CityDoctorModel} of the associated file can only be accessed after loading the corresponding entry.
*/
public class CityGmlZipEntry implements Serializable {
private static final Logger logger = LogManager.getLogger(CityGmlZipEntry.class);
@Serial
private static final long serialVersionUID = -5732913269959043262L;
private final Path filePath;
private final String fileName;
private final String displayName;
private transient CityDoctorModel model;
private CityGmlZipArchive parentArchive;
private boolean inMemory;
private long fileSize = -1L;
private static final long MB = 1024 * 1024L;
private ZipEntryErrorType errorType = null;
/**
* Attempts to parse the CityGML model associated with this entry and loads it into memory.
* <p/>
* In the event of a parsing error, the entry will be flagged by assigning the appropriate
* {@link ZipEntryErrorType} to the errorType field.
*
* @param config Parser configuration for this model
*/
public void loadEntry(ParserConfiguration config) {
loadEntry(config, null);
}
/**
* Attempts to parse the CityGML model associated with this entry and loads it into memory.
* <p/>
* In the event of a parsing error, the entry will be flagged by assigning the appropriate
* {@link ZipEntryErrorType} to the errorType field.
*
* @param config Parser configuration for this model
* @param l ProgressListener for tracking parsing progress
*/
public void loadEntry(ParserConfiguration config, ProgressListener l) {
if (inMemory) {
return;
}
if (errorType != null) {
logger.warn("Tried loading erroneous CityGmlZipEntry");
return;
}
try {
this.model = CityGmlParser.parseCityGmlZipEntry(this, config, l);
this.inMemory = true;
} catch (CityGmlParseException | InvalidGmlFileException e) {
logger.error(e);
this.errorType = ZipEntryErrorType.INVALID_CITY_GML_FILE;
} catch (IOException e) {
logger.error(e);
this.errorType = ZipEntryErrorType.IO_ERROR;
}
}
/**
* Registers a {@link ZipEntry ZipEntry} in a ZIP-archive as a {@link CityGmlZipEntry}.
* <p/>
* If the filesize of the associated file exceeds the total available system memory, or read access is denied,
* the entry will be flagged by assigning the appropriate {@link ZipEntryErrorType} to the errorType field.
*
* @param entry The ZipEntry object
* @param parentArchive The parent archive for this entry
* @return A corresponding CityGmlZipEntry object
*/
public static CityGmlZipEntry register(ZipEntry entry, CityGmlZipArchive parentArchive) {
CityGmlZipEntry cgzEntry = new CityGmlZipEntry(entry, parentArchive, false);
try {
if (!cgzEntry.entrySizeWithinMemoryLimits()) {
cgzEntry.errorType = ZipEntryErrorType.EXCESSIVE_FILESIZE;
}
} catch (IOException e) {
logger.error(e);
cgzEntry.errorType = ZipEntryErrorType.IO_ERROR;
}
return cgzEntry;
}
/**
* Checks if the filesize of this entry would exceed the system's available memory.
*
* @return true if within limits, false otherwise
* @throws IOException if read access to the ZIP-archive is denied
*/
private boolean entrySizeWithinMemoryLimits() throws IOException {
long memoryLimit = (long) Math.ceil(((double) Runtime.getRuntime().maxMemory() / MB) * 0.9);
if (fileSize == -1L) {
try (CityGmlZipEntryFile entryFile = new CityGmlZipEntryFile(this)) {
long filesize = entryFile.getFileSize();
if (filesize != -1) {
this.fileSize = filesize;
} else {
return false;
}
} catch (Exception e) {
throw new IOException(e);
}
}
return memoryLimit > (fileSize / MB);
}
private CityGmlZipEntry(ZipEntry entry, CityGmlZipArchive parentArchive, boolean inMemory) {
this.fileName = entry.getName();
this.filePath = Path.of(entry.getName());
this.displayName = filePath.getFileName().toString();
if (entry.getSize() != -1) {
this.fileSize = entry.getSize();
}
this.model = null;
this.inMemory = inMemory;
this.parentArchive = parentArchive;
}
/**
* Gets the parent archive of this entry.
* @return the archive
*/
public CityGmlZipArchive getArchive() {
return parentArchive;
}
/**
* Gets the sub-path in the archive of the file associated with this entry.
*
* @return the relative sub-path from the archive root directory
*/
public String getEntrySubPath() {
return fileName;
}
/**
* Gets the name of the file associated with this entry.
* @return the filename
*/
public String getDisplayName() {
return displayName;
}
/**
* Gets the {@link ZipEntryErrorType} of this entry.
* @return the error type, or null if this entry is not erroneous
*/
public ZipEntryErrorType getErrorType() {
return errorType;
}
/**
* Gets the {@link CityDoctorModel} of this entry.
* @return The model, or null if the entry has not been loaded or is erroneous
*/
public CityDoctorModel getModel() {
return model;
}
public void setFileSize(long size) {
fileSize = size;
}
/**
* Resolves the reference path of a {@link de.hft.stuttgart.citydoctor2.datastructure.LibraryObject LibraryObject}
* in the {@link CityDoctorModel} of this entry.
* @param libraryObjectPath The reference path to the LibraryObject's CityGml file
* @return Relative sub-path within the archive to the CityGml file
*/
public Path resolveLibraryObjectPath(String libraryObjectPath) {
return filePath.getParent().resolve(libraryObjectPath);
}
/**
* Checks if the {@link CityDoctorModel} of this entry has been loaded into memory.
*
* @return true if it is loaded, false otherwise
*/
public boolean isLoaded() {
return inMemory;
}
/**
* Returns the estimated uncompressed filesize of this entry.
*
* @return filesize in bytes, -1L if filesize is unknown
*/
public long getFileSize() {
return fileSize;
}
}
package de.hft.stuttgart.citydoctor2.zip;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
/**
* This class serves as a resource for read-access to the file that is being represented by
* a CityGmlZipEntry object.
* <p/>
* Does not decompress the file or the parent ZIP-archive.
*/
public class CityGmlZipEntryFile implements AutoCloseable {
private final ZipFile zip;
private final ZipEntry zipEntry;
private final CityGmlZipEntry cgmlZipEntry;
private boolean closed = false;
/**
* Creates a {@link CityGmlZipEntryFile} for a {@link CityGmlZipEntry} object's referenced file.
*
* @param entry the requested entry
* @throws IOException if read access to the ZIP-archive is denied.
*/
public CityGmlZipEntryFile(CityGmlZipEntry entry) throws IOException {
CityGmlZipArchive archive = entry.getArchive();
zip = new ZipFile(archive.getArchivePath().toFile());
zipEntry = zip.getEntry(entry.getEntrySubPath());
this.cgmlZipEntry = entry;
}
/**
* Gets a new InputStream of this file.
* <p/>
* Returned streams are independent of each other, but will all be closed when the {@link CityGmlZipEntryFile} object
* is closed.
* @return an InputStream of this file.
* @throws IOException when this method is called after the file has been closed.
*/
public InputStream getInputStream() throws IOException {
if (closed){
throw new IOException("CityGmlZipEntryFile closed");
}
return zip.getInputStream(zipEntry);
}
/**
* Gets an estimation of this file's filesize.
* @return filesize in bytes, -1L if unknown
* @throws IOException when this method is called after the file has been closed.
*/
public long getFileSize() throws IOException {
if (closed){
throw new IOException("CityGmlZipEntryFile closed");
}
if (cgmlZipEntry.getFileSize() == -1L) {
if (zipEntry.getSize() == -1) {
long bytes = 0;
InputStream is = new BufferedInputStream(this.getInputStream());
for (int i = is.read(); i != -1; i = is.read()) {
bytes++;
}
cgmlZipEntry.setFileSize(bytes);
} else {
cgmlZipEntry.setFileSize(zipEntry.getSize());
}
}
return cgmlZipEntry.getFileSize();
}
@Override
public void close() throws IOException {
zip.close();
closed = true;
}
}
package de.hft.stuttgart.citydoctor2.zip;
import java.util.zip.ZipException;
/**
* Signals that a ZIP-file is corrupted and couldn't be parsed.
*/
public class MalformedZipFileException extends ZipException {
public MalformedZipFileException() {
super();
}
public MalformedZipFileException(String message) {
super(message);
}
}
package de.hft.stuttgart.citydoctor2.zip;
/**
* Error types for {@link CityGmlZipEntry} objects.
*/
public enum ZipEntryErrorType {
INVALID_CITY_GML_FILE, EXCESSIVE_FILESIZE, IO_ERROR
}
package de.hft.stuttgart.citydoctor2.zip;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class ZipParser {
private static final Logger logger = LogManager.getLogger(ZipParser.class);
}
CityDoctorValidation.Version=${versionString}
DistanceError.distanceFromPlane=distance from plane
AboutDialog.developedBy=Developed by
AboutDialog.closeBtn=Close
AboutDialog.contact=Contact
AboutDialog.developedBy=Developed by
AboutDialog.title=CityDoctor 3 - About
AboutDialog.closeBtn=Close
CheckDialog.title=Check Configuration
CheckDialog.schematronFiles=Schematron Files
CheckDialog.schematronChooserTitle=Choose schematron file..
CheckDialog.validationConfiguration=Validation Configuration
CheckDialog.startingChecks=Starting checks
CheckDialog.checksDone=Checks done
CheckDialog.failedChecks=Failed to execute checks
CheckDialog.schematronFileNotExisting=Schematron file does not exist, ignoring
CheckContainer.error=Unexpected exception while executing check: {}
CheckDialog.availableChecksLabel=Available Checks
CheckDialog.cancelBtn=Cancel
CheckDialog.checkBtn=Check
CheckDialog.checkEnabled=Enabled
CheckDialog.checkName=Name
CheckDialog.parameterValue=Value
CheckDialog.checksDone=Checks done
CheckDialog.checksReenabledAlert=Some checks have been reenabled so that other wanted checks can be executed\nSee the log for more information.
CheckDialog.checksTab=Checks
CheckDialog.failedChecks=Failed to execute checks
CheckDialog.filterTab=Filter
CheckDialog.geometricChecksLabel=Geometric Checks
CheckDialog.globalParametersLabel=Global Parameters
CheckDialog.noPathError=Output path is missing!
CheckDialog.outputPathBtn=Select
CheckDialog.outputPathLabel=Output directory (Required):
CheckDialog.parameterUnit=Unit
CheckDialog.parameterValue=Value
CheckDialog.pdfReportsOption=Create PDF reports
CheckDialog.schematronChooserTitle=Choose schematron file ...
CheckDialog.schematronFileLabel=Schematron File:
CheckDialog.schematronFileNotExisting=Schematron file does not exist, Schematron will be skipped
CheckDialog.schematronFiles=Schematron Files
CheckDialog.selectBtn=Select
CheckDialog.semanticChecksLabel=Semantic Checks
CheckDialog.startingChecks=Starting checks
CheckDialog.streamCheckLabel=Citymodels are not loaded and kept in memory. Check results are saved to the QualityADE in copies of the input files.
CheckDialog.streamCheckOption=Use low memory mode
CheckDialog.title=Check Configuration
CheckDialog.validationConfiguration=Validation Configuration
CheckDialog.xmlReportsOption=Create XML reports
Checker.checkFeature=Checking feature: {}
Checker.checksFinished=Finished executing checks. Total time: {0}
Checker.dbStillUnresponsive=Checker still unable to load some CityObjects from database!
Checker.dbUnresponsive=Checker could not load some CityObjects from database!
Checker.executeCheck=Executing check: {}
Checker.failPdf=Failed to write PDF Report.
Checker.failReports=Failed to write reports.
Checker.failXml=Failed to write XML Error Report.
Checker.finishedSchematron=Finished Schematron validation
Checker.futuresCheckFailures=Encountered check failures due to the following errors:
Checker.noCheckSatisfiesRequirement=Could not find any check that satisfies requirement {}, it will not be checked
Checker.schematronCompleted=Schematron completed
Checker.schematronFileNotFound=Schematron file {} could not be found
Checker.schematronInterrupted=Main Thread was interrupted while waiting for Schematron
Checker.schematronStillRunning=Schematron is still running. Waiting for completion, this may take some time
Checker.schematronValidation=Schematron-validation thread started
Checker.shutdownInterrupted=Main Thread got interrupted during ThreadPool shutdown
Checker.validationInterrupted=Validation aborted: Checker got interrupted
Checker.waitAndRetry=Waiting a second before retrying...
Checks.missingCheck=Could not find check for id: {}
CityDoctorController.exportSuccess=Successfully exported feature
CityDoctorController.noDatamodel=Datamodel is null, no checks could be done
CityDoctorController.noSourceFile=Source file is null, no checks could be done
CityDoctorController.noZipFile=ZIP archive is null, no checks could be done
CityDoctorController.exportSuccess=Successfully exported feature
CityDoctorController.saveZipArchiveReports=Successfully exported validation reports!
CityDoctorValidation.Version=${versionString}
CityDoctorValidation.inputFileNotExisting= Input file '{}' does not exist.
CityDoctorValidation.loadingDefaultConfig=No configuration file given, loading default configuration
CityDoctorValidation.noConfig=No configuration file specified with -config [FILE]
CityDoctorValidation.noInputFile=No input file specified. (-in [FILE])
CityDoctorValidation.noOutputFile=No output file specified. (-out [FILE])
CityDoctorValidation.notExactlyOneConfigFile=Specify exactly one file as configuration
CityDoctorValidation.notExactlyOneInputFile=Specify exactly one file as input.
CityDoctorValidation.notExactlyOneOutputFile=Specify exactly one file as output.
CityDoctorValidation.notExactlyOnePDFOutput=Specify exactly one file as pdfReport
CityDoctorValidation.notExactlyOneXMLOutput=Specify exactly one file as xmlReport
CityDoctorValidation.wrongInputFileFormat=Input file '{}' does not end with .gml or .xml
CityGmlParser.chunkReadFailed=Failed to read GML file in chunks, falling back to reading the complete file
CityGmlParser.convertCrsToUtmZoneN=Converting coordinate system to UTM zone {}N
CityGmlParser.convertCrsToUtmZoneS=Converting coordinate system to UTM zone {}S
CityGmlParser.creating4jContextFailed=Unable to create citygml4j context
CityGmlParser.creatingAdePluginsFailed=Unable to add ADE plugins to citygml4j
CityGmlParser.errorReadingGmlFile=Error while reading city gml file\n{}
CityGmlParser.errorWritingGmlFile=Error while writing city gml file\n{}
CityGmlParser.failedEPSGParse=Could not read EPSG code, fallback to metric system
CityGmlParser.missingCityModel=File does not contain a CityModel definition! Temporary CityModel will be created.
CityGmlParser.missingEPSGCode=No EPSG code found, assuming metric system
CityGmlParser.noConversionNeeded=Coordinate system is in meters, no conversion done
CityGmlParser.notValidGmlFile=This is not a valid GML-File\n
CityGmlParser.parsedObjects=Parsed model with {} objects
CityGmlWriterUtils.unknownADEError= Found error {} that cannot be converted to ADE error. It will not be written
CityGmlZipArchive.generalException=Encountered an unexpected error while reading the ZIP archive
CityGmlZipArchive.ioError=Accessing the ZIP archive failed
CityGmlZipArchive.malformedZipFile=Parsing of ZIP archive aborted, ZIP file is malformed!
DatabaseHandler.batchCommitFailure=Batch-commit aborted: Critical failure while trying to write CityObject {} to database!
DatabaseHandler.connectionFailure=Connection to embedded database could not be opened!
DatabaseHandler.fetchErrorIdsFailure=Fetching list of GmlIDs of CityObjects with errors failed!
DatabaseHandler.getAllCityObjectsFailure=Fetching of all CityObjects failed!
DatabaseHandler.getBBoxIntersectFailure= Connection to database failed while trying to fetch bbox intersecting objects of CityObject {}
DatabaseHandler.getBufferIntersectFailure=Connection to database failed while trying to fetch buffer intersecting objects of CityObject {}
DatabaseHandler.getFeatureCountFailure=Connection to database failed while trying to get count of CityObjects!
DatabaseHandler.marshallingFailure=Writing CityObject {} to database failed!
DatabaseHandler.serializationFailure=Serialization of CityObject {} failed!
DatabaseHandler.setupFailure=FATAL ERROR: Creation of embedded database failed!
DatabaseHandler.tableFailure=FATAL ERROR: Creation of features table failed!
DatabaseHandler.unmarshallingFailure=Loading of CityObject {} from embedded database failed!
DistanceError.distanceFromPlane=distance from plane
ErrorItemVisitor.childId=Child id
ErrorItemVisitor.component=Component
ErrorItemVisitor.degeneratedRing=Degenerated ring
ErrorItemVisitor.deviation=Deviation
ErrorItemVisitor.distance=Distance
ErrorItemVisitor.intersection=Intersection
ErrorItemVisitor.nameOfAttribute=Name of attribute
ErrorItemVisitor.pointTouchesEdge=Point touches edge
ErrorItemVisitor.triangles=Triangles
ExceptionDialog.stacktrace=The exception stacktrace was:
FilterPane.buildings=Buildings
FeatureMapper.polygonUnreferenced=Polygon {} is referenced but not found in feature polygons
FilterPane.bridges=Bridges
FilterPane.buildings=Buildings
FilterPane.landUse=Land Use
FilterPane.transportation=Transportation
FilterPane.vegetation=Vegetation
FilterPane.water=Water
MainToolBar.wireframe=Show/Hide Wireframe
GeometryMapper.emptyPolygon=Found polygon without exterior ring, ignoring
LibraryObject.fileMissing=Implicit geometry references non-existing library object file {}
LibraryObject.parsingError=Encountered an error while parsing library object {}
MainToolBar.culling=Enable/Disable Culling
MainToolBar.writeReports=Write Reports
MainToolBar.executeChecks=Execute Checks
MainToolBar.showWorld=Show entire city model
MainToolBar.resetCamera=Reset view
MainToolBar.hideRoof=Show/Hide roof BoundarySurfaces
MainToolBar.resetCamera=Reset view
MainToolBar.showWorld=Show entire city model
MainToolBar.wireframe=Show/Hide Wireframe
MainToolBar.writeReports=Write Reports
MainToolBar.zip=Open zip-entry selection window
MainWindow.missingConfig=Could not find configuration file.
MainWindow.loadGivenFile=Loading given file, please wait
MainWindow.finishedLoading=Finished loading
MainWindow.checking=Checking, please wait
MainWindow.writeXml=Writing xml report
MainWindow.finishedXml=Finished xml report
MainWindow.writePdf=Writing pdf report
MainWindow.finishedPdf=Finished pdf report
MainWindow.loadFailed=Failed to load given gml file: {}
MainWindow.all=All
MainWindow.withErrors=With errors
MainWindow.export=Export feature
MainWindow.attributeTab=Attributes
MainWindow.availableLabel=Available:
MainWindow.bridgeTab=Bridges
MainWindow.buildingsTab=Buildings
MainWindow.checking=Checking, please wait
MainWindow.cityfurnitureTab=CityFurniture
MainWindow.clearBtn=Clear
MainWindow.copyId=Copy GML-ID
MainWindow.delete=Delete feature
MainWindow.infoTopLevelExport=Only top-level object can be exported!
MainWindow.edgesTab=Edges
MainWindow.errorsTab=Errors
MainWindow.export=Export feature
MainWindow.finishedLoading=Finished loading
MainWindow.finishedPdf=Finished pdf report
MainWindow.finishedXml=Finished xml report
MainWindow.focusCityObject=Focus object
MainWindow.globalErrorsTab=Global Errors
MainWindow.infoTopLevelCopyID=GML-ID can only be copied from top-level object!
mainWindow.warnCopyIdFailed=Could not copy GML-ID!
OpenFileDialog.select=Select CityGML file
MainWindow.infoTopLevelExport=Only top-level object can be exported!
MainWindow.languageChange=For the change in language to apply, restart CityDoctor2.
MainWindow.buildingsTab=Buildings
MainWindow.vegetationTab=Vegetation
MainWindow.transportationTab=Transportation
MainWindow.tunnelTab=Tunnels
MainWindow.bridgeTab=Bridges
MainWindow.waterTab=Water
MainWindow.terrainTab=Terrain
MainWindow.cityfurnitureTab=CityFurniture
MainWindow.loadFailed=Failed to load given gml file: {}
MainWindow.loadGivenFile=Loading given file, please wait
MainWindow.logTab=Log
MainWindow.memoryLabel=Memory:
MainWindow.missingConfig=Could not find configuration file.
MainWindow.otherObjectsTab=Other
MainWindow.viewLabel=View
MainWindow.showLabel=Show:
MainWindow.searchLabel=Search:
MainWindow.searchBtn=Search
MainWindow.clearBtn=Clear
MainWindow.errorsTab=Errors
MainWindow.polygonsTab=Polygons
MainWindow.edgesTab=Edges
MainWindow.searchBtn=Search
MainWindow.searchLabel=Search:
MainWindow.showLabel=Show:
MainWindow.terrainTab=Terrain
MainWindow.transportationTab=Transportation
MainWindow.tunnelTab=Tunnels
MainWindow.vegetationTab=Vegetation
MainWindow.verticesTab=Vertices
MainWindow.attributeTab=Attributes
MainWindow.logTab=Log
MainWindow.globalErrorsTab=Global Errors
MainWindow.focusCityObject=Focus object
MainWindow.viewLabel=View
MainWindow.warnCopyIdFailed=Could not copy GML-ID!
MainWindow.waterTab=Water
MainWindow.withErrors=With errors
MainWindow.writePdf=Writing pdf report
MainWindow.writeXml=Writing xml report
OpenFileDialog.cancelBtn=Cancel
OpenFileDialog.fileLabel=File:
OpenFileDialog.selectBtn=Select
OpenFileDialog.loadBtn=Load
OpenFileDialog.settingsPane=Parser Preferences
OpenFileDialog.loadFailed=Failed to load CityGML File
OpenFileDialog.lowMemoryLabel=Low Memory Consumption Mode
OpenFileDialog.roundingPlacesLabel=NumberOfRoundingPlaces
OpenFileDialog.select=Select CityGML file
OpenFileDialog.selectBtn=Select
OpenFileDialog.settingsPane=Parser Preferences
OpenFileDialog.xmlValidationLabel=Use XML Validation
Checker.failXml=Failed to write XML Error Report.
Checker.failPdf=Failed to write PDF Report.
Checker.checksFinished=Finished executing checks
Checker.schematronValidation=Starting Schematron validation
Checker.finishedSchematron=Finished Schematron validation
Checker.failReports=Failed to write reports.
Checker.checkFeature=Checking feature: {}
Checker.executeCheck=Executing check: {}
ValidationConfiguration.reenable={} has been disabled but {} depends on it, reenabling
TimeFormatter.hours={0} hours
TimeFormatter.lessThanASecond=< 1 second
TimeFormatter.minutes={0} minutes
TimeFormatter.oneHour=1 hour
TimeFormatter.oneMinute=1 minute
TimeFormatter.oneSecond=1 second
TimeFormatter.seconds={0} seconds
Unit.Degree=Degree
Unit.Radian=Radian
ValidationConfiguration.missingSchematron={} is not an existing file, disabling schematron check
CheckContainer.error=Unexpected exception while executing check: {}
Checks.missingCheck=Could not find check for id: {}
OpenFileDialog.cancelBtn=Cancel
CheckDialog.checksTab=Checks
CheckDialog.filterTab=Filter
CheckDialog.globalParametersLabel=Global Parameters
CheckDialog.availableChecksLabel=Available Checks
CheckDialog.geometricChecksLabel=Geometric Checks
CheckDialog.semanticChecksLabel=Semantic Checks
CheckDialog.schematronFileLabel=Schematron File:
CheckDialog.selectBtn=Select
CheckDialog.checkBtn=Check
CheckDialog.cancelBtn=Cancel
CheckDialog.streamCheckOption=Use low memory mode
CheckDialog.streamCheckLabel=Citymodels are not loaded and kept in memory. Check results are saved to the QualityADE in copies of the input files.
CheckDialog.outputPathLabel=Output directory (Required):
CheckDialog.outputPathBtn=Select
CheckDialog.pdfReportsOption=Create PDF reports
CheckDialog.xmlReportsOption=Create XML reports
CheckDialog.noPathError=Output path is missing!
ZipEntryManager.title=Zip-entry manager
ZipEntryManager.entryListTitle=Zip-entries
ZipEntryManager.metadata=Metadata
ZipEntryManager.subpathLbl=Subpath:
ZipEntryManager.erroneousLbl=Erroneous:
ZipEntryManager.excessiveFileSize=Filesize exceeds memory
ZipEntryManager.invalidCityGml=Invalid CityGML file
ZipEntryManager.ioError=Unable to access file
ZipEntryManager.filesizeLbl=Filesize:
ZipEntryManager.validatedLbl=Validated:
ZipEntryManager.objectCountLbl=Object count:
ZipEntryManager.loadBtn=Load CityGML model
ZipEntryManager.decompressBtn=Unpack file
ZipEntryManager.decompressAllBtn=Unpack all files
ZipEntryManager.checkAllBtn=Check all files
ZipEntryManager.showReportBtn=Show error statistic
ZipEntryManager.saveBtn=Export validation results
ZipEntryManager.cancelBtn=Cancel
ZipEntryManager.unknownValue=N/A
ZipEntryManager.yes=Yes
ZipEntryManager.no=No
CityGmlZipArchive.ioError=Accessing the ZIP archive failed
CityGmlZipArchive.malformedZipFile=Parsing of ZIP archive aborted, ZIP file is malformed!
CityGmlZipArchive.generalException=Encountered an unexpected error while reading the ZIP archive
WriteReportDialog.writeBtn=Save
ValidationConfiguration.reenable={} has been disabled but {} depends on it, reenabling
WriteReportDialog.cancelBtn=Cancel
WriteReportDialog.errorStatisticsLabel=Error Statistics
WriteReportDialog.saveImageBtn=Save Image...
WriteReportDialog.selectPdfBtn=Select
WriteReportDialog.selectXmlFile=Select
WriteReportDialog.writeBtn=Save
WriteReportDialog.xAxisLabel=Error
WriteReportDialog.yAxisLabel=Count
Unit.Radian=Radian
Unit.Degree=Degree
FeatureMapper.polygonUnreferenced=Polygon {} is referenced but not found in feature polygons
GeometryMapper.emptyPolygon=Found polygon without exterior ring, ignoring
CityGmlParser.parsedObjects=Parsed model with {} objects
CityGmlParser.chunkReadFailed=Failed to read GML file in chunks, falling back to reading the complete file
CityGmlParser.notValidGmlFile=This is not a valid GML-File\n
CityGmlParser.errorReadingGmlFile=Error while reading city gml file\n{}
CityGmlParser.errorWritingGmlFile=Error while writing city gml file\n{}
CityGmlParser.noConversionNeeded=Coordinate system is in meters, no conversion done
CityGmlParser.failedEPSGParse=Could not read EPSG code, fallback to metric system
CityGmlParser.missingEPSGCode=No EPSG code found, 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:
OpenFileDialog.lowMemoryLabel=Low Memory Consumption Mode
ErrorItemVisitor.intersection=Intersection
ErrorItemVisitor.component=Component
ErrorItemVisitor.nameOfAttribute=Name of attribute
ErrorItemVisitor.childId=Child id
ErrorItemVisitor.distance=Distance
ErrorItemVisitor.pointTouchesEdge=Point touches edge
ErrorItemVisitor.degeneratedRing=Degenerated ring
ErrorItemVisitor.deviation=Deviation
ErrorItemVisitor.triangles=Triangles
\ No newline at end of file
WriteReportDialog.yAxisLabel=Count
\ No newline at end of file
......@@ -14,5 +14,8 @@
<Logger name="org.apache.fop" level="INFO">
<AppenderRef ref="console" />
</Logger>
<Logger name="com.zaxxer.hikari" level="INFO" additivity="false">
<AppenderRef ref="console"/>
</Logger>
</Loggers>
</Configuration>
\ No newline at end of file
......@@ -51,7 +51,6 @@ import de.hft.stuttgart.citydoctor2.utils.visitors.UnsetGeometriesVisitor;
public class BridgeObjectTest {
//TODO: Rework this class with the new Visitors
@Test
public void testAccept() {
......
......@@ -64,7 +64,7 @@ public class BuildingTest {
b.setCityGmlBuilding(createCityGmlBuilding());
RoofSurface rs = new RoofSurface();
rs.setId("testRoof");
BoundarySurface surface = new BoundarySurface(SurfaceFeatureType.BUILDING, BoundarySurfaceType.ROOF, rs);
BoundarySurface surface = new BoundarySurface(BoundarySurfaceType.ROOF, rs);
Geometry geomSurface = new Geometry(GeometryType.MULTI_SURFACE, Lod.LOD2, Orientation.OUTWARD);
geomSurface.addPolygon(new LinkedPolygon(p, geomSurface));
geomSurface.updateEdgesAndVertices();
......@@ -75,7 +75,8 @@ public class BuildingTest {
assertNotSame(b, copy);
assertEquals(b.getGmlId(), copy.getGmlId());
copy.prepareForChecking();
Geometry copyGeom = copy.getGeometries().get(0);
assertNotSame(geom, copyGeom);
......
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