use of org.activityinfo.shared.report.content.AdminOverlay in project activityinfo by bedatadriven.
the class MapEditorMapView method onContentLoaded.
private void onContentLoaded(MapContent result) {
Log.debug("MapPreview: Received content");
content = result;
statusWidget.setStatus(result.getUnmappedSites().size() + " " + I18N.CONSTANTS.siteLackCoordiantes(), null);
if (!isRendered()) {
return;
}
if (map == null) {
createMap();
}
overlays.clear();
overlays.setBaseMap(result.getBaseMap());
overlays.addMarkers(result.getMarkers());
for (AdminOverlay overlay : result.getAdminOverlays()) {
overlays.addAdminLayer(overlay);
}
if (!zoomSet) {
if (model.getZoomLevel() != -1 && model.getCenter() != null) {
map.getMap().setView(new LatLng(model.getCenter().getLat(), model.getCenter().getLng()), model.getZoomLevel(), true);
} else {
map.fitBounds(result.getExtents());
}
zoomSet = true;
}
}
use of org.activityinfo.shared.report.content.AdminOverlay in project activityinfo by bedatadriven.
the class LeafletReportOverlays method syncWith.
public void syncWith(MapReportElement element) {
clear();
addMarkers(element.getContent().getMarkers());
setBaseMap(element.getContent().getBaseMap());
for (AdminOverlay overlay : element.getContent().getAdminOverlays()) {
addAdminLayer(overlay);
}
setView(element.getContent());
}
use of org.activityinfo.shared.report.content.AdminOverlay in project activityinfo by bedatadriven.
the class PolygonGeneratorTest method polygonWithHole.
@Test
public void polygonWithHole() throws IOException {
AdminMarker marker = new AdminMarker();
marker.setAdminEntityId(1930);
marker.setColor("#FFBBBB");
AdminOverlay overlay = new AdminOverlay(1383);
overlay.setOutlineColor("#FF0000");
overlay.addPolygon(marker);
PolygonMapLayer layer = new PolygonMapLayer();
layer.addIndicatorId(1);
layer.setAdminLevelId(1383);
MapContent content = new MapContent();
content.setZoomLevel(8);
content.setBaseMap(GoogleBaseMap.ROADMAP);
content.setCenter(new AiLatLng(12.60500192642215, -7.98924994468689));
content.getAdminOverlays().add(overlay);
content.setFilterDescriptions(new ArrayList<FilterDescription>());
PolygonLegend.ColorClass clazz1 = new PolygonLegend.ColorClass(1, 53.6, "0000FF");
PolygonLegend.ColorClass clazz2 = new PolygonLegend.ColorClass(600, 600, "FF0000");
PolygonLegend legend = new PolygonLegend(layer, Lists.newArrayList(clazz1, clazz2));
content.getLegends().add(legend);
IndicatorDTO indicator = new IndicatorDTO();
indicator.setId(1);
indicator.setName("Indicator Test");
content.getIndicators().add(indicator);
MapReportElement map = new MapReportElement();
map.addLayer(layer);
map.setContent(content);
FileOutputStream fos = new FileOutputStream("target/report-tests/polygon-hole.pdf");
PdfReportRenderer pdfr = new PdfReportRenderer(TestGeometry.get(), "");
pdfr.render(map, fos);
fos.close();
}
Aggregations