Search in sources :

Example 1 with GeneralPath

use of com.google.code.appengine.awt.geom.GeneralPath in project activityinfo by bedatadriven.

the class ImageMapRenderer method drawAdminOverlay.

@Timed(name = "mapping.draw_admin_overlay")
protected void drawAdminOverlay(TiledMap map, Graphics2D g2d, AdminOverlay overlay) {
    List<AdminGeo> geometry = geometryProvider.getGeometries(overlay.getAdminLevelId());
    Color strokeColor = ColorUtil.colorFromString(overlay.getOutlineColor());
    g2d.setStroke(new BasicStroke(1, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
    for (AdminGeo adminGeo : geometry) {
        AdminMarker polygon = overlay.getPolygon(adminGeo.getId());
        if (polygon != null) {
            GeneralPath path = PathUtils.toPath(map, adminGeo.getGeometry());
            g2d.setColor(bubbleFillColor(ColorUtil.colorFromString(polygon.getColor())));
            g2d.fill(path);
            g2d.setColor(strokeColor);
            g2d.draw(path);
        }
    }
}
Also used : AdminGeo(org.activityinfo.server.geo.AdminGeo) GeneralPath(com.google.code.appengine.awt.geom.GeneralPath) Timed(org.activityinfo.server.util.monitoring.Timed)

Example 2 with GeneralPath

use of com.google.code.appengine.awt.geom.GeneralPath in project activityinfo by bedatadriven.

the class PathUtils method toPath.

public static GeneralPath toPath(TiledMap map, Geometry geometry) {
    GeneralPath path = new GeneralPath();
    for (int i = 0; i != geometry.getNumGeometries(); ++i) {
        Polygon polygon = (Polygon) geometry.getGeometryN(i);
        PathUtils.addRingToPath(map, path, polygon.getExteriorRing().getCoordinates());
        for (int j = 0; j != polygon.getNumInteriorRing(); ++j) {
            PathUtils.addRingToPath(map, path, polygon.getInteriorRingN(j).getCoordinates());
        }
        break;
    }
    return path;
}
Also used : GeneralPath(com.google.code.appengine.awt.geom.GeneralPath) Polygon(com.vividsolutions.jts.geom.Polygon) Point(org.activityinfo.legacy.shared.reports.content.Point)

Aggregations

GeneralPath (com.google.code.appengine.awt.geom.GeneralPath)2 Polygon (com.vividsolutions.jts.geom.Polygon)1 Point (org.activityinfo.legacy.shared.reports.content.Point)1 AdminGeo (org.activityinfo.server.geo.AdminGeo)1 Timed (org.activityinfo.server.util.monitoring.Timed)1