Commit 2459496d authored by Riegel's avatar Riegel
Browse files

Merge branch 'dev_gui_features_zip_loading' into 'dev'

Add ZIP-archive support

See merge request !26
parents ca7fe768 b75c2602
Pipeline #10995 passed with stage
in 1 minute and 29 seconds
......@@ -106,6 +106,11 @@ public class WaterObject extends CityObject {
gmlWater.getDeprecatedProperties().setLod1MultiSurface(null);
}
@Override
public CityObject getTopLevelCityObject() {
return this;
}
public void setGmlObject(WaterBody waterBody) {
gmlWater = waterBody;
}
......
......@@ -27,7 +27,6 @@ import de.hft.stuttgart.citydoctor2.datastructure.BuildingPart;
import de.hft.stuttgart.citydoctor2.datastructure.BuildingRoom;
import de.hft.stuttgart.citydoctor2.datastructure.LinearRing;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon;
import de.hft.stuttgart.citydoctor2.datastructure.BridgeObject.BridgeType;
import de.hft.stuttgart.citydoctor2.datastructure.TunnelConstructiveElement;
import de.hft.stuttgart.citydoctor2.datastructure.TunnelFurniture;
import de.hft.stuttgart.citydoctor2.datastructure.TunnelPart;
......@@ -36,6 +35,7 @@ import de.hft.stuttgart.citydoctor2.datastructure.Vegetation.VegetationType;
import de.hft.stuttgart.citydoctor2.math.graph.KDTree;
import de.hft.stuttgart.citydoctor2.parser.ParserConfiguration;
import de.hft.stuttgart.citydoctor2.utils.Localization;
import de.hft.stuttgart.citydoctor2.zip.CityGmlZipEntry;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.citygml4j.core.model.CityGMLVersion;
......@@ -77,18 +77,28 @@ public class Citygml3FeatureMapper extends ObjectWalker {
private final CityDoctorModel model;
private final ParserConfiguration config;
private final Path directory;
private final double neighborDistance;
private final CityGmlZipEntry zipEntry;
private final double neighborDistance;
private Map<String, ConcretePolygon> polygonMap = new HashMap<>();
private Map<String, CompositeCollection> compositeMap = new HashMap<>();
private List<ResolvableReference> references = new ArrayList<>();
private Map<Vertex, Vertex> vertexMap = new HashMap<>();
public Citygml3FeatureMapper(ParserConfiguration config, Path path) {
this.config = config;
this.directory = path.getParent();
model = new CityDoctorModel(config, path.toFile());
neighborDistance = 1.8d / Math.pow(10, config.getNumberOfRoundingPlaces());
}
public Citygml3FeatureMapper(ParserConfiguration config, Path path) {
this.config = config;
this.directory = path.getParent();
model = new CityDoctorModel(config, path.toFile());
neighborDistance = 1.8d / Math.pow(10, config.getNumberOfRoundingPlaces());
zipEntry = null;
}
public Citygml3FeatureMapper(ParserConfiguration config, CityGmlZipEntry entry) {
this.config = config;
this.directory = null;
this.zipEntry = entry;
model = new CityDoctorModel(config, Path.of(entry.getEntrySubPath()).toFile());
neighborDistance = 1.8d / Math.pow(10, config.getNumberOfRoundingPlaces());
}
public static void parseId(AbstractGML gml, GmlElement gmlElement) {
String id = gml.getId();
......@@ -255,7 +265,7 @@ public class Citygml3FeatureMapper extends ObjectWalker {
@Override
public void visit(Bridge bridge) {
BridgeObject bo = new BridgeObject(BridgeType.BRIDGE, bridge);
BridgeObject bo = new BridgeObject(bridge);
// parse deprecated geometries
parseAndAddMultiSurface(bridge.getDeprecatedProperties().getLod1MultiSurface(), Lod.LOD1, bo);
......@@ -268,7 +278,7 @@ public class Citygml3FeatureMapper extends ObjectWalker {
continue;
}
BridgePart gmlBridgePart = bPartProperty.getObject();
BridgeObject bPart = new BridgeObject(BridgeType.BRIDGE_PART, gmlBridgePart);
BridgeObject bPart = new BridgeObject(gmlBridgePart, bo);
mapAbstractBridge(gmlBridgePart, bPart);
bo.addBridgePart(bPart);
}
......@@ -415,8 +425,8 @@ public class Citygml3FeatureMapper extends ObjectWalker {
}
}
}
cdTunnel.unsetGmlGeometries();
resolveAndClearReferences();
updateEdgesAndVertices(cdTunnel);
......@@ -794,15 +804,15 @@ public class Citygml3FeatureMapper extends ObjectWalker {
co.addGeometry(geom);
}
private void parseAndAddSolid(SolidProperty sp, Lod lod, CityObject co) {
if (sp == null || sp.getObject() == null) {
return;
}
Geometry geom = parseSolid(sp.getObject(), lod);
if (geom != null) {
co.addGeometry(geom);
}
}
private void parseAndAddSolid(SolidProperty sp, Lod lod, CityObject co) {
if (sp == null || sp.getObject() == null) {
return;
}
Geometry geom = parseSolid(sp.getObject(), lod);
if (geom != null) {
co.addGeometry(geom);
}
}
private void parseImplicitGeometry(AbstractOccupiedSpace aos, CityObject co) {
for (int i = 1; i <= 3; i++) {
......@@ -828,8 +838,16 @@ public class Citygml3FeatureMapper extends ObjectWalker {
private ImplicitGeometryHolder resolveImplicitGeometry(ImplicitGeometry ig, int lodInt) {
ImplicitGeometryHolder igh = null;
if (ig.getLibraryObject() != null) {
Path libraryObjectPath = directory.resolve(ig.getLibraryObject());
LibraryObject libObj = LibraryObject.of(libraryObjectPath, config);
LibraryObject libObj = null;
if (directory != null){
Path libraryObjectPath = directory.resolve(ig.getLibraryObject());
libObj = LibraryObject.of(libraryObjectPath, config);
} else {
String libraryObjectPath = ig.getLibraryObject();
Path loPath = zipEntry.resolveLibraryObjectPath(libraryObjectPath);
CityGmlZipEntry libEntry = zipEntry.getArchive().getEntry(loPath.toString());
libObj = LibraryObject.of(libEntry, config);
}
if (libObj != null) {
igh = new ImplicitGeometryHolder(ig, libObj);
}
......
/*-
* Copyright 2022 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
......@@ -18,30 +18,16 @@
*/
package de.hft.stuttgart.citydoctor2.parser;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.xml.XMLConstants;
import javax.xml.namespace.QName;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import de.hft.stuttgart.citydoctor2.datastructure.CityDoctorModel;
import de.hft.stuttgart.citydoctor2.datastructure.CityObject;
import de.hft.stuttgart.citydoctor2.mapper.citygml3.Citygml3FeatureMapper;
import de.hft.stuttgart.citydoctor2.mapper.citygml3.GMLValidationHandler;
import de.hft.stuttgart.citydoctor2.math.Vector3d;
import de.hft.stuttgart.citydoctor2.utils.Localization;
import de.hft.stuttgart.citydoctor2.zip.CityGmlZipEntry;
import de.hft.stuttgart.citydoctor2.zip.CityGmlZipEntryFile;
import de.hft.stuttgart.quality.QualityADEContext;
import de.hft.stuttgart.quality.QualityADEModule;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
......@@ -69,454 +55,648 @@ import org.locationtech.proj4j.BasicCoordinateTransform;
import org.locationtech.proj4j.CRSFactory;
import org.locationtech.proj4j.CoordinateReferenceSystem;
import org.locationtech.proj4j.ProjCoordinate;
import org.locationtech.proj4j.io.Proj4FileReader;
import org.locationtech.proj4j.proj.Projection;
import org.locationtech.proj4j.units.Units;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.SAXNotRecognizedException;
import org.xml.sax.SAXNotSupportedException;
import org.xml.sax.SAXParseException;
import org.xmlobjects.schema.SchemaHandler;
import org.xmlobjects.schema.SchemaHandlerException;
import org.xmlobjects.stream.XMLReader;
import org.xmlobjects.stream.XMLReaderFactory;
import de.hft.stuttgart.citydoctor2.datastructure.CityDoctorModel;
import de.hft.stuttgart.citydoctor2.datastructure.CityObject;
import de.hft.stuttgart.citydoctor2.mapper.citygml3.Citygml3FeatureMapper;
import de.hft.stuttgart.citydoctor2.mapper.citygml3.GMLValidationHandler;
import de.hft.stuttgart.citydoctor2.math.Vector3d;
import de.hft.stuttgart.citydoctor2.utils.Localization;
import de.hft.stuttgart.quality.QualityADEContext;
import de.hft.stuttgart.quality.QualityADEModule;
import javax.xml.XMLConstants;
import javax.xml.namespace.QName;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Utility class to parse CityGML files.
*
* @author Matthias Betz
*
* @author Matthias Betz
*/
public class CityGmlParser {
private static final String CITY_OBJECT_MEMBER = "cityObjectMember";
private static final String WGS_84 = "EPSG:4326";
private static final Logger logger = LogManager.getLogger(CityGmlParser.class);
private static final CRSFactory CRS_FACTORY = new CRSFactory();
// EPSG:31467
private static final Pattern P_EPSG = Pattern.compile("^(EPSG:\\d+)$");
// urn:ogc:def:crs,crs:EPSG:6.12:31467,crs:EPSG:6.12:5783
// or
// urn:ogc:def:crs,crs:EPSG::28992
private static final Pattern P_OGC = Pattern.compile("urn:ogc:def:crs,crs:EPSG:[\\d\\.]*:([\\d]+)\\D*");
private static final Pattern P_OGC2 = Pattern.compile("urn:ogc:def:crs:EPSG:[\\d\\.]*:([\\d]+)\\D*");
// urn:adv:crs:DE_DHDN_3GK3*DE_DHHN92_NH
// urn:adv:crs:ETRS89_UTM32*DE_DHHN92_NH
private static final Pattern P_URN = Pattern.compile("urn:adv:crs:([^\\*]+)");
private static final SAXParserFactory FACTORY;
private static CityGMLContext context;
private static List<QName> chunkProperties = new ArrayList<>();
// Toggle to suppress logger output for parsing of libraryObjects
private static boolean gagged = false;
static {
System.setProperty("javax.xml.transform.TransformerFactory", "com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl");
FACTORY = SAXParserFactory.newInstance();
try {
FACTORY.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, false);
} catch (SAXNotRecognizedException | SAXNotSupportedException | ParserConfigurationException e) {
logger.catching(e);
}
chunkProperties.add(new QName(CityGMLConstants.CITYGML_1_0_CORE_NAMESPACE, CITY_OBJECT_MEMBER));
chunkProperties.add(new QName(CityGMLConstants.CITYGML_2_0_CORE_NAMESPACE, CITY_OBJECT_MEMBER));
chunkProperties.add(new QName(CityGMLConstants.CITYGML_3_0_CORE_NAMESPACE, CITY_OBJECT_MEMBER));
}
private CityGmlParser() {
}
public static synchronized CityGMLContext getContext() {
if (context == null) {
try {
context = CityGMLContext.newInstance(CityGmlParser.class.getClassLoader());
// also setup ades
ADERegistry adeRegistry = ADERegistry.getInstance();
adeRegistry.loadADE(new QualityADEContext());
} catch (CityGMLContextException e) {
logger.fatal("Unable to create citygml4j context", e);
throw new IllegalStateException("Unable to create citygml4j context");
} catch (ADEException e) {
logger.fatal("Unable to add ADE plugins to citygml4j", e);
throw new IllegalStateException("Unable to add ADE plugins to citygml4j");
}
}
return context;
}
public static CityDoctorModel parseCityGmlFile(String file, ParserConfiguration config)
throws CityGmlParseException, InvalidGmlFileException {
return parseCityGmlFile(file, config, null, null);
}
public static CityDoctorModel parseCityGmlFile(String file, ParserConfiguration config, ProgressListener l)
throws CityGmlParseException, InvalidGmlFileException {
return parseCityGmlFile(file, config, l, null);
}
public static CityDoctorModel parseCityGmlFile(String filePath, ParserConfiguration config, ProgressListener l,
GMLValidationHandler handler) throws CityGmlParseException, InvalidGmlFileException {
CityGMLContext context = getContext();
Path file = Paths.get(filePath);
if (config.getValidate()) {
List<String> messages = validateFile(context, handler, file);
if (!messages.isEmpty()) {
throw new InvalidGmlFileException("Invalid GML File. First error: \n" + messages.get(0));
}
}
try {
parseEpsgCodeFromFile(file, config);
CityGMLInputFactory in = context.createCityGMLInputFactory()
.withChunking(ChunkOptions.chunkByProperties(chunkProperties).skipCityModel(false));
try (ObservedInputStream ois = new ObservedInputStream(file.toFile())) {
if (l != null) {
ois.addListener(l::updateProgress);
}
return readAndKeepFeatures(config, file, in, ois);
}
} catch (CityGMLReadException | IOException e) {
throw new CityGmlParseException("Failed to read CityGML file", e);
}
}
public static void streamCityGml(String file, ParserConfiguration config, CityGmlConsumer cityObjectConsumer,
String outputFile) throws CityGmlParseException {
Path f = Paths.get(file);
streamCityGml(f, config, null, cityObjectConsumer, outputFile);
}
public static void streamCityGml(File file, ParserConfiguration parserConfig, CityGmlConsumer cityObjectConsumer,
String outputFile) throws CityGmlParseException {
streamCityGml(file.toPath(), parserConfig, null, cityObjectConsumer, outputFile);
}
public static void streamCityGml(Path file, ParserConfiguration config, ProgressListener l,
CityGmlConsumer cityObjectConsumer, String outputFile) throws CityGmlParseException {
parseEpsgCodeFromFile(file, config);
startReadingCityGml(file, config, l, cityObjectConsumer, outputFile);
}
public static CityModel parseOnlyCityModel(File inputFile) throws CityGmlParseException {
try {
CityGMLInputFactory inputFactory = context.createCityGMLInputFactory()
.withChunking(ChunkOptions.chunkByProperties(chunkProperties).skipCityModel(false));
try (CityGMLReader reader = inputFactory.createCityGMLReader(inputFile)) {
while (reader.hasNext()) {
AbstractFeature chunk = reader.next();
if (chunk instanceof CityModel cModel) {
cModel.setCityObjectMembers(null);
return cModel;
}
}
}
} catch (CityGMLReadException e) {
throw new CityGmlParseException(e);
}
throw new CityGmlParseException("Did not find any CityModel in CityGML file");
}
private static void startReadingCityGml(Path file, ParserConfiguration config, ProgressListener l,
CityGmlConsumer cityObjectConsumer, String outputFile) {
try (ObservedInputStream ois = new ObservedInputStream(file.toFile())) {
if (l != null) {
ois.addListener(l::updateProgress);
}
readAndDiscardFeatures(file, config, ois, cityObjectConsumer, outputFile);
} catch (IOException | CityGMLReadException e) {
logger.error(Localization.getText("CityGmlParser.errorReadingGmlFile"), e.getMessage());
logger.catching(Level.ERROR, e);
}
}
private static void readAndDiscardFeatures(Path file, ParserConfiguration config, ObservedInputStream ois,
CityGmlConsumer cityObjectConsumer, String outputFile) throws CityGMLReadException {
getContext();
CityGMLInputFactory inputFactory = context.createCityGMLInputFactory()
.withChunking(ChunkOptions.chunkByProperties(chunkProperties).skipCityModel(false));
CityGMLChunkWriter writer = null;
try (CityGMLReader reader = inputFactory.createCityGMLReader(ois)) {
Citygml3FeatureMapper mapper = new Citygml3FeatureMapper(config, file);
CityDoctorModel model = mapper.getModel();
boolean isInitialized = false;
while (reader.hasNext()) {
AbstractFeature chunk = reader.next();
if (writer == null) {
writer = createCityModelWriter(outputFile, reader);
}
if (!isInitialized && writer != null && reader.getParentInfo() != null
&& reader.getParentInfo().getTypeName().getLocalPart().equals("CityModel")) {
FeatureInfo parentInfo = reader.getParentInfo();
writer.withCityModelInfo(parentInfo);
isInitialized = true;
}
if (chunk instanceof AbstractCityObject ag) {
ag.accept(mapper);
drainCityModel(model, cityObjectConsumer);
writeAbstractCityObject(writer, ag);
} else if (chunk instanceof CityModel cModel) {
cModel.setCityObjectMembers(null);
mapper.setCityModel(cModel);
cityObjectConsumer.accept(cModel);
writeCityModel(writer, cModel);
} else if (writer != null) {
writer.writeMember(chunk);
}
}
// end of stream
logger.debug("End of gml file stream");
} catch (CityGMLReadException e) {
logger.error(Localization.getText("CityGmlParser.errorReadingGmlFile"), e.getMessage(), e);
} catch (CityGMLWriteException e) {
logger.error(Localization.getText("CityGmlParser.errorWritingGmlFile"), e.getMessage(), e);
} finally {
if (writer != null) {
try {
writer.close();
} catch (CityGMLWriteException e) {
// ignore
}
}
}
}
private static void writeCityModel(CityGMLChunkWriter writer, CityModel cModel) {
if (writer != null) {
for (ADEProperty genEle : cModel.getADEProperties()) {
writer.getCityModelInfo().addADEProperty(genEle);
}
}
}
private static void writeAbstractCityObject(CityGMLChunkWriter writer, AbstractCityObject ag)
throws CityGMLWriteException {
if (writer != null) {
writer.writeMember(ag);
}
}
private static CityGMLChunkWriter createCityModelWriter(String outputFile, CityGMLReader reader)
throws CityGMLWriteException {
if (outputFile == null) {
return null;
}
CityGMLContext gmlContext = CityGmlParser.getContext();
CityGMLVersion version = CityGMLModules.getCityGMLVersion(reader.getName().getNamespaceURI());
CityGMLOutputFactory factory = gmlContext.createCityGMLOutputFactory(version);
CityGMLChunkWriter writer = factory.createCityGMLChunkWriter(new File(outputFile),
StandardCharsets.UTF_8.name());
writer.withPrefix("qual", QualityADEModule.NAMESPACE_URI);
writer.withSchemaLocation(QualityADEModule.NAMESPACE_URI, QualityADEModule.NAMESPACE_URI + "/qualityAde.xsd");
writer.withIndent(" ");
writer.withDefaultPrefixes();
writer.withDefaultSchemaLocations();
return writer;
}
/**
* Suppresses logger output of {@link #readAndKeepFeatures} for the next parse.
* Used to prevent logging spam while resolving implicit geometries.
*/
public static void gagLogger(boolean value){
gagged = value;
}
private static CityDoctorModel readAndKeepFeatures(ParserConfiguration config, Path file,
CityGMLInputFactory inputFactory, ObservedInputStream ois) throws CityGMLReadException {
try (CityGMLReader reader = inputFactory.createCityGMLReader(ois)) {
Citygml3FeatureMapper mapper = new Citygml3FeatureMapper(config, file);
CityGMLVersion version = null;
// model is read in chunked mode
// object members are replaced by href in model
// need to remove the refs and re-add unparsed objects
List<AbstractCityObject> acos = new ArrayList<>();
while (reader.hasNext()) {
AbstractFeature chunk = reader.next();
version = CityGMLModules.getCityGMLVersion(reader.getName().getNamespaceURI());
if (chunk instanceof CityModel cModel) {
cModel.setCityObjectMembers(null);
mapper.setCityModel(cModel);
mapper.setCityGMLVersion(version);
} else if (chunk instanceof AbstractCityObject aco) {
acos.add(aco);
aco.accept(mapper);
}
}
if (mapper.getModel().getCityModel() == null) {
// file does not contain a city model?
// create it for now
mapper.setCityModel(new CityModel());
}
CityModel cModel = mapper.getModel().getCityModel();
// remove those that should have been parsed
List<AbstractCityObject> parsedCityObjects = mapper.getModel().createFeatureStream()
.map(CityObject::getGmlObject).toList();
acos.removeAll(parsedCityObjects);
// re-add all not parsed objects
for (AbstractCityObject aco : acos) {
cModel.getCityObjectMembers().add(new AbstractCityObjectProperty(aco));
}
if (logger.isInfoEnabled() && !gagged) {
logger.info(Localization.getText("CityGmlParser.parsedObjects"),
mapper.getModel().getNumberOfFeatures());
} else if (gagged){
// Remove gag
gagged = false;
}
mapper.setCityGMLVersion(version);
return mapper.getModel();
}
}
private static void parseEpsgCodeFromFile(Path file, ParserConfiguration config) throws CityGmlParseException {
try (BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file.toFile()))) {
parseEpsgCodeFromStream(bis, config);
} catch (ParserConfigurationException | SAXException | IOException e) {
throw new CityGmlParseException("Failed to read CityGML file", e);
}
}
private static void parseEpsgCodeFromStream(InputStream is, ParserConfiguration config)
throws ParserConfigurationException, SAXException {
SAXParser parser = FACTORY.newSAXParser();
CityGmlHandler handler = new CityGmlHandler();
try {
parser.parse(new InputSource(is), handler);
} catch (EnvelopeFoundException e) {
try {
parseCoordinateSystem(config, handler);
} catch (Exception e2) {
logger.debug("Exception while parsing for EPSG code", e2);
if (logger.isWarnEnabled()) {
logger.warn(Localization.getText("CityGmlParser.noEPSG"));
}
}
} catch (Exception e) {
logger.debug("Exception while parsing for EPSG code", e);
if (logger.isWarnEnabled()) {
logger.warn(Localization.getText("CityGmlParser.noEPSG"));
}
}
}
private static void parseCoordinateSystem(ParserConfiguration config, CityGmlHandler handler) {
if (handler.getEpsg() == null) {
return;
}
CoordinateReferenceSystem crs = crsFromSrsName(handler.getEpsg());
if (crs == null) {
// could not find a coordinate system for srsName
// assuming metric system
return;
}
if (crs.getProjection().getUnits() == Units.METRES) {
// coordinate system is in meters, do not convert
if (logger.isInfoEnabled()) {
logger.info(Localization.getText("CityGmlParser.noConversionNeeded"));
}
return;
}
parseMeterConversion(config, crs);
Vector3d low = handler.getLowerCorner();
Vector3d up = handler.getUpperCorner();
double centerLong = low.getX() + ((up.getX() - low.getX()) / 2);
double centerLat = low.getY() + ((up.getY() - low.getY()) / 2);
if (!crs.getName().equals(WGS_84)) {
// need to convert coordinates first to WGS84, then find UTM Zone
CoordinateReferenceSystem wgs84 = crsFromSrsName(WGS_84);
ProjCoordinate p1 = new ProjCoordinate();
p1.setValue(centerLong, centerLat);
ProjCoordinate p2 = new ProjCoordinate();
BasicCoordinateTransform bct = new BasicCoordinateTransform(crs, wgs84);
bct.transform(p1, p2);
centerLong = p2.x;
centerLat = p2.y;
}
int zone = (int) (31 + Math.round(centerLong / 6));
CoordinateReferenceSystem utm;
if (centerLat < 0) {
// south
logger.info("Converting coordiante system to UTM zone {}S", zone);
utm = CRS_FACTORY.createFromParameters("UTM", "+proj=utm +ellps=WGS84 +units=m +zone=" + zone + " +south");
} else {
// north
logger.info("Converting coordiante system to UTM zone {}N", zone);
utm = CRS_FACTORY.createFromParameters("UTM", "+proj=utm +ellps=WGS84 +units=m +zone=" + zone);
}
config.setCoordinateSystem(crs, utm);
}
private static void parseMeterConversion(ParserConfiguration config, CoordinateReferenceSystem crs) {
Projection projection = crs.getProjection();
double fromMetres = projection.getFromMetres();
if (fromMetres > 0) {
// also transform height information
config.setFromMeters(fromMetres);
} else {
config.setFromMeters(1.0);
}
}
/**
* The srsName (The name by which this reference system is identified) inside
* the CityGML file can have multiple formats. This method tries to parse the
* string and detect the corresponding reference system. If it is found, it
* returns a proj4j.CoordinateReferenceSystem. It throws an
* IllegalArgumentException otherwise.
*
* This method should be able to parse any EPSG id : e.g. "EPSG:1234". German
* Citygmls might also have "DE_DHDN_3GK3" or "ETRS89_UTM32" as srsName, so
* those are also included. It isn't guaranteed that those formats are correctly
* parsed, though.
*
* The EPSG ids and parameters are defined in resources ('nad/epsg') inside
* proj4j-0.1.0.jar. Some EPSG ids are missing though, e.g. 7415
*
* @param srsName
* @return CoordinateReferenceSystem
*/
private static CoordinateReferenceSystem crsFromSrsName(String srsName) {
srsName = srsName.trim();
Matcher mEPSG = P_EPSG.matcher(srsName);
if (mEPSG.find()) {
if ("EPSG:4979".contentEquals(srsName)) {
srsName = "EPSG:4236";
} else if ("EPSG:7415".contentEquals(srsName)) {
return CRS_FACTORY.createFromParameters("EPSG:7415",
"+proj=sterea +lat_0=52.15616055555555 +lon_0=5.38763888888889 +k=0.9999079 +x_0=155000 +y_0=463000 +ellps=bessel +towgs84=565.417,50.3319,465.552,-0.398957,0.343988,-1.8774,4.0725 +units=m +no_defs");
}
return CRS_FACTORY.createFromName(srsName);
}
Matcher mOGC = P_OGC.matcher(srsName);
if (mOGC.find()) {
return CRS_FACTORY.createFromName("EPSG:" + mOGC.group(1));
}
Matcher mOGC2 = P_OGC2.matcher(srsName);
if (mOGC2.find()) {
return CRS_FACTORY.createFromName("EPSG:" + mOGC2.group(1));
}
Matcher mURN = P_URN.matcher(srsName);
// NOTE: Could use a HashMap if the switch/case becomes too long.
if (mURN.find()) {
private static final String CITY_OBJECT_MEMBER = "cityObjectMember";
private static final String WGS_84 = "EPSG:4326";
private static final Logger logger = LogManager.getLogger(CityGmlParser.class);
private static final CRSFactory CRS_FACTORY = new CRSFactory();
// EPSG:31467
private static final Pattern P_EPSG = Pattern.compile("^(EPSG:\\d+)$");
// urn:ogc:def:crs,crs:EPSG:6.12:31467,crs:EPSG:6.12:5783
// or
// urn:ogc:def:crs,crs:EPSG::28992
private static final Pattern P_OGC = Pattern.compile("urn:ogc:def:crs,crs:EPSG:[\\d\\.]*:([\\d]+)\\D*");
private static final Pattern P_OGC2 = Pattern.compile("urn:ogc:def:crs:EPSG:[\\d\\.]*:([\\d]+)\\D*");
// urn:adv:crs:DE_DHDN_3GK3*DE_DHHN92_NH
// urn:adv:crs:ETRS89_UTM32*DE_DHHN92_NH
private static final Pattern P_URN = Pattern.compile("urn:adv:crs:([^\\*]+)");
private static final SAXParserFactory FACTORY;
private static Proj4FileReader csReader = new Proj4FileReader();
private static final Pattern P_VUNITS = Pattern.compile("^\\+vunits=.+");
private static final Pattern P_GEOIDGRID = Pattern.compile("^\\+geoidgrid=.+");
private static CityGMLContext context;
private static List<QName> chunkProperties = new ArrayList<>();
static {
System.setProperty("javax.xml.transform.TransformerFactory", "com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl");
FACTORY = SAXParserFactory.newInstance();
try {
FACTORY.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, false);
} catch (SAXNotRecognizedException | SAXNotSupportedException | ParserConfigurationException e) {
logger.catching(e);
}
chunkProperties.add(new QName(CityGMLConstants.CITYGML_1_0_CORE_NAMESPACE, CITY_OBJECT_MEMBER));
chunkProperties.add(new QName(CityGMLConstants.CITYGML_2_0_CORE_NAMESPACE, CITY_OBJECT_MEMBER));
chunkProperties.add(new QName(CityGMLConstants.CITYGML_3_0_CORE_NAMESPACE, CITY_OBJECT_MEMBER));
}
private CityGmlParser() {
}
public static synchronized CityGMLContext getContext() {
if (context == null) {
try {
context = CityGMLContext.newInstance(CityGmlParser.class.getClassLoader());
// also setup ades
ADERegistry adeRegistry = ADERegistry.getInstance();
adeRegistry.loadADE(new QualityADEContext());
} catch (CityGMLContextException e) {
logger.fatal("Unable to create citygml4j context", e);
throw new IllegalStateException("Unable to create citygml4j context");
} catch (ADEException e) {
logger.fatal("Unable to add ADE plugins to citygml4j", e);
throw new IllegalStateException("Unable to add ADE plugins to citygml4j");
}
}
return context;
}
public static CityDoctorModel parseCityGmlFileSilently(String file, ParserConfiguration config)
throws CityGmlParseException, InvalidGmlFileException {
return parseCityGmlFile(file, config, null, null, false);
}
public static CityDoctorModel parseCityGmlFile(String file, ParserConfiguration config)
throws CityGmlParseException, InvalidGmlFileException {
return parseCityGmlFile(file, config, null, null, true);
}
public static CityDoctorModel parseCityGmlFile(String file, ParserConfiguration config, ProgressListener l)
throws CityGmlParseException, InvalidGmlFileException {
return parseCityGmlFile(file, config, l, null, true);
}
public static CityDoctorModel parseCityGmlFile(String filePath, ParserConfiguration config, ProgressListener l,
GMLValidationHandler handler, boolean verbose) throws CityGmlParseException, InvalidGmlFileException {
CityGMLContext context = getContext();
Path file = Paths.get(filePath);
if (config.getValidate()) {
List<String> messages = validateFile(context, handler, file);
if (!messages.isEmpty()) {
throw new InvalidGmlFileException("Invalid GML File. First error: \n" + messages.get(0));
}
}
try {
parseEpsgCodeFromFile(file, config);
CityGMLInputFactory in = context.createCityGMLInputFactory()
.withChunking(ChunkOptions.chunkByProperties(chunkProperties).skipCityModel(false));
try (ObservedInputStream ois = new ObservedInputStream(file.toFile())) {
if (l != null) {
ois.addListener(l::updateProgress);
}
return readAndKeepFeatures(config, file, in, ois, verbose);
}
} catch (CityGMLReadException | IOException e) {
throw new CityGmlParseException("Failed to read CityGML file", e);
}
}
public static CityDoctorModel parseCityGmlZipEntry(CityGmlZipEntry entry, ParserConfiguration config)
throws CityGmlParseException, InvalidGmlFileException, IOException {
return parseCityGmlZipEntry(entry, config, null);
}
public static CityDoctorModel parseCityGmlZipEntry(CityGmlZipEntry entry, ParserConfiguration config, ProgressListener l)
throws CityGmlParseException, InvalidGmlFileException, IOException {
CityGMLContext context = getContext();
if (config.getValidate()) {
try (CityGmlZipEntryFile entryFile = new CityGmlZipEntryFile(entry)) {
List<String> messages = validateStream(entryFile.getInputStream(), context);
if (!messages.isEmpty()) {
throw new InvalidGmlFileException("Invalid GML File. First error: \n" + messages.get(0));
}
} catch (Exception e) {
throw new CityGmlParseException(e);
}
}
return decompressAndParseCityGmlEntry(entry, config, l, context);
}
public static CityDoctorModel decompressAndParseCityGmlEntry(CityGmlZipEntry entry, ParserConfiguration config, CityGMLContext context)
throws CityGmlParseException {
return decompressAndParseCityGmlEntry(entry, config, null, context);
}
public static CityDoctorModel decompressAndParseCityGmlEntry(CityGmlZipEntry entry, ParserConfiguration config, ProgressListener l, CityGMLContext context)
throws CityGmlParseException {
try (CityGmlZipEntryFile entryFile = new CityGmlZipEntryFile(entry)) {
BufferedInputStream bis = new BufferedInputStream(entryFile.getInputStream());
readEpsgCodeFromInputStream(bis, config);
CityGMLInputFactory in = context.createCityGMLInputFactory()
.withChunking(ChunkOptions.chunkByProperties(chunkProperties).skipCityModel(false));
try (ObservedInputStream ois = new ObservedInputStream(bis, bis.available())) {
if (l != null) {
ois.addListener(l::updateProgress);
}
return readAndKeepFeatures(config, entry, in, ois, false);
}
} catch (CityGMLReadException | IOException e) {
throw new CityGmlParseException("Failed to read CityGML file", e);
} catch (Exception e) {
throw new CityGmlParseException(e);
}
}
private static CityDoctorModel readAndKeepFeatures(ParserConfiguration config, CityGmlZipEntry entry,
CityGMLInputFactory inputFactory, ObservedInputStream ois, boolean verbose) throws CityGMLReadException {
return readAndKeepModel(new Citygml3FeatureMapper(config, entry), inputFactory, ois, verbose);
}
private static List<String> validateStream(InputStream vis, CityGMLContext context) throws CityGmlParseException {
GMLValidationHandler handler = new GMLValidationHandler();
try {
BufferedInputStream bis = new BufferedInputStream(vis);
SchemaHandler schemaHandler = new ValidationSchemaHandler(context.getDefaultSchemaHandler());
readAdditionalSchemaDefinitions(context, bis, schemaHandler);
Source[] schemas = schemaHandler.getSchemas();
SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
schemaFactory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
Schema schema = schemaFactory.newSchema(schemas);
Validator validator = schema.newValidator();
validator.setErrorHandler(handler);
validator.validate(new StreamSource(bis));
return handler.getMessages();
} catch (SchemaHandlerException | SAXException | IOException e) {
throw new CityGmlParseException("Failed to validate CityGML file", e);
}
}
private static void readAdditionalSchemaDefinitions(CityGMLContext context, BufferedInputStream bis, SchemaHandler schemaHandler)
throws CityGmlParseException {
bis.mark(Integer.MAX_VALUE);
try (XMLReader reader = XMLReaderFactory.newInstance(context.getXMLObjects())
.withSchemaHandler(schemaHandler)
.createReader(bis)) {
reader.nextTag();
bis.reset();
} catch (Exception e) {
throw new CityGmlParseException("Failed to read Schema from stream.", e);
}
}
private static void readEpsgCodeFromInputStream(BufferedInputStream bis, ParserConfiguration config) throws CityGmlParseException {
try {
// Mark start position of GML-"file"
bis.mark(Integer.MAX_VALUE);
// Buffer the first 10000 chars of the Stream, EPSG/envelope info should be found within that range
int peekingWidth = Math.min(10000, bis.available());
byte[] buf = new byte[peekingWidth];
bis.read(buf, 0, peekingWidth);
bis.reset();
parseEpsgCodeFromBuffer(buf, config);
} catch (ParserConfigurationException | SAXException | IOException e) {
throw new CityGmlParseException("Failed to read CityGML file", e);
}
}
public static void streamCityGml(CityGmlZipEntry entry, ParserConfiguration config, CityGmlConsumer cityObjectConsumer,
String outputFile) throws CityGmlParseException, IOException {
try (CityGmlZipEntryFile entryFile = new CityGmlZipEntryFile(entry)) {
parseEpsgCodeFromStream(entryFile.getInputStream(), config);
startReadingCityGmlZipEntry(entry, config, null, cityObjectConsumer, outputFile);
} catch (ParserConfigurationException | SAXException | IOException e) {
throw new CityGmlParseException("Failed to read CityGML stream", e);
}
}
public static void streamCityGml(String file, ParserConfiguration config, CityGmlConsumer cityObjectConsumer,
String outputFile) throws CityGmlParseException {
Path f = Paths.get(file);
streamCityGml(f, config, null, cityObjectConsumer, outputFile);
}
public static void streamCityGml(File file, ParserConfiguration parserConfig, CityGmlConsumer cityObjectConsumer,
String outputFile) throws CityGmlParseException {
streamCityGml(file.toPath(), parserConfig, null, cityObjectConsumer, outputFile);
}
public static void streamCityGml(Path file, ParserConfiguration config, ProgressListener l,
CityGmlConsumer cityObjectConsumer, String outputFile) throws CityGmlParseException {
parseEpsgCodeFromFile(file, config);
startReadingCityGmlFile(file, config, l, cityObjectConsumer, outputFile);
}
public static CityModel parseOnlyCityModel(File inputFile) throws CityGmlParseException {
try {
CityGMLInputFactory inputFactory = context.createCityGMLInputFactory()
.withChunking(ChunkOptions.chunkByProperties(chunkProperties).skipCityModel(false));
try (CityGMLReader reader = inputFactory.createCityGMLReader(inputFile)) {
while (reader.hasNext()) {
AbstractFeature chunk = reader.next();
if (chunk instanceof CityModel cModel) {
cModel.setCityObjectMembers(null);
return cModel;
}
}
}
} catch (CityGMLReadException e) {
throw new CityGmlParseException(e);
}
throw new CityGmlParseException("Did not find any CityModel in CityGML file");
}
private static void startReadingCityGmlFile(Path file, ParserConfiguration config, ProgressListener l,
CityGmlConsumer cityObjectConsumer, String outputFile) {
try (ObservedInputStream ois = new ObservedInputStream(file.toFile())) {
if (l != null) {
ois.addListener(l::updateProgress);
}
readAndDiscardFeatures(file, config, ois, cityObjectConsumer, outputFile);
} catch (IOException | CityGMLReadException e) {
logger.error(Localization.getText("CityGmlParser.errorReadingGmlFile"), e.getMessage());
logger.catching(Level.ERROR, e);
}
}
private static void readAndDiscardFeatures(Path file, ParserConfiguration config, ObservedInputStream ois,
CityGmlConsumer cityObjectConsumer, String outputFile) throws CityGMLReadException {
Citygml3FeatureMapper mapper = new Citygml3FeatureMapper(config, file);
readAndDiscardModel(mapper, ois, cityObjectConsumer, outputFile);
}
private static void startReadingCityGmlZipEntry(CityGmlZipEntry entry, ParserConfiguration config, ProgressListener l,
CityGmlConsumer cityObjectConsumer, String outputFile) {
try (CityGmlZipEntryFile entryFile = new CityGmlZipEntryFile(entry);
ObservedInputStream ois = new ObservedInputStream(entryFile.getInputStream(), entry.getFileSize())) {
if (l != null) {
ois.addListener(l::updateProgress);
}
streamAndDiscardFeatures(entry, config, ois, cityObjectConsumer, outputFile);
} catch (IOException | CityGMLReadException e) {
logger.error(Localization.getText("CityGmlParser.errorReadingGmlFile"), e.getMessage());
logger.catching(Level.ERROR, e);
}
}
private static void streamAndDiscardFeatures(CityGmlZipEntry entry, ParserConfiguration config, ObservedInputStream ois,
CityGmlConsumer cityObjectConsumer, String outputFile) throws CityGMLReadException {
Citygml3FeatureMapper mapper = new Citygml3FeatureMapper(config, entry);
readAndDiscardModel(mapper, ois, cityObjectConsumer, outputFile);
}
private static void readAndDiscardModel(Citygml3FeatureMapper mapper, ObservedInputStream ois,
CityGmlConsumer cityObjectConsumer, String outputFile) throws CityGMLReadException {
getContext();
CityGMLInputFactory inputFactory = context.createCityGMLInputFactory()
.withChunking(ChunkOptions.chunkByProperties(chunkProperties).skipCityModel(false));
CityGMLChunkWriter writer = null;
try (CityGMLReader reader = inputFactory.createCityGMLReader(ois)) {
CityDoctorModel model = mapper.getModel();
boolean isInitialized = false;
while (reader.hasNext()) {
AbstractFeature chunk = reader.next();
if (writer == null) {
writer = createCityModelWriter(outputFile, reader);
}
if (!isInitialized && writer != null && reader.getParentInfo() != null
&& reader.getParentInfo().getTypeName().getLocalPart().equals("CityModel")) {
FeatureInfo parentInfo = reader.getParentInfo();
writer.withCityModelInfo(parentInfo);
isInitialized = true;
}
if (chunk instanceof AbstractCityObject ag) {
ag.accept(mapper);
drainCityModel(model, cityObjectConsumer);
writeAbstractCityObject(writer, ag);
} else if (chunk instanceof CityModel cModel) {
cModel.setCityObjectMembers(null);
mapper.setCityModel(cModel);
cityObjectConsumer.accept(cModel);
writeCityModel(writer, cModel);
} else if (writer != null) {
writer.writeMember(chunk);
}
}
// end of stream
logger.debug("End of gml file stream");
} catch (CityGMLReadException e) {
logger.error(Localization.getText("CityGmlParser.errorReadingGmlFile"), e.getMessage(), e);
} catch (CityGMLWriteException e) {
logger.error(Localization.getText("CityGmlParser.errorWritingGmlFile"), e.getMessage(), e);
} finally {
if (writer != null) {
try {
writer.close();
} catch (CityGMLWriteException e) {
// ignore
}
}
}
}
private static void writeCityModel(CityGMLChunkWriter writer, CityModel cModel) {
if (writer != null) {
for (ADEProperty genEle : cModel.getADEProperties()) {
writer.getCityModelInfo().addADEProperty(genEle);
}
}
}
private static void writeAbstractCityObject(CityGMLChunkWriter writer, AbstractCityObject ag)
throws CityGMLWriteException {
if (writer != null) {
writer.writeMember(ag);
}
}
private static CityGMLChunkWriter createCityModelWriter(String outputFile, CityGMLReader reader)
throws CityGMLWriteException {
if (outputFile == null) {
return null;
}
CityGMLContext gmlContext = CityGmlParser.getContext();
CityGMLVersion version = CityGMLModules.getCityGMLVersion(reader.getName().getNamespaceURI());
CityGMLOutputFactory factory = gmlContext.createCityGMLOutputFactory(version);
CityGMLChunkWriter writer = factory.createCityGMLChunkWriter(new File(outputFile),
StandardCharsets.UTF_8.name());
writer.withPrefix("qual", QualityADEModule.NAMESPACE_URI);
writer.withSchemaLocation(QualityADEModule.NAMESPACE_URI, QualityADEModule.NAMESPACE_URI + "/qualityAde.xsd");
writer.withIndent(" ");
writer.withDefaultPrefixes();
writer.withDefaultSchemaLocations();
return writer;
}
private static CityDoctorModel readAndKeepFeatures(ParserConfiguration config, Path file,
CityGMLInputFactory inputFactory, ObservedInputStream ois, boolean verbose) throws CityGMLReadException {
return readAndKeepModel(new Citygml3FeatureMapper(config, file), inputFactory, ois, verbose);
}
private static CityDoctorModel readAndKeepModel(Citygml3FeatureMapper mapper, CityGMLInputFactory inputFactory,
ObservedInputStream ois, boolean verbose) throws CityGMLReadException {
try (CityGMLReader reader = inputFactory.createCityGMLReader(ois)) {
CityGMLVersion version = null;
// model is read in chunked mode
// object members are replaced by href in model
// need to remove the refs and re-add unparsed objects
List<AbstractCityObject> acos = new ArrayList<>();
while (reader.hasNext()) {
AbstractFeature chunk = reader.next();
version = CityGMLModules.getCityGMLVersion(reader.getName().getNamespaceURI());
if (chunk instanceof CityModel cModel) {
cModel.setCityObjectMembers(null);
mapper.setCityModel(cModel);
mapper.setCityGMLVersion(version);
} else if (chunk instanceof AbstractCityObject aco) {
acos.add(aco);
aco.accept(mapper);
}
}
if (mapper.getModel().getCityModel() == null) {
// file does not contain a city model?
// create it for now
mapper.setCityModel(new CityModel());
}
CityModel cModel = mapper.getModel().getCityModel();
// remove those that should have been parsed
List<AbstractCityObject> parsedCityObjects = mapper.getModel().createFeatureStream()
.map(CityObject::getGmlObject).toList();
acos.removeAll(parsedCityObjects);
// re-add all not parsed objects
for (AbstractCityObject aco : acos) {
cModel.getCityObjectMembers().add(new AbstractCityObjectProperty(aco));
}
if (logger.isInfoEnabled() && verbose) {
logger.info(Localization.getText("CityGmlParser.parsedObjects"),
mapper.getModel().getNumberOfFeatures());
}
mapper.setCityGMLVersion(version);
return mapper.getModel();
}
}
private static void parseEpsgCodeFromFile(Path file, ParserConfiguration config) throws CityGmlParseException {
try (BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file.toFile()))) {
parseEpsgCodeFromStream(bis, config);
} catch (ParserConfigurationException | SAXException | IOException e) {
throw new CityGmlParseException("Failed to read CityGML file", e);
}
}
private static void parseEpsgCodeFromStream(InputStream is, ParserConfiguration config)
throws ParserConfigurationException, SAXException {
SAXParser parser = FACTORY.newSAXParser();
CityGmlHandler handler = new CityGmlHandler();
try {
parser.parse(new InputSource(is), handler);
} catch (EnvelopeFoundException e) {
try {
parseCoordinateSystem(config, handler);
} catch (Exception e2) {
logEpsgParseError(e2);
}
} catch (Exception e) {
logEpsgParseError(e);
}
if (handler.getEpsg() == null && logger.isInfoEnabled()) {
logger.info(Localization.getText("CityGmlParser.missingEPSGCode"));
}
}
private static void parseEpsgCodeFromBuffer(byte[] buffer, ParserConfiguration config)
throws ParserConfigurationException, SAXException {
InputStream is = new ByteArrayInputStream(buffer);
SAXParser parser = FACTORY.newSAXParser();
CityGmlHandler handler = new CityGmlHandler();
try {
parser.parse(new InputSource(is), handler);
} catch (EnvelopeFoundException e) {
try {
parseCoordinateSystem(config, handler);
} catch (Exception e2) {
logEpsgParseError(e2);
}
} catch (SAXParseException spe) {
// suppress XML document structure warning
if (!spe.getMessage().matches("XML document structures must start and end within the same entity.")) {
logEpsgParseError(spe);
}
} catch (Exception e) {
logEpsgParseError(e);
}
if (handler.getEpsg() == null && logger.isInfoEnabled()) {
logger.info(Localization.getText("CityGmlParser.missingEPSGCode"));
}
}
private static void logEpsgParseError(Exception e) {
logger.debug("Exception while parsing for EPSG code", e);
if (logger.isWarnEnabled()) {
logger.warn(Localization.getText("CityGmlParser.failedEPSGParse"));
}
}
private static void parseCoordinateSystem(ParserConfiguration config, CityGmlHandler handler) {
if (handler.getEpsg() == null) {
return;
}
CoordinateReferenceSystem crs = crsFromSrsName(handler.getEpsg());
if (crs == null) {
// could not find a coordinate system for srsName
// assuming metric system
if (logger.isInfoEnabled()) {
logger.info(Localization.getText("CityGmlParser.missingEPSGCode"));
}
return;
}
if (crs.getProjection().getUnits() == Units.METRES) {
// coordinate system is in meters, do not convert
if (logger.isInfoEnabled()) {
logger.info(Localization.getText("CityGmlParser.noConversionNeeded"));
}
return;
}
parseMeterConversion(config, crs);
Vector3d low = handler.getLowerCorner();
Vector3d up = handler.getUpperCorner();
double centerLong = low.getX() + ((up.getX() - low.getX()) / 2);
double centerLat = low.getY() + ((up.getY() - low.getY()) / 2);
if (!crs.getName().equals(WGS_84)) {
// need to convert coordinates first to WGS84, then find UTM Zone
CoordinateReferenceSystem wgs84 = crsFromSrsName(WGS_84);
ProjCoordinate p1 = new ProjCoordinate();
p1.setValue(centerLong, centerLat);
ProjCoordinate p2 = new ProjCoordinate();
BasicCoordinateTransform bct = new BasicCoordinateTransform(crs, wgs84);
bct.transform(p1, p2);
centerLong = p2.x;
centerLat = p2.y;
}
int zone = (int) (31 + Math.round(centerLong / 6));
CoordinateReferenceSystem utm;
if (centerLat < 0) {
// south
logger.info("Converting coordiante system to UTM zone {}S", zone);
utm = CRS_FACTORY.createFromParameters("UTM", "+proj=utm +ellps=WGS84 +units=m +zone=" + zone + " +south");
} else {
// north
logger.info("Converting coordiante system to UTM zone {}N", zone);
utm = CRS_FACTORY.createFromParameters("UTM", "+proj=utm +ellps=WGS84 +units=m +zone=" + zone);
}
config.setCoordinateSystem(crs, utm);
}
private static void parseMeterConversion(ParserConfiguration config, CoordinateReferenceSystem crs) {
Projection projection = crs.getProjection();
double fromMetres = projection.getFromMetres();
if (fromMetres > 0) {
// also transform height information
config.setFromMeters(fromMetres);
} else {
config.setFromMeters(1.0);
}
}
/**
* The srsName (The name by which this reference system is identified) inside
* the CityGML file can have multiple formats. This method tries to parse the
* string and detect the corresponding reference system. If it is found, it
* returns a proj4j.CoordinateReferenceSystem. It throws an
* IllegalArgumentException otherwise.
* <p>
* This method should be able to parse any EPSG id : e.g. "EPSG:1234". German
* Citygmls might also have "DE_DHDN_3GK3" or "ETRS89_UTM32" as srsName, so
* those are also included. It isn't guaranteed that those formats are correctly
* parsed, though.
* <p>
* The EPSG ids and parameters are defined in resources ('nad/epsg') inside
* proj4j-0.1.0.jar. Some EPSG ids are missing though, e.g. 7415
*
* @param srsName
* @return CoordinateReferenceSystem
*/
private static CoordinateReferenceSystem crsFromSrsName(String srsName) {
srsName = srsName.trim();
Matcher mEPSG = P_EPSG.matcher(srsName);
if (mEPSG.find()) {
if ("EPSG:4979".contentEquals(srsName)) {
srsName = "EPSG:4236";
} else if ("EPSG:7415".contentEquals(srsName)) {
return CRS_FACTORY.createFromParameters("EPSG:7415",
"+proj=sterea +lat_0=52.15616055555555 +lon_0=5.38763888888889 +k=0.9999079 +x_0=155000 +y_0=463000 +ellps=bessel +towgs84=565.417,50.3319,465.552,-0.398957,0.343988,-1.8774,4.0725 +units=m +no_defs");
}
return CRS_FACTORY.createFromName(srsName);
}
Matcher mOGC = P_OGC.matcher(srsName);
if (mOGC.find()) {
return getCrsFromOGCSrsCode(mOGC.group(1));
}
Matcher mOGC2 = P_OGC2.matcher(srsName);
if (mOGC2.find()) {
return getCrsFromOGCSrsCode(mOGC2.group(1));
}
Matcher mURN = P_URN.matcher(srsName);
// NOTE: Could use a HashMap if the switch/case becomes too long.
if (mURN.find()) {
return switch (mURN.group(1)) {
case "DE_DHDN_3GK2" -> CRS_FACTORY.createFromName("EPSG:31466");
case "DE_DHDN_3GK3" -> CRS_FACTORY.createFromName("EPSG:31467");
......@@ -525,59 +705,70 @@ public class CityGmlParser {
case "ETRS89_UTM32" -> CRS_FACTORY.createFromName("EPSG:25832");
default -> null;
};
}
if (srsName.equals("http://www.opengis.net/def/crs/EPSG/0/6697")) {
return CRS_FACTORY.createFromParameters("EPSG:6697", "+proj=longlat +ellps=GRS80 +no_defs +axis=neu");
}
return null;
}
private static List<String> validateFile(CityGMLContext context, GMLValidationHandler handler, Path file)
throws CityGmlParseException {
if (handler == null) {
handler = new GMLValidationHandler();
}
try {
SchemaHandler schemaHandler = new ValidationSchemaHandler(context.getDefaultSchemaHandler());
}
if (srsName.equals("http://www.opengis.net/def/crs/EPSG/0/6697")) {
return CRS_FACTORY.createFromParameters("EPSG:6697", "+proj=longlat +ellps=GRS80 +no_defs +axis=neu");
}
return null;
}
private static CoordinateReferenceSystem getCrsFromOGCSrsCode(String srsCode) {
String crsName = "EPSG:" + srsCode;
List<String> params = new ArrayList<>(Arrays.stream(csReader.getParameters(crsName)).toList());
params.removeIf(P_VUNITS.asPredicate());
params.removeIf(P_GEOIDGRID.asPredicate());
return CRS_FACTORY.createFromParameters(crsName, params.toArray(new String[0]));
}
private static List<String> validateFile(CityGMLContext context, GMLValidationHandler handler, Path file)
throws CityGmlParseException {
if (handler == null) {
handler = new GMLValidationHandler();
}
try {
SchemaHandler schemaHandler = new ValidationSchemaHandler(context.getDefaultSchemaHandler());
readAdditionalSchemaDefinitions(context, file, schemaHandler);
Source[] schemas = schemaHandler.getSchemas();
SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
schemaFactory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
Schema schema = schemaFactory.newSchema(schemas);
Validator validator = schema.newValidator();
validator.setErrorHandler(handler);
validator.validate(new StreamSource(file.toFile()));
return handler.getMessages();
} catch (SchemaHandlerException | SAXException | IOException e) {
throw new CityGmlParseException("Failed to validate CityGML file", e);
}
}
private static void readAdditionalSchemaDefinitions(CityGMLContext context, Path file, SchemaHandler schemaHandler)
throws CityGmlParseException {
try (XMLReader reader = XMLReaderFactory.newInstance(context.getXMLObjects())
.withSchemaHandler(schemaHandler)
.createReader(file)) {
reader.nextTag();
} catch (Exception e) {
throw new CityGmlParseException("Failed to read file " + file.toAbsolutePath() + ".", e);
}
}
private static void drainCityModel(CityDoctorModel model, CityGmlConsumer cityObjectConsumer) {
drainCityObjectList(model.getBuildings(), cityObjectConsumer);
drainCityObjectList(model.getBridges(), cityObjectConsumer);
drainCityObjectList(model.getVegetation(), cityObjectConsumer);
drainCityObjectList(model.getLand(), cityObjectConsumer);
drainCityObjectList(model.getTransportation(), cityObjectConsumer);
drainCityObjectList(model.getWater(), cityObjectConsumer);
}
private static void drainCityObjectList(List<? extends CityObject> objects, CityGmlConsumer cityObjectConsumer) {
for (CityObject co : objects) {
cityObjectConsumer.accept(co);
}
objects.clear();
}
Source[] schemas = schemaHandler.getSchemas();
SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
schemaFactory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
Schema schema = schemaFactory.newSchema(schemas);
Validator validator = schema.newValidator();
validator.setErrorHandler(handler);
validator.validate(new StreamSource(file.toFile()));
return handler.getMessages();
} catch (SchemaHandlerException | SAXException | IOException e) {
throw new CityGmlParseException("Failed to validate CityGML file", e);
}
}
private static void readAdditionalSchemaDefinitions(CityGMLContext context, Path file, SchemaHandler schemaHandler)
throws CityGmlParseException {
try (XMLReader reader = XMLReaderFactory.newInstance(context.getXMLObjects())
.withSchemaHandler(schemaHandler)
.createReader(file)) {
reader.nextTag();
} catch (Exception e) {
throw new CityGmlParseException("Failed to read file " + file.toAbsolutePath() + ".", e);
}
}
private static void drainCityModel(CityDoctorModel model, CityGmlConsumer cityObjectConsumer) {
drainCityObjectList(model.getBuildings(), cityObjectConsumer);
drainCityObjectList(model.getBridges(), cityObjectConsumer);
drainCityObjectList(model.getVegetation(), cityObjectConsumer);
drainCityObjectList(model.getLand(), cityObjectConsumer);
drainCityObjectList(model.getTransportation(), cityObjectConsumer);
drainCityObjectList(model.getWater(), cityObjectConsumer);
drainCityObjectList(model.getTunnels(), cityObjectConsumer);
drainCityObjectList(model.getCityFurniture(), cityObjectConsumer);
drainCityObjectList(model.getGenericCityObjects(), cityObjectConsumer);
}
private static void drainCityObjectList(List<? extends CityObject> objects, CityGmlConsumer cityObjectConsumer) {
for (CityObject co : objects) {
cityObjectConsumer.accept(co);
}
objects.clear();
}
}
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());
}
}
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);
}
......@@ -18,6 +18,9 @@ CheckDialog.parameterValue=Value
CheckDialog.parameterUnit=Unit
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!
ExceptionDialog.stacktrace=The exception stacktrace was:
FilterPane.buildings=Buildings
FilterPane.bridges=Bridges
......@@ -32,6 +35,7 @@ MainToolBar.executeChecks=Execute Checks
MainToolBar.showWorld=Show entire city model
MainToolBar.resetCamera=Reset view
MainToolBar.hideRoof=Show/Hide roof BoundarySurfaces
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
......@@ -43,7 +47,12 @@ MainWindow.finishedPdf=Finished pdf report
MainWindow.loadFailed=Failed to load given gml file: {}
MainWindow.all=All
MainWindow.withErrors=With errors
MainWindow.export=Export
MainWindow.export=Export feature
MainWindow.copyId=Copy GML-ID
MainWindow.delete=Delete feature
MainWindow.infoTopLevelExport=Only top-level object can be exported!
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.languageChange=For the change in language to apply, restart CityDoctor2.
MainWindow.buildingsTab=Buildings
......@@ -67,6 +76,7 @@ MainWindow.verticesTab=Vertices
MainWindow.attributeTab=Attributes
MainWindow.logTab=Log
MainWindow.globalErrorsTab=Global Errors
MainWindow.focusCityObject=Focus object
OpenFileDialog.fileLabel=File:
OpenFileDialog.selectBtn=Select
OpenFileDialog.loadBtn=Load
......@@ -96,6 +106,37 @@ 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
WriteReportDialog.cancelBtn=Cancel
WriteReportDialog.errorStatisticsLabel=Error Statistics
......@@ -114,7 +155,8 @@ 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.noEPSG=Could not read EPSG code, assuming metric system
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.
......
......@@ -16,6 +16,9 @@ CheckDialog.parameterValue=Wert
CheckDialog.parameterUnit=Einheit
CityDoctorController.noDatamodel=Datenmodell ist null, keine Pr\u00fcfungen konnten ausgef\u00fchrt werden
CityDoctorController.noSourceFile=Quelldatei ist null, keine Pr\u00fcfungen konnten ausgef\u00fchrt werden
CityDoctorController.noZipFile=ZIP-Archiv ist null, keine Pr\u00fcfungen konnten ausgef\u00fchrt werden
CityDoctorController.exportSuccess=Feature export erfolgreich abgeschlossen
CityDoctorController.saveZipArchiveReports=Validierungsberichte erfolgreich exportiert!
ExceptionDialog.stacktrace=Der Stacktrace des Fehlers war:
FilterPane.buildings=Geb\u00e4ude
FilterPane.bridges=Br\u00fccken
......@@ -30,6 +33,7 @@ MainToolBar.executeChecks=F\u00fchre Pr\u00fcfungen aus
MainToolBar.showWorld=Gesamtes Stadtmodell anzeigen
MainToolBar.resetCamera=Ansicht zur\u00fccksetzen
MainToolBar.hideRoof=Zeige/Verstecke Dach BoundarySurfaces
MainToolBar.zip=Zip-eintrag Auswahlfenster \u00f6ffnen
MainWindow.missingConfig=Konnte Konfigurationsdatei nicht finden.
MainWindow.loadGivenFile=Lade vorhandene Datei, bitte warten
MainWindow.finishedLoading=Fertig geladen
......@@ -41,7 +45,12 @@ MainWindow.finishedPdf=Pdf Report abgeschlossen
MainWindow.loadFailed=Konnte GML-Datei nicht laden: {}
MainWindow.all=Alle
MainWindow.withErrors=Mit Fehlern
MainWindow.export=Exportieren
MainWindow.export=Feature Exportieren
MainWindow.copyId=GML-ID kopieren
MainWindow.delete=Feature L\u00f6schen
MainWindow.infoTopLevelExport=Export ist nur f\u00fcr Featureobjekt basis m\u00f6glich!
MainWindow.infoTopLevelCopyID=GML-ID kann nur von Featureobjekt basis kopiert werden!
mainWindow.warnCopyIdFailed=Kopieren der ID fehlgeschlagen!
OpenFileDialog.select=W\u00e4hle CityGML Datei aus
MainWindow.languageChange=Um die Spracheinstellung zu \u00fcbernehmen muss CityDoctor2 neugestartet werden.
MainWindow.buildingsTab=Geb\u00e4ude
......@@ -65,6 +74,7 @@ MainWindow.verticesTab=Punkte
MainWindow.attributeTab=Attribute
MainWindow.logTab=Log
MainWindow.globalErrorsTab=Globale Fehler
MainWindow.focusCityObject=Objekt fokussieren
OpenFileDialog.fileLabel=Datei:
OpenFileDialog.selectBtn=Ausw\u00e4hlen
OpenFileDialog.loadBtn=Laden
......@@ -94,6 +104,37 @@ CheckDialog.schematronFileLabel=Schematron Datei
CheckDialog.selectBtn=Ausw\u00e4hlen
CheckDialog.checkBtn=Pr\u00fcfen
CheckDialog.cancelBtn=Abbrechen
CheckDialog.streamCheckOption=Niedrigen Arbeitsspeicherverbrauchsmodus aktivieren
CheckDialog.streamCheckLabel=Stadtmodelle werden nicht in den Arbeitsspeicher geladen. Ergebnisse werden in der QualityADE in Kopien der Eingangsdateien gespeichert.
CheckDialog.outputPathLabel=Ausgabeordner (Pflichtfeld):
CheckDialog.outputPathBtn=Ausw\u00e4hlen
CheckDialog.pdfReportsOption=PDF Berichte erstellen
CheckDialog.xmlReportsOption=XML Berichte erstellen
CheckDialog.noPathError=Ausgabepfad wurde nicht gesetzt!
ZipEntryManager.title=Zipeintrag Manager
ZipEntryManager.entryListTitle=Zipeintr\u00e4ge
ZipEntryManager.metadata=Metadaten
ZipEntryManager.subpathLbl=Unterpfad:
ZipEntryManager.erroneousLbl=Fehlerhaft:
ZipEntryManager.excessiveFileSize=Datei zu gro\u00DF
ZipEntryManager.invalidCityGml=Ung\u00fcltige CityGML Datei
ZipEntryManager.ioError=Dateizugriff fehlgeschlagen
ZipEntryManager.filesizeLbl=Dateigr\u00f6\u00DFe:
ZipEntryManager.validatedLbl=Validiert:
ZipEntryManager.objectCountLbl=Objektanzahl:
ZipEntryManager.loadBtn=CityGML Modell laden
ZipEntryManager.decompressBtn=Datei entpacken
ZipEntryManager.decompressAllBtn=Alle Dateien entpacken
ZipEntryManager.checkAllBtn=Alle Dateien pr\u00fcfen
ZipEntryManager.showReportBtn=Fehlerstatistik anzeigen
ZipEntryManager.saveBtn=Validierungsergebnisse exportieren
ZipEntryManager.cancelBtn=Abbruch
ZipEntryManager.unknownValue=Unbekannt
ZipEntryManager.yes=Ja
ZipEntryManager.no=Nein
CityGmlZipArchive.ioError=Zugriff auf ZIP-Datei fehlgeschlagen
CityGmlZipArchive.malformedZipFile=Einlesen des ZIP-Archivs abgebrochen, ZIP-Datei ist fehlerhaft!
CityGmlZipArchive.generalException=Unerwarteter Fehler beim Einlesen des ZIP-Archivs
WriteReportDialog.writeBtn=Speichern
WriteReportDialog.cancelBtn=Abbrechen
WriteReportDialog.errorStatisticsLabel=Fehler Statistik
......@@ -104,7 +145,7 @@ WriteReportDialog.xAxisLabel=Fehler
WriteReportDialog.yAxisLabel=Anzahl
Unit.Radian=Radiant
Unit.Degree=Grad
FeatureMapper.polygonUnreferenced=Polygon {} ist referenziert wurde aber nicht gefunden
FeatureMapper.polygonUnreferenced=Polygon {} ist referenziert, konnte aber nicht gefunden werden
GeometryMapper.emptyPolygon=Polygon ohne externen Ring gefunden, ignoriere
CityGmlParser.parsedObjects=Modell mit {} Objekten gelesen
CityGmlParser.chunkReadFailed=Konnte Datei nicht in St\u00fccken lesen, versuche komplett zu lesen
......@@ -112,7 +153,8 @@ CityGmlParser.notValidGmlFile=Dies ist keine korrekte CityGML Datei\n
CityGmlParser.errorReadingGmlFile=Fehler beim lesen der CityGML Datei\n{}
CityGmlParser.errorWritingGmlFile=Fehler beim schreiben der CityGML Datei\n{}
CityGmlParser.noConversionNeeded=Koordinatensystem in Metern, keine Konvertierung notwendig
CityGmlParser.noEPSG=Konnte EPSG Code nicht lesen, nehme metrisches System an
CityGmlParser.failedEPSGParse=Lesen des EPSG Codes fehlgeschlagen, greife auf metrisches System zur\u00fcck
CityGmlParser.missingEPSGCode=Kein EPSG Code gefunden, nehme metrisches System an
OpenFileDialog.loadFailed=Konnte CityGML Datei nicht laden
MainWindow.memoryLabel=Speicher:
CheckDialog.checksReenabledAlert=Manche Pr\u00fcfungen wurden reaktiviert damit andere gewollte Pr\u00fcfungen durchgef\u00fchrt werden k\u00f6nnen\nMehr Details sind im Log geschrieben
......
......@@ -348,6 +348,11 @@ public class AbstractBuildingTest {
return null;
}
@Override
public CityObject getTopLevelCityObject(){
return null;
}
};
return ab;
}
......
......@@ -47,7 +47,7 @@ public class BridgeObjectTest {
@Test
public void testAccept() {
BridgeObject bo = new BridgeObject(BridgeType.BRIDGE, mock(AbstractBridge.class));
BridgeObject bo = new BridgeObject(mock(AbstractBridge.class));
bo.addBoundarySurface(new BoundarySurface(null));
AtomicInteger boCounter = new AtomicInteger(0);
AtomicInteger bsCounter = new AtomicInteger(0);
......@@ -75,7 +75,7 @@ public class BridgeObjectTest {
@Test
public void testPrepareForChecking() {
BridgeObject bo = new BridgeObject(BridgeType.BRIDGE, mock(AbstractBridge.class));
BridgeObject bo = new BridgeObject(mock(AbstractBridge.class));
BoundarySurface bsMock = mock(BoundarySurface.class);
bo.addBoundarySurface(bsMock);
bo.prepareForChecking();
......@@ -84,7 +84,7 @@ public class BridgeObjectTest {
@Test
public void testClearMetaInformation() {
BridgeObject bo = new BridgeObject(BridgeType.BRIDGE, mock(AbstractBridge.class));
BridgeObject bo = new BridgeObject(mock(AbstractBridge.class));
BoundarySurface bsMock = mock(BoundarySurface.class);
bo.addBoundarySurface(bsMock);
bo.clearMetaInformation();
......@@ -93,7 +93,7 @@ public class BridgeObjectTest {
@Test
public void testContainsError() {
BridgeObject bo = new BridgeObject(BridgeType.BRIDGE, mock(AbstractBridge.class));
BridgeObject bo = new BridgeObject(mock(AbstractBridge.class));
assertFalse(bo.containsError(CheckId.C_GE_P_HOLE_OUTSIDE));
bo.addCheckResult(new CheckResult(CheckId.C_GE_P_HOLE_OUTSIDE, ResultStatus.ERROR, mock(CheckError.class)));
assertTrue(bo.containsError(CheckId.C_GE_P_HOLE_OUTSIDE));
......@@ -101,7 +101,7 @@ public class BridgeObjectTest {
@Test
public void testContainsError2() {
BridgeObject bo = new BridgeObject(BridgeType.BRIDGE, mock(AbstractBridge.class));
BridgeObject bo = new BridgeObject(mock(AbstractBridge.class));
BoundarySurface bsMock = mock(BoundarySurface.class);
bo.addBoundarySurface(bsMock);
assertFalse(bo.containsError(CheckId.C_GE_P_HOLE_OUTSIDE));
......@@ -111,7 +111,7 @@ public class BridgeObjectTest {
@Test
public void testClearAllContainedCheckResults() {
BridgeObject bo = new BridgeObject(BridgeType.BRIDGE, mock(AbstractBridge.class));
BridgeObject bo = new BridgeObject(mock(AbstractBridge.class));
BoundarySurface bsMock = mock(BoundarySurface.class);
bo.addBoundarySurface(bsMock);
bo.clearAllContainedCheckResults();
......@@ -120,7 +120,7 @@ public class BridgeObjectTest {
@Test
public void testContainsAnyError() {
BridgeObject bo = new BridgeObject(BridgeType.BRIDGE, mock(AbstractBridge.class));
BridgeObject bo = new BridgeObject(mock(AbstractBridge.class));
BoundarySurface bsMock = mock(BoundarySurface.class);
bo.addBoundarySurface(bsMock);
bo.containsAnyError();
......@@ -129,14 +129,14 @@ public class BridgeObjectTest {
when(bsMock.containsAnyError()).thenReturn(true);
assertTrue(bo.containsAnyError());
BridgeObject bo2 = new BridgeObject(BridgeType.BRIDGE, mock(AbstractBridge.class));
BridgeObject bo2 = new BridgeObject(mock(AbstractBridge.class));
bo2.addCheckResult(new CheckResult(CheckId.C_GE_P_HOLE_OUTSIDE, ResultStatus.ERROR, mock(CheckError.class)));
assertTrue(bo2.containsAnyError());
}
@Test
public void testCollectContainedErrors() {
BridgeObject bo = new BridgeObject(BridgeType.BRIDGE, mock(AbstractBridge.class));
BridgeObject bo = new BridgeObject(mock(AbstractBridge.class));
BoundarySurface bsMock = mock(BoundarySurface.class);
bo.addBoundarySurface(bsMock);
ArrayList<CheckError> errors = new ArrayList<>();
......@@ -146,7 +146,7 @@ public class BridgeObjectTest {
@Test
public void testReCreateGeometries() {
BridgeObject bo = new BridgeObject(BridgeType.BRIDGE, mock(AbstractBridge.class));
BridgeObject bo = new BridgeObject(mock(AbstractBridge.class));
BoundarySurface bsMock = mock(BoundarySurface.class);
bo.addBoundarySurface(bsMock);
GeometryFactory factoryMock = mock(GeometryFactory.class);
......@@ -157,7 +157,7 @@ public class BridgeObjectTest {
@Test
public void testReCreateGeometriesMultiSurfaceLod1() {
BridgeObject bo = new BridgeObject(BridgeType.BRIDGE, mock(AbstractBridge.class));
BridgeObject bo = new BridgeObject(mock(AbstractBridge.class));
Geometry geom = GeometryTestUtils.createDummyGeometry(GeometryType.MULTI_SURFACE, Lod.LOD1);
AbstractBridge ab = new Bridge();
bo.setGmlObject(ab);
......@@ -172,7 +172,7 @@ public class BridgeObjectTest {
@Test
public void testReCreateGeometriesMultiSurfaceLod2() {
BridgeObject bo = new BridgeObject(BridgeType.BRIDGE, mock(AbstractBridge.class));
BridgeObject bo = new BridgeObject(mock(AbstractBridge.class));
Geometry geom = GeometryTestUtils.createDummyGeometry(GeometryType.MULTI_SURFACE, Lod.LOD2);
AbstractBridge ab = new Bridge();
bo.setGmlObject(ab);
......@@ -186,7 +186,7 @@ public class BridgeObjectTest {
@Test
public void testReCreateGeometriesMultiSurfaceLod3() {
BridgeObject bo = new BridgeObject(BridgeType.BRIDGE, mock(AbstractBridge.class));
BridgeObject bo = new BridgeObject(mock(AbstractBridge.class));
Geometry geom = GeometryTestUtils.createDummyGeometry(GeometryType.MULTI_SURFACE, Lod.LOD3);
AbstractBridge ab = new Bridge();
bo.setGmlObject(ab);
......@@ -200,7 +200,7 @@ public class BridgeObjectTest {
@Test
public void testReCreateGeometriesMultiSurfaceLod4() {
BridgeObject bo = new BridgeObject(BridgeType.BRIDGE, mock(AbstractBridge.class));
BridgeObject bo = new BridgeObject(mock(AbstractBridge.class));
Geometry geom = GeometryTestUtils.createDummyGeometry(GeometryType.MULTI_SURFACE, Lod.LOD4);
AbstractBridge ab = new Bridge();
bo.setGmlObject(ab);
......@@ -214,7 +214,7 @@ public class BridgeObjectTest {
@Test
public void testReCreateGeometriesSolidLod1() {
BridgeObject bo = new BridgeObject(BridgeType.BRIDGE, mock(AbstractBridge.class));
BridgeObject bo = new BridgeObject(mock(AbstractBridge.class));
Geometry geom = GeometryTestUtils.createDummyGeometry(GeometryType.SOLID, Lod.LOD1);
AbstractBridge ab = new Bridge();
bo.setGmlObject(ab);
......@@ -228,7 +228,7 @@ public class BridgeObjectTest {
@Test
public void testReCreateGeometriesSolidLod2() {
BridgeObject bo = new BridgeObject(BridgeType.BRIDGE, mock(AbstractBridge.class));
BridgeObject bo = new BridgeObject(mock(AbstractBridge.class));
Geometry geom = GeometryTestUtils.createDummyGeometry(GeometryType.SOLID, Lod.LOD2);
AbstractBridge ab = new Bridge();
bo.setGmlObject(ab);
......@@ -242,7 +242,7 @@ public class BridgeObjectTest {
@Test
public void testReCreateGeometriesSolidLod3() {
BridgeObject bo = new BridgeObject(BridgeType.BRIDGE, mock(AbstractBridge.class));
BridgeObject bo = new BridgeObject(mock(AbstractBridge.class));
Geometry geom = GeometryTestUtils.createDummyGeometry(GeometryType.SOLID, Lod.LOD3);
AbstractBridge ab = new Bridge();
bo.setGmlObject(ab);
......@@ -256,7 +256,7 @@ public class BridgeObjectTest {
@Test
public void testReCreateGeometriesSolidLod4() {
BridgeObject bo = new BridgeObject(BridgeType.BRIDGE, mock(AbstractBridge.class));
BridgeObject bo = new BridgeObject(mock(AbstractBridge.class));
Geometry geom = GeometryTestUtils.createDummyGeometry(GeometryType.SOLID, Lod.LOD4);
AbstractBridge ab = new Bridge();
bo.setGmlObject(ab);
......@@ -273,7 +273,7 @@ public class BridgeObjectTest {
AbstractBridge abMock = mock(AbstractBridge.class);
DeprecatedPropertiesOfAbstractBridge propsMock = mock(DeprecatedPropertiesOfAbstractBridge.class);
when(abMock.getDeprecatedProperties()).thenReturn(propsMock);
BridgeObject bo = new BridgeObject(BridgeType.BRIDGE, abMock);
BridgeObject bo = new BridgeObject(abMock);
BoundarySurface bsMock = mock(BoundarySurface.class);
bo.addBoundarySurface(bsMock);
......@@ -293,14 +293,14 @@ public class BridgeObjectTest {
@Test
public void testGetFeatureType() {
AbstractBridge abMock = mock(AbstractBridge.class);
BridgeObject bo = new BridgeObject(BridgeType.BRIDGE, abMock);
BridgeObject bo = new BridgeObject(abMock);
assertEquals(FeatureType.BRIDGE, bo.getFeatureType());
}
@Test
public void testGetType() {
AbstractBridge abMock = mock(AbstractBridge.class);
BridgeObject bo = new BridgeObject(BridgeType.BRIDGE, abMock);
BridgeObject bo = new BridgeObject( abMock);
assertEquals(BridgeType.BRIDGE, bo.getType());
bo.setType(BridgeType.BRIDGE_PART);
assertEquals(BridgeType.BRIDGE_PART, bo.getType());
......@@ -309,7 +309,7 @@ public class BridgeObjectTest {
@Test
public void testGetGmlObject() {
AbstractBridge abMock = mock(AbstractBridge.class);
BridgeObject bo = new BridgeObject(BridgeType.BRIDGE, abMock);
BridgeObject bo = new BridgeObject(abMock);
assertEquals(abMock, bo.getGmlObject());
AbstractBridge abMock2 = mock(AbstractBridge.class);
bo.setGmlObject(abMock2);
......
package de.hft.stuttgart.citydoctor2.zip;
import de.hft.stuttgart.citydoctor2.datastructure.CityDoctorModel;
import de.hft.stuttgart.citydoctor2.parser.ParserConfiguration;
import org.apache.commons.io.FileUtils;
import org.junit.Test;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
public class ZipTest {
ParserConfiguration config = new ParserConfiguration(8, false);
@Test
public void testUnzipping() throws MalformedZipFileException {
CityGmlZipArchive cgmlArch = CityGmlZipArchive.register("src/test/resources/zip/mock_archive.zip");
assertNotNull(cgmlArch);
cgmlArch.mountArchive(config);
checkMockArchive(cgmlArch);
}
private void checkMockArchive(CityGmlZipArchive cgmlArch) {
assertEquals(5, cgmlArch.getEntries().size());
for (CityGmlZipEntry entry : cgmlArch.getEntries()) {
assertNotNull(entry);
assertTrue(entry.getEntrySubPath().matches("^mock[1-5].gml$"));
assertNull(entry.getErrorType());
assertNotNull(entry.getModel());
assertEquals(1, entry.getModel().getNumberOfFeatures());
}
}
@Test
public void testZipping() throws IOException {
CityGmlZipArchive cgmlArch = CityGmlZipArchive.register("src/test/resources/zip/mock_archive.zip");
assertNotNull(cgmlArch);
cgmlArch.mountArchive(config);
Path tmpDir = null;
try {
tmpDir = Files.createTempDirectory("testTmp");
tmpDir.toFile().deleteOnExit();
String expPath = tmpDir + "/export.zip";
cgmlArch.exportToZipFile(expPath);
CityGmlZipArchive cgmlExport = CityGmlZipArchive.register(expPath);
assertNotNull(cgmlExport);
cgmlExport.mountArchive(config);
checkMockArchive(cgmlExport);
} finally {
if (tmpDir != null) {
FileUtils.deleteDirectory(tmpDir.toFile());
}
}
}
@Test
public void testEpsgParsing() throws MalformedZipFileException {
CityGmlZipArchive cgmlArch = CityGmlZipArchive.register("src/test/resources/zip/epsg.zip");
assertNotNull(cgmlArch);
cgmlArch.mountArchive(config);
CityGmlZipEntry entry = cgmlArch.getEntry("epsg1.gml");
assertNotNull(entry);
String srsName = entry.getModel().getCityModel().getBoundedBy().getEnvelope().getSrsName().split(":")[6];
assertEquals("25832", srsName);
entry = cgmlArch.getEntry("epsg2.gml");
assertNotNull(entry);
srsName = entry.getModel().getCityModel().getBoundedBy().getEnvelope().getSrsName().split(":")[6];
assertEquals("7415", srsName);
}
@Test
public void testXMLValidation() throws MalformedZipFileException {
ParserConfiguration valConfig = new ParserConfiguration(8, true);
CityGmlZipArchive cgmlArch = CityGmlZipArchive.register("src/test/resources/zip/validate.zip");
assertNotNull(cgmlArch);
cgmlArch.mountArchive(valConfig);
assertNull(cgmlArch.getEntry("valCorrect.gml").getErrorType());
assertEquals(ZipEntryErrorType.INVALID_CITY_GML_FILE, cgmlArch.getEntry("valFaulty.gml").getErrorType());
}
@Test
public void testImplicitParsing() throws MalformedZipFileException {
CityGmlZipArchive cgmlArch = CityGmlZipArchive.register("src/test/resources/zip/implicit.zip");
assertNotNull(cgmlArch);
cgmlArch.mountArchive(config);
CityDoctorModel mainModel = cgmlArch.getEntry("Main_model.gml").getModel();
assertEquals(18, mainModel.getGenericCityObjects().size());
}
}
<?xml version="1.0" encoding="utf-8"?>
<core:CityModel xmlns:core="http://www.opengis.net/citygml/2.0" xmlns:gen="http://www.opengis.net/citygml/generics/2.0" xmlns:bldg="http://www.opengis.net/citygml/building/2.0" xmlns:app="http://www.opengis.net/citygml/appearance/2.0" xmlns:dem="http://www.opengis.net/citygml/relief/2.0" xmlns:gml="http://www.opengis.net/gml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/citygml/building/2.0 http://schemas.opengis.net/citygml/building/2.0/building.xsd http://www.opengis.net/citygml/appearance/2.0 http://schemas.opengis.net/citygml/appearance/2.0/appearance.xsd http://www.opengis.net/citygml/relief/2.0 http://schemas.opengis.net/citygml/relief/2.0/relief.xsd http://www.opengis.net/citygml/2.0 http://schemas.opengis.net/citygml/2.0/cityGMLBase.xsd http://www.opengis.net/citygml/generics/2.0 http://schemas.opengis.net/citygml/generics/2.0/generics.xsd">
<gml:boundedBy>
<gml:Envelope srsDimension="3" srsName="urn:ogc:def:crs:EPSG::25832">
<gml:lowerCorner>357978.09 5654873.32 0.00</gml:lowerCorner>
<gml:upperCorner>359213.91 5656013.49 0.00</gml:upperCorner>
</gml:Envelope>
</gml:boundedBy>
</core:CityModel>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<core:CityModel xmlns:core="http://www.opengis.net/citygml/2.0" xmlns:gen="http://www.opengis.net/citygml/generics/2.0" xmlns:bldg="http://www.opengis.net/citygml/building/2.0" xmlns:app="http://www.opengis.net/citygml/appearance/2.0" xmlns:dem="http://www.opengis.net/citygml/relief/2.0" xmlns:gml="http://www.opengis.net/gml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/citygml/building/2.0 http://schemas.opengis.net/citygml/building/2.0/building.xsd http://www.opengis.net/citygml/appearance/2.0 http://schemas.opengis.net/citygml/appearance/2.0/appearance.xsd http://www.opengis.net/citygml/relief/2.0 http://schemas.opengis.net/citygml/relief/2.0/relief.xsd http://www.opengis.net/citygml/2.0 http://schemas.opengis.net/citygml/2.0/cityGMLBase.xsd http://www.opengis.net/citygml/generics/2.0 http://schemas.opengis.net/citygml/generics/2.0/generics.xsd">
<gml:boundedBy>
<gml:Envelope srsDimension="3" srsName="urn:ogc:def:crs:EPSG::7415">
<gml:lowerCorner>84616.468 447422.999 0</gml:lowerCorner>
<gml:upperCorner>85140.839 447750.636 100</gml:upperCorner>
</gml:Envelope>
</gml:boundedBy>
</core:CityModel>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<core:CityModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:core="http://www.opengis.net/citygml/2.0"
xmlns:gml="http://www.opengis.net/gml"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:tran="http://www.opengis.net/citygml/transportation/2.0"
xmlns:wtr="http://www.opengis.net/citygml/waterbody/2.0"
xmlns:smil20lang="http://www.w3.org/2001/SMIL20/Language"
xmlns:grp="http://www.opengis.net/citygml/cityobjectgroup/2.0"
xmlns:luse="http://www.opengis.net/citygml/landuse/2.0"
xmlns:frn="http://www.opengis.net/citygml/cityfurniture/2.0"
xmlns:app="http://www.opengis.net/citygml/appearance/2.0"
xmlns:tex="http://www.opengis.net/citygml/texturedsurface/2.0"
xmlns:smil20="http://www.w3.org/2001/SMIL20/"
xmlns:xAL="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0"
xmlns:bldg="http://www.opengis.net/citygml/building/2.0"
xmlns:dem="http://www.opengis.net/citygml/relief/2.0"
xmlns:veg="http://www.opengis.net/citygml/vegetation/2.0"
xmlns:brid="http://www.opengis.net/citygml/bridge/2.0"
xmlns:tun="http://www.opengis.net/citygml/tunnel/2.0"
xmlns:gen="http://www.opengis.net/citygml/generics/2.0"
xmlns:wfs="http://www.opengis.net/wfs"
xsi:schemaLocation="http://www.opengis.net/citygml/landuse/2.0 http://schemas.opengis.net/citygml/landuse/2.0/landUse.xsd http://www.opengis.net/citygml/cityfurniture/2.0 http://schemas.opengis.net/citygml/cityfurniture/2.0/cityFurniture.xsd http://www.opengis.net/citygml/appearance/2.0 http://schemas.opengis.net/citygml/appearance/2.0/appearance.xsd http://www.opengis.net/citygml/texturedsurface/2.0 http://schemas.opengis.net/citygml/texturedsurface/2.0/texturedSurface.xsd http://www.opengis.net/citygml/transportation/2.0 http://schemas.opengis.net/citygml/transportation/2.0/transportation.xsd http://www.opengis.net/citygml/waterbody/2.0 http://schemas.opengis.net/citygml/waterbody/2.0/waterBody.xsd http://www.opengis.net/citygml/building/2.0 http://schemas.opengis.net/citygml/building/2.0/building.xsd http://www.opengis.net/citygml/relief/2.0 http://schemas.opengis.net/citygml/relief/2.0/relief.xsd http://www.opengis.net/citygml/vegetation/2.0 http://schemas.opengis.net/citygml/vegetation/2.0/vegetation.xsd http://www.opengis.net/citygml/cityobjectgroup/2.0 http://schemas.opengis.net/citygml/cityobjectgroup/2.0/cityObjectGroup.xsd http://www.opengis.net/citygml/bridge/2.0 http://schemas.opengis.net/citygml/bridge/2.0/bridge.xsd http://www.opengis.net/citygml/tunnel/2.0 http://schemas.opengis.net/citygml/tunnel/2.0/tunnel.xsd http://www.opengis.net/citygml/generics/2.0 http://schemas.opengis.net/citygml/generics/2.0/generics.xsd">
<gml:description>Testdataset</gml:description>
<gml:name>ImplicitGeometry zipfile testdata</gml:name>
<core:cityObjectMember>
<gen:GenericCityObject>
<gml:description>CPA_Symbol</gml:description>
<gml:name>Implicit1</gml:name>
<gen:lod2Geometry>
<gml:MultiSurface>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-5">
<gml:exterior>
<gml:LinearRing gml:id="ringID-5">
<gml:posList srsDimension="3">0.549000 0.854000 1.282000 0.549000 0.854000 1.232000 -0.542000 0.855000 1.232000 -0.542000 0.855000 1.282000 0.549000 0.854000 1.282000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-6">
<gml:exterior>
<gml:LinearRing gml:id="ringID-6">
<gml:posList srsDimension="3">-0.744000 0.755000 0.000000 -0.744000 0.755000 2.100000 -0.745000 -0.895000 2.100000 -0.745000 -0.895000 2.190000 -0.745000 -0.825000 2.260000 -0.744000 0.785000 2.260000 -0.744000 0.855000 2.190000 -0.744000 0.855000 0.000000 -0.744000 0.755000 0.000000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-7">
<gml:exterior>
<gml:LinearRing gml:id="ringID-7">
<gml:posList srsDimension="3">0.647000 -0.896000 2.100000 0.647000 -0.896000 2.190000 -0.745000 -0.895000 2.190000 -0.745000 -0.895000 2.100000 0.647000 -0.896000 2.100000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-8">
<gml:exterior>
<gml:LinearRing gml:id="ringID-8">
<gml:posList srsDimension="3">-0.745000 -0.825000 2.260000 -0.745000 -0.895000 2.190000 0.647000 -0.896000 2.190000 0.647000 -0.826000 2.260000 -0.745000 -0.825000 2.260000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-9">
<gml:exterior>
<gml:LinearRing gml:id="ringID-9">
<gml:posList srsDimension="3">-0.744000 0.855000 2.190000 -0.744000 0.785000 2.260000 0.647000 0.784000 2.260000 0.647000 0.854000 2.190000 -0.744000 0.855000 2.190000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-10">
<gml:exterior>
<gml:LinearRing gml:id="ringID-10">
<gml:posList srsDimension="3">-0.542000 0.855000 1.132000 -0.542000 0.855000 1.182000 0.549000 0.854000 1.182000 0.549000 0.854000 1.132000 -0.542000 0.855000 1.132000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-11">
<gml:exterior>
<gml:LinearRing gml:id="ringID-11">
<gml:posList srsDimension="3">0.647000 0.784000 2.260000 -0.744000 0.785000 2.260000 -0.745000 -0.825000 2.260000 0.647000 -0.826000 2.260000 0.647000 0.784000 2.260000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-12">
<gml:exterior>
<gml:LinearRing gml:id="ringID-12">
<gml:posList srsDimension="3">-0.646000 0.755000 2.100000 -0.744000 0.755000 2.100000 -0.744000 0.755000 0.000000 -0.646000 0.755000 0.000000 -0.646000 0.755000 2.100000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-13">
<gml:exterior>
<gml:LinearRing gml:id="ringID-13">
<gml:posList srsDimension="3">-0.745000 -0.895000 2.100000 -0.744000 0.755000 2.100000 -0.646000 0.755000 2.100000 -0.646000 0.855000 2.100000 0.647000 0.854000 2.100000 0.647000 -0.896000 2.100000 -0.745000 -0.895000 2.100000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-14">
<gml:exterior>
<gml:LinearRing gml:id="ringID-14">
<gml:posList srsDimension="3">-0.744000 0.855000 2.190000 0.647000 0.854000 2.190000 0.647000 0.854000 2.100000 -0.646000 0.855000 2.100000 -0.646000 0.855000 0.547000 -0.646000 0.855000 0.504000 -0.646000 0.855000 0.300000 -0.646000 0.855000 0.220000 -0.646000 0.855000 0.000000 -0.744000 0.855000 0.000000 -0.744000 0.855000 2.190000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-15">
<gml:exterior>
<gml:LinearRing gml:id="ringID-15">
<gml:posList srsDimension="3">-0.646000 0.855000 0.220000 -0.646000 0.855000 0.300000 0.647000 0.854000 0.300000 0.647000 0.854000 0.220000 -0.646000 0.855000 0.220000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-16">
<gml:exterior>
<gml:LinearRing gml:id="ringID-16">
<gml:posList srsDimension="3">-0.646000 0.855000 2.100000 -0.646000 0.755000 2.100000 -0.646000 0.755000 0.000000 -0.646000 0.855000 0.000000 -0.646000 0.855000 0.220000 -0.646000 0.855000 0.300000 -0.646000 0.855000 0.504000 -0.646000 0.855000 0.547000 -0.646000 0.855000 2.100000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-17">
<gml:exterior>
<gml:LinearRing gml:id="ringID-17">
<gml:posList srsDimension="3">-0.646000 0.855000 0.547000 -0.646000 0.855000 0.504000 -0.546000 0.855000 0.504000 -0.546000 0.855000 0.547000 -0.646000 0.855000 0.547000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-18">
<gml:exterior>
<gml:LinearRing gml:id="ringID-18">
<gml:posList srsDimension="3">-0.546000 0.855000 0.504000 -0.546000 0.530000 0.504000 -0.546000 0.530000 0.547000 -0.546000 0.855000 0.547000 -0.546000 0.855000 0.504000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-19">
<gml:exterior>
<gml:LinearRing gml:id="ringID-19">
<gml:posList srsDimension="3">-0.496000 0.530000 0.504000 -0.496000 0.855000 0.504000 -0.496000 0.855000 0.547000 -0.496000 0.530000 0.547000 -0.496000 0.530000 0.504000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-20">
<gml:exterior>
<gml:LinearRing gml:id="ringID-20">
<gml:posList srsDimension="3">-0.546000 0.530000 0.547000 -0.546000 0.530000 0.504000 -0.496000 0.530000 0.504000 -0.496000 0.530000 0.547000 -0.546000 0.530000 0.547000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-21">
<gml:exterior>
<gml:LinearRing gml:id="ringID-21">
<gml:posList srsDimension="3">-0.546000 0.855000 0.547000 -0.546000 0.530000 0.547000 -0.496000 0.530000 0.547000 -0.496000 0.855000 0.547000 -0.546000 0.855000 0.547000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-22">
<gml:exterior>
<gml:LinearRing gml:id="ringID-22">
<gml:posList srsDimension="3">0.497000 0.854000 0.504000 0.497000 0.530000 0.504000 0.497000 0.530000 0.547000 0.497000 0.854000 0.547000 0.497000 0.854000 0.504000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-23">
<gml:exterior>
<gml:LinearRing gml:id="ringID-23">
<gml:posList srsDimension="3">0.547000 0.530000 0.504000 0.547000 0.530000 0.547000 0.497000 0.530000 0.547000 0.497000 0.530000 0.504000 0.547000 0.530000 0.504000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-24">
<gml:exterior>
<gml:LinearRing gml:id="ringID-24">
<gml:posList srsDimension="3">0.547000 0.530000 0.547000 0.547000 0.854000 0.547000 0.497000 0.854000 0.547000 0.497000 0.530000 0.547000 0.547000 0.530000 0.547000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-25">
<gml:exterior>
<gml:LinearRing gml:id="ringID-25">
<gml:posList srsDimension="3">-0.196000 0.855000 0.547000 -0.196000 0.530000 0.547000 -0.146000 0.530000 0.547000 -0.146000 0.854000 0.547000 -0.196000 0.855000 0.547000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-26">
<gml:exterior>
<gml:LinearRing gml:id="ringID-26">
<gml:posList srsDimension="3">-0.196000 0.530000 0.547000 -0.196000 0.530000 0.504000 -0.146000 0.530000 0.504000 -0.146000 0.530000 0.547000 -0.196000 0.530000 0.547000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-27">
<gml:exterior>
<gml:LinearRing gml:id="ringID-27">
<gml:posList srsDimension="3">-0.146000 0.530000 0.504000 -0.146000 0.854000 0.504000 -0.146000 0.854000 0.547000 -0.146000 0.530000 0.547000 -0.146000 0.530000 0.504000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-28">
<gml:exterior>
<gml:LinearRing gml:id="ringID-28">
<gml:posList srsDimension="3">-0.196000 0.855000 0.504000 -0.196000 0.530000 0.504000 -0.196000 0.530000 0.547000 -0.196000 0.855000 0.547000 -0.196000 0.855000 0.504000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-29">
<gml:exterior>
<gml:LinearRing gml:id="ringID-29">
<gml:posList srsDimension="3">0.144000 0.530000 0.547000 0.144000 0.530000 0.504000 0.194000 0.530000 0.504000 0.194000 0.530000 0.547000 0.144000 0.530000 0.547000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-30">
<gml:exterior>
<gml:LinearRing gml:id="ringID-30">
<gml:posList srsDimension="3">0.194000 0.530000 0.504000 0.194000 0.854000 0.504000 0.194000 0.854000 0.547000 0.194000 0.530000 0.547000 0.194000 0.530000 0.504000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-31">
<gml:exterior>
<gml:LinearRing gml:id="ringID-31">
<gml:posList srsDimension="3">0.144000 0.854000 0.547000 0.144000 0.530000 0.547000 0.194000 0.530000 0.547000 0.194000 0.854000 0.547000 0.144000 0.854000 0.547000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-32">
<gml:exterior>
<gml:LinearRing gml:id="ringID-32">
<gml:posList srsDimension="3">-0.476000 0.835000 0.547000 -0.476000 0.530000 0.547000 -0.216000 0.530000 0.547000 -0.216000 0.835000 0.547000 -0.476000 0.835000 0.547000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-33">
<gml:exterior>
<gml:LinearRing gml:id="ringID-33">
<gml:posList srsDimension="3">-0.476000 0.530000 0.520000 -0.476000 0.835000 0.520000 -0.216000 0.835000 0.520000 -0.216000 0.530000 0.520000 -0.476000 0.530000 0.520000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-34">
<gml:exterior>
<gml:LinearRing gml:id="ringID-34">
<gml:posList srsDimension="3">-0.476000 0.530000 0.547000 -0.476000 0.835000 0.547000 -0.476000 0.835000 0.520000 -0.476000 0.530000 0.520000 -0.476000 0.530000 0.547000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-35">
<gml:exterior>
<gml:LinearRing gml:id="ringID-35">
<gml:posList srsDimension="3">-0.476000 0.835000 0.547000 -0.216000 0.835000 0.547000 -0.216000 0.835000 0.520000 -0.476000 0.835000 0.520000 -0.476000 0.835000 0.547000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-36">
<gml:exterior>
<gml:LinearRing gml:id="ringID-36">
<gml:posList srsDimension="3">-0.216000 0.835000 0.547000 -0.216000 0.530000 0.547000 -0.216000 0.530000 0.520000 -0.216000 0.835000 0.520000 -0.216000 0.835000 0.547000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-37">
<gml:exterior>
<gml:LinearRing gml:id="ringID-37">
<gml:posList srsDimension="3">-0.216000 0.530000 0.547000 -0.476000 0.530000 0.547000 -0.476000 0.530000 0.520000 -0.216000 0.530000 0.520000 -0.216000 0.530000 0.547000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-38">
<gml:exterior>
<gml:LinearRing gml:id="ringID-38">
<gml:posList srsDimension="3">0.144000 0.854000 0.504000 0.144000 0.530000 0.504000 0.144000 0.530000 0.547000 0.144000 0.854000 0.547000 0.144000 0.854000 0.504000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-39">
<gml:exterior>
<gml:LinearRing gml:id="ringID-39">
<gml:posList srsDimension="3">-0.132000 0.834000 0.547000 0.128000 0.834000 0.547000 0.128000 0.834000 0.520000 -0.132000 0.834000 0.520000 -0.132000 0.834000 0.547000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-40">
<gml:exterior>
<gml:LinearRing gml:id="ringID-40">
<gml:posList srsDimension="3">-0.132000 0.530000 0.520000 -0.132000 0.834000 0.520000 0.128000 0.834000 0.520000 0.128000 0.530000 0.520000 -0.132000 0.530000 0.520000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-41">
<gml:exterior>
<gml:LinearRing gml:id="ringID-41">
<gml:posList srsDimension="3">-0.132000 0.530000 0.547000 -0.132000 0.834000 0.547000 -0.132000 0.834000 0.520000 -0.132000 0.530000 0.520000 -0.132000 0.530000 0.547000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-42">
<gml:exterior>
<gml:LinearRing gml:id="ringID-42">
<gml:posList srsDimension="3">0.128000 0.530000 0.547000 -0.132000 0.530000 0.547000 -0.132000 0.530000 0.520000 0.128000 0.530000 0.520000 0.128000 0.530000 0.547000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-43">
<gml:exterior>
<gml:LinearRing gml:id="ringID-43">
<gml:posList srsDimension="3">0.128000 0.834000 0.547000 0.128000 0.530000 0.547000 0.128000 0.530000 0.520000 0.128000 0.834000 0.520000 0.128000 0.834000 0.547000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-44">
<gml:exterior>
<gml:LinearRing gml:id="ringID-44">
<gml:posList srsDimension="3">-0.132000 0.834000 0.547000 -0.132000 0.530000 0.547000 0.128000 0.530000 0.547000 0.128000 0.834000 0.547000 -0.132000 0.834000 0.547000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-45">
<gml:exterior>
<gml:LinearRing gml:id="ringID-45">
<gml:posList srsDimension="3">0.215000 0.834000 0.547000 0.215000 0.530000 0.547000 0.475000 0.530000 0.547000 0.475000 0.834000 0.547000 0.215000 0.834000 0.547000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-46">
<gml:exterior>
<gml:LinearRing gml:id="ringID-46">
<gml:posList srsDimension="3">0.475000 0.834000 0.547000 0.475000 0.530000 0.547000 0.475000 0.530000 0.520000 0.475000 0.834000 0.520000 0.475000 0.834000 0.547000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-47">
<gml:exterior>
<gml:LinearRing gml:id="ringID-47">
<gml:posList srsDimension="3">0.215000 0.530000 0.520000 0.215000 0.834000 0.520000 0.475000 0.834000 0.520000 0.475000 0.530000 0.520000 0.215000 0.530000 0.520000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-48">
<gml:exterior>
<gml:LinearRing gml:id="ringID-48">
<gml:posList srsDimension="3">0.475000 0.530000 0.547000 0.215000 0.530000 0.547000 0.215000 0.530000 0.520000 0.475000 0.530000 0.520000 0.475000 0.530000 0.547000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-49">
<gml:exterior>
<gml:LinearRing gml:id="ringID-49">
<gml:posList srsDimension="3">0.215000 0.834000 0.547000 0.475000 0.834000 0.547000 0.475000 0.834000 0.520000 0.215000 0.834000 0.520000 0.215000 0.834000 0.547000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-50">
<gml:exterior>
<gml:LinearRing gml:id="ringID-50">
<gml:posList srsDimension="3">0.215000 0.530000 0.547000 0.215000 0.834000 0.547000 0.215000 0.834000 0.520000 0.215000 0.530000 0.520000 0.215000 0.530000 0.547000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-51">
<gml:exterior>
<gml:LinearRing gml:id="ringID-51">
<gml:posList srsDimension="3">0.547000 0.530000 0.504000 0.547000 0.854000 0.504000 0.547000 0.854000 0.547000 0.547000 0.530000 0.547000 0.547000 0.530000 0.504000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-52">
<gml:exterior>
<gml:LinearRing gml:id="ringID-52">
<gml:posList srsDimension="3">0.194000 0.854000 0.547000 0.194000 0.854000 0.504000 0.144000 0.854000 0.504000 0.144000 0.854000 0.547000 0.194000 0.854000 0.547000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-53">
<gml:exterior>
<gml:LinearRing gml:id="ringID-53">
<gml:posList srsDimension="3">-0.146000 0.854000 0.547000 -0.146000 0.854000 0.504000 -0.196000 0.855000 0.504000 -0.196000 0.855000 0.547000 -0.146000 0.854000 0.547000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-54">
<gml:exterior>
<gml:LinearRing gml:id="ringID-54">
<gml:posList srsDimension="3">0.547000 0.854000 0.504000 0.497000 0.854000 0.504000 0.497000 0.854000 0.547000 0.547000 0.854000 0.547000 0.547000 0.854000 0.504000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-55">
<gml:exterior>
<gml:LinearRing gml:id="ringID-55">
<gml:posList srsDimension="3">-0.496000 0.855000 0.504000 -0.546000 0.855000 0.504000 -0.546000 0.855000 0.547000 -0.496000 0.855000 0.547000 -0.496000 0.855000 0.504000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-56">
<gml:exterior>
<gml:LinearRing gml:id="ringID-56">
<gml:posList srsDimension="3">-0.546000 0.855000 0.504000 -0.496000 0.855000 0.504000 -0.196000 0.855000 0.504000 -0.146000 0.854000 0.504000 0.144000 0.854000 0.504000 0.194000 0.854000 0.504000 0.497000 0.854000 0.504000 0.547000 0.854000 0.504000 0.647000 0.854000 0.504000 0.647000 0.854000 0.300000 -0.646000 0.855000 0.300000 -0.646000 0.855000 0.504000 -0.546000 0.855000 0.504000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-57">
<gml:exterior>
<gml:LinearRing gml:id="ringID-57">
<gml:posList srsDimension="3">-0.146000 0.854000 0.547000 -0.146000 0.854000 0.504000 0.144000 0.854000 0.504000 0.144000 0.854000 0.547000 -0.146000 0.854000 0.547000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-58">
<gml:exterior>
<gml:LinearRing gml:id="ringID-58">
<gml:posList srsDimension="3">-0.496000 0.855000 0.547000 -0.496000 0.855000 0.504000 -0.196000 0.855000 0.504000 -0.196000 0.855000 0.547000 -0.496000 0.855000 0.547000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-59">
<gml:exterior>
<gml:LinearRing gml:id="ringID-59">
<gml:posList srsDimension="3">0.194000 0.854000 0.547000 0.194000 0.854000 0.504000 0.497000 0.854000 0.504000 0.497000 0.854000 0.547000 0.194000 0.854000 0.547000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-60">
<gml:exterior>
<gml:LinearRing gml:id="ringID-60">
<gml:posList srsDimension="3">0.547000 0.854000 0.547000 0.547000 0.854000 0.504000 0.647000 0.854000 0.504000 0.647000 0.854000 0.547000 0.547000 0.854000 0.547000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-61">
<gml:exterior>
<gml:LinearRing gml:id="ringID-61">
<gml:posList srsDimension="3">0.647000 0.854000 2.100000 0.647000 0.854000 0.547000 0.547000 0.854000 0.547000 0.497000 0.854000 0.547000 0.194000 0.854000 0.547000 0.144000 0.854000 0.547000 -0.146000 0.854000 0.547000 -0.196000 0.855000 0.547000 -0.496000 0.855000 0.547000 -0.546000 0.855000 0.547000 -0.646000 0.855000 0.547000 -0.646000 0.855000 2.100000 0.647000 0.854000 2.100000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
<gml:interior>
<gml:LinearRing gml:id="ringID-61_1">
<gml:posList srsDimension="3">0.549000 0.854000 1.182000 -0.542000 0.855000 1.182000 -0.542000 0.855000 1.132000 0.549000 0.854000 1.132000 0.549000 0.854000 1.182000 </gml:posList>
</gml:LinearRing>
</gml:interior>
<gml:interior>
<gml:LinearRing gml:id="ringID-61_2">
<gml:posList srsDimension="3">-0.542000 0.855000 1.282000 -0.542000 0.855000 1.232000 0.549000 0.854000 1.232000 0.549000 0.854000 1.282000 -0.542000 0.855000 1.282000 </gml:posList>
</gml:LinearRing>
</gml:interior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-62">
<gml:exterior>
<gml:LinearRing gml:id="ringID-62">
<gml:posList srsDimension="3">2.136000 0.754000 2.100000 2.038000 0.754000 2.100000 2.038000 0.754000 0.000000 2.136000 0.754000 0.000000 2.136000 0.754000 0.220000 2.136000 0.754000 0.300000 2.136000 0.754000 2.100000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-63">
<gml:exterior>
<gml:LinearRing gml:id="ringID-63">
<gml:posList srsDimension="3">2.068000 0.784000 2.260000 2.136000 0.854000 2.190000 0.647000 0.854000 2.190000 0.647000 0.784000 2.260000 2.068000 0.784000 2.260000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-64">
<gml:exterior>
<gml:LinearRing gml:id="ringID-64">
<gml:posList srsDimension="3">2.136000 -0.396000 1.182000 2.136000 -0.396000 1.132000 2.136000 0.654000 1.132000 2.136000 0.654000 1.182000 2.136000 -0.396000 1.182000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-65">
<gml:exterior>
<gml:LinearRing gml:id="ringID-65">
<gml:posList srsDimension="3">2.136000 0.854000 2.190000 2.068000 0.784000 2.260000 2.067000 -0.826000 2.260000 2.136000 -0.896000 2.190000 2.136000 0.854000 2.190000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-66">
<gml:exterior>
<gml:LinearRing gml:id="ringID-66">
<gml:posList srsDimension="3">0.647000 -0.896000 2.190000 2.136000 -0.896000 2.190000 2.067000 -0.826000 2.260000 0.647000 -0.826000 2.260000 0.647000 -0.896000 2.190000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-67">
<gml:exterior>
<gml:LinearRing gml:id="ringID-67">
<gml:posList srsDimension="3">0.843000 0.854000 1.232000 0.843000 0.854000 1.282000 1.934000 0.854000 1.282000 1.934000 0.854000 1.232000 0.843000 0.854000 1.232000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-68">
<gml:exterior>
<gml:LinearRing gml:id="ringID-68">
<gml:posList srsDimension="3">2.038000 -0.596000 2.100000 2.038000 -0.596000 0.000000 2.136000 -0.596000 0.000000 2.136000 -0.596000 2.100000 2.038000 -0.596000 2.100000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-69">
<gml:exterior>
<gml:LinearRing gml:id="ringID-69">
<gml:posList srsDimension="3">2.136000 -0.496000 0.300000 2.136000 -0.496000 0.220000 2.136000 0.754000 0.220000 2.136000 0.754000 0.300000 2.136000 -0.496000 0.300000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-70">
<gml:exterior>
<gml:LinearRing gml:id="ringID-70">
<gml:posList srsDimension="3">2.038000 -0.596000 2.100000 2.038000 -0.496000 2.100000 2.038000 -0.496000 0.000000 2.038000 -0.596000 0.000000 2.038000 -0.596000 2.100000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-71">
<gml:exterior>
<gml:LinearRing gml:id="ringID-71">
<gml:posList srsDimension="3">2.038000 0.854000 0.300000 2.038000 0.854000 0.220000 0.745000 0.854000 0.220000 0.745000 0.854000 0.300000 2.038000 0.854000 0.300000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-72">
<gml:exterior>
<gml:LinearRing gml:id="ringID-72">
<gml:posList srsDimension="3">0.745000 0.854000 2.100000 2.038000 0.854000 2.100000 2.038000 0.854000 0.300000 0.745000 0.854000 0.300000 0.745000 0.854000 2.100000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
<gml:interior>
<gml:LinearRing gml:id="ringID-72_1">
<gml:posList srsDimension="3">1.934000 0.854000 1.182000 0.843000 0.854000 1.182000 0.843000 0.854000 1.132000 1.934000 0.854000 1.132000 1.934000 0.854000 1.182000 </gml:posList>
</gml:LinearRing>
</gml:interior>
<gml:interior>
<gml:LinearRing gml:id="ringID-72_2">
<gml:posList srsDimension="3">1.934000 0.854000 1.232000 1.934000 0.854000 1.282000 0.843000 0.854000 1.282000 0.843000 0.854000 1.232000 1.934000 0.854000 1.232000 </gml:posList>
</gml:LinearRing>
</gml:interior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-73">
<gml:exterior>
<gml:LinearRing gml:id="ringID-73">
<gml:posList srsDimension="3">2.136000 0.654000 1.232000 2.136000 0.654000 1.282000 2.136000 -0.396000 1.282000 2.136000 -0.396000 1.232000 2.136000 0.654000 1.232000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-74">
<gml:exterior>
<gml:LinearRing gml:id="ringID-74">
<gml:posList srsDimension="3">1.934000 0.854000 1.182000 1.934000 0.854000 1.132000 0.843000 0.854000 1.132000 0.843000 0.854000 1.182000 1.934000 0.854000 1.182000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-75">
<gml:exterior>
<gml:LinearRing gml:id="ringID-75">
<gml:posList srsDimension="3">2.038000 0.754000 2.100000 2.038000 0.854000 2.100000 2.038000 0.854000 0.300000 2.038000 0.854000 0.220000 2.038000 0.854000 0.000000 2.038000 0.754000 0.000000 2.038000 0.754000 2.100000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-76">
<gml:exterior>
<gml:LinearRing gml:id="ringID-76">
<gml:posList srsDimension="3">2.136000 -0.496000 2.100000 2.136000 -0.496000 0.300000 2.136000 0.754000 0.300000 2.136000 0.754000 2.100000 2.136000 -0.496000 2.100000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
<gml:interior>
<gml:LinearRing gml:id="ringID-76_1">
<gml:posList srsDimension="3">2.136000 -0.396000 1.132000 2.136000 -0.396000 1.182000 2.136000 0.654000 1.182000 2.136000 0.654000 1.132000 2.136000 -0.396000 1.132000 </gml:posList>
</gml:LinearRing>
</gml:interior>
<gml:interior>
<gml:LinearRing gml:id="ringID-76_2">
<gml:posList srsDimension="3">2.136000 0.654000 1.232000 2.136000 -0.396000 1.232000 2.136000 -0.396000 1.282000 2.136000 0.654000 1.282000 2.136000 0.654000 1.232000 </gml:posList>
</gml:LinearRing>
</gml:interior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-77">
<gml:exterior>
<gml:LinearRing gml:id="ringID-77">
<gml:posList srsDimension="3">2.136000 -0.896000 2.100000 2.136000 -0.896000 2.190000 0.647000 -0.896000 2.190000 0.647000 -0.896000 2.100000 2.136000 -0.896000 2.100000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-78">
<gml:exterior>
<gml:LinearRing gml:id="ringID-78">
<gml:posList srsDimension="3">2.136000 0.854000 0.000000 2.136000 0.854000 2.190000 2.136000 -0.896000 2.190000 2.136000 -0.896000 2.100000 2.136000 -0.596000 2.100000 2.136000 -0.596000 0.000000 2.136000 -0.496000 0.000000 2.136000 -0.496000 0.220000 2.136000 -0.496000 0.300000 2.136000 -0.496000 2.100000 2.136000 0.754000 2.100000 2.136000 0.754000 0.300000 2.136000 0.754000 0.220000 2.136000 0.754000 0.000000 2.136000 0.854000 0.000000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-79">
<gml:exterior>
<gml:LinearRing gml:id="ringID-79">
<gml:posList srsDimension="3">2.038000 0.854000 2.100000 0.745000 0.854000 2.100000 0.745000 0.854000 0.300000 0.745000 0.854000 0.220000 0.745000 0.854000 0.000000 0.647000 0.854000 0.000000 0.647000 0.854000 2.190000 2.136000 0.854000 2.190000 2.136000 0.854000 0.000000 2.038000 0.854000 0.000000 2.038000 0.854000 0.220000 2.038000 0.854000 0.300000 2.038000 0.854000 2.100000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-80">
<gml:exterior>
<gml:LinearRing gml:id="ringID-80">
<gml:posList srsDimension="3">2.038000 -0.496000 2.100000 2.136000 -0.496000 2.100000 2.136000 -0.496000 0.300000 2.136000 -0.496000 0.220000 2.136000 -0.496000 0.000000 2.038000 -0.496000 0.000000 2.038000 -0.496000 2.100000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-81">
<gml:exterior>
<gml:LinearRing gml:id="ringID-81">
<gml:posList srsDimension="3">2.068000 0.784000 2.260000 0.647000 0.784000 2.260000 0.647000 -0.826000 2.260000 2.067000 -0.826000 2.260000 2.068000 0.784000 2.260000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-82">
<gml:exterior>
<gml:LinearRing gml:id="ringID-82">
<gml:posList srsDimension="3">0.745000 0.754000 2.100000 0.647000 0.754000 2.100000 0.647000 0.754000 0.000000 0.745000 0.754000 0.000000 0.745000 0.754000 2.100000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-83">
<gml:exterior>
<gml:LinearRing gml:id="ringID-83">
<gml:posList srsDimension="3">0.647000 0.754000 0.000000 0.647000 0.754000 2.100000 0.647000 -0.896000 2.100000 0.647000 -0.896000 2.190000 0.647000 -0.826000 2.260000 0.647000 0.784000 2.260000 0.647000 0.854000 2.190000 0.647000 0.854000 0.000000 0.647000 0.754000 0.000000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-84">
<gml:exterior>
<gml:LinearRing gml:id="ringID-84">
<gml:posList srsDimension="3">0.745000 0.854000 2.100000 0.745000 0.754000 2.100000 0.745000 0.754000 0.000000 0.745000 0.854000 0.000000 0.745000 0.854000 0.220000 0.745000 0.854000 0.300000 0.745000 0.854000 2.100000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-85">
<gml:exterior>
<gml:LinearRing gml:id="ringID-85">
<gml:posList srsDimension="3">2.136000 -0.596000 2.100000 2.136000 -0.896000 2.100000 0.647000 -0.896000 2.100000 0.647000 0.754000 2.100000 0.745000 0.754000 2.100000 0.745000 0.854000 2.100000 2.038000 0.854000 2.100000 2.038000 0.754000 2.100000 2.136000 0.754000 2.100000 2.136000 -0.496000 2.100000 2.038000 -0.496000 2.100000 2.038000 -0.596000 2.100000 2.136000 -0.596000 2.100000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-86">
<gml:exterior>
<gml:LinearRing gml:id="ringID-86">
<gml:posList srsDimension="3">-0.745000 -0.895000 2.100000 -0.745000 -0.895000 2.190000 -2.136000 -0.895000 2.190000 -2.136000 -0.895000 2.100000 -0.745000 -0.895000 2.100000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-87">
<gml:exterior>
<gml:LinearRing gml:id="ringID-87">
<gml:posList srsDimension="3">-2.136000 -0.495000 0.300000 -2.136000 -0.495000 2.100000 -2.136000 0.755000 2.100000 -2.136000 0.755000 0.300000 -2.136000 -0.495000 0.300000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
<gml:interior>
<gml:LinearRing gml:id="ringID-87_1">
<gml:posList srsDimension="3">-2.136000 0.655000 1.132000 -2.136000 0.655000 1.182000 -2.136000 -0.395000 1.182000 -2.136000 -0.395000 1.132000 -2.136000 0.655000 1.132000 </gml:posList>
</gml:LinearRing>
</gml:interior>
<gml:interior>
<gml:LinearRing gml:id="ringID-87_2">
<gml:posList srsDimension="3">-2.136000 -0.395000 1.232000 -2.136000 0.655000 1.232000 -2.136000 0.655000 1.282000 -2.136000 -0.395000 1.282000 -2.136000 -0.395000 1.232000 </gml:posList>
</gml:LinearRing>
</gml:interior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-88">
<gml:exterior>
<gml:LinearRing gml:id="ringID-88">
<gml:posList srsDimension="3">-2.067000 0.785000 2.260000 -2.068000 -0.825000 2.260000 -0.745000 -0.825000 2.260000 -0.745000 0.785000 2.260000 -2.067000 0.785000 2.260000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-89">
<gml:exterior>
<gml:LinearRing gml:id="ringID-89">
<gml:posList srsDimension="3">-2.136000 0.855000 2.190000 -0.745000 0.855000 2.190000 -0.745000 0.855000 2.100000 -2.038000 0.855000 2.100000 -2.038000 0.855000 0.300000 -2.038000 0.855000 0.220000 -2.038000 0.855000 0.000000 -2.136000 0.855000 0.000000 -2.136000 0.855000 2.190000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-90">
<gml:exterior>
<gml:LinearRing gml:id="ringID-90">
<gml:posList srsDimension="3">-2.136000 0.755000 2.100000 -2.038000 0.755000 2.100000 -2.038000 0.855000 2.100000 -0.745000 0.855000 2.100000 -0.745000 -0.895000 2.100000 -2.136000 -0.895000 2.100000 -2.136000 -0.595000 2.100000 -2.038000 -0.595000 2.100000 -2.038000 -0.495000 2.100000 -2.136000 -0.495000 2.100000 -2.136000 0.755000 2.100000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-91">
<gml:exterior>
<gml:LinearRing gml:id="ringID-91">
<gml:posList srsDimension="3">-2.136000 0.755000 0.300000 -2.136000 0.755000 2.100000 -2.136000 -0.495000 2.100000 -2.136000 -0.495000 0.300000 -2.136000 -0.495000 0.220000 -2.136000 -0.495000 0.000000 -2.136000 -0.595000 0.000000 -2.136000 -0.595000 2.100000 -2.136000 -0.895000 2.100000 -2.136000 -0.895000 2.190000 -2.136000 0.855000 2.190000 -2.136000 0.855000 0.000000 -2.136000 0.755000 0.000000 -2.136000 0.755000 0.220000 -2.136000 0.755000 0.300000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-92">
<gml:exterior>
<gml:LinearRing gml:id="ringID-92">
<gml:posList srsDimension="3">-2.136000 -0.495000 2.100000 -2.038000 -0.495000 2.100000 -2.038000 -0.495000 0.000000 -2.136000 -0.495000 0.000000 -2.136000 -0.495000 0.220000 -2.136000 -0.495000 0.300000 -2.136000 -0.495000 2.100000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-93">
<gml:exterior>
<gml:LinearRing gml:id="ringID-93">
<gml:posList srsDimension="3">-2.038000 -0.595000 2.100000 -2.136000 -0.595000 2.100000 -2.136000 -0.595000 0.000000 -2.038000 -0.595000 0.000000 -2.038000 -0.595000 2.100000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-94">
<gml:exterior>
<gml:LinearRing gml:id="ringID-94">
<gml:posList srsDimension="3">-2.067000 0.785000 2.260000 -2.136000 0.855000 2.190000 -2.136000 -0.895000 2.190000 -2.068000 -0.825000 2.260000 -2.067000 0.785000 2.260000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-95">
<gml:exterior>
<gml:LinearRing gml:id="ringID-95">
<gml:posList srsDimension="3">-2.038000 -0.495000 2.100000 -2.038000 -0.595000 2.100000 -2.038000 -0.595000 0.000000 -2.038000 -0.495000 0.000000 -2.038000 -0.495000 2.100000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-96">
<gml:exterior>
<gml:LinearRing gml:id="ringID-96">
<gml:posList srsDimension="3">-0.745000 -0.895000 2.190000 -0.745000 -0.825000 2.260000 -2.068000 -0.825000 2.260000 -2.136000 -0.895000 2.190000 -0.745000 -0.895000 2.190000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-97">
<gml:exterior>
<gml:LinearRing gml:id="ringID-97">
<gml:posList srsDimension="3">-2.038000 0.755000 2.100000 -2.136000 0.755000 2.100000 -2.136000 0.755000 0.300000 -2.136000 0.755000 0.220000 -2.136000 0.755000 0.000000 -2.038000 0.755000 0.000000 -2.038000 0.755000 2.100000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-98">
<gml:exterior>
<gml:LinearRing gml:id="ringID-98">
<gml:posList srsDimension="3">-0.745000 0.785000 2.260000 -0.745000 0.855000 2.190000 -2.136000 0.855000 2.190000 -2.067000 0.785000 2.260000 -0.745000 0.785000 2.260000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-99">
<gml:exterior>
<gml:LinearRing gml:id="ringID-99">
<gml:posList srsDimension="3">-2.038000 0.855000 2.100000 -2.038000 0.755000 2.100000 -2.038000 0.755000 0.000000 -2.038000 0.855000 0.000000 -2.038000 0.855000 0.220000 -2.038000 0.855000 0.300000 -2.038000 0.855000 2.100000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-100">
<gml:exterior>
<gml:LinearRing gml:id="ringID-100">
<gml:posList srsDimension="3">-2.136000 -0.495000 0.220000 -2.136000 -0.495000 0.300000 -2.136000 0.755000 0.300000 -2.136000 0.755000 0.220000 -2.136000 -0.495000 0.220000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-101">
<gml:exterior>
<gml:LinearRing gml:id="ringID-101">
<gml:posList srsDimension="3">-2.038000 0.855000 0.220000 -2.038000 0.855000 0.300000 -0.745000 0.855000 0.300000 -0.745000 0.855000 0.220000 -2.038000 0.855000 0.220000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-102">
<gml:exterior>
<gml:LinearRing gml:id="ringID-102">
<gml:posList srsDimension="3">-2.136000 0.655000 1.282000 -2.136000 0.655000 1.232000 -2.136000 -0.395000 1.232000 -2.136000 -0.395000 1.282000 -2.136000 0.655000 1.282000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-103">
<gml:exterior>
<gml:LinearRing gml:id="ringID-103">
<gml:posList srsDimension="3">-2.136000 -0.395000 1.132000 -2.136000 -0.395000 1.182000 -2.136000 0.655000 1.182000 -2.136000 0.655000 1.132000 -2.136000 -0.395000 1.132000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-104">
<gml:exterior>
<gml:LinearRing gml:id="ringID-104">
<gml:posList srsDimension="3">-1.934000 0.855000 1.132000 -1.934000 0.855000 1.182000 -0.843000 0.855000 1.182000 -0.843000 0.855000 1.132000 -1.934000 0.855000 1.132000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-105">
<gml:exterior>
<gml:LinearRing gml:id="ringID-105">
<gml:posList srsDimension="3">-0.843000 0.855000 1.282000 -0.843000 0.855000 1.232000 -1.934000 0.855000 1.232000 -1.934000 0.855000 1.282000 -0.843000 0.855000 1.282000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
<gml:surfaceMember>
<gml:Polygon gml:id="PolyIDGeo-106">
<gml:exterior>
<gml:LinearRing gml:id="ringID-106">
<gml:posList srsDimension="3">-2.038000 0.855000 2.100000 -0.745000 0.855000 2.100000 -0.745000 0.855000 0.300000 -2.038000 0.855000 0.300000 -2.038000 0.855000 2.100000 </gml:posList>
</gml:LinearRing>
</gml:exterior>
<gml:interior>
<gml:LinearRing gml:id="ringID-106_1">
<gml:posList srsDimension="3">-0.843000 0.855000 1.182000 -1.934000 0.855000 1.182000 -1.934000 0.855000 1.132000 -0.843000 0.855000 1.132000 -0.843000 0.855000 1.182000 </gml:posList>
</gml:LinearRing>
</gml:interior>
<gml:interior>
<gml:LinearRing gml:id="ringID-106_2">
<gml:posList srsDimension="3">-1.934000 0.855000 1.282000 -1.934000 0.855000 1.232000 -0.843000 0.855000 1.232000 -0.843000 0.855000 1.282000 -1.934000 0.855000 1.282000 </gml:posList>
</gml:LinearRing>
</gml:interior>
</gml:Polygon>
</gml:surfaceMember>
</gml:MultiSurface>
</gen:lod2Geometry>
</gen:GenericCityObject>
</core:cityObjectMember>
</core:CityModel>
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