Commit da7ce302 authored by Riegel's avatar Riegel
Browse files

Feat: Add entrypoints for parsing CityModel from Stream

2 merge requests!28Version 3.17.0 Release,!26Add ZIP-archive support
Showing with 35 additions and 0 deletions
+35 -0
......@@ -196,6 +196,41 @@ public class CityGmlParser {
}
}
public static CityDoctorModel parseCityGmlStream(InputStream is, ParserConfiguration config)
throws CityGmlParseException, InvalidGmlFileException {
return parseCityGmlStream(is, config, null, null);
}
public static CityDoctorModel parseCityGmlStream(InputStream is, ParserConfiguration config, ProgressListener l)
throws CityGmlParseException, InvalidGmlFileException {
return parseCityGmlStream(is, config, l, null);
}
public static CityDoctorModel parseCityGmlStream(InputStream is, ParserConfiguration config, ProgressListener l,
GMLValidationHandler handler) throws CityGmlParseException, InvalidGmlFileException {
CityGMLContext context = getContext();
if (config.getValidate()) {
//TODO: Think of something to validate Inputstream
throw new InvalidGmlFileException("Invalid GML File.");
}
try {
parseEpsgCodeFromStream(is, config);
CityGMLInputFactory in = context.createCityGMLInputFactory()
.withChunking(ChunkOptions.chunkByProperties(chunkProperties).skipCityModel(false));
try(ObservedInputStream ois = new ObservedInputStream(is, is.available())){
if (l != null){
ois.addListener(l::updateProgress);
}
return readAndKeepFeatures(config, Path.of(""), in, ois);
}
} catch (CityGMLReadException | IOException | ParserConfigurationException | SAXException e) {
logger.error(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);
......
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