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");
}
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");
}
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");
}
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();
}
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));
}
Aggregations