use of org.activityinfo.legacy.shared.reports.model.layers.PolygonMapLayer in project activityinfo by bedatadriven.
the class NewLayerWizard method createLayer.
public MapLayer createLayer() {
MapLayer layer = layerTypePage.newLayer();
layer.setName(composeName());
for (Integer indicatorId : indicatorPage.getSelectedIds()) {
layer.addIndicatorId(indicatorId);
}
if (layer instanceof PolygonMapLayer) {
((PolygonMapLayer) layer).setAdminLevelId(adminLevelPage.getSelectedLevelId());
}
return layer;
}
use of org.activityinfo.legacy.shared.reports.model.layers.PolygonMapLayer in project activityinfo by bedatadriven.
the class PolygonGeneratorTest method basicTest.
@Test
public void basicTest() throws IOException {
PolygonMapLayer layer = new PolygonMapLayer();
layer.addIndicatorId(1);
layer.setAdminLevelId(1383);
MapReportElement map = new MapReportElement();
map.addLayer(layer);
MapContent content = execute(new GenerateElement<MapContent>(map));
map.setContent(content);
Reports.toPdf(getClass(), map, "polygon");
try (FileOutputStream fos = TestOutput.open(getClass(), "polygon.pdf")) {
PdfReportRenderer renderer = new PdfReportRenderer(TestGeometry.get(), MAP_ICON_PATH);
renderer.render(map, fos);
}
}
use of org.activityinfo.legacy.shared.reports.model.layers.PolygonMapLayer 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);
try (FileOutputStream fos = TestOutput.open(getClass(), "polygon-hole.pdf")) {
PdfReportRenderer renderer = new PdfReportRenderer(TestGeometry.get(), MAP_ICON_PATH);
renderer.render(map, fos);
}
}
Aggregations