* Creates a superoverlay, ie. a short description and network links to the first overlays.
*
* @param tile
*/
private void handleSuperOverlay(ConveyorKMLTile tile) throws GeoWebCacheException {
TileLayer layer = tile.getLayer();
GridSubset gridSubset = tile.getGridSubset();
// int srsIdx = layer.getSRSIndex(srs);
BoundingBox bbox = gridSubset.getCoverageBestFitBounds();
String formatExtension = "." + tile.getMimeType().getFileExtension();
if (tile.getWrapperMimeType() != null) {
formatExtension = formatExtension + "." + tile.getWrapperMimeType().getFileExtension();
}
long[] gridRect = gridSubset.getCoverageBestFit();
String networkLinks = null;
// Check whether we need two tiles for world bounds or not
if (gridRect[4] > 0 && (gridRect[2] != gridRect[0] || gridRect[3] != gridRect[1])) {
throw new GeoWebCacheException(layer.getName() + " (" + bbox.toString()
+ ") is too big for the sub grid set for " + gridSubset.getName()
+ ", allow for smaller zoom levels.");
} else if (gridRect[0] != gridRect[2]) {
long[] gridLocWest = { 0, 0, 0 };
long[] gridLocEast = { 1, 0, 0 };
BoundingBox bboxWest = new BoundingBox(bbox.getMinX(), bbox.getMinY(), 0.0,
bbox.getMaxY());
BoundingBox bboxEast = new BoundingBox(0.0, bbox.getMinY(), bbox.getMaxX(),
bbox.getMaxY());
networkLinks = superOverlayNetworLink(layer.getName() + " West", bboxWest,
tile.getUrlPrefix() + "/" + gridLocString(gridLocWest) + formatExtension)
+ superOverlayNetworLink(layer.getName() + " East", bboxEast,
tile.getUrlPrefix() + "/" + gridLocString(gridLocEast)
+ formatExtension);
} else {
long[] gridLoc = { gridRect[0], gridRect[1], gridRect[4] };
networkLinks = superOverlayNetworLink(layer.getName(), bbox, tile.getUrlPrefix() + "/"
+ gridLocString(gridLoc) + formatExtension);
}
String xml = KMLHeader() + "\n<Folder>" + getLookAt(bbox) + networkLinks + "\n</Folder>"
+ "\n</kml>\n";