use of org.n52.io.quantity.img.ChartDimension in project series-rest-api by 52North.
the class PreRenderingJob method renderWithStyle.
private void renderWithStyle(String datasetId, RenderingConfig renderingConfig, String interval) throws IOException, DatasetFactoryException, URISyntaxException {
IntervalWithTimeZone timespan = createTimespanFromInterval(datasetId, interval);
IoParameters config = createConfig(timespan.toString(), renderingConfig);
DatasetOutput<?, ?> metadata = datasetService.getParameter(datasetId, config);
IoStyleContext context = IoStyleContext.createContextForSingleSeries(metadata, config);
RequestStyledParameterSet styleDefinition = context.getChartStyleDefinitions();
context.setDimensions(new ChartDimension(styleDefinition.getWidth(), styleDefinition.getHeight()));
RequestSimpleParameterSet parameters = RequestSimpleParameterSet.createForSingleSeries(datasetId, config);
String chartQualifier = renderingConfig.getChartQualifier();
FileOutputStream fos = createFile(datasetId, interval, chartQualifier);
try (FileOutputStream out = fos) {
createIoFactory(parameters).createHandler(IMAGE_EXTENSION).writeBinary(out);
fos.flush();
} catch (IoHandlerException | IOException e) {
LOGGER.error("Image creation occures error.", e);
}
}
Aggregations