use of org.activityinfo.server.report.generator.map.IconRectCalculator in project activityinfo by bedatadriven.
the class PPTMapRenderer method addIconMarker.
private void addIconMarker(SlideShow ppt, Slide slide, int offsetX, int offsetY, Map<String, Integer> iconPictureIndex, IconMapMarker marker) {
Integer iconIndex = iconPictureIndex.get(marker.getIcon().getName());
if (iconIndex == null) {
try {
iconIndex = ppt.addPicture(new File(getMapIconRoot() + "/" + marker.getIcon().getName() + ".png"), Picture.PNG);
} catch (IOException e) {
iconIndex = -1;
}
iconPictureIndex.put(marker.getIcon().getName(), iconIndex);
}
if (iconIndex != -1) {
IconRectCalculator rectCtor = new IconRectCalculator(marker.getIcon());
Picture icon = new Picture(iconIndex);
org.activityinfo.shared.geom.Rectangle iconRect = rectCtor.iconRect(offsetX + marker.getX(), offsetY + marker.getY());
icon.setAnchor(new Rectangle(iconRect.getX(), iconRect.getY(), iconRect.getWidth(), iconRect.getHeight()));
slide.addShape(icon);
}
}
Aggregations