Search in sources :

Example 6 with MapReportElement

use of org.activityinfo.shared.report.model.MapReportElement in project activityinfo by bedatadriven.

the class ItextReportRendererTest method googleMapsBaseMap.

@Test
public void googleMapsBaseMap() throws IOException {
    ReportContent content = new ReportContent();
    content.setFilterDescriptions(Collections.EMPTY_LIST);
    Report report = new Report();
    report.setContent(content);
    TileBaseMap referenceBaseMap = new TileBaseMap();
    referenceBaseMap.setTileUrlPattern("http://www.activityinfo.org/resources/tile/admin.cd/{z}/{x}/{y}.png");
    referenceBaseMap.setName("Administrative Map");
    BaseMap[] baseMaps = new BaseMap[] { referenceBaseMap, GoogleBaseMap.HYBRID, GoogleBaseMap.ROADMAP, GoogleBaseMap.SATELLITE, GoogleBaseMap.TERRAIN };
    for (BaseMap baseMap : baseMaps) {
        BubbleMapMarker marker1 = new BubbleMapMarker();
        marker1.setLat(-2.45);
        marker1.setLng(28.8);
        marker1.setX(100);
        marker1.setY(100);
        marker1.setRadius(25);
        MapContent mapContent = new MapContent();
        mapContent.setFilterDescriptions(Collections.EMPTY_LIST);
        mapContent.setBaseMap(baseMap);
        mapContent.setZoomLevel(8);
        mapContent.setCenter(new Extents(-2.2, -2.1, 28.85, 28.9).center());
        mapContent.setMarkers(Arrays.asList((MapMarker) marker1));
        MapReportElement satelliteMap = new MapReportElement();
        satelliteMap.setTitle(baseMap.toString());
        satelliteMap.setContent(mapContent);
        report.addElement(satelliteMap);
    }
    // renderToPdf(report, "google map.pdf");
    // renderToHtml(report, "google map.html");
    renderToRtf(report, "google map.rtf");
}
Also used : MapReportElement(org.activityinfo.shared.report.model.MapReportElement) ReportContent(org.activityinfo.shared.report.content.ReportContent) MapMarker(org.activityinfo.shared.report.content.MapMarker) IconMapMarker(org.activityinfo.shared.report.content.IconMapMarker) BubbleMapMarker(org.activityinfo.shared.report.content.BubbleMapMarker) Report(org.activityinfo.shared.report.model.Report) MapContent(org.activityinfo.shared.report.content.MapContent) TileBaseMap(org.activityinfo.shared.map.TileBaseMap) BubbleMapMarker(org.activityinfo.shared.report.content.BubbleMapMarker) Extents(org.activityinfo.shared.util.mapping.Extents) GoogleBaseMap(org.activityinfo.shared.map.GoogleBaseMap) BaseMap(org.activityinfo.shared.map.BaseMap) TileBaseMap(org.activityinfo.shared.map.TileBaseMap) Test(org.junit.Test)

Example 7 with MapReportElement

use of org.activityinfo.shared.report.model.MapReportElement in project activityinfo by bedatadriven.

the class PPTMapRendererTest method renderTitledMap.

@Test
public void renderTitledMap() throws FileNotFoundException, IOException {
    MapReportElement map = createMap(referenceBaseMap);
    renderPPT(map, "tiledMap.ppt");
}
Also used : MapReportElement(org.activityinfo.shared.report.model.MapReportElement) Test(org.junit.Test)

Example 8 with MapReportElement

use of org.activityinfo.shared.report.model.MapReportElement in project activityinfo by bedatadriven.

the class PPTMapRendererTest method renderPPtScaled2.

@Test
public void renderPPtScaled2() throws IOException {
    MapReportElement map = createMap(GoogleBaseMap.ROADMAP);
    renderPPT(map, "googleBaseMap.ppt");
}
Also used : MapReportElement(org.activityinfo.shared.report.model.MapReportElement) Test(org.junit.Test)

Example 9 with MapReportElement

use of org.activityinfo.shared.report.model.MapReportElement in project activityinfo by bedatadriven.

the class PPTMapRendererTest method renderPPtScaled.

@Test
public void renderPPtScaled() throws IOException {
    MapReportElement element = createMap(GoogleBaseMap.ROADMAP);
    FileOutputStream fos = new FileOutputStream("target/report-tests/map-custom-extents.ppt");
    PPTMapRenderer renderer = new PPTMapRenderer(TestGeometry.get(), "");
    renderer.render(element, fos);
    fos.close();
}
Also used : MapReportElement(org.activityinfo.shared.report.model.MapReportElement) FileOutputStream(java.io.FileOutputStream) Test(org.junit.Test)

Example 10 with MapReportElement

use of org.activityinfo.shared.report.model.MapReportElement in project activityinfo by bedatadriven.

the class MapGeneratorTest method adminMapIcon.

@Test
public void adminMapIcon() {
    AdministrativeLevelClustering clustering = new AdministrativeLevelClustering();
    clustering.getAdminLevels().add(1);
    IconMapLayer layer = new IconMapLayer();
    layer.setClustering(clustering);
    layer.getIndicatorIds().add(1);
    Filter filter = new Filter();
    filter.addRestriction(DimensionType.Site, 3);
    MapReportElement map = new MapReportElement();
    map.addLayer(layer);
    map.setFilter(filter);
    MapContent result = (MapContent) execute(new GenerateElement(map));
    System.out.println(result.getMarkers());
    IconMapMarker marker = (IconMapMarker) result.getMarkers().get(0);
    assertThat(marker.getSiteIds().size(), equalTo(1));
    assertThat(marker.getSiteIds().get(0), equalTo(3));
    System.out.println(marker.getTitle());
    // assertThat(marker., equalTo(10000d));
    assertThat(result.getUnmappedSites().size(), equalTo(0));
}
Also used : MapReportElement(org.activityinfo.shared.report.model.MapReportElement) AdministrativeLevelClustering(org.activityinfo.shared.report.model.clustering.AdministrativeLevelClustering) IconMapLayer(org.activityinfo.shared.report.model.layers.IconMapLayer) MapContent(org.activityinfo.shared.report.content.MapContent) IconMapMarker(org.activityinfo.shared.report.content.IconMapMarker) Test(org.junit.Test)

Aggregations

MapReportElement (org.activityinfo.shared.report.model.MapReportElement)23 Test (org.junit.Test)17 MapContent (org.activityinfo.shared.report.content.MapContent)12 Report (org.activityinfo.shared.report.model.Report)8 BubbleMapMarker (org.activityinfo.shared.report.content.BubbleMapMarker)6 IconMapMarker (org.activityinfo.shared.report.content.IconMapMarker)6 TileBaseMap (org.activityinfo.shared.map.TileBaseMap)5 MapMarker (org.activityinfo.shared.report.content.MapMarker)5 BubbleMapLayer (org.activityinfo.shared.report.model.layers.BubbleMapLayer)5 FileOutputStream (java.io.FileOutputStream)4 PivotChartReportElement (org.activityinfo.shared.report.model.PivotChartReportElement)4 AiLatLng (org.activityinfo.shared.report.content.AiLatLng)3 ReportContent (org.activityinfo.shared.report.content.ReportContent)3 TableElement (org.activityinfo.shared.report.model.TableElement)3 PiechartMapLayer (org.activityinfo.shared.report.model.layers.PiechartMapLayer)3 Extents (org.activityinfo.shared.util.mapping.Extents)3 JsonArray (com.google.gson.JsonArray)2 JsonObject (com.google.gson.JsonObject)2 PdfReportRenderer (org.activityinfo.server.report.renderer.itext.PdfReportRenderer)2 IndicatorDTO (org.activityinfo.shared.dto.IndicatorDTO)2