1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
public synchronized void paint(Graphics g) {
  Graphics2D g2 = (Graphics2D) g;
  int w = getWidth();
  int h = getHeight();
  ...
  // Draw Background.
  g2.setBackground(getBackground());
  g2.clearRect(0, 0, w, h);
  g2.setTransform(_worldToView.getTransform());

  // Draw Map.
  switchFromWorldScaleToMapScale(g2);
  g2.drawImage(backgroundImg, 0, 0, null);
  switchFromMapScaleToWorldScale(g2);

  synchronized (_depthOrdering) { 
    for (Iterator it = _depthOrdering.iterator(); it.hasNext();) {
      MapObject mo = (MapObject)it.next();
      mo.paint(g2);
    }
  }
  ...
}