Search in sources :

Example 1 with IconRectCalculator

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);
    }
}
Also used : Picture(org.apache.poi.hslf.model.Picture) Rectangle(com.google.code.appengine.awt.Rectangle) IconRectCalculator(org.activityinfo.server.report.generator.map.IconRectCalculator) IOException(java.io.IOException) File(java.io.File)

Aggregations

Rectangle (com.google.code.appengine.awt.Rectangle)1 File (java.io.File)1 IOException (java.io.IOException)1 IconRectCalculator (org.activityinfo.server.report.generator.map.IconRectCalculator)1 Picture (org.apache.poi.hslf.model.Picture)1