use of net.parostroj.timetable.output2.impl.StationTimetablesExtractor in project grafikon by jub77.
the class XmlStationTimetablesOutput method writeTo.
@Override
protected void writeTo(OutputParams params, OutputStream stream, TrainDiagram diagram) throws OutputException {
try {
// show circulations in adjacent sessions
boolean adjacentSessions = params.getParamValue("adjacent.sessions", Boolean.class, false);
// technological times
boolean techTime = false;
if (params.paramExistWithValue("tech.time")) {
techTime = params.getParam("tech.time").getValue(Boolean.class);
}
// extract positions
StationTimetablesExtractor se = new StationTimetablesExtractor(diagram, SelectionHelper.selectNodes(params, diagram), techTime, adjacentSessions, this.getLocale());
StationTimetables st = new StationTimetables(se.getStationTimetables());
JAXBContext context = JAXBContext.newInstance(StationTimetables.class);
Marshaller m = context.createMarshaller();
m.setProperty(Marshaller.JAXB_ENCODING, this.getCharset().name());
m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
Writer writer = new OutputStreamWriter(stream, this.getCharset());
m.marshal(st, writer);
} catch (Exception e) {
throw new OutputException(e);
}
}
Aggregations