Commit 2ed18e2e authored by Riegel's avatar Riegel
Browse files

Fix oversight in CityGML version number parsing

parent f1d06dce
Pipeline #10275 passed with stage
in 1 minute and 19 seconds
...@@ -341,16 +341,17 @@ public class CityGmlParser { ...@@ -341,16 +341,17 @@ public class CityGmlParser {
CityGMLInputFactory inputFactory, ObservedInputStream ois) throws CityGMLReadException { CityGMLInputFactory inputFactory, ObservedInputStream ois) throws CityGMLReadException {
try (CityGMLReader reader = inputFactory.createCityGMLReader(ois)) { try (CityGMLReader reader = inputFactory.createCityGMLReader(ois)) {
Citygml3FeatureMapper mapper = new Citygml3FeatureMapper(config, file); Citygml3FeatureMapper mapper = new Citygml3FeatureMapper(config, file);
CityGMLVersion version = null;
// model is read in chunked mode // model is read in chunked mode
// object members are replaced by href in model // object members are replaced by href in model
// need to remove the refs and re-add unparsed objects // need to remove the refs and re-add unparsed objects
List<AbstractCityObject> acos = new ArrayList<>(); List<AbstractCityObject> acos = new ArrayList<>();
while (reader.hasNext()) { while (reader.hasNext()) {
AbstractFeature chunk = reader.next(); AbstractFeature chunk = reader.next();
version = CityGMLModules.getCityGMLVersion(reader.getName().getNamespaceURI());
if (chunk instanceof CityModel cModel) { if (chunk instanceof CityModel cModel) {
cModel.setCityObjectMembers(null); cModel.setCityObjectMembers(null);
mapper.setCityModel(cModel); mapper.setCityModel(cModel);
CityGMLVersion version = CityGMLModules.getCityGMLVersion(reader.getName().getNamespaceURI());
mapper.setCityGMLVersion(version); mapper.setCityGMLVersion(version);
} else if (chunk instanceof AbstractCityObject aco) { } else if (chunk instanceof AbstractCityObject aco) {
acos.add(aco); acos.add(aco);
...@@ -380,6 +381,7 @@ public class CityGmlParser { ...@@ -380,6 +381,7 @@ public class CityGmlParser {
// Remove gag // Remove gag
gagged = false; gagged = false;
} }
mapper.setCityGMLVersion(version);
return mapper.getModel(); return mapper.getModel();
} }
} }
......
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