@Override
void encodeDocumentContents(Document container) {
boolean cachedMode = "cached".equals(context.getSuperOverlayMode());
// normalize the requested bounds to match a WGS84 hierarchy tile
Tile tile = new Tile(new ReferencedEnvelope(request.getBbox(), Tile.WGS84));
while(tile.getZ() > 0 && !tile.getEnvelope().contains(request.getBbox())) {
tile = tile.getParent();
}
Envelope normalizedEnvelope = null;
if (tile.getZ() >= 0 && tile.getEnvelope().contains(request.getBbox())) {
normalizedEnvelope = tile.getEnvelope();
} else {
normalizedEnvelope = KmlEncodingContext.WORLD_BOUNDS_WGS84;
}
int zoomLevel = (int) tile.getZ();
// encode top level region, which is always visible
addRegion(container, normalizedEnvelope, Integer.MAX_VALUE, -1);
List<MapLayerInfo> layers = request.getLayers();
for (int i = 0; i < layers.size(); i++) {