g.clearRect(0,0, getMapDisplay().getWidth(), getMapDisplay().getHeight());
//update screen tile states
for( Iterator<Object> iterator = tileCache.getKeys().iterator(); iterator.hasNext(); ) {
ReferencedEnvelope referencedEnvelope = (ReferencedEnvelope) iterator.next();
Tile t = (Tile)tileCache.get(referencedEnvelope);
if (t != null && !tileBounds.contains(referencedEnvelope)){
t.setScreenState(Tile.ScreenState.OFFSCREEN);
}
}
try {
for( Iterator<ReferencedEnvelope> iterator = tileBounds.iterator(); iterator.hasNext(); ) {
ReferencedEnvelope env = (ReferencedEnvelope) iterator.next();
// get the tile image
Tile tile = getOrCreateTile(env);
tile.setScreenState(Tile.ScreenState.ONSCREEN);
BufferedImage tileimage = tile.getBufferedImage();
//write the image to the screen image
Point a = getViewportModelInternal().worldToPixel(new Coordinate(env.getMinX(), env.getMinY()));
Point b = getViewportModelInternal().worldToPixel(new Coordinate(env.getMaxX(), env.getMaxY()));