use of org.activityinfo.shared.report.content.ReportContent in project activityinfo by bedatadriven.
the class StaticElementRenderTest method getStatic.
public Report getStatic() throws JAXBException {
Report r = parseXml("static.xml");
r.setContent(new ReportContent());
r.getContent().setFilterDescriptions(new ArrayList<FilterDescription>());
return r;
}
use of org.activityinfo.shared.report.content.ReportContent in project activityinfo by bedatadriven.
the class ItextReportRendererTest method iconTest.
@Test
public void iconTest() throws IOException {
IconMapMarker marker1 = new IconMapMarker();
marker1.setIcon(MapIcon.fromEnum(Icon.Default));
marker1.setLat(-2.45);
marker1.setLng(28.8);
marker1.setX(100);
marker1.setY(100);
TileBaseMap baseMap = new TileBaseMap();
baseMap.setTileUrlPattern("//www.activityinfo.org/resources/tile/nordkivu.cd/{z}/{x}/{y}.png");
IconMapLayer layer3 = new IconMapLayer();
layer3.setIcon(MapIcon.Icon.Default.name());
layer3.getIndicatorIds().add(101);
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 map = new MapReportElement();
map.setTitle("My Map");
map.setContent(mapContent);
map.addLayer(layer3);
ReportContent content = new ReportContent();
content.setFilterDescriptions(Collections.EMPTY_LIST);
Report report = new Report();
report.setContent(content);
report.addElement(map);
renderToPdf(report, "iconMarker.pdf");
renderToHtml(report, "iconMarker.html");
renderToRtf(report, "iconMarker.rtf");
renderToPpt(map, "iconMarker.ppt");
renderToImage(map, "iconMarker.png");
}
use of org.activityinfo.shared.report.content.ReportContent in project activityinfo by bedatadriven.
the class ItextReportRendererTest method manyColumns.
@Test
public void manyColumns() throws IOException {
PivotTableData data = new PivotTableData();
Dimension partner = new Dimension(DimensionType.Partner);
Dimension year = new DateDimension(DateUnit.YEAR);
EntityCategory avsi = new EntityCategory(100, "AVSI RRMP");
Axis avsiRow = data.getRootRow().addChild(partner, avsi, avsi.getLabel(), comparator);
for (int y = 2011; y < 2030; ++y) {
Axis col = data.getRootColumn().addChild(year, new SimpleCategory("" + y), "" + y, comparator);
avsiRow.setValue(col, (double) y);
}
PivotContent tableContent = new PivotContent(data, Lists.<FilterDescription>newArrayList());
PivotTableReportElement table = new PivotTableReportElement();
table.addRowDimension(partner);
table.addColDimension(year);
table.setContent(tableContent);
ReportContent content = new ReportContent();
content.setFilterDescriptions(Collections.EMPTY_LIST);
Report report = new Report();
report.setContent(content);
report.addElement(table);
renderToPdf(report, "narrowColumns.pdf");
renderToRtf(report, "narrowColumns.rtf");
}
use of org.activityinfo.shared.report.content.ReportContent in project activityinfo by bedatadriven.
the class ItextReportRendererTest method htmlImages.
@Test
public void htmlImages() throws IOException {
DummyPivotTableData data = new DummyPivotTableData();
PivotChartContent chartContent = new PivotChartContent();
chartContent.setData(data.table);
chartContent.setYMin(0);
chartContent.setYStep(100);
chartContent.setFilterDescriptions(Collections.EMPTY_LIST);
PivotChartReportElement chart = new PivotChartReportElement(Type.Pie);
chart.setTitle("My Pie Chart");
chart.setCategoryDimensions(data.colDims);
chart.setSeriesDimensions(data.rowDims);
chart.setContent(chartContent);
PivotContent tableContent = new PivotContent();
tableContent.setFilterDescriptions(Collections.EMPTY_LIST);
tableContent.setData(data.table);
PivotTableReportElement table = new PivotTableReportElement();
table.setColumnDimensions(data.colDims);
table.setRowDimensions(data.rowDims);
table.setTitle("My Table");
table.setContent(tableContent);
BubbleMapMarker marker1 = new BubbleMapMarker();
marker1.setLat(-2.45);
marker1.setLng(28.8);
marker1.setX(100);
marker1.setY(100);
marker1.setRadius(25);
TileBaseMap baseMap = new TileBaseMap();
baseMap.setTileUrlPattern("http://mt{s}.aimaps.net/nordkivu.cd/v1/z{z}/{x}x{y}.png");
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 map = new MapReportElement();
map.setTitle("My Map");
map.setContent(mapContent);
ReportContent content = new ReportContent();
content.setFilterDescriptions(Collections.EMPTY_LIST);
Report report = new Report();
report.setContent(content);
report.addElement(chart);
report.addElement(table);
report.addElement(new TextReportElement("Testing 1..2.3.. français"));
report.addElement(map);
renderToPdf(report, "piechart.pdf");
renderToHtml(report, "piechart.html");
// renderToHtmlUsingWriter(report, "piechart2.html");
renderToRtf(report, "piechart.rtf");
}
use of org.activityinfo.shared.report.content.ReportContent 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");
}
Aggregations