use of org.activityinfo.server.util.logging.LogSlow in project activityinfo by bedatadriven.
the class ImageMapRenderer method drawAdminOverlay.
@LogSlow(threshold = 50)
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);
}
}
}
use of org.activityinfo.server.util.logging.LogSlow in project activityinfo by bedatadriven.
the class ImageMapRenderer method drawGoogleBaseMap.
@LogSlow(threshold = 100)
protected void drawGoogleBaseMap(TileHandler tileHandler, TiledMap map, GoogleBaseMap baseMap) throws IOException {
for (int x = 0; x < map.getWidth(); x += GoogleStaticMapsApi.MAX_WIDTH) {
for (int y = 0; y < map.getHeight(); y += GoogleStaticMapsApi.MAX_HEIGHT) {
int sliceWidth = Math.min(GoogleStaticMapsApi.MAX_WIDTH, map.getWidth() - x);
int sliceHeight = Math.min(GoogleStaticMapsApi.MAX_HEIGHT, map.getHeight() - y);
AiLatLng sliceCenter = map.fromPixelToLatLng(x + (sliceWidth / 2), y + (sliceHeight / 2));
String tileUrl = GoogleStaticMapsApi.buildRequest().setBaseMap(baseMap).setCenter(sliceCenter).setWidth(sliceWidth).setHeight(sliceHeight).setZoom(map.getZoom()).urlString();
tileHandler.addTile(tileUrl, x, y, sliceWidth, sliceHeight);
}
}
}
use of org.activityinfo.server.util.logging.LogSlow in project activityinfo by bedatadriven.
the class WkbGeometryProvider method getGeometries.
@Override
@LogSlow(threshold = 200)
public List<AdminGeo> getGeometries(int adminLevelId) {
try {
List<AdminGeo> list = Lists.newArrayList();
DataInputStream in = new DataInputStream(storage.openWkb(adminLevelId));
WKBReader wkbReader = new WKBReader(geometryFactory);
int count = in.readInt();
for (int i = 0; i != count; ++i) {
int id = in.readInt();
LOGGER.info("Reading geometry for admin entity " + id);
Geometry geometry = wkbReader.read(new DataInputInStream(in));
list.add(new AdminGeo(id, geometry));
}
return list;
} catch (IOException e) {
throw new RuntimeException(e);
} catch (ParseException e) {
throw new RuntimeException(e);
}
}
Aggregations