@Override
protected MapComponentInfo buildMap() {
ViewPort viewPort = mapPresenter.getViewPort();
double printWidth = getPageWidth() - 2 * marginX;
double printHeight = getPageHeight() - 2 * marginY;
Bbox fittingBox = createFittingBox(viewPort.getBounds(), printWidth / printHeight);
MapComponentInfo map = super.buildMap(fittingBox);
map.getLayoutConstraint().setMarginX(marginX);
map.getLayoutConstraint().setMarginY(marginY);
map.setLocation(new org.geomajas.geometry.Coordinate(fittingBox.getX(), fittingBox.getY()));
map.setPpUnit((float) (printWidth / fittingBox.getWidth()));
map.setTag("map");
map.setMapId(mapPresenter.getConfiguration().getServerConfiguration().getId());
map.setApplicationId(applicationId);
map.setRasterResolution(rasterDpi);
double rasterScale = map.getPpUnit() * map.getRasterResolution() / 72.0;
mapBuilder.build(mapPresenter, fittingBox, rasterScale);
List<PrintComponentInfo> layers = new ArrayList<PrintComponentInfo>();
RasterizedLayersComponentInfo rasterizedLayersComponentInfo = new RasterizedLayersComponentInfo();
rasterizedLayersComponentInfo.setMapInfo(mapPresenter.getConfiguration().getServerConfiguration());
layers.add(rasterizedLayersComponentInfo);
map.getChildren().addAll(0, layers);
return map;
}