Search in sources :

Example 6 with MapMarker

use of org.activityinfo.legacy.shared.reports.content.MapMarker in project activityinfo by bedatadriven.

the class GeoDigestRenderer method renderDatabase.

private void renderDatabase(StringBuilder html, DatabaseModel databaseModel) throws IOException {
    html.append("<div class='geo-database' style='margin-top:20px'>");
    html.append("<span class='geo-header' style='font-weight:bold; color: #" + BUBBLE_COLOR + ";'>");
    html.append(databaseModel.getName());
    html.append("</span><br>");
    html.append("<img class='geo-graph' width=\"450px\" src=\"");
    html.append(databaseModel.getUrl());
    html.append("\" /><br><br>");
    for (MapMarker marker : databaseModel.getContent().getMarkers()) {
        String label = ((BubbleMapMarker) marker).getLabel();
        html.append("<span class='geo-marker-header' style='color: #" + BUBBLE_COLOR + "; font-weight:bold;'>");
        html.append(label);
        html.append(":</span><br>");
        LOGGER.finest(marker.getSiteIds().size() + " sites for marker " + label + ": " + marker.getSiteIds());
        renderSites(html, databaseModel, marker.getSiteIds());
    }
    if (!databaseModel.getContent().getUnmappedSites().isEmpty()) {
        html.append("<br><span class='geo-unmapped-header' style='color:black; font-weight:bold;'>");
        html.append(I18N.MESSAGES.geoDigestUnmappedSites());
        html.append(":</span><br>");
        LOGGER.finest(databaseModel.getContent().getUnmappedSites().size() + " unmapped sites");
        renderSites(html, databaseModel, databaseModel.getContent().getUnmappedSites());
    }
    html.append("</div>");
}
Also used : BubbleMapMarker(org.activityinfo.legacy.shared.reports.content.BubbleMapMarker) MapMarker(org.activityinfo.legacy.shared.reports.content.MapMarker) BubbleMapMarker(org.activityinfo.legacy.shared.reports.content.BubbleMapMarker)

Example 7 with MapMarker

use of org.activityinfo.legacy.shared.reports.content.MapMarker in project activityinfo by bedatadriven.

the class LRTBComparatorTest method testComparator.

@Test
public void testComparator() {
    MapMarker ul = new BubbleMapMarker();
    ul.setX(1);
    ul.setY(1);
    MapMarker ul2 = new BubbleMapMarker();
    ul2.setX(60);
    ul2.setY(0);
    MapMarker c = new BubbleMapMarker();
    c.setX(30);
    c.setY(50);
    MapMarker ll = new BubbleMapMarker();
    ll.setX(0);
    ll.setY(80);
    List<MapMarker> list = new ArrayList<MapMarker>();
    list.add(ll);
    list.add(c);
    list.add(ul2);
    list.add(ul);
    Collections.sort(list, new MapMarker.LRTBComparator());
    for (MapMarker marker : list) {
        System.out.println(marker.toString());
    }
    Assert.assertEquals(ul, list.get(0));
    Assert.assertEquals(ul2, list.get(1));
    Assert.assertEquals(c, list.get(2));
    Assert.assertEquals(ll, list.get(3));
}
Also used : BubbleMapMarker(org.activityinfo.legacy.shared.reports.content.BubbleMapMarker) MapMarker(org.activityinfo.legacy.shared.reports.content.MapMarker) ArrayList(java.util.ArrayList) BubbleMapMarker(org.activityinfo.legacy.shared.reports.content.BubbleMapMarker) Test(org.junit.Test)

Example 8 with MapMarker

use of org.activityinfo.legacy.shared.reports.content.MapMarker in project activityinfo by bedatadriven.

the class MgMapIntegrationTest method siteBoundsToAdminLevelsAreMappedAsIcons.

@Test
public void siteBoundsToAdminLevelsAreMappedAsIcons() throws IOException {
    IconMapLayer layer = new IconMapLayer();
    layer.setIcon("educ");
    layer.getIndicatorIds().add(NUMBER_OF_BENE_INDICATOR_ID);
    generateMap(layer, "mg-icons");
    assertThat(content.getMarkers().size(), equalTo(10));
    MapMarker marker = getMarkerForSite(1336279918);
    assertThat(marker.getX(), equalTo(262));
    assertThat(marker.getY(), equalTo(113));
}
Also used : MapMarker(org.activityinfo.legacy.shared.reports.content.MapMarker) IconMapLayer(org.activityinfo.legacy.shared.reports.model.layers.IconMapLayer) Test(org.junit.Test)

Aggregations

MapMarker (org.activityinfo.legacy.shared.reports.content.MapMarker)8 BubbleMapMarker (org.activityinfo.legacy.shared.reports.content.BubbleMapMarker)4 Test (org.junit.Test)3 IconMapMarker (org.activityinfo.legacy.shared.reports.content.IconMapMarker)2 ArrayList (java.util.ArrayList)1 Filter (org.activityinfo.legacy.shared.command.Filter)1 MapContent (org.activityinfo.legacy.shared.reports.content.MapContent)1 PieMapMarker (org.activityinfo.legacy.shared.reports.content.PieMapMarker)1 MapReportElement (org.activityinfo.legacy.shared.reports.model.MapReportElement)1 BubbleMapLayer (org.activityinfo.legacy.shared.reports.model.layers.BubbleMapLayer)1 IconMapLayer (org.activityinfo.legacy.shared.reports.model.layers.IconMapLayer)1 Extents (org.activityinfo.model.type.geo.Extents)1 HSSFWorkbook (org.apache.poi.hssf.usermodel.HSSFWorkbook)1 Options (org.discotools.gwt.leaflet.client.Options)1 EventHandler (org.discotools.gwt.leaflet.client.events.handler.EventHandler)1 JSObject (org.discotools.gwt.leaflet.client.jsobject.JSObject)1 CircleMarker (org.discotools.gwt.leaflet.client.marker.CircleMarker)1 Marker (org.discotools.gwt.leaflet.client.marker.Marker)1 MarkerOptions (org.discotools.gwt.leaflet.client.marker.MarkerOptions)1 IconOptions (org.discotools.gwt.leaflet.client.types.IconOptions)1