json.key("rotation").value(true);
Template template = configuration.getTemplates().get(name);
// find the map attribute
MapAttribute map = null;
for (Attribute attribute : template.getAttributes().values()) {
if (attribute instanceof MapAttribute) {
if (map != null) {
throw new UnsupportedOperationException("Template '" + name + "' contains "
+ "more than one map configuration. The legacy API "
+ "supports only one map per template.");
} else {
map = (MapAttribute) attribute;
}
}
}
if (map == null) {
throw new UnsupportedOperationException("Template '" + name + "' contains "
+ "no map configuration.");
}
MapAttributeValues mapValues = map.createValue(template);
json.key("map");
json.object();
{
json.key("width").value(mapValues.getMapSize().width);
json.key("height").value(mapValues.getMapSize().height);
}
json.endObject();
// get the zoom levels and dpi values from the first template
if (maxDpi == null) {
maxDpi = map.getMaxDpi();
dpiSuggestions = map.getDpiSuggestions();
}
if (zoomLevels == null) {
zoomLevels = mapValues.getZoomLevels();
}
}