use of net.parostroj.timetable.output2.impl.Cycles in project grafikon by jub77.
the class XmlEngineCyclesOutput method writeTo.
@Override
protected void writeTo(OutputParams params, OutputStream stream, TrainDiagram diagram) throws OutputException {
try {
EngineCyclesExtractor tuce = new EngineCyclesExtractor(SelectionHelper.selectCycles(params, diagram, diagram.getEngineCycleType()));
EngineCycles cycles = new EngineCycles(tuce.getEngineCycles());
JAXBContext context = JAXBContext.newInstance(EngineCycles.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(cycles, writer);
} catch (Exception e) {
throw new OutputException(e);
}
}
use of net.parostroj.timetable.output2.impl.Cycles in project grafikon by jub77.
the class StartsTemplateBinding method addSpecific.
@Override
protected void addSpecific(OutputParams params, Map<String, Object> map, TrainDiagram diagram, Locale locale) {
Integer startTime = params.getParamValue("start.time", Integer.class);
// extract positions
PositionsExtractor pe = new PositionsExtractor(diagram);
List<Position> engines = pe.getStartPositions(diagram.getEngineCycleType().getCycles(), startTime);
List<Position> trainUnits = pe.getStartPositions(diagram.getTrainUnitCycleType().getCycles(), startTime);
List<Cycles> customCycles = pe.getStartPositionsCustom(startTime);
// call template
map.put("engines", engines);
map.put("train_units", trainUnits);
map.put("custom_cycles", customCycles);
map.put("start_time", startTime);
}
Aggregations