Index: applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/Coordinate.java
===================================================================
--- applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/Coordinate.java	(revision 16032)
+++ applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/Coordinate.java	(revision 16032)
@@ -0,0 +1,55 @@
+package org.openstreetmap.gui.jmapviewer;
+
+//License: GPL. Copyright 2009 by Stefan Zeller
+
+import java.awt.geom.Point2D;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+
+/**
+ * This class encapsulates a Point2D.Double and provide access
+ * via <tt>lat</tt> and <tt>lon</tt>.
+ * 
+ * @author Jan Peter Stotz
+ * 
+ */
+public class Coordinate implements Serializable {
+    private transient Point2D.Double data;
+
+    public Coordinate(double lat, double lon) {
+        data = new Point2D.Double(lon, lat);
+    }
+
+    public double getLat() {
+        return data.y;
+    }
+
+    public void setLat(double lat) {
+        data.y = lat;
+    }
+
+    public double getLon() {
+        return data.x;
+    }
+
+    public void setLon(double lon) {
+        data.x = lon;
+    }
+
+    private void writeObject(ObjectOutputStream out) throws IOException {
+        out.writeObject(data.x);
+        out.writeObject(data.y);
+    }
+
+    private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        data = new Point2D.Double();
+        data.x = (Double) in.readObject();
+        data.y = (Double) in.readObject();
+    }
+
+    public String toString() {
+        return "Coordinate[" + data.y + ", " + data.x + "]";
+    }
+}
Index: applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/JMapViewer.java
===================================================================
--- applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/JMapViewer.java	(revision 15039)
+++ applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/JMapViewer.java	(revision 16032)
@@ -10,5 +10,4 @@
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
-import java.awt.geom.Point2D;
 import java.util.LinkedList;
 import java.util.List;
@@ -23,4 +22,5 @@
 import org.openstreetmap.gui.jmapviewer.JobDispatcher.JobThread;
 import org.openstreetmap.gui.jmapviewer.interfaces.MapMarker;
+import org.openstreetmap.gui.jmapviewer.interfaces.MapSquare;
 import org.openstreetmap.gui.jmapviewer.interfaces.TileCache;
 import org.openstreetmap.gui.jmapviewer.interfaces.TileLoader;
@@ -53,5 +53,9 @@
 
     protected List<MapMarker> mapMarkerList;
+    protected List<MapSquare> mapSquareList;
+
     protected boolean mapMarkersVisible;
+    protected boolean mapSquaresVisible;
+
     protected boolean tileGridVisible;
 
@@ -92,5 +96,7 @@
         jobDispatcher = JobDispatcher.getInstance();
         mapMarkerList = new LinkedList<MapMarker>();
+        mapSquareList = new LinkedList<MapSquare>();
         mapMarkersVisible = true;
+        mapSquaresVisible = true;
         tileGridVisible = false;
         setLayout(null);
@@ -253,16 +259,24 @@
     }
 
-    public Point2D.Double getPosition() {
+    public Coordinate getPosition() {
         double lon = OsmMercator.XToLon(center.x, zoom);
         double lat = OsmMercator.YToLat(center.y, zoom);
-        return new Point2D.Double(lat, lon);
-    }
-
-    public Point2D.Double getPosition(Point mapPoint) {
+        return new Coordinate(lat, lon);
+    }
+
+    public Coordinate getPosition(Point mapPoint) {
         int x = center.x + mapPoint.x - getWidth() / 2;
         int y = center.y + mapPoint.y - getHeight() / 2;
         double lon = OsmMercator.XToLon(x, zoom);
         double lat = OsmMercator.YToLat(y, zoom);
-        return new Point2D.Double(lat, lon);
+        return new Coordinate(lat, lon);
+    }
+
+    public Coordinate getPosition(int mapPointX, int mapPointY) {
+        int x = center.x + mapPointX - getWidth() / 2;
+        int y = center.y + mapPointY - getHeight() / 2;
+        double lon = OsmMercator.XToLon(x, zoom);
+        double lat = OsmMercator.YToLat(y, zoom);
+        return new Coordinate(lat, lon);
     }
 
@@ -357,11 +371,26 @@
 
         // g.drawString("Tiles in cache: " + tileCache.getTileCount(), 50, 20);
-        if (!mapMarkersVisible || mapMarkerList == null)
-            return;
-        for (MapMarker marker : mapMarkerList) {
-            Point p = getMapPosition(marker.getLat(), marker.getLon());
-            // System.out.println(marker + " -> " + p);
-            if (p != null)
-                marker.paint(g, p);
+
+        if (mapSquaresVisible && mapSquareList != null) {
+            for (MapSquare square : mapSquareList) {
+                Coordinate topLeft = square.getTopLeft();
+                Coordinate bottomRight = square.getBottomRight();
+                if (topLeft != null && bottomRight != null) {
+                    Point pTopLeft = getMapPosition(topLeft.getLat(), topLeft.getLon());
+                    Point pBottomRight = getMapPosition(bottomRight.getLat(), bottomRight.getLon());
+                    if (pTopLeft != null && pBottomRight != null) {
+                        square.paint(g, pTopLeft, pBottomRight);
+                    }
+                }
+            }
+        }
+
+        if (mapMarkersVisible && mapMarkerList != null) {
+            for (MapMarker marker : mapMarkerList) {
+                Point p = getMapPosition(marker.getLat(), marker.getLon());
+                if (p != null) {
+                    marker.paint(g, p);
+                }
+            }
         }
     }
@@ -419,8 +448,8 @@
         if (zoom > tileSource.getMaxZoom() || zoom < tileSource.getMinZoom() || zoom == this.zoom)
             return;
-        Point2D.Double zoomPos = getPosition(mapPoint);
+        Coordinate zoomPos = getPosition(mapPoint);
         jobDispatcher.cancelOutstandingJobs(); // Clearing outstanding load
         // requests
-        setDisplayPositionByLatLon(mapPoint, zoomPos.x, zoomPos.y, zoom);
+        setDisplayPositionByLatLon(mapPoint, zoomPos.getLat(), zoomPos.getLon(), zoom);
     }
 
@@ -505,6 +534,26 @@
     }
 
+    public void setMapSquareList(List<MapSquare> mapSquareList) {
+        this.mapSquareList = mapSquareList;
+        repaint();
+    }
+
+    public List<MapSquare> getMapSquareList() {
+        return mapSquareList;
+    }
+
     public void addMapMarker(MapMarker marker) {
         mapMarkerList.add(marker);
+        repaint();
+    }
+
+    public void addMapSquare(MapSquare square) {
+        mapSquareList.add(square);
+        repaint();
+    }
+
+    public void removeMapSquare(MapSquare square) {
+        mapSquareList.remove(square);
+        repaint();
     }
 
@@ -557,3 +606,18 @@
     }
 
+    public boolean isMapSquaresVisible() {
+        return mapSquaresVisible;
+    }
+
+    /**
+     * Enables or disables painting of the {@link MapSquare}
+     * 
+     * @param mapMarkersVisible
+     * @see #addMapSquare(MapSquare)
+     * @see #getMapSquareList()
+     */
+    public void setMapSquaresVisible(boolean mapSquaresVisible) {
+        this.mapSquaresVisible = mapSquaresVisible;
+        repaint();
+    }
 }
Index: applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/interfaces/MapMarker.java
===================================================================
--- applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/interfaces/MapMarker.java	(revision 15039)
+++ applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/interfaces/MapMarker.java	(revision 16032)
@@ -9,5 +9,5 @@
 
 /**
- * Interface to be implemented by all elements that can be displayed on the map.
+ * Interface to be implemented by all one dimensional elements that can be displayed on the map.
  * 
  * @author Jan Peter Stotz
Index: applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/interfaces/MapSquare.java
===================================================================
--- applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/interfaces/MapSquare.java	(revision 16032)
+++ applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/interfaces/MapSquare.java	(revision 16032)
@@ -0,0 +1,39 @@
+package org.openstreetmap.gui.jmapviewer.interfaces;
+
+//License: GPL. Copyright 2009 by Stefan Zeller
+
+import java.awt.Graphics;
+import java.awt.Point;
+
+import org.openstreetmap.gui.jmapviewer.Coordinate;
+import org.openstreetmap.gui.jmapviewer.JMapViewer;
+
+/**
+ * Interface to be implemented by squares that can be displayed on the map.
+ * 
+ * @author Stefan Zeller
+ * @see JMapViewer#addMapSquare(MapSquare)
+ * @see JMapViewer#getMapSquareList()
+ * @date 21.06.2009S
+ */
+public interface MapSquare {
+
+    /**
+     * @return Latitude/Longitude of top left of square
+     */
+    public Coordinate getTopLeft();
+
+    /**
+     * @return Latitude/Longitude of bottom right of square
+     */
+    public Coordinate getBottomRight();
+
+    /**
+     * Paints the map square on the map. The <code>topLeft</code> and
+     * <code>bottomRight</code> specifies the coordinates within <code>g</code>
+     * 
+     * @param g
+     * @param position
+     */
+    public void paint(Graphics g, Point topLeft, Point bottomRight);
+}
