Search in sources :

Example 1 with AdminOverlay

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;
    }
}
Also used : AdminOverlay(org.activityinfo.shared.report.content.AdminOverlay) LatLng(org.discotools.gwt.leaflet.client.types.LatLng) AiLatLng(org.activityinfo.shared.report.content.AiLatLng)

Example 2 with AdminOverlay

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());
}
Also used : AdminOverlay(org.activityinfo.shared.report.content.AdminOverlay)

Example 3 with AdminOverlay

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();
}
Also used : PolygonMapLayer(org.activityinfo.shared.report.model.layers.PolygonMapLayer) MapContent(org.activityinfo.shared.report.content.MapContent) PdfReportRenderer(org.activityinfo.server.report.renderer.itext.PdfReportRenderer) FilterDescription(org.activityinfo.shared.report.content.FilterDescription) MapReportElement(org.activityinfo.shared.report.model.MapReportElement) IndicatorDTO(org.activityinfo.shared.dto.IndicatorDTO) AdminOverlay(org.activityinfo.shared.report.content.AdminOverlay) PolygonLegend(org.activityinfo.shared.report.content.PolygonLegend) AdminMarker(org.activityinfo.shared.report.content.AdminMarker) FileOutputStream(java.io.FileOutputStream) AiLatLng(org.activityinfo.shared.report.content.AiLatLng) Test(org.junit.Test)

Aggregations

AdminOverlay (org.activityinfo.shared.report.content.AdminOverlay)3 AiLatLng (org.activityinfo.shared.report.content.AiLatLng)2 FileOutputStream (java.io.FileOutputStream)1 PdfReportRenderer (org.activityinfo.server.report.renderer.itext.PdfReportRenderer)1 IndicatorDTO (org.activityinfo.shared.dto.IndicatorDTO)1 AdminMarker (org.activityinfo.shared.report.content.AdminMarker)1 FilterDescription (org.activityinfo.shared.report.content.FilterDescription)1 MapContent (org.activityinfo.shared.report.content.MapContent)1 PolygonLegend (org.activityinfo.shared.report.content.PolygonLegend)1 MapReportElement (org.activityinfo.shared.report.model.MapReportElement)1 PolygonMapLayer (org.activityinfo.shared.report.model.layers.PolygonMapLayer)1 LatLng (org.discotools.gwt.leaflet.client.types.LatLng)1 Test (org.junit.Test)1