}
}
protected String getTileMapDoc(TileLayer layer, GridSubset gridSub, GridSetBroker gsb, MimeType mimeType) {
StringBuilder str = new StringBuilder();
XMLBuilder xml = new XMLBuilder(str);
try {
xml.header("1.0", encoding);
xml.indentElement("TileMap")
.attribute("version", "1.0.0")
.attribute("tilemapservice", urlMangler.buildURL(baseUrl, contextPath, "/service/tms/1.0.0"));
xml.simpleElement("Title", tileMapTitle(layer), true);
xml.simpleElement("Abstract", tileMapDescription(layer), true);
// <KeywordList></KeywordList>
// <Metadata type="TC211" mime-type="text/xml" href="http://www.org" />
// <Attribution>
// <Title>National Geospatial Intelligence Agency</Title>
// <Logo width="10" height="10" href="http://nga.mil/logo.gif" mime-type="image/gif" />
// </Attribution>
// <WebMapContext href="http://wms.org" />
// <Face>0</Face>
// Check with tschaub whether we actually have to provide this as OSGEO:40041
// No.
xml.simpleElement("SRS", gridSub.getSRS().toString(), true);
double[] coords = gridSub.getCoverageBestFitBounds().getCoords();
xml.boundingBox(null, coords[0], coords[1], coords[2], coords[3]);
xml.indentElement("Origin")
.attribute("x", Double.toString(coords[0]))
.attribute("y", Double.toString(coords[1]))
.endElement();
// Can we have multiple formats? NO
xml.indentElement("TileFormat")
.attribute("width", Integer.toString(gridSub.getTileWidth()))
.attribute("height", Integer.toString(gridSub.getTileHeight()))
.attribute("mime-type", mimeType.getMimeType())
.attribute("extension", mimeType.getFileExtension())
.endElement();
xml.indentElement("TileSets")
.attribute("profile", profileForGridSet(gridSub.getGridSet()));
double[] resolutions = gridSub.getResolutions();
int resIdx = 0;
for(int zoom = gridSub.getZoomStart(); zoom <= gridSub.getZoomStop(); zoom++) {
xml.indentElement("TileSet");
xml.attribute("href", tileMapUrl(layer, gridSub, mimeType, zoom));
xml.attribute("units-per-pixel", Double.toString(resolutions[resIdx]));
xml.attribute("order", Integer.toString(resIdx));
xml.endElement();;
resIdx++;
}
xml.endElement();
xml.endElement();
return str.toString();
} catch (IOException ex) {
// Should not happen
throw new IllegalStateException(ex);