final List<SceneObject> sceneObjects = context.getSceneObjects();
final Timestamp to = context.getTo();
final Timestamp from = context.getFrom();
Image image;
try {
BufferedImage backgroundImage = backgroundImageProvider.getImage(context.getReferenceTimestamp());
if (backgroundImage != null) {
image = new Image(getOutputConfiguration(), drawAttributes, backgroundImage);
} else {
image = new Image(getOutputConfiguration(), drawAttributes);
}
} catch (IOException e1) {
logger.error("could not read background image: " + e1);
image = new Image(getOutputConfiguration(), drawAttributes);
}
for (final SceneObject obj : sceneObjects) {
image.drawPointData(transformation.transform(obj), sceneConfig);
}
image.drawTimestamp(context.getReferenceTimestamp(), sceneConfig);
image.drawDaycounter(context.getDaycount(), sceneConfig);
drawnObjects.addAndGet(sceneObjects.size());
try {
image.save(outputFile);
logger.info("created " + fileName + ", " + sceneObjects.size() + " objects drawn, timestamp between " + from + " and " + to);
} catch (IOException e) {
logger.error("error creating image #" + num + ": " + e);
}
}