Index: /applications/editors/josm/plugins/DirectUpload/src/org/openstreetmap/josm/plugins/DirectUpload/UploadDataGui.java
===================================================================
--- /applications/editors/josm/plugins/DirectUpload/src/org/openstreetmap/josm/plugins/DirectUpload/UploadDataGui.java	(revision 23189)
+++ /applications/editors/josm/plugins/DirectUpload/src/org/openstreetmap/josm/plugins/DirectUpload/UploadDataGui.java	(revision 23190)
@@ -82,5 +82,5 @@
 
         @Override
-		public String toString() {
+        public String toString() {
             return this.name().toLowerCase();
         }
@@ -134,8 +134,8 @@
      */
     private JPanel initComponents() {
-    	JLabel visibilityLabel = new JLabel(tr("Visibility"));
+        JLabel visibilityLabel = new JLabel(tr("Visibility"));
         visibilityLabel.setToolTipText(tr("Defines the visibility of your trace for other OSM users."));
         for(visibility v : visibility.values()) {
-        	visibilityCombo.addItem(v.description);
+            visibilityCombo.addItem(v.description);
         }
         UrlLabel visiUrl = new UrlLabel(tr("http://wiki.openstreetmap.org/wiki/Visibility_of_GPS_traces"), tr("(What does that mean?)"));
@@ -205,53 +205,53 @@
      */
     private void upload(String description, String tags, String visi, GpxData gpxData, ProgressMonitor progressMonitor) throws IOException {
-    	progressMonitor.beginTask(null);
-    	try {
-    		if(checkForErrors(username, password, description, gpxData))
-    			return;
-
-    		// Clean description/tags from disallowed chars
-    		description = description.replaceAll("[&?/\\\\]"," ");
-    		tags = tags.replaceAll("[&?/\\\\.;]"," ");
-
-    		// Set progress dialog to indeterminate while connecting
-    		progressMonitor.indeterminateSubTask(tr("Connecting..."));
-
-    		try {
-    			// Generate data for upload
-    			ByteArrayOutputStream baos  = new ByteArrayOutputStream();
-    			writeGpxFile(baos, "file", gpxData);
-    			writeField(baos, "description", description);
-    			writeField(baos, "tags", (tags != null && tags.length() > 0) ? tags : "");
-    			writeField(baos, "visibility", visi);
-    			writeString(baos, "--" + BOUNDARY + "--" + LINE_END);
-
-    			ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
-    			HttpURLConnection conn = setupConnection(baos.size());
-
-    			progressMonitor.setTicksCount(baos.size());
-    			progressMonitor.subTask(null);
-
-    			try {
-    				flushToServer(bais, conn.getOutputStream(), progressMonitor);
-    			} catch(Exception e) {}
-
-    			if(cancelled) {
-    				conn.disconnect();
-    				OutputDisplay.setText(tr("Upload cancelled"));
-    				buttons.get(0).setEnabled(true);
-    				cancelled = false;
-    			} else {
-    				boolean success = finishUpConnection(conn);
-    				buttons.get(0).setEnabled(!success);
-    				if(success)
-    					buttons.get(1).setText(tr("Close"));
-    			}
-    		} catch(Exception e) {
-    			OutputDisplay.setText(tr("Error while uploading"));
-    			e.printStackTrace();
-    		}
-    	} finally {
-    		progressMonitor.finishTask();
-    	}
+        progressMonitor.beginTask(null);
+        try {
+            if(checkForErrors(username, password, description, gpxData))
+                return;
+
+            // Clean description/tags from disallowed chars
+            description = description.replaceAll("[&?/\\\\]"," ");
+            tags = tags.replaceAll("[&?/\\\\.;]"," ");
+
+            // Set progress dialog to indeterminate while connecting
+            progressMonitor.indeterminateSubTask(tr("Connecting..."));
+
+            try {
+                // Generate data for upload
+                ByteArrayOutputStream baos  = new ByteArrayOutputStream();
+                writeGpxFile(baos, "file", gpxData);
+                writeField(baos, "description", description);
+                writeField(baos, "tags", (tags != null && tags.length() > 0) ? tags : "");
+                writeField(baos, "visibility", visi);
+                writeString(baos, "--" + BOUNDARY + "--" + LINE_END);
+
+                ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+                HttpURLConnection conn = setupConnection(baos.size());
+
+                progressMonitor.setTicksCount(baos.size());
+                progressMonitor.subTask(null);
+
+                try {
+                    flushToServer(bais, conn.getOutputStream(), progressMonitor);
+                } catch(Exception e) {}
+
+                if(cancelled) {
+                    conn.disconnect();
+                    OutputDisplay.setText(tr("Upload cancelled"));
+                    buttons.get(0).setEnabled(true);
+                    cancelled = false;
+                } else {
+                    boolean success = finishUpConnection(conn);
+                    buttons.get(0).setEnabled(!success);
+                    if(success)
+                        buttons.get(1).setText(tr("Close"));
+                }
+            } catch(Exception e) {
+                OutputDisplay.setText(tr("Error while uploading"));
+                e.printStackTrace();
+            }
+        } finally {
+            progressMonitor.finishTask();
+        }
     }
 
Index: /applications/editors/josm/plugins/DirectUpload/src/org/openstreetmap/josm/plugins/DirectUpload/UploadDataGuiPlugin.java
===================================================================
--- /applications/editors/josm/plugins/DirectUpload/src/org/openstreetmap/josm/plugins/DirectUpload/UploadDataGuiPlugin.java	(revision 23189)
+++ /applications/editors/josm/plugins/DirectUpload/src/org/openstreetmap/josm/plugins/DirectUpload/UploadDataGuiPlugin.java	(revision 23190)
@@ -27,5 +27,5 @@
 
     public UploadDataGuiPlugin(PluginInformation info) {
-    	super(info);
+        super(info);
         openaction = new UploadAction();
         Main.main.menu.toolsMenu.add(openaction);
@@ -44,13 +44,13 @@
 
         @Override
-		protected void updateEnabledState() {
-           	// enable button if there is "one active GpxLayer" or "exactly one GpxLayer in the list of all layers available"
-           	if(Main.map == null
+        protected void updateEnabledState() {
+            // enable button if there is "one active GpxLayer" or "exactly one GpxLayer in the list of all layers available"
+            if(Main.map == null
                     || Main.map.mapView == null
                     || Main.map.mapView.getActiveLayer() == null
-                    || !(Main.map.mapView.getActiveLayer() instanceof GpxLayer)) {                
+                    || !(Main.map.mapView.getActiveLayer() instanceof GpxLayer)) {
                 setEnabled(false);
             } else {
-            	setEnabled(true);
+                setEnabled(true);
             }
 
@@ -61,5 +61,5 @@
             }
 
-        }		
+        }
     }
 }
Index: /applications/editors/josm/plugins/buildings_tools/src/buildings_tools/AddressDialog.java
===================================================================
--- /applications/editors/josm/plugins/buildings_tools/src/buildings_tools/AddressDialog.java	(revision 23189)
+++ /applications/editors/josm/plugins/buildings_tools/src/buildings_tools/AddressDialog.java	(revision 23190)
@@ -20,61 +20,61 @@
 @SuppressWarnings("serial")
 public class AddressDialog extends ExtendedDialog {
-	private static String lhousenum,lstreetname;
-	private static boolean inc = true;
-	private JTextField housenum = new JTextField();
-	private JTextField streetname = new JTextField();
-	private Choice cincdec = new Choice();
+    private static String lhousenum,lstreetname;
+    private static boolean inc = true;
+    private JTextField housenum = new JTextField();
+    private JTextField streetname = new JTextField();
+    private Choice cincdec = new Choice();
 
-	private JPanel panel = new JPanel(new GridBagLayout());
-	private void addLabelled(String str, Component c) {
-		JLabel label = new JLabel(str);
-		panel.add(label, GBC.std());
-		label.setLabelFor(c);
-		panel.add(c, GBC.eol().fill(GBC.HORIZONTAL));
-	}
+    private JPanel panel = new JPanel(new GridBagLayout());
+    private void addLabelled(String str, Component c) {
+        JLabel label = new JLabel(str);
+        panel.add(label, GBC.std());
+        label.setLabelFor(c);
+        panel.add(c, GBC.eol().fill(GBC.HORIZONTAL));
+    }
 
-	public AddressDialog() {
-		super(Main.parent, tr("Building address"), 
-				new String[] { tr("OK"), tr("Cancel") },
-				true);
-		
-		contentInsets = new Insets(15,15,5,15);
-		setButtonIcons(new String[] {"ok.png", "cancel.png" });
-		
-		addLabelled(tr("House number:"),housenum);
-		addLabelled(tr("Street Name:"),streetname);
-		housenum.setText(nextHouseNum());
-		streetname.setText(lstreetname);
+    public AddressDialog() {
+        super(Main.parent, tr("Building address"),
+                new String[] { tr("OK"), tr("Cancel") },
+                true);
 
-		cincdec.add(tr("Increment"));
-		cincdec.add(tr("Decrement"));
-		cincdec.select(inc?0:1);
-		addLabelled(tr("Numbers:"), cincdec);
+        contentInsets = new Insets(15,15,5,15);
+        setButtonIcons(new String[] {"ok.png", "cancel.png" });
 
-		setContent(panel);
-		setupDialog();
-		setVisible(true);
-	}
-	
-	private static String nextHouseNum() {
-		if (lhousenum==null) return "";
-		try {
-			Integer num = NumberFormat.getInstance().parse(lhousenum).intValue();
-			if (inc) num=num+2; else num = num-2;
-			return num.toString();
-		} catch (ParseException e) {			
-			return lhousenum;
-		}
-	}
-	public void saveValues() {
-		lhousenum = housenum.getText();
-		lstreetname = streetname.getText();
-		inc = cincdec.getSelectedIndex() == 0;		
-	}
-	public String getHouseNum() {
-		return housenum.getText();
-	}
-	public String getStreetName() {
-		return streetname.getText();
-	}
+        addLabelled(tr("House number:"),housenum);
+        addLabelled(tr("Street Name:"),streetname);
+        housenum.setText(nextHouseNum());
+        streetname.setText(lstreetname);
+
+        cincdec.add(tr("Increment"));
+        cincdec.add(tr("Decrement"));
+        cincdec.select(inc?0:1);
+        addLabelled(tr("Numbers:"), cincdec);
+
+        setContent(panel);
+        setupDialog();
+        setVisible(true);
+    }
+
+    private static String nextHouseNum() {
+        if (lhousenum==null) return "";
+        try {
+            Integer num = NumberFormat.getInstance().parse(lhousenum).intValue();
+            if (inc) num=num+2; else num = num-2;
+            return num.toString();
+        } catch (ParseException e) {
+            return lhousenum;
+        }
+    }
+    public void saveValues() {
+        lhousenum = housenum.getText();
+        lstreetname = streetname.getText();
+        inc = cincdec.getSelectedIndex() == 0;
+    }
+    public String getHouseNum() {
+        return housenum.getText();
+    }
+    public String getStreetName() {
+        return streetname.getText();
+    }
 }
Index: /applications/editors/josm/plugins/buildings_tools/src/buildings_tools/AdvancedSettingsDialog.java
===================================================================
--- /applications/editors/josm/plugins/buildings_tools/src/buildings_tools/AdvancedSettingsDialog.java	(revision 23189)
+++ /applications/editors/josm/plugins/buildings_tools/src/buildings_tools/AdvancedSettingsDialog.java	(revision 23190)
@@ -18,48 +18,48 @@
 
 public class AdvancedSettingsDialog extends ExtendedDialog {
-	private TagEditorModel tagsModel = new TagEditorModel();
+    private TagEditorModel tagsModel = new TagEditorModel();
 
-	private JCheckBox cBigMode = new JCheckBox(tr("Big buildings mode"));
-	private JCheckBox cSoftCur = new JCheckBox(tr("Rotate crosshair"));
+    private JCheckBox cBigMode = new JCheckBox(tr("Big buildings mode"));
+    private JCheckBox cSoftCur = new JCheckBox(tr("Rotate crosshair"));
 
-	public AdvancedSettingsDialog() {
-		super(Main.parent, tr("Advanced settings"),
-				new String[] { tr("OK"), tr("Cancel") },
-				true);
-		contentInsets = new Insets(15, 15, 5, 15);
-		setButtonIcons(new String[] { "ok.png", "cancel.png" });
+    public AdvancedSettingsDialog() {
+        super(Main.parent, tr("Advanced settings"),
+                new String[] { tr("OK"), tr("Cancel") },
+                true);
+        contentInsets = new Insets(15, 15, 5, 15);
+        setButtonIcons(new String[] { "ok.png", "cancel.png" });
 
-		final JPanel panel = new JPanel(new GridBagLayout());
-		panel.add(new JLabel(tr("Buildings tags:")), GBC.eol().fill(GBC.HORIZONTAL));
+        final JPanel panel = new JPanel(new GridBagLayout());
+        panel.add(new JLabel(tr("Buildings tags:")), GBC.eol().fill(GBC.HORIZONTAL));
 
-		for (Entry<String, String> entry : ToolSettings.getTags().entrySet()) {
-			tagsModel.add(entry.getKey(), entry.getValue());
-		}
-		panel.add(new TagEditorPanel(tagsModel, null), GBC.eop().fill(GBC.BOTH));
+        for (Entry<String, String> entry : ToolSettings.getTags().entrySet()) {
+            tagsModel.add(entry.getKey(), entry.getValue());
+        }
+        panel.add(new TagEditorPanel(tagsModel, null), GBC.eop().fill(GBC.BOTH));
 
-		panel.add(cBigMode, GBC.eol().fill(GBC.HORIZONTAL));
-		panel.add(cSoftCur, GBC.eol().fill(GBC.HORIZONTAL));
+        panel.add(cBigMode, GBC.eol().fill(GBC.HORIZONTAL));
+        panel.add(cSoftCur, GBC.eol().fill(GBC.HORIZONTAL));
 
-		cBigMode.setSelected(ToolSettings.isBBMode());
-		cSoftCur.setSelected(ToolSettings.isSoftCursor());
+        cBigMode.setSelected(ToolSettings.isBBMode());
+        cSoftCur.setSelected(ToolSettings.isSoftCursor());
 
-		setContent(panel);
+        setContent(panel);
 
-		setupDialog();
-		setVisible(true);
-	}
+        setupDialog();
+        setVisible(true);
+    }
 
-	public boolean isBBMode() {
-		return cBigMode.isSelected();
-	}
+    public boolean isBBMode() {
+        return cBigMode.isSelected();
+    }
 
-	public boolean isSoftCursor() {
-		return cSoftCur.isSelected();
-	}
+    public boolean isSoftCursor() {
+        return cSoftCur.isSelected();
+    }
 
-	public void saveSettings() {
-		tagsModel.applyToTags(ToolSettings.getTags());
-		ToolSettings.setBBMode(isBBMode());
-		ToolSettings.setSoftCursor(isSoftCursor());
-	}
+    public void saveSettings() {
+        tagsModel.applyToTags(ToolSettings.getTags());
+        ToolSettings.setBBMode(isBBMode());
+        ToolSettings.setSoftCursor(isSoftCursor());
+    }
 }
Index: /applications/editors/josm/plugins/buildings_tools/src/buildings_tools/AngleSnap.java
===================================================================
--- /applications/editors/josm/plugins/buildings_tools/src/buildings_tools/AngleSnap.java	(revision 23189)
+++ /applications/editors/josm/plugins/buildings_tools/src/buildings_tools/AngleSnap.java	(revision 23190)
@@ -11,90 +11,90 @@
 
 public class AngleSnap {
-	private static final double PI_2 = Math.PI / 2;
-	TreeSet<Double> snapSet = new TreeSet<Double>();
+    private static final double PI_2 = Math.PI / 2;
+    TreeSet<Double> snapSet = new TreeSet<Double>();
 
-	public void clear() {
-		snapSet.clear();
-	}
+    public void clear() {
+        snapSet.clear();
+    }
 
-	public void addSnap(double snap) {
-		snapSet.add(snap % PI_2);
-	}
+    public void addSnap(double snap) {
+        snapSet.add(snap % PI_2);
+    }
 
-	public Double addSnap(Node[] nodes) {
-		if (nodes.length == 2) {
-			EastNorth p1, p2;
-			p1 = latlon2eastNorth(((Node) nodes[0]).getCoor());
-			p2 = latlon2eastNorth(((Node) nodes[1]).getCoor());
-			double heading = p1.heading(p2);
-			addSnap(heading);
-			addSnap(heading + Math.PI / 4);
-			return heading;
-		} else {
-			return null;
-		}
-	}
+    public Double addSnap(Node[] nodes) {
+        if (nodes.length == 2) {
+            EastNorth p1, p2;
+            p1 = latlon2eastNorth(((Node) nodes[0]).getCoor());
+            p2 = latlon2eastNorth(((Node) nodes[1]).getCoor());
+            double heading = p1.heading(p2);
+            addSnap(heading);
+            addSnap(heading + Math.PI / 4);
+            return heading;
+        } else {
+            return null;
+        }
+    }
 
-	public void addSnap(Way way) {
-		for (Pair<Node, Node> pair : way.getNodePairs(false)) {
-			EastNorth a, b;
-			a = latlon2eastNorth(pair.a.getCoor());
-			b = latlon2eastNorth(pair.b.getCoor());
-			double heading = a.heading(b);
-			addSnap(heading);
-		}
-	}
+    public void addSnap(Way way) {
+        for (Pair<Node, Node> pair : way.getNodePairs(false)) {
+            EastNorth a, b;
+            a = latlon2eastNorth(pair.a.getCoor());
+            b = latlon2eastNorth(pair.b.getCoor());
+            double heading = a.heading(b);
+            addSnap(heading);
+        }
+    }
 
-	public Double getAngle() {
-		if (snapSet.isEmpty()) {
-			return null;
-		}
-		double first = snapSet.first();
-		double last = snapSet.last();
-		if (first < Math.PI / 4 && last > Math.PI / 4) {
-			last -= PI_2;
-		}
-		if (Math.abs(first - last) < 0.001) {
-			double center = (first + last) / 2;
-			if (center < 0)
-				center += PI_2;
-			return center;
-		} else {
-			return null;
-		}
-	}
+    public Double getAngle() {
+        if (snapSet.isEmpty()) {
+            return null;
+        }
+        double first = snapSet.first();
+        double last = snapSet.last();
+        if (first < Math.PI / 4 && last > Math.PI / 4) {
+            last -= PI_2;
+        }
+        if (Math.abs(first - last) < 0.001) {
+            double center = (first + last) / 2;
+            if (center < 0)
+                center += PI_2;
+            return center;
+        } else {
+            return null;
+        }
+    }
 
-	public double snapAngle(double angle) {
-		if (snapSet.isEmpty()) {
-			return angle;
-		}
-		int quadrant = (int) Math.floor(angle / PI_2);
-		double ang = angle % PI_2;
-		Double prev = snapSet.floor(ang);
-		if (prev == null)
-			prev = snapSet.last() - PI_2;
-		Double next = snapSet.ceiling(ang);
-		if (next == null)
-			next = snapSet.first() + PI_2;
+    public double snapAngle(double angle) {
+        if (snapSet.isEmpty()) {
+            return angle;
+        }
+        int quadrant = (int) Math.floor(angle / PI_2);
+        double ang = angle % PI_2;
+        Double prev = snapSet.floor(ang);
+        if (prev == null)
+            prev = snapSet.last() - PI_2;
+        Double next = snapSet.ceiling(ang);
+        if (next == null)
+            next = snapSet.first() + PI_2;
 
-		if (Math.abs(ang - next) > Math.abs(ang - prev)) {
-			if (Math.abs(ang - prev) > Math.PI / 8) {
-				return angle;
-			} else {
-				double ret = prev + PI_2 * quadrant;
-				if (ret < 0)
-					ret += 2 * Math.PI;
-				return ret;
-			}
-		} else {
-			if (Math.abs(ang - next) > Math.PI / 8) {
-				return angle;
-			} else {
-				double ret = next + PI_2 * quadrant;
-				if (ret > 2 * Math.PI)
-					ret -= 2 * Math.PI;
-				return ret;
-			}
-		}
-	}
+        if (Math.abs(ang - next) > Math.abs(ang - prev)) {
+            if (Math.abs(ang - prev) > Math.PI / 8) {
+                return angle;
+            } else {
+                double ret = prev + PI_2 * quadrant;
+                if (ret < 0)
+                    ret += 2 * Math.PI;
+                return ret;
+            }
+        } else {
+            if (Math.abs(ang - next) > Math.PI / 8) {
+                return angle;
+            } else {
+                double ret = next + PI_2 * quadrant;
+                if (ret > 2 * Math.PI)
+                    ret -= 2 * Math.PI;
+                return ret;
+            }
+        }
+    }
 }
Index: /applications/editors/josm/plugins/buildings_tools/src/buildings_tools/Building.java
===================================================================
--- /applications/editors/josm/plugins/buildings_tools/src/buildings_tools/Building.java	(revision 23189)
+++ /applications/editors/josm/plugins/buildings_tools/src/buildings_tools/Building.java	(revision 23190)
@@ -28,234 +28,234 @@
 
 class Building {
-	private static final double eqlen = 40075004; // length of equator in metres
-	private final EastNorth[] en = new EastNorth[4];
-
-	double meter = 0;
-
-	private double len = 0;
-	private double width;
-	private double heading;
-	private AngleSnap angleSnap = new AngleSnap();
-	private Double drawingAngle;
-
-	public void clearAngleSnap() {
-		angleSnap.clear();
-		drawingAngle = null;
-	}
-
-	public void addAngleSnap(Node[] nodes) {
-		drawingAngle = angleSnap.addSnap(nodes);
-	}
-
-	public void addAngleSnap(Way way) {
-		angleSnap.addSnap(way);
-		if (drawingAngle == null) {
-			drawingAngle = angleSnap.getAngle();
-		}
-	}
-
-	public double getLength() {
-		return len;
-	}
-
-	public double getWidth() {
-		return width;
-	}
-
-	public boolean isRectDrawing() {
-		return drawingAngle != null && ToolSettings.getWidth() == 0 && ToolSettings.getLenStep() == 0;
-	}
-
-	public Double getDrawingAngle() {
-		return drawingAngle;
-	}
-
-	public void reset() {
-		len = 0;
-
-		for (int i = 0; i < 4; i++)
-			en[i] = null;
-	}
-
-	public EastNorth getPoint(int num) {
-		return en[num];
-	}
-
-	private void updMetrics() {
-		meter = 2 * Math.PI / (Math.cos(Math.toRadians(eastNorth2latlon(en[0]).lat())) * eqlen);
-		len = 0;
-	}
-
-	public void setBase(EastNorth base) {
-		en[0] = base;
-		updMetrics();
-	}
-
-	public void setBase(Node base) {
-		en[0] = latlon2eastNorth(base.getCoor());
-		updMetrics();
-	}
-
-	/**
-	 * @returns Projection of the point to the heading vector in metres
-	 */
-	private double projection1(EastNorth p) {
-		final EastNorth vec = en[0].sub(p);
-		return (Math.sin(heading) * vec.east() + Math.cos(heading) * vec.north()) / meter;
-	}
-
-	/**
-	 * @returns Projection of the point to the perpendicular of the heading
-	 *          vector in metres
-	 */
-	private double projection2(EastNorth p) {
-		final EastNorth vec = en[0].sub(p);
-		return (Math.cos(heading) * vec.east() - Math.sin(heading) * vec.north()) / meter;
-	}
-
-	private void updatePos() {
-		if (len == 0)
-			return;
-		final EastNorth p1 = en[0];
-		en[1] = new EastNorth(p1.east() + Math.sin(heading) * len * meter, p1.north() + Math.cos(heading) * len * meter);
-		en[2] = new EastNorth(p1.east() + Math.sin(heading) * len * meter + Math.cos(heading) * width * meter,
-				p1.north() + Math.cos(heading) * len * meter - Math.sin(heading) * width * meter);
-		en[3] = new EastNorth(p1.east() + Math.cos(heading) * width * meter,
-				p1.north() - Math.sin(heading) * width * meter);
-	}
-
-	public void setLengthWidth(double length, double width) {
-		this.len = length;
-		this.width = width;
-		updatePos();
-	}
-
-	public void setWidth(EastNorth p3) {
-		this.width = projection2(p3);
-		updatePos();
-	}
-
-	public void setPlace(EastNorth p2, double width, double lenstep, boolean ignoreConstraints) {
-		if (en[0] == null)
-			throw new IllegalStateException("setPlace() called without the base point");
-		this.heading = en[0].heading(p2);
-		if (!ignoreConstraints)
-			this.heading = angleSnap.snapAngle(this.heading);
-
-		this.width = width;
-		this.len = projection1(p2);
-		if (lenstep > 0 && !ignoreConstraints)
-			this.len = Math.round(this.len / lenstep) * lenstep;
-
-		updatePos();
-
-		Main.map.statusLine.setHeading(Math.toDegrees(heading));
-		if (this.drawingAngle != null && !ignoreConstraints) {
-			double ang = Math.toDegrees(heading - this.drawingAngle);
-			if (ang < 0)
-				ang += 360;
-			if (ang > 360)
-				ang -= 360;
-			Main.map.statusLine.setAngle(ang);
-		}
-	}
-
-	public void setPlaceRect(EastNorth p2) {
-		if (en[0] == null)
-			throw new IllegalStateException("SetPlaceRect() called without the base point");
-		if (!isRectDrawing())
-			throw new IllegalStateException("Invalid drawing mode");
-		heading = drawingAngle;
-		setLengthWidth(projection1(p2), projection2(p2));
-		Main.map.statusLine.setHeading(Math.toDegrees(heading));
-	}
-
-	public void angFix(EastNorth point) {
-		EastNorth en3 = en[2];
-		EastNorth mid = en[0].getCenter(en3);
-		double radius = en3.distance(mid);
-		heading = mid.heading(point);
-		heading = en[0].heading(mid.add(Math.sin(heading) * radius, Math.cos(heading) * radius));
-		setLengthWidth(projection1(en3), projection2(en3));
-		en[2] = en3;
-	}
-
-	public void paint(Graphics2D g, MapView mv) {
-		if (len == 0)
-			return;
-		GeneralPath b = new GeneralPath();
-		Point pp1 = mv.getPoint(eastNorth2latlon(en[0]));
-		Point pp2 = mv.getPoint(eastNorth2latlon(en[1]));
-		Point pp3 = mv.getPoint(eastNorth2latlon(en[2]));
-		Point pp4 = mv.getPoint(eastNorth2latlon(en[3]));
-
-		b.moveTo(pp1.x, pp1.y);
-		b.lineTo(pp2.x, pp2.y);
-		b.lineTo(pp3.x, pp3.y);
-		b.lineTo(pp4.x, pp4.y);
-		b.lineTo(pp1.x, pp1.y);
-		g.draw(b);
-	}
-
-	private Node findNode(EastNorth en) {
-		DataSet ds = Main.main.getCurrentDataSet();
-		LatLon l = eastNorth2latlon(en);
-		List<Node> nodes = ds.searchNodes(new BBox(l.lon() - 0.0000001, l.lat() - 0.0000001,
-				l.lon() + 0.0000001, l.lat() + 0.0000001));
-		Node bestnode = null;
-		double mindist = 0.0003;
-		for (Node n : nodes) {
-			double dist = n.getCoor().distanceSq(l);
-			if (dist < mindist && OsmPrimitive.isUsablePredicate.evaluate(n)) {
-				bestnode = n;
-				mindist = dist;
-			}
-		}
-		return bestnode;
-	}
-
-	public Way create() {
-		if (len == 0)
-			return null;
-		final boolean[] created = new boolean[4];
-		final Node[] nodes = new Node[4];
-		for (int i = 0; i < 4; i++) {
-
-			Node n = findNode(en[i]);
-			if (n == null) {
-				nodes[i] = new Node(eastNorth2latlon(en[i]));
-				created[i] = true;
-			} else {
-				nodes[i] = n;
-				created[i] = false;
-			}
-			if (nodes[i].getCoor().isOutSideWorld()) {
-				JOptionPane.showMessageDialog(Main.parent,
-						tr("Cannot place building outside of the world."));
-				return null;
-			}
-		}
-		Way w = new Way();
-		w.addNode(nodes[0]);
-		if (projection2(en[2]) > 0 ^ len < 0) {
-			w.addNode(nodes[1]);
-			w.addNode(nodes[2]);
-			w.addNode(nodes[3]);
-		} else {
-			w.addNode(nodes[3]);
-			w.addNode(nodes[2]);
-			w.addNode(nodes[1]);
-		}
-		w.addNode(nodes[0]);
-		w.setKeys(ToolSettings.getTags());
-		Collection<Command> cmds = new LinkedList<Command>();
-		for (int i = 0; i < 4; i++) {
-			if (created[i])
-				cmds.add(new AddCommand(nodes[i]));
-		}
-		cmds.add(new AddCommand(w));
-		Command c = new SequenceCommand(tr("Create building"), cmds);
-		Main.main.undoRedo.add(c);
-		return w;
-	}
+    private static final double eqlen = 40075004; // length of equator in metres
+    private final EastNorth[] en = new EastNorth[4];
+
+    double meter = 0;
+
+    private double len = 0;
+    private double width;
+    private double heading;
+    private AngleSnap angleSnap = new AngleSnap();
+    private Double drawingAngle;
+
+    public void clearAngleSnap() {
+        angleSnap.clear();
+        drawingAngle = null;
+    }
+
+    public void addAngleSnap(Node[] nodes) {
+        drawingAngle = angleSnap.addSnap(nodes);
+    }
+
+    public void addAngleSnap(Way way) {
+        angleSnap.addSnap(way);
+        if (drawingAngle == null) {
+            drawingAngle = angleSnap.getAngle();
+        }
+    }
+
+    public double getLength() {
+        return len;
+    }
+
+    public double getWidth() {
+        return width;
+    }
+
+    public boolean isRectDrawing() {
+        return drawingAngle != null && ToolSettings.getWidth() == 0 && ToolSettings.getLenStep() == 0;
+    }
+
+    public Double getDrawingAngle() {
+        return drawingAngle;
+    }
+
+    public void reset() {
+        len = 0;
+
+        for (int i = 0; i < 4; i++)
+            en[i] = null;
+    }
+
+    public EastNorth getPoint(int num) {
+        return en[num];
+    }
+
+    private void updMetrics() {
+        meter = 2 * Math.PI / (Math.cos(Math.toRadians(eastNorth2latlon(en[0]).lat())) * eqlen);
+        len = 0;
+    }
+
+    public void setBase(EastNorth base) {
+        en[0] = base;
+        updMetrics();
+    }
+
+    public void setBase(Node base) {
+        en[0] = latlon2eastNorth(base.getCoor());
+        updMetrics();
+    }
+
+    /**
+     * @returns Projection of the point to the heading vector in metres
+     */
+    private double projection1(EastNorth p) {
+        final EastNorth vec = en[0].sub(p);
+        return (Math.sin(heading) * vec.east() + Math.cos(heading) * vec.north()) / meter;
+    }
+
+    /**
+     * @returns Projection of the point to the perpendicular of the heading
+     *          vector in metres
+     */
+    private double projection2(EastNorth p) {
+        final EastNorth vec = en[0].sub(p);
+        return (Math.cos(heading) * vec.east() - Math.sin(heading) * vec.north()) / meter;
+    }
+
+    private void updatePos() {
+        if (len == 0)
+            return;
+        final EastNorth p1 = en[0];
+        en[1] = new EastNorth(p1.east() + Math.sin(heading) * len * meter, p1.north() + Math.cos(heading) * len * meter);
+        en[2] = new EastNorth(p1.east() + Math.sin(heading) * len * meter + Math.cos(heading) * width * meter,
+                p1.north() + Math.cos(heading) * len * meter - Math.sin(heading) * width * meter);
+        en[3] = new EastNorth(p1.east() + Math.cos(heading) * width * meter,
+                p1.north() - Math.sin(heading) * width * meter);
+    }
+
+    public void setLengthWidth(double length, double width) {
+        this.len = length;
+        this.width = width;
+        updatePos();
+    }
+
+    public void setWidth(EastNorth p3) {
+        this.width = projection2(p3);
+        updatePos();
+    }
+
+    public void setPlace(EastNorth p2, double width, double lenstep, boolean ignoreConstraints) {
+        if (en[0] == null)
+            throw new IllegalStateException("setPlace() called without the base point");
+        this.heading = en[0].heading(p2);
+        if (!ignoreConstraints)
+            this.heading = angleSnap.snapAngle(this.heading);
+
+        this.width = width;
+        this.len = projection1(p2);
+        if (lenstep > 0 && !ignoreConstraints)
+            this.len = Math.round(this.len / lenstep) * lenstep;
+
+        updatePos();
+
+        Main.map.statusLine.setHeading(Math.toDegrees(heading));
+        if (this.drawingAngle != null && !ignoreConstraints) {
+            double ang = Math.toDegrees(heading - this.drawingAngle);
+            if (ang < 0)
+                ang += 360;
+            if (ang > 360)
+                ang -= 360;
+            Main.map.statusLine.setAngle(ang);
+        }
+    }
+
+    public void setPlaceRect(EastNorth p2) {
+        if (en[0] == null)
+            throw new IllegalStateException("SetPlaceRect() called without the base point");
+        if (!isRectDrawing())
+            throw new IllegalStateException("Invalid drawing mode");
+        heading = drawingAngle;
+        setLengthWidth(projection1(p2), projection2(p2));
+        Main.map.statusLine.setHeading(Math.toDegrees(heading));
+    }
+
+    public void angFix(EastNorth point) {
+        EastNorth en3 = en[2];
+        EastNorth mid = en[0].getCenter(en3);
+        double radius = en3.distance(mid);
+        heading = mid.heading(point);
+        heading = en[0].heading(mid.add(Math.sin(heading) * radius, Math.cos(heading) * radius));
+        setLengthWidth(projection1(en3), projection2(en3));
+        en[2] = en3;
+    }
+
+    public void paint(Graphics2D g, MapView mv) {
+        if (len == 0)
+            return;
+        GeneralPath b = new GeneralPath();
+        Point pp1 = mv.getPoint(eastNorth2latlon(en[0]));
+        Point pp2 = mv.getPoint(eastNorth2latlon(en[1]));
+        Point pp3 = mv.getPoint(eastNorth2latlon(en[2]));
+        Point pp4 = mv.getPoint(eastNorth2latlon(en[3]));
+
+        b.moveTo(pp1.x, pp1.y);
+        b.lineTo(pp2.x, pp2.y);
+        b.lineTo(pp3.x, pp3.y);
+        b.lineTo(pp4.x, pp4.y);
+        b.lineTo(pp1.x, pp1.y);
+        g.draw(b);
+    }
+
+    private Node findNode(EastNorth en) {
+        DataSet ds = Main.main.getCurrentDataSet();
+        LatLon l = eastNorth2latlon(en);
+        List<Node> nodes = ds.searchNodes(new BBox(l.lon() - 0.0000001, l.lat() - 0.0000001,
+                l.lon() + 0.0000001, l.lat() + 0.0000001));
+        Node bestnode = null;
+        double mindist = 0.0003;
+        for (Node n : nodes) {
+            double dist = n.getCoor().distanceSq(l);
+            if (dist < mindist && OsmPrimitive.isUsablePredicate.evaluate(n)) {
+                bestnode = n;
+                mindist = dist;
+            }
+        }
+        return bestnode;
+    }
+
+    public Way create() {
+        if (len == 0)
+            return null;
+        final boolean[] created = new boolean[4];
+        final Node[] nodes = new Node[4];
+        for (int i = 0; i < 4; i++) {
+
+            Node n = findNode(en[i]);
+            if (n == null) {
+                nodes[i] = new Node(eastNorth2latlon(en[i]));
+                created[i] = true;
+            } else {
+                nodes[i] = n;
+                created[i] = false;
+            }
+            if (nodes[i].getCoor().isOutSideWorld()) {
+                JOptionPane.showMessageDialog(Main.parent,
+                        tr("Cannot place building outside of the world."));
+                return null;
+            }
+        }
+        Way w = new Way();
+        w.addNode(nodes[0]);
+        if (projection2(en[2]) > 0 ^ len < 0) {
+            w.addNode(nodes[1]);
+            w.addNode(nodes[2]);
+            w.addNode(nodes[3]);
+        } else {
+            w.addNode(nodes[3]);
+            w.addNode(nodes[2]);
+            w.addNode(nodes[1]);
+        }
+        w.addNode(nodes[0]);
+        w.setKeys(ToolSettings.getTags());
+        Collection<Command> cmds = new LinkedList<Command>();
+        for (int i = 0; i < 4; i++) {
+            if (created[i])
+                cmds.add(new AddCommand(nodes[i]));
+        }
+        cmds.add(new AddCommand(w));
+        Command c = new SequenceCommand(tr("Create building"), cmds);
+        Main.main.undoRedo.add(c);
+        return w;
+    }
 }
Index: /applications/editors/josm/plugins/buildings_tools/src/buildings_tools/BuildingSizeAction.java
===================================================================
--- /applications/editors/josm/plugins/buildings_tools/src/buildings_tools/BuildingSizeAction.java	(revision 23189)
+++ /applications/editors/josm/plugins/buildings_tools/src/buildings_tools/BuildingSizeAction.java	(revision 23190)
@@ -12,18 +12,18 @@
 public class BuildingSizeAction extends JosmAction {
 
-	public BuildingSizeAction() {
-		super(tr("Set buildings size"), "mapmode/building", tr("Set buildings size"),
-				Shortcut.registerShortcut("edit:buildingsdialog",
-				tr("Edit: {0}", tr("Set buildings size")),
-				KeyEvent.VK_W, Shortcut.GROUP_EDIT,
-				Shortcut.SHIFT_DEFAULT),
-				true);
-	}
+    public BuildingSizeAction() {
+        super(tr("Set buildings size"), "mapmode/building", tr("Set buildings size"),
+                Shortcut.registerShortcut("edit:buildingsdialog",
+                tr("Edit: {0}", tr("Set buildings size")),
+                KeyEvent.VK_W, Shortcut.GROUP_EDIT,
+                Shortcut.SHIFT_DEFAULT),
+                true);
+    }
 
-	public void actionPerformed(ActionEvent arg0) {
-		BuildingSizeDialog dlg = new BuildingSizeDialog();
-		if (dlg.getValue() == 1) {
-			dlg.saveSettings();
-		}
-	}
+    public void actionPerformed(ActionEvent arg0) {
+        BuildingSizeDialog dlg = new BuildingSizeDialog();
+        if (dlg.getValue() == 1) {
+            dlg.saveSettings();
+        }
+    }
 }
Index: /applications/editors/josm/plugins/buildings_tools/src/buildings_tools/BuildingSizeDialog.java
===================================================================
--- /applications/editors/josm/plugins/buildings_tools/src/buildings_tools/BuildingSizeDialog.java	(revision 23189)
+++ /applications/editors/josm/plugins/buildings_tools/src/buildings_tools/BuildingSizeDialog.java	(revision 23190)
@@ -23,75 +23,75 @@
 @SuppressWarnings("serial")
 public class BuildingSizeDialog extends ExtendedDialog {
-	private JFormattedTextField twidth = new JFormattedTextField(NumberFormat.getInstance());
-	private JFormattedTextField tlenstep = new JFormattedTextField(NumberFormat.getInstance());
-	private JCheckBox caddr = new JCheckBox(tr("Use Address dialog"));
-	private JCheckBox cAutoSelect = new JCheckBox(tr("Auto-select building"));
+    private JFormattedTextField twidth = new JFormattedTextField(NumberFormat.getInstance());
+    private JFormattedTextField tlenstep = new JFormattedTextField(NumberFormat.getInstance());
+    private JCheckBox caddr = new JCheckBox(tr("Use Address dialog"));
+    private JCheckBox cAutoSelect = new JCheckBox(tr("Auto-select building"));
 
-	static void addLabelled(JPanel panel, String str, Component c) {
-		JLabel label = new JLabel(str);
-		panel.add(label, GBC.std());
-		label.setLabelFor(c);
-		panel.add(c, GBC.eol().fill(GBC.HORIZONTAL));
-	}
+    static void addLabelled(JPanel panel, String str, Component c) {
+        JLabel label = new JLabel(str);
+        panel.add(label, GBC.std());
+        label.setLabelFor(c);
+        panel.add(c, GBC.eol().fill(GBC.HORIZONTAL));
+    }
 
-	public BuildingSizeDialog() {
-		super(Main.parent, tr("Set buildings size"),
-				new String[] { tr("OK"), tr("Cancel") },
-				true);
-		contentInsets = new Insets(15, 15, 5, 15);
-		setButtonIcons(new String[] { "ok.png", "cancel.png" });
+    public BuildingSizeDialog() {
+        super(Main.parent, tr("Set buildings size"),
+                new String[] { tr("OK"), tr("Cancel") },
+                true);
+        contentInsets = new Insets(15, 15, 5, 15);
+        setButtonIcons(new String[] { "ok.png", "cancel.png" });
 
-		final JPanel panel = new JPanel(new GridBagLayout());
-		addLabelled(panel, tr("Buildings width:"), twidth);
-		addLabelled(panel, tr("Length step:"), tlenstep);
-		panel.add(caddr, GBC.eol().fill(GBC.HORIZONTAL));
-		panel.add(cAutoSelect, GBC.eol().fill(GBC.HORIZONTAL));
+        final JPanel panel = new JPanel(new GridBagLayout());
+        addLabelled(panel, tr("Buildings width:"), twidth);
+        addLabelled(panel, tr("Length step:"), tlenstep);
+        panel.add(caddr, GBC.eol().fill(GBC.HORIZONTAL));
+        panel.add(cAutoSelect, GBC.eol().fill(GBC.HORIZONTAL));
 
-		twidth.setValue(ToolSettings.getWidth());
-		tlenstep.setValue(ToolSettings.getLenStep());
-		caddr.setSelected(ToolSettings.isUsingAddr());
-		cAutoSelect.setSelected(ToolSettings.isAutoSelect());
+        twidth.setValue(ToolSettings.getWidth());
+        tlenstep.setValue(ToolSettings.getLenStep());
+        caddr.setSelected(ToolSettings.isUsingAddr());
+        cAutoSelect.setSelected(ToolSettings.isAutoSelect());
 
-		JButton bAdv = new JButton(tr("Advanced..."));
-		bAdv.addActionListener(new ActionListener() {
-			@Override
-			public void actionPerformed(ActionEvent arg0) {
-				AdvancedSettingsDialog dlg = new AdvancedSettingsDialog();
-				if (dlg.getValue() == 1) {
-					dlg.saveSettings();
-				}
-			}
-		});
-		panel.add(bAdv, GBC.eol().insets(0, 5, 0, 0).anchor(GBC.EAST));
+        JButton bAdv = new JButton(tr("Advanced..."));
+        bAdv.addActionListener(new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent arg0) {
+                AdvancedSettingsDialog dlg = new AdvancedSettingsDialog();
+                if (dlg.getValue() == 1) {
+                    dlg.saveSettings();
+                }
+            }
+        });
+        panel.add(bAdv, GBC.eol().insets(0, 5, 0, 0).anchor(GBC.EAST));
 
-		setContent(panel);
-		setupDialog();
-		setVisible(true);
-	}
+        setContent(panel);
+        setupDialog();
+        setVisible(true);
+    }
 
-	public double width() {
-		try {
-			return NumberFormat.getInstance().parse(twidth.getText()).doubleValue();
-		} catch (ParseException e) {
-			return 0;
-		}
-	}
+    public double width() {
+        try {
+            return NumberFormat.getInstance().parse(twidth.getText()).doubleValue();
+        } catch (ParseException e) {
+            return 0;
+        }
+    }
 
-	public double lenstep() {
-		try {
-			return NumberFormat.getInstance().parse(tlenstep.getText()).doubleValue();
-		} catch (ParseException e) {
-			return 0;
-		}
-	}
+    public double lenstep() {
+        try {
+            return NumberFormat.getInstance().parse(tlenstep.getText()).doubleValue();
+        } catch (ParseException e) {
+            return 0;
+        }
+    }
 
-	public boolean useAddr() {
-		return caddr.isSelected();
-	}
+    public boolean useAddr() {
+        return caddr.isSelected();
+    }
 
-	public void saveSettings() {
-		ToolSettings.setSizes(width(), lenstep());
-		ToolSettings.setAddrDialog(useAddr());
-		ToolSettings.setAutoSelect(cAutoSelect.isSelected());
-	}
+    public void saveSettings() {
+        ToolSettings.setSizes(width(), lenstep());
+        ToolSettings.setAddrDialog(useAddr());
+        ToolSettings.setAutoSelect(cAutoSelect.isSelected());
+    }
 }
Index: /applications/editors/josm/plugins/buildings_tools/src/buildings_tools/BuildingsToolsPlugin.java
===================================================================
--- /applications/editors/josm/plugins/buildings_tools/src/buildings_tools/BuildingsToolsPlugin.java	(revision 23189)
+++ /applications/editors/josm/plugins/buildings_tools/src/buildings_tools/BuildingsToolsPlugin.java	(revision 23190)
@@ -12,22 +12,22 @@
 
 public class BuildingsToolsPlugin extends Plugin {
-	public static Mercator proj = new Mercator();
+    public static Mercator proj = new Mercator();
 
-	public static EastNorth latlon2eastNorth(LatLon p) {
-		return proj.latlon2eastNorth(p); 
-	}
-	public static LatLon eastNorth2latlon(EastNorth p) {
-		return proj.eastNorth2latlon(p); 
-	}
+    public static EastNorth latlon2eastNorth(LatLon p) {
+        return proj.latlon2eastNorth(p);
+    }
+    public static LatLon eastNorth2latlon(EastNorth p) {
+        return proj.eastNorth2latlon(p);
+    }
 
-	public BuildingsToolsPlugin(PluginInformation info) {
-		super(info);
-		Main.main.menu.editMenu.addSeparator();
-		MainMenu.add(Main.main.menu.editMenu, new BuildingSizeAction());
-	}
-	@Override public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) {
-		if (oldFrame==null && newFrame!=null) {
-			Main.map.addMapMode(new IconToggleButton(new DrawBuildingAction(Main.map)));
-		}
-	}
+    public BuildingsToolsPlugin(PluginInformation info) {
+        super(info);
+        Main.main.menu.editMenu.addSeparator();
+        MainMenu.add(Main.main.menu.editMenu, new BuildingSizeAction());
+    }
+    @Override public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) {
+        if (oldFrame==null && newFrame!=null) {
+            Main.map.addMapMode(new IconToggleButton(new DrawBuildingAction(Main.map)));
+        }
+    }
 }
Index: /applications/editors/josm/plugins/buildings_tools/src/buildings_tools/DrawBuildingAction.java
===================================================================
--- /applications/editors/josm/plugins/buildings_tools/src/buildings_tools/DrawBuildingAction.java	(revision 23189)
+++ /applications/editors/josm/plugins/buildings_tools/src/buildings_tools/DrawBuildingAction.java	(revision 23190)
@@ -42,417 +42,417 @@
 @SuppressWarnings("serial")
 public class DrawBuildingAction extends MapMode implements MapViewPaintable, AWTEventListener, SelectionChangedListener {
-	private enum Mode {
-		None, Drawing, DrawingWidth, DrawingAngFix
-	}
-
-	final private Cursor cursorCrosshair;
-	final private Cursor cursorJoinNode;
-	private Cursor currCursor;
-	private Cursor customCursor;
-
-	private Mode mode = Mode.None;
-	private Mode nextMode = Mode.None;
-
-	private Color selectedColor;
-	private Point drawStartPos;
-	private Point mousePos;
-	private boolean isCtrlDown;
-	private boolean isShiftDown;
-
-	Building building = new Building();
-
-	public DrawBuildingAction(MapFrame mapFrame) {
-		super(tr("Draw buildings"), "building", tr("Draw buildings"),
-				Shortcut.registerShortcut("mapmode:buildings",
-						tr("Mode: {0}", tr("Draw buildings")),
-						KeyEvent.VK_W, Shortcut.GROUP_EDIT),
-				mapFrame, getCursor());
-
-		cursorCrosshair = getCursor();
-		cursorJoinNode = ImageProvider.getCursor("crosshair", "joinnode");
-		currCursor = cursorCrosshair;
-
-		selectedColor = Main.pref.getColor(marktr("selected"), Color.red);
-	}
-
-	private static Cursor getCursor() {
-		try {
-			return ImageProvider.getCursor("crosshair", null);
-		} catch (Exception e) {
-		}
-		return Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR);
-	}
-
-	/**
-	 * Displays the given cursor instead of the normal one
-	 * 
-	 * @param Cursors
-	 *            One of the available cursors
-	 */
-	private void setCursor(final Cursor c) {
-		if (currCursor.equals(c))
-			return;
-		try {
-			// We invoke this to prevent strange things from happening
-			EventQueue.invokeLater(new Runnable() {
-				public void run() {
-					// Don't change cursor when mode has changed already
-					if (!(Main.map.mapMode instanceof DrawBuildingAction))
-						return;
-					Main.map.mapView.setCursor(c);
-				}
-			});
-			currCursor = c;
-		} catch (Exception e) {
-		}
-	}
-
-	private static void showAddrDialog(Way w) {
-		AddressDialog dlg = new AddressDialog();
-		int answer = dlg.getValue();
-		if (answer == 1) {
-			dlg.saveValues();
-			String tmp;
-			tmp = dlg.getHouseNum();
-			if (tmp != null && tmp != "")
-				w.put("addr:housenumber", tmp);
-			tmp = dlg.getStreetName();
-			if (tmp != null && tmp != "")
-				w.put("addr:street", tmp);
-		}
-	}
-
-	@Override
-	public void enterMode() {
-		super.enterMode();
-		if (getCurrentDataSet() == null) {
-			Main.map.selectSelectTool(false);
-			return;
-		}
-		currCursor = cursorCrosshair;
-		Main.map.mapView.addMouseListener(this);
-		Main.map.mapView.addMouseMotionListener(this);
-		Main.map.mapView.addTemporaryLayer(this);
-		DataSet.addSelectionListener(this);
-		updateSnap(getCurrentDataSet().getSelected());
-		try {
-			Toolkit.getDefaultToolkit().addAWTEventListener(this, AWTEvent.KEY_EVENT_MASK);
-		} catch (SecurityException ex) {
-		}
-	}
-
-	@Override
-	public void exitMode() {
-		super.exitMode();
-		Main.map.mapView.removeMouseListener(this);
-		Main.map.mapView.removeMouseMotionListener(this);
-		Main.map.mapView.removeTemporaryLayer(this);
-		DataSet.removeSelectionListener(this);
-		try {
-			Toolkit.getDefaultToolkit().removeAWTEventListener(this);
-		} catch (SecurityException ex) {
-		}
-		if (mode != Mode.None)
-			Main.map.mapView.repaint();
-		mode = Mode.None;
-	}
-
-	public void cancelDrawing() {
-		mode = Mode.None;
-		if (Main.map == null || Main.map.mapView == null)
-			return;
-		Main.map.statusLine.setHeading(-1);
-		Main.map.statusLine.setAngle(-1);
-		building.reset();
-		Main.map.mapView.repaint();
-		updateStatusLine();
-	}
-
-	public void eventDispatched(AWTEvent arg0) {
-		if (!(arg0 instanceof KeyEvent))
-			return;
-		KeyEvent ev = (KeyEvent) arg0;
-		int modifiers = ev.getModifiersEx();
-		boolean isCtrlDown = (modifiers & KeyEvent.CTRL_DOWN_MASK) != 0;
-		boolean isShiftDown = (modifiers & KeyEvent.SHIFT_DOWN_MASK) != 0;
-		if (this.isCtrlDown != isCtrlDown || this.isShiftDown != isShiftDown) {
-			this.isCtrlDown = isCtrlDown;
-			this.isShiftDown = isShiftDown;
-			processMouseEvent(null);
-			updCursor();
-			if (mode != Mode.None)
-				Main.map.mapView.repaint();
-		}
-
-		if (ev.getKeyCode() == KeyEvent.VK_ESCAPE && ev.getID() == KeyEvent.KEY_PRESSED) {
-			if (mode != Mode.None)
-				ev.consume();
-
-			cancelDrawing();
-		}
-	}
-
-	private EastNorth getEastNorth() {
-		Node n;
-		if (isCtrlDown) {
-			n = null;
-		} else {
-			n = Main.map.mapView.getNearestNode(mousePos, OsmPrimitive.isUsablePredicate);
-		}
-		if (n == null) {
-			return latlon2eastNorth(Main.map.mapView.getLatLon(mousePos.x, mousePos.y));
-		} else {
-			return latlon2eastNorth(n.getCoor());
-		}
-	}
-
-	private boolean isRectDrawing() {
-		return building.isRectDrawing() && (!isShiftDown || ToolSettings.isBBMode());
-	}
-
-	private Mode modeDrawing() {
-		EastNorth p = getEastNorth();
-		if (isRectDrawing()) {
-			building.setPlaceRect(p);
-			return isShiftDown ? Mode.DrawingAngFix : Mode.None;
-		} else {
-			building.setPlace(p, ToolSettings.getWidth(), ToolSettings.getLenStep(), isShiftDown);
-			Main.map.statusLine.setDist(building.getLength());
-			return this.nextMode = ToolSettings.getWidth() == 0 ? Mode.DrawingWidth : Mode.None;
-		}
-	}
-
-	private Mode modeDrawingWidth() {
-		building.setWidth(getEastNorth());
-		Main.map.statusLine.setDist(Math.abs(building.getWidth()));
-		return Mode.None;
-	}
-
-	private Mode modeDrawingAngFix() {
-		building.angFix(getEastNorth());
-		return Mode.None;
-	}
-
-	private void processMouseEvent(MouseEvent e) {
-		if (e != null) {
-			mousePos = e.getPoint();
-			isCtrlDown = e.isControlDown();
-			isShiftDown = e.isShiftDown();
-		}
-		if (mode == Mode.None) {
-			nextMode = Mode.None;
-			return;
-		}
-
-		if (mode == Mode.Drawing) {
-			nextMode = modeDrawing();
-		} else if (mode == Mode.DrawingWidth) {
-			nextMode = modeDrawingWidth();
-		} else if (mode == Mode.DrawingAngFix) {
-			nextMode = modeDrawingAngFix();
-		} else
-			throw new AssertionError("Invalid drawing mode");
-	}
-
-	public void paint(Graphics2D g, MapView mv, Bounds bbox) {
-		if (mode == Mode.None)
-			return;
-		if (building.getLength() == 0)
-			return;
-
-		g.setColor(selectedColor);
-		g.setStroke(new BasicStroke(3, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
-
-		building.paint(g, mv);
-
-		g.setStroke(new BasicStroke(1));
-
-	}
-
-	private void drawingStart(MouseEvent e) {
-		mousePos = e.getPoint();
-		drawStartPos = mousePos;
-
-		Node n = Main.map.mapView.getNearestNode(mousePos, OsmPrimitive.isUsablePredicate);
-		if (n == null) {
-			building.setBase(latlon2eastNorth(Main.map.mapView.getLatLon(mousePos.x, mousePos.y)));
-		} else {
-			building.setBase(n);
-		}
-		mode = Mode.Drawing;
-		updateStatusLine();
-	}
-
-	private void drawingAdvance(MouseEvent e) {
-		processMouseEvent(e);
-		if (this.mode != Mode.None && this.nextMode == Mode.None) {
-			drawingFinish();
-		} else {
-			mode = this.nextMode;
-			updateStatusLine();
-		}
-	}
-
-	private void drawingFinish() {
-		if (building.getLength() != 0) {
-			Way w = building.create();
-			if (w != null && ToolSettings.isUsingAddr())
-				showAddrDialog(w);
-			if (ToolSettings.isAutoSelect() &&
-					(Main.main.getCurrentDataSet().getSelected().isEmpty() || isShiftDown)) {
-				Main.main.getCurrentDataSet().setSelected(w);
-			}
-		}
-		cancelDrawing();
-	}
-
-	@Override
-	public void mousePressed(MouseEvent e) {
-		if (e.getButton() != MouseEvent.BUTTON1)
-			return;
-		if (!Main.map.mapView.isActiveLayerDrawable())
-			return;
-
-		if (mode == Mode.None)
-			drawingStart(e);
-	}
-
-	@Override
-	public void mouseDragged(MouseEvent e) {
-		processMouseEvent(e);
-		updCursor();
-		if (mode != Mode.None)
-			Main.map.mapView.repaint();
-	}
-
-	@Override
-	public void mouseReleased(MouseEvent e) {
-		if (e.getButton() != MouseEvent.BUTTON1)
-			return;
-		if (!Main.map.mapView.isActiveLayerDrawable())
-			return;
-		boolean dragged = true;
-		if (drawStartPos != null)
-			dragged = e.getPoint().distance(drawStartPos) > 10;
-		drawStartPos = null;
-
-		if (mode == Mode.Drawing && !dragged)
-			return;
-		if (mode == Mode.None)
-			return;
-
-		drawingAdvance(e);
-	}
-
-	private void updCursor() {
-		if (mousePos == null)
-			return;
-		if (!Main.isDisplayingMapView())
-			return;
-		Node n = null;
-		if (!isCtrlDown)
-			n = Main.map.mapView.getNearestNode(mousePos, OsmPrimitive.isUsablePredicate);
-		if (n != null) {
-			setCursor(cursorJoinNode);
-		} else {
-			if (customCursor != null && (!isShiftDown || isRectDrawing()))
-				setCursor(customCursor);
-			else
-				setCursor(cursorCrosshair);
-		}
-
-	}
-
-	@Override
-	public void mouseMoved(MouseEvent e) {
-		if (!Main.map.mapView.isActiveLayerDrawable())
-			return;
-		processMouseEvent(e);
-		updCursor();
-		if (mode != Mode.None)
-			Main.map.mapView.repaint();
-	}
-
-	@Override
-	public String getModeHelpText() {
-		if (mode == Mode.None)
-			return tr("Point on the corner of the building to start drawing");
-		if (mode == Mode.Drawing)
-			return tr("Point on opposite end of the building");
-		if (mode == Mode.DrawingWidth)
-			return tr("Set width of the building");
-		return "";
-	}
-
-	@Override
-	public boolean layerIsSupported(Layer l) {
-		return l instanceof OsmDataLayer;
-	}
-
-	public void updateSnap(Collection<? extends OsmPrimitive> newSelection) {
-		building.clearAngleSnap();
-		// update snap only if selection isn't too big
-		if (newSelection.size() <= 10) {
-			LinkedList<Node> nodes = new LinkedList<Node>();
-			LinkedList<Way> ways = new LinkedList<Way>();
-
-			for (OsmPrimitive p : newSelection) {
-				switch (p.getType()) {
-				case NODE:
-					nodes.add((Node) p);
-					break;
-				case WAY:
-					ways.add((Way) p);
-					break;
-				}
-			}
-
-			building.addAngleSnap(nodes.toArray(new Node[0]));
-			for (Way w : ways) {
-				building.addAngleSnap(w);
-			}
-		}
-		updateCustomCursor();
-	}
-
-	private void updateCustomCursor() {
-		Double angle = building.getDrawingAngle();
-		if (angle == null || !ToolSettings.isSoftCursor()) {
-			customCursor = null;
-			return;
-		}
-		final int R = 9; // crosshair outer radius
-		final int r = 3; // crosshair inner radius
-		BufferedImage img = new BufferedImage(32, 32, BufferedImage.TYPE_INT_ARGB);
-		Graphics2D g = img.createGraphics();
-
-		GeneralPath b = new GeneralPath();
-		b.moveTo(16 - Math.cos(angle) * R, 16 - Math.sin(angle) * R);
-		b.lineTo(16 - Math.cos(angle) * r, 16 - Math.sin(angle) * r);
-		b.moveTo(16 + Math.cos(angle) * R, 16 + Math.sin(angle) * R);
-		b.lineTo(16 + Math.cos(angle) * r, 16 + Math.sin(angle) * r);
-		b.moveTo(16 + Math.sin(angle) * R, 16 - Math.cos(angle) * R);
-		b.lineTo(16 + Math.sin(angle) * r, 16 - Math.cos(angle) * r);
-		b.moveTo(16 - Math.sin(angle) * R, 16 + Math.cos(angle) * R);
-		b.lineTo(16 - Math.sin(angle) * r, 16 + Math.cos(angle) * r);
-
-		g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
-		g.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);
-
-		g.setStroke(new BasicStroke(3, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
-		g.setColor(Color.WHITE);
-		g.draw(b);
-
-		g.setStroke(new BasicStroke(1, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
-		g.setColor(Color.BLACK);
-		g.draw(b);
-
-		customCursor = Toolkit.getDefaultToolkit().createCustomCursor(img, new Point(16, 16), "custom crosshair");
-
-		updCursor();
-	}
-
-	public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) {
-		updateSnap(newSelection);
-	}
+    private enum Mode {
+        None, Drawing, DrawingWidth, DrawingAngFix
+    }
+
+    final private Cursor cursorCrosshair;
+    final private Cursor cursorJoinNode;
+    private Cursor currCursor;
+    private Cursor customCursor;
+
+    private Mode mode = Mode.None;
+    private Mode nextMode = Mode.None;
+
+    private Color selectedColor;
+    private Point drawStartPos;
+    private Point mousePos;
+    private boolean isCtrlDown;
+    private boolean isShiftDown;
+
+    Building building = new Building();
+
+    public DrawBuildingAction(MapFrame mapFrame) {
+        super(tr("Draw buildings"), "building", tr("Draw buildings"),
+                Shortcut.registerShortcut("mapmode:buildings",
+                        tr("Mode: {0}", tr("Draw buildings")),
+                        KeyEvent.VK_W, Shortcut.GROUP_EDIT),
+                mapFrame, getCursor());
+
+        cursorCrosshair = getCursor();
+        cursorJoinNode = ImageProvider.getCursor("crosshair", "joinnode");
+        currCursor = cursorCrosshair;
+
+        selectedColor = Main.pref.getColor(marktr("selected"), Color.red);
+    }
+
+    private static Cursor getCursor() {
+        try {
+            return ImageProvider.getCursor("crosshair", null);
+        } catch (Exception e) {
+        }
+        return Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR);
+    }
+
+    /**
+     * Displays the given cursor instead of the normal one
+     *
+     * @param Cursors
+     *            One of the available cursors
+     */
+    private void setCursor(final Cursor c) {
+        if (currCursor.equals(c))
+            return;
+        try {
+            // We invoke this to prevent strange things from happening
+            EventQueue.invokeLater(new Runnable() {
+                public void run() {
+                    // Don't change cursor when mode has changed already
+                    if (!(Main.map.mapMode instanceof DrawBuildingAction))
+                        return;
+                    Main.map.mapView.setCursor(c);
+                }
+            });
+            currCursor = c;
+        } catch (Exception e) {
+        }
+    }
+
+    private static void showAddrDialog(Way w) {
+        AddressDialog dlg = new AddressDialog();
+        int answer = dlg.getValue();
+        if (answer == 1) {
+            dlg.saveValues();
+            String tmp;
+            tmp = dlg.getHouseNum();
+            if (tmp != null && tmp != "")
+                w.put("addr:housenumber", tmp);
+            tmp = dlg.getStreetName();
+            if (tmp != null && tmp != "")
+                w.put("addr:street", tmp);
+        }
+    }
+
+    @Override
+    public void enterMode() {
+        super.enterMode();
+        if (getCurrentDataSet() == null) {
+            Main.map.selectSelectTool(false);
+            return;
+        }
+        currCursor = cursorCrosshair;
+        Main.map.mapView.addMouseListener(this);
+        Main.map.mapView.addMouseMotionListener(this);
+        Main.map.mapView.addTemporaryLayer(this);
+        DataSet.addSelectionListener(this);
+        updateSnap(getCurrentDataSet().getSelected());
+        try {
+            Toolkit.getDefaultToolkit().addAWTEventListener(this, AWTEvent.KEY_EVENT_MASK);
+        } catch (SecurityException ex) {
+        }
+    }
+
+    @Override
+    public void exitMode() {
+        super.exitMode();
+        Main.map.mapView.removeMouseListener(this);
+        Main.map.mapView.removeMouseMotionListener(this);
+        Main.map.mapView.removeTemporaryLayer(this);
+        DataSet.removeSelectionListener(this);
+        try {
+            Toolkit.getDefaultToolkit().removeAWTEventListener(this);
+        } catch (SecurityException ex) {
+        }
+        if (mode != Mode.None)
+            Main.map.mapView.repaint();
+        mode = Mode.None;
+    }
+
+    public void cancelDrawing() {
+        mode = Mode.None;
+        if (Main.map == null || Main.map.mapView == null)
+            return;
+        Main.map.statusLine.setHeading(-1);
+        Main.map.statusLine.setAngle(-1);
+        building.reset();
+        Main.map.mapView.repaint();
+        updateStatusLine();
+    }
+
+    public void eventDispatched(AWTEvent arg0) {
+        if (!(arg0 instanceof KeyEvent))
+            return;
+        KeyEvent ev = (KeyEvent) arg0;
+        int modifiers = ev.getModifiersEx();
+        boolean isCtrlDown = (modifiers & KeyEvent.CTRL_DOWN_MASK) != 0;
+        boolean isShiftDown = (modifiers & KeyEvent.SHIFT_DOWN_MASK) != 0;
+        if (this.isCtrlDown != isCtrlDown || this.isShiftDown != isShiftDown) {
+            this.isCtrlDown = isCtrlDown;
+            this.isShiftDown = isShiftDown;
+            processMouseEvent(null);
+            updCursor();
+            if (mode != Mode.None)
+                Main.map.mapView.repaint();
+        }
+
+        if (ev.getKeyCode() == KeyEvent.VK_ESCAPE && ev.getID() == KeyEvent.KEY_PRESSED) {
+            if (mode != Mode.None)
+                ev.consume();
+
+            cancelDrawing();
+        }
+    }
+
+    private EastNorth getEastNorth() {
+        Node n;
+        if (isCtrlDown) {
+            n = null;
+        } else {
+            n = Main.map.mapView.getNearestNode(mousePos, OsmPrimitive.isUsablePredicate);
+        }
+        if (n == null) {
+            return latlon2eastNorth(Main.map.mapView.getLatLon(mousePos.x, mousePos.y));
+        } else {
+            return latlon2eastNorth(n.getCoor());
+        }
+    }
+
+    private boolean isRectDrawing() {
+        return building.isRectDrawing() && (!isShiftDown || ToolSettings.isBBMode());
+    }
+
+    private Mode modeDrawing() {
+        EastNorth p = getEastNorth();
+        if (isRectDrawing()) {
+            building.setPlaceRect(p);
+            return isShiftDown ? Mode.DrawingAngFix : Mode.None;
+        } else {
+            building.setPlace(p, ToolSettings.getWidth(), ToolSettings.getLenStep(), isShiftDown);
+            Main.map.statusLine.setDist(building.getLength());
+            return this.nextMode = ToolSettings.getWidth() == 0 ? Mode.DrawingWidth : Mode.None;
+        }
+    }
+
+    private Mode modeDrawingWidth() {
+        building.setWidth(getEastNorth());
+        Main.map.statusLine.setDist(Math.abs(building.getWidth()));
+        return Mode.None;
+    }
+
+    private Mode modeDrawingAngFix() {
+        building.angFix(getEastNorth());
+        return Mode.None;
+    }
+
+    private void processMouseEvent(MouseEvent e) {
+        if (e != null) {
+            mousePos = e.getPoint();
+            isCtrlDown = e.isControlDown();
+            isShiftDown = e.isShiftDown();
+        }
+        if (mode == Mode.None) {
+            nextMode = Mode.None;
+            return;
+        }
+
+        if (mode == Mode.Drawing) {
+            nextMode = modeDrawing();
+        } else if (mode == Mode.DrawingWidth) {
+            nextMode = modeDrawingWidth();
+        } else if (mode == Mode.DrawingAngFix) {
+            nextMode = modeDrawingAngFix();
+        } else
+            throw new AssertionError("Invalid drawing mode");
+    }
+
+    public void paint(Graphics2D g, MapView mv, Bounds bbox) {
+        if (mode == Mode.None)
+            return;
+        if (building.getLength() == 0)
+            return;
+
+        g.setColor(selectedColor);
+        g.setStroke(new BasicStroke(3, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
+
+        building.paint(g, mv);
+
+        g.setStroke(new BasicStroke(1));
+
+    }
+
+    private void drawingStart(MouseEvent e) {
+        mousePos = e.getPoint();
+        drawStartPos = mousePos;
+
+        Node n = Main.map.mapView.getNearestNode(mousePos, OsmPrimitive.isUsablePredicate);
+        if (n == null) {
+            building.setBase(latlon2eastNorth(Main.map.mapView.getLatLon(mousePos.x, mousePos.y)));
+        } else {
+            building.setBase(n);
+        }
+        mode = Mode.Drawing;
+        updateStatusLine();
+    }
+
+    private void drawingAdvance(MouseEvent e) {
+        processMouseEvent(e);
+        if (this.mode != Mode.None && this.nextMode == Mode.None) {
+            drawingFinish();
+        } else {
+            mode = this.nextMode;
+            updateStatusLine();
+        }
+    }
+
+    private void drawingFinish() {
+        if (building.getLength() != 0) {
+            Way w = building.create();
+            if (w != null && ToolSettings.isUsingAddr())
+                showAddrDialog(w);
+            if (ToolSettings.isAutoSelect() &&
+                    (Main.main.getCurrentDataSet().getSelected().isEmpty() || isShiftDown)) {
+                Main.main.getCurrentDataSet().setSelected(w);
+            }
+        }
+        cancelDrawing();
+    }
+
+    @Override
+    public void mousePressed(MouseEvent e) {
+        if (e.getButton() != MouseEvent.BUTTON1)
+            return;
+        if (!Main.map.mapView.isActiveLayerDrawable())
+            return;
+
+        if (mode == Mode.None)
+            drawingStart(e);
+    }
+
+    @Override
+    public void mouseDragged(MouseEvent e) {
+        processMouseEvent(e);
+        updCursor();
+        if (mode != Mode.None)
+            Main.map.mapView.repaint();
+    }
+
+    @Override
+    public void mouseReleased(MouseEvent e) {
+        if (e.getButton() != MouseEvent.BUTTON1)
+            return;
+        if (!Main.map.mapView.isActiveLayerDrawable())
+            return;
+        boolean dragged = true;
+        if (drawStartPos != null)
+            dragged = e.getPoint().distance(drawStartPos) > 10;
+        drawStartPos = null;
+
+        if (mode == Mode.Drawing && !dragged)
+            return;
+        if (mode == Mode.None)
+            return;
+
+        drawingAdvance(e);
+    }
+
+    private void updCursor() {
+        if (mousePos == null)
+            return;
+        if (!Main.isDisplayingMapView())
+            return;
+        Node n = null;
+        if (!isCtrlDown)
+            n = Main.map.mapView.getNearestNode(mousePos, OsmPrimitive.isUsablePredicate);
+        if (n != null) {
+            setCursor(cursorJoinNode);
+        } else {
+            if (customCursor != null && (!isShiftDown || isRectDrawing()))
+                setCursor(customCursor);
+            else
+                setCursor(cursorCrosshair);
+        }
+
+    }
+
+    @Override
+    public void mouseMoved(MouseEvent e) {
+        if (!Main.map.mapView.isActiveLayerDrawable())
+            return;
+        processMouseEvent(e);
+        updCursor();
+        if (mode != Mode.None)
+            Main.map.mapView.repaint();
+    }
+
+    @Override
+    public String getModeHelpText() {
+        if (mode == Mode.None)
+            return tr("Point on the corner of the building to start drawing");
+        if (mode == Mode.Drawing)
+            return tr("Point on opposite end of the building");
+        if (mode == Mode.DrawingWidth)
+            return tr("Set width of the building");
+        return "";
+    }
+
+    @Override
+    public boolean layerIsSupported(Layer l) {
+        return l instanceof OsmDataLayer;
+    }
+
+    public void updateSnap(Collection<? extends OsmPrimitive> newSelection) {
+        building.clearAngleSnap();
+        // update snap only if selection isn't too big
+        if (newSelection.size() <= 10) {
+            LinkedList<Node> nodes = new LinkedList<Node>();
+            LinkedList<Way> ways = new LinkedList<Way>();
+
+            for (OsmPrimitive p : newSelection) {
+                switch (p.getType()) {
+                case NODE:
+                    nodes.add((Node) p);
+                    break;
+                case WAY:
+                    ways.add((Way) p);
+                    break;
+                }
+            }
+
+            building.addAngleSnap(nodes.toArray(new Node[0]));
+            for (Way w : ways) {
+                building.addAngleSnap(w);
+            }
+        }
+        updateCustomCursor();
+    }
+
+    private void updateCustomCursor() {
+        Double angle = building.getDrawingAngle();
+        if (angle == null || !ToolSettings.isSoftCursor()) {
+            customCursor = null;
+            return;
+        }
+        final int R = 9; // crosshair outer radius
+        final int r = 3; // crosshair inner radius
+        BufferedImage img = new BufferedImage(32, 32, BufferedImage.TYPE_INT_ARGB);
+        Graphics2D g = img.createGraphics();
+
+        GeneralPath b = new GeneralPath();
+        b.moveTo(16 - Math.cos(angle) * R, 16 - Math.sin(angle) * R);
+        b.lineTo(16 - Math.cos(angle) * r, 16 - Math.sin(angle) * r);
+        b.moveTo(16 + Math.cos(angle) * R, 16 + Math.sin(angle) * R);
+        b.lineTo(16 + Math.cos(angle) * r, 16 + Math.sin(angle) * r);
+        b.moveTo(16 + Math.sin(angle) * R, 16 - Math.cos(angle) * R);
+        b.lineTo(16 + Math.sin(angle) * r, 16 - Math.cos(angle) * r);
+        b.moveTo(16 - Math.sin(angle) * R, 16 + Math.cos(angle) * R);
+        b.lineTo(16 - Math.sin(angle) * r, 16 + Math.cos(angle) * r);
+
+        g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+        g.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);
+
+        g.setStroke(new BasicStroke(3, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
+        g.setColor(Color.WHITE);
+        g.draw(b);
+
+        g.setStroke(new BasicStroke(1, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
+        g.setColor(Color.BLACK);
+        g.draw(b);
+
+        customCursor = Toolkit.getDefaultToolkit().createCustomCursor(img, new Point(16, 16), "custom crosshair");
+
+        updCursor();
+    }
+
+    public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) {
+        updateSnap(newSelection);
+    }
 }
Index: /applications/editors/josm/plugins/buildings_tools/src/buildings_tools/ToolSettings.java
===================================================================
--- /applications/editors/josm/plugins/buildings_tools/src/buildings_tools/ToolSettings.java	(revision 23189)
+++ /applications/editors/josm/plugins/buildings_tools/src/buildings_tools/ToolSettings.java	(revision 23190)
@@ -7,61 +7,61 @@
 
 public class ToolSettings {
-	private static double width = 0;
-	private static double lenstep = 0;
-	private static boolean useAddr;
-	private static final Map<String, String> tags = new HashMap<String, String>();
-	private static boolean autoSelect;
+    private static double width = 0;
+    private static double lenstep = 0;
+    private static boolean useAddr;
+    private static final Map<String, String> tags = new HashMap<String, String>();
+    private static boolean autoSelect;
 
-	static {
-		tags.put("building", "yes");
-	}
+    static {
+        tags.put("building", "yes");
+    }
 
-	public static void setAddrDialog(boolean _useAddr) {
-		useAddr = _useAddr;
-	}
+    public static void setAddrDialog(boolean _useAddr) {
+        useAddr = _useAddr;
+    }
 
-	public static void setSizes(double newwidth, double newlenstep) {
-		width = newwidth;
-		lenstep = newlenstep;
-	}
+    public static void setSizes(double newwidth, double newlenstep) {
+        width = newwidth;
+        lenstep = newlenstep;
+    }
 
-	public static double getWidth() {
-		return width;
-	}
+    public static double getWidth() {
+        return width;
+    }
 
-	public static double getLenStep() {
-		return lenstep;
-	}
+    public static double getLenStep() {
+        return lenstep;
+    }
 
-	public static boolean isUsingAddr() {
-		return useAddr;
-	}
+    public static boolean isUsingAddr() {
+        return useAddr;
+    }
 
-	public static Map<String, String> getTags() {
-		return tags;
-	}
+    public static Map<String, String> getTags() {
+        return tags;
+    }
 
-	public static void setBBMode(boolean bbmode) {
-		Main.pref.put("buildings_tools.bbmode", bbmode);
-	}
+    public static void setBBMode(boolean bbmode) {
+        Main.pref.put("buildings_tools.bbmode", bbmode);
+    }
 
-	public static boolean isBBMode() {
-		return Main.pref.getBoolean("buildings_tools.bbmode", false);
-	}
+    public static boolean isBBMode() {
+        return Main.pref.getBoolean("buildings_tools.bbmode", false);
+    }
 
-	public static void setSoftCursor(boolean softCursor) {
-		Main.pref.put("buildings_tools.softcursor", softCursor);
-	}
+    public static void setSoftCursor(boolean softCursor) {
+        Main.pref.put("buildings_tools.softcursor", softCursor);
+    }
 
-	public static boolean isSoftCursor() {
-		return Main.pref.getBoolean("buildings_tools.softcursor", false);
-	}
+    public static boolean isSoftCursor() {
+        return Main.pref.getBoolean("buildings_tools.softcursor", false);
+    }
 
-	public static boolean isAutoSelect() {
-		return autoSelect;
-	}
+    public static boolean isAutoSelect() {
+        return autoSelect;
+    }
 
-	public static void setAutoSelect(boolean _autoSelect) {
-		autoSelect = _autoSelect;
-	}
+    public static void setAutoSelect(boolean _autoSelect) {
+        autoSelect = _autoSelect;
+    }
 }
Index: /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CacheControl.java
===================================================================
--- /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CacheControl.java	(revision 23189)
+++ /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CacheControl.java	(revision 23190)
@@ -25,5 +25,5 @@
 
 public class CacheControl implements Runnable {
-    
+
     public static final String cLambertCC9Z = "CC";
 
@@ -55,5 +55,5 @@
         return ret;
     }
-    
+
     public CacheControl(WMSLayer wmsLayer) {
         cacheEnabled = Main.pref.getBoolean("cadastrewms.enableCaching", true);
@@ -110,5 +110,5 @@
                     int reply = (Integer)pane.getValue();
                     // till here
-    
+
                     if (reply == JOptionPane.OK_OPTION && loadCache(file, wmsLayer.getLambertZone())) {
                         return true;
@@ -136,5 +136,5 @@
         }
     }
-    
+
     private void delete(File file) {
         System.out.println("Delete file "+file);
@@ -215,5 +215,5 @@
         }
     }
-    
+
     private String WMSFileExtension() {
         String ext = String.valueOf((wmsLayer.getLambertZone() + 1));
Index: /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastreGrabber.java
===================================================================
--- /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastreGrabber.java	(revision 23189)
+++ /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastreGrabber.java	(revision 23190)
@@ -52,5 +52,5 @@
         }
     }
-    
+
     public GeorefImage grabParcels(WMSLayer wmsLayer, EastNorth lambertMin, EastNorth lambertMax) throws IOException, OsmTransferException {
         try {
@@ -63,5 +63,5 @@
         }
     }
-    
+
     private URL getURLRaster(WMSLayer wmsLayer, EastNorth lambertMin, EastNorth lambertMax) throws MalformedURLException {
         // GET /scpc/wms?version=1.1&request=GetMap&layers=CDIF:PMC@QH4480001701&format=image/png&bbox=-1186,0,13555,8830&width=576&height=345&exception=application/vnd.ogc.se_inimage&styles= HTTP/1.1
@@ -85,5 +85,5 @@
             EastNorth lambertMin, EastNorth lambertMax) throws MalformedURLException {
         String str = new String(wmsInterface.baseURL+"/scpc/wms?version=1.1&request=GetMap");
-        str += "&layers="+ layers;  
+        str += "&layers="+ layers;
         str += "&format=image/png";
         //str += "&format=image/jpeg";
@@ -100,6 +100,6 @@
 
     private URL getURLVector(EastNorth lambertMin, EastNorth lambertMax) throws MalformedURLException {
-        return buildURLVector(CadastrePlugin.grabLayers, CadastrePlugin.grabStyles, 
-                CadastrePlugin.imageWidth, CadastrePlugin.imageHeight, 
+        return buildURLVector(CadastrePlugin.grabLayers, CadastrePlugin.grabStyles,
+                CadastrePlugin.imageWidth, CadastrePlugin.imageHeight,
                 lambertMin, lambertMax);
     }
Index: /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastreInterface.java
===================================================================
--- /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastreInterface.java	(revision 23189)
+++ /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastreInterface.java	(revision 23190)
@@ -53,5 +53,5 @@
     final String cOptionListEnd = "</option>";
     final String cBBoxCommunStart = "new GeoBox(";
-    final String cBBoxCommunEnd = ")";    
+    final String cBBoxCommunEnd = ")";
 
     final String cInterfaceVector = "afficherCarteCommune.do";
@@ -62,5 +62,5 @@
     final String cImageNameStart = ">Feuille ";
     final String cTAImageNameStart = "Tableau d'assemblage <strong>";
-    
+
     final static long cCookieExpiration = 30 * 60 * 1000; // 30 minutes expressed in milliseconds
 
@@ -97,5 +97,5 @@
 
     /**
-     * 
+     *
      * @return true if a cookie is delivered by WMS and false is WMS is not opening a client session
      *         (too many clients or in maintenance)
@@ -141,5 +141,5 @@
         cookie = null;
     }
-    
+
     public boolean isCookieExpired() {
         long now = new Date().getTime();
@@ -165,5 +165,5 @@
         urlConn.setRequestProperty("Cookie", this.cookie);
     }
-    
+
     private void getInterface(WMSLayer wmsLayer) throws IOException, DuplicateLayerException {
         // first attempt : search for given name without codeCommune
@@ -379,5 +379,5 @@
         return lines;
     }
-    
+
     private void parseFeuillesList(String input) {
         listOfFeuilles.clear();
@@ -402,5 +402,5 @@
         }
     }
-    
+
     private String selectMunicipalityDialog(WMSLayer wmsLayer) {
         JPanel p = new JPanel(new GridBagLayout());
@@ -455,5 +455,5 @@
      * and store it in given wmsLayer
      * In case of raster image, we also check in the same http request if the image is already georeferenced
-     * and store the result in the wmsLayer as well. 
+     * and store the result in the wmsLayer as well.
      * @param wmsLayer the WMSLayer where the commune data and images are stored
      * @throws IOException
@@ -502,5 +502,5 @@
         }
     }
-    
+
     private void parseGeoreferences(WMSLayer wmsLayer, String input) {
         if (input.lastIndexOf(cBBoxCommunStart) != -1) {
@@ -537,5 +537,5 @@
         }
     }
-    
+
     private double tryParseDouble(String str) {
         try {
Index: /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastrePlugin.java
===================================================================
--- /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastrePlugin.java	(revision 23189)
+++ /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastrePlugin.java	(revision 23190)
@@ -96,5 +96,5 @@
  *                 - proper WMS layer cleanup at destruction (workaround for memory leak)
  *                 - new cache format (v3) storing original image and cropped image bbox + angle
- *                 - new cache format (v4) storing original image size for later rotation 
+ *                 - new cache format (v4) storing original image size for later rotation
  *                 - cache files read compatible with previous formats
  *                 - raster image rotation issues fixed, now using shift+ctrl key instead of ctrl
@@ -104,5 +104,5 @@
  *                 - improved download cancellation
  *                 - from Erik Amzallag:
- *                 -     possibility to modify the auto-sourcing text just before upload 
+ *                 -     possibility to modify the auto-sourcing text just before upload
  *                 - from Clément Ménier:
  *                 -     new option allowing an auto-selection of the first cadastre layer for grab
@@ -112,5 +112,5 @@
  *                 - download cancellation improved
  *                 - last deployment for Java1.5 compatibility
- * 2.0 xx-xxx-xxxx - update projection for "La Reunion" departement to RGR92, UTM40S. 
+ * 2.0 xx-xxx-xxxx - update projection for "La Reunion" departement to RGR92, UTM40S.
  *                 - add 'departement' as option in the municipality selection
  *                 - fixed bug in cache directory size control (and disabled by default)
@@ -145,5 +145,5 @@
 
     public static int imageWidth, imageHeight;
-    
+
     public static String grabLayers, grabStyles = null;
 
@@ -156,5 +156,5 @@
      */
     public CadastrePlugin(PluginInformation info) throws Exception {
-    	super(info);
+        super(info);
         System.out.println("Pluging cadastre-fr v"+VERSION+" started...");
         if (Main.pref.get("cadastrewms.cacheDir").equals(""))
@@ -218,5 +218,5 @@
 
     public static void refreshConfiguration() {
-        source = checkSourceMillesime(); 
+        source = checkSourceMillesime();
         autoSourcing = Main.pref.getBoolean("cadastrewms.autosourcing", true);
         alterColors = Main.pref.getBoolean("cadastrewms.alterColors");
@@ -234,9 +234,9 @@
         } else if (currentResolution.equals("medium")){
             imageWidth = 800; imageHeight = 600;
-        } else { 
+        } else {
             imageWidth = 600; imageHeight = 400;
         }
         refreshLayersURL();
-        
+
         // overwrite F11 shortcut used from the beginning by this plugin and recently used
         // for full-screen switch in JOSM core
@@ -268,5 +268,5 @@
         refreshMenu();
     }
-    
+
     private static void refreshLayersURL() {
         grabLayers = "";
@@ -346,5 +346,5 @@
         }
     }
-    
+
     public static boolean isCadastreProjection() {
         return Main.proj.toString().equals(new Lambert().toString())
@@ -360,5 +360,5 @@
 
     // See OptionPaneUtil
-    // FIXME: this is a temporary solution. 
+    // FIXME: this is a temporary solution.
     public static void prepareDialog(JDialog dialog) {
         if (Main.pref.getBoolean("window-handling.option-pane-always-on-top", true)) {
@@ -373,5 +373,5 @@
         dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
     }
-    
+
     /**
      * Adds the WMSLayer following this rule:<br/>
@@ -393,5 +393,5 @@
             Main.main.addLayer(wmsLayer);
     }
-    
+
     private static String checkSourceMillesime() {
         java.util.Calendar calendar = java.util.Calendar.getInstance();
@@ -411,4 +411,4 @@
         return src;
     }
-    
+
 }
Index: /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastrePreferenceSetting.java
===================================================================
--- /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastrePreferenceSetting.java	(revision 23189)
+++ /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastrePreferenceSetting.java	(revision 23190)
@@ -40,11 +40,11 @@
 
     private JCheckBox disableImageCropping = new JCheckBox(tr("Disable image cropping during georeferencing."));
-    
+
     private JCheckBox enableTableauAssemblage = new JCheckBox(tr("Use \"Tableau d''assemblage\""));
-    
+
     private JCheckBox autoFirstLayer = new JCheckBox(tr("Select first WMS layer in list."));
-    
+
     private JCheckBox dontUseRelation = new JCheckBox(tr("Don't use relation for addresses (but \"addr:street\" on elements)."));
-    
+
     private JRadioButton grabMultiplier1 = new JRadioButton("", true);
 
@@ -54,7 +54,7 @@
 
     private JRadioButton grabMultiplier4 = new JRadioButton("", true);
-    
+
     private JRadioButton crosspiece1 = new JRadioButton("off");
-    
+
     private JRadioButton crosspiece2 = new JRadioButton("25m");
 
@@ -87,10 +87,10 @@
     JLabel jLabelCacheSize = new JLabel(tr("Max. cache size (in MB)"));
     private JTextField cacheSize = new JTextField(20);
-    
+
     static final String DEFAULT_RASTER_DIVIDER = "5";
     private JTextField rasterDivider = new JTextField(10);
 
     static final int DEFAULT_CROSSPIECES = 0;
-    
+
     public void addGui(final PreferenceTabbedPane gui) {
 
@@ -101,5 +101,5 @@
                 + "before any upload of data created by this plugin.");
         JPanel cadastrewmsMast = gui.createPreferenceTab("cadastrewms.gif", I18n.tr("French cadastre WMS"), description);
-        
+
         JPanel cadastrewms = new JPanel(new GridBagLayout());
         cadastrewms.setBorder(BorderFactory.createEmptyBorder(0,0,0,0));
@@ -177,5 +177,5 @@
         cadastrewms.add(grabRes2, GBC.std().insets(5, 0, 5, 0));
         cadastrewms.add(grabRes3, GBC.eol().fill(GBC.HORIZONTAL).insets(5, 5, 0, 5));
-        
+
         // option to select image zooming interpolation method
         JLabel jLabelImageZoomInterpolation = new JLabel(tr("Image filter interpolation:"));
@@ -185,7 +185,7 @@
         imageInterpolationMethod.addItem(tr("Bicubic (slow)"));
         String savedImageInterpolationMethod = Main.pref.get("cadastrewms.imageInterpolation", "standard");
-        if (savedImageInterpolationMethod.equals("bilinear")) 
+        if (savedImageInterpolationMethod.equals("bilinear"))
             imageInterpolationMethod.setSelectedIndex(1);
-        else if (savedImageInterpolationMethod.equals("bicubic")) 
+        else if (savedImageInterpolationMethod.equals("bicubic"))
             imageInterpolationMethod.setSelectedIndex(2);
         else
@@ -195,5 +195,5 @@
         // separator
         cadastrewms.add(new JSeparator(SwingConstants.HORIZONTAL), GBC.eol().fill(GBC.HORIZONTAL));
-        
+
         // the vectorized images multiplier
         JLabel jLabelScale = new JLabel(tr("Vector images grab multiplier:"));
@@ -275,5 +275,5 @@
         layerCommune.setToolTipText(tr("Municipality administrative borders."));
         cadastrewms.add(layerCommune, GBC.eop().insets(5, 0, 5, 0));
-        
+
         // separator
         cadastrewms.add(new JSeparator(SwingConstants.HORIZONTAL), GBC.eol().fill(GBC.HORIZONTAL));
@@ -335,5 +335,5 @@
         // separator
         cadastrewms.add(new JSeparator(SwingConstants.HORIZONTAL), GBC.eol().fill(GBC.HORIZONTAL));
-        
+
         // option to select the first WMS layer
         autoFirstLayer.setSelected(Main.pref.getBoolean("cadastrewms.autoFirstLayer", false));
@@ -348,5 +348,5 @@
         dontUseRelation.setToolTipText(tr("Enable this to use the tag \"add:street\" on nodes."));
         cadastrewms.add(dontUseRelation, GBC.eop().insets(0, 0, 0, 0));
-        
+
         // end of dialog, scroll bar
         cadastrewms.add(Box.createVerticalGlue(), GBC.eol().fill(GBC.VERTICAL));
@@ -374,5 +374,5 @@
         else if (imageInterpolationMethod.getSelectedIndex() == 1)
             Main.pref.put("cadastrewms.imageInterpolation", "bilinear");
-        else 
+        else
             Main.pref.put("cadastrewms.imageInterpolation", "standard");
         if (grabMultiplier1.isSelected())
Index: /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CheckSourceUploadHook.java
===================================================================
--- /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CheckSourceUploadHook.java	(revision 23189)
+++ /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CheckSourceUploadHook.java	(revision 23190)
@@ -38,5 +38,5 @@
      * Add the tag "source" if it doesn't exist for all new Nodes and Ways before uploading
      */
-    public boolean checkUpload(APIDataSet apiDataSet) 
+    public boolean checkUpload(APIDataSet apiDataSet)
     {
         if (CadastrePlugin.autoSourcing && CadastrePlugin.pluginUsed && !apiDataSet.getPrimitivesToAdd().isEmpty()) {
Index: /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/DownloadSVGBuilding.java
===================================================================
--- /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/DownloadSVGBuilding.java	(revision 23189)
+++ /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/DownloadSVGBuilding.java	(revision 23190)
@@ -54,5 +54,5 @@
     @Override
     public void realRun() throws IOException, OsmTransferException {
-    	progressMonitor.indeterminateSubTask(tr("Contacting WMS Server..."));
+        progressMonitor.indeterminateSubTask(tr("Contacting WMS Server..."));
         errorMessage = null;
         try {
Index: /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/DownloadSVGTask.java
===================================================================
--- /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/DownloadSVGTask.java	(revision 23189)
+++ /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/DownloadSVGTask.java	(revision 23190)
@@ -57,5 +57,5 @@
     @Override
     public void realRun() throws IOException, OsmTransferException {
-    	progressMonitor.indeterminateSubTask(tr("Contacting WMS Server..."));
+        progressMonitor.indeterminateSubTask(tr("Contacting WMS Server..."));
         errorMessage = null;
         try {
Index: /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/DownloadWMSVectorImage.java
===================================================================
--- /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/DownloadWMSVectorImage.java	(revision 23189)
+++ /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/DownloadWMSVectorImage.java	(revision 23190)
@@ -16,6 +16,6 @@
 
     private WMSLayer wmsLayer;
-    private Bounds bounds;    
-    private CadastreGrabber grabber = CadastrePlugin.cadastreGrabber;    
+    private Bounds bounds;
+    private CadastreGrabber grabber = CadastrePlugin.cadastreGrabber;
     private static String errorMessage;
 
Index: /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/EastNorthBound.java
===================================================================
--- /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/EastNorthBound.java	(revision 23189)
+++ /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/EastNorthBound.java	(revision 23190)
@@ -31,5 +31,5 @@
         return enb;
     }
-    
+
     public Bounds toBounds() {
         return new Bounds(Main.proj.eastNorth2latlon(min), Main.proj.eastNorth2latlon(max));
Index: /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/GeorefImage.java
===================================================================
--- /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/GeorefImage.java	(revision 23189)
+++ /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/GeorefImage.java	(revision 23190)
@@ -30,7 +30,7 @@
     public EastNorth max;
     // bbox of the georeferenced original image (raster only) (inclined if rotated and before cropping)
-    // P[0] is bottom,left then next are clockwise. 
+    // P[0] is bottom,left then next are clockwise.
     public EastNorth[] orgRaster = new EastNorth[4];
-    // bbox of the georeferenced original image (raster only) after cropping 
+    // bbox of the georeferenced original image (raster only) after cropping
     public EastNorth[] orgCroppedRaster = new EastNorth[4];
     // angle with georeferenced original image after rotation (raster images only)(in radian)
@@ -46,5 +46,5 @@
     public GeorefImage(BufferedImage img, EastNorth min, EastNorth max) {
         image = img;
-        
+
         this.min = min;
         this.max = max;
@@ -70,6 +70,6 @@
 
     /**
-     * Recalculate the new bounding box of the image based on the four points provided as parameters. 
-     * The new bbox defined in [min.max] will retain the extreme values of both boxes. 
+     * Recalculate the new bounding box of the image based on the four points provided as parameters.
+     * The new bbox defined in [min.max] will retain the extreme values of both boxes.
      * @param p1 one of the bounding box corner
      * @param p2 one of the bounding box corner
@@ -128,5 +128,5 @@
                     g.drawLine(croppedPoint[i].x, croppedPoint[i].y, croppedPoint[i+1].x, croppedPoint[i+1].y);
                 }
-                /* 
+                /*
                 //Uncomment this section to display the original image size (before cropping)
                 Point[] orgPoint = new Point[5];
@@ -212,5 +212,5 @@
             imageOriginalHeight = in.readInt();
             imageOriginalWidth =  in.readInt();
-        }        
+        }
         image = (BufferedImage) ImageIO.read(ImageIO.createImageInputStream(in));
         updatePixelPer();
@@ -276,8 +276,8 @@
         }
     }
-    
+
     /**
      * Change this image scale by moving the min,max coordinates around an anchor
-     * @param anchor 
+     * @param anchor
      * @param proportion
      */
@@ -324,5 +324,5 @@
         angle+=delta_ang;
     }
-    
+
     /**
      * Crop the image based on new bbox coordinates adj1 and adj2 (for raster images only).
Index: /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/ImageModifier.java
===================================================================
--- /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/ImageModifier.java	(revision 23189)
+++ /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/ImageModifier.java	(revision 23190)
@@ -19,5 +19,5 @@
 
     protected int parcelColor = Color.RED.getRGB();
-    
+
     public BufferedImage bufferedImage;
 
@@ -31,5 +31,5 @@
             new byte[] { (byte) 0, (byte) 0xFF }
         );
-        
+
         BufferedImage dest = new BufferedImage(
             src.getWidth(), src.getHeight(),
@@ -37,5 +37,5 @@
             icm
             );
-        
+
         ColorConvertOp cco = new ColorConvertOp(
             src.getColorModel().getColorSpace(),
@@ -43,7 +43,7 @@
             null
             );
-        
+
         cco.filter(src, dest);
-        
+
         return dest;
       }
@@ -72,5 +72,5 @@
         return convert4(src, cmap);
       }
-        
+
       /**
        * Converts the source image to 4-bit colour
@@ -96,8 +96,8 @@
             );
         cco.filter(src, dest);
-        
+
         return dest;
       }
-      
+
     protected BufferedImage convert8(BufferedImage src) {
         BufferedImage dest = new BufferedImage(
@@ -115,5 +115,5 @@
 
     public boolean isBuildingColor(int rgb, boolean ignoreParcelColor) {
-        for (int i = 0; i < cBuilingFootColors.length; i++) 
+        for (int i = 0; i < cBuilingFootColors.length; i++)
             if (rgb == cBuilingFootColors[i])
                     return true;
@@ -124,5 +124,5 @@
 
     public boolean isRoofColor(int rgb, boolean ignoreParcelColor) {
-        for (int i = 0; i < cRoofColors.length; i++) 
+        for (int i = 0; i < cRoofColors.length; i++)
             if (rgb == cRoofColors[i])
                     return true;
@@ -152,8 +152,8 @@
         return ret;
     }
-    
+
     /**
      * Checks if the rgb value is the black background color
-     * @param  
+     * @param
      * @return
      */
Index: /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionGrabPlanImage.java
===================================================================
--- /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionGrabPlanImage.java	(revision 23189)
+++ /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionGrabPlanImage.java	(revision 23190)
@@ -180,18 +180,18 @@
      */
     private boolean startCropping() {
-	    mode = cGetCorners;
-	    countMouseClicked = 0;
-		Object[] options = { "OK", "Cancel" };
-		int ret = JOptionPane.showOptionDialog( null,
-				tr("Click first corner for image cropping\n(two points required)"),
-				tr("Image cropping"),
-	    		JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE,
-	    		null, options, options[0]);
-	    if (ret == JOptionPane.OK_OPTION) {
-	        mouseClickedTime = System.currentTimeMillis();
-	    } else
-	    	if (canceledOrRestartCurrAction("image cropping"))
-	    		return startCropping();
-	    return true;
+        mode = cGetCorners;
+        countMouseClicked = 0;
+        Object[] options = { "OK", "Cancel" };
+        int ret = JOptionPane.showOptionDialog( null,
+                tr("Click first corner for image cropping\n(two points required)"),
+                tr("Image cropping"),
+                JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE,
+                null, options, options[0]);
+        if (ret == JOptionPane.OK_OPTION) {
+            mouseClickedTime = System.currentTimeMillis();
+        } else
+            if (canceledOrRestartCurrAction("image cropping"))
+                return startCropping();
+        return true;
     }
 
@@ -201,15 +201,15 @@
      */
     private boolean continueCropping() {
-		Object[] options = { "OK", "Cancel" };
-		int ret = JOptionPane.showOptionDialog( null,
-				tr("Click second corner for image cropping"),
-				tr("Image cropping"),
-	    		JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE,
-	    		null, options, options[0]);
-	    if (ret != JOptionPane.OK_OPTION) {
-	    	if (canceledOrRestartCurrAction("image cropping"))
-	    		return startCropping();
-	    }
-	    return true;
+        Object[] options = { "OK", "Cancel" };
+        int ret = JOptionPane.showOptionDialog( null,
+                tr("Click second corner for image cropping"),
+                tr("Image cropping"),
+                JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE,
+                null, options, options[0]);
+        if (ret != JOptionPane.OK_OPTION) {
+            if (canceledOrRestartCurrAction("image cropping"))
+                return startCropping();
+        }
+        return true;
     }
 
@@ -219,18 +219,18 @@
      */
     private boolean startGeoreferencing() {
-	    countMouseClicked = 0;
-	    mode = cGetLambertCrosspieces;
-		Object[] options = { "OK", "Cancel" };
-		int ret = JOptionPane.showOptionDialog( null,
-				tr("Click first Lambert crosspiece for georeferencing\n(two points required)"),
-				tr("Image georeferencing"),
-	    		JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE,
-	    		null, options, options[0]);
-	    if (ret == JOptionPane.OK_OPTION) {
-	        mouseClickedTime = System.currentTimeMillis();
-	    } else
-	    	if (canceledOrRestartCurrAction("georeferencing"))
-	    		return startGeoreferencing();
-	    return true;
+        countMouseClicked = 0;
+        mode = cGetLambertCrosspieces;
+        Object[] options = { "OK", "Cancel" };
+        int ret = JOptionPane.showOptionDialog( null,
+                tr("Click first Lambert crosspiece for georeferencing\n(two points required)"),
+                tr("Image georeferencing"),
+                JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE,
+                null, options, options[0]);
+        if (ret == JOptionPane.OK_OPTION) {
+            mouseClickedTime = System.currentTimeMillis();
+        } else
+            if (canceledOrRestartCurrAction("georeferencing"))
+                return startGeoreferencing();
+        return true;
     }
 
@@ -240,15 +240,15 @@
      */
     private boolean continueGeoreferencing() {
-		Object[] options = { "OK", "Cancel" };
-		int ret = JOptionPane.showOptionDialog( null,
-				tr("Click second Lambert crosspiece for georeferencing"),
-				tr("Image georeferencing"),
-	    		JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE,
-	    		null, options, options[0]);
-	    if (ret != JOptionPane.OK_OPTION) {
-	    	if (canceledOrRestartCurrAction("georeferencing"))
-	    		return startGeoreferencing();
-	    }
-	    return true;
+        Object[] options = { "OK", "Cancel" };
+        int ret = JOptionPane.showOptionDialog( null,
+                tr("Click second Lambert crosspiece for georeferencing"),
+                tr("Image georeferencing"),
+                JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE,
+                null, options, options[0]);
+        if (ret != JOptionPane.OK_OPTION) {
+            if (canceledOrRestartCurrAction("georeferencing"))
+                return startGeoreferencing();
+        }
+        return true;
     }
     
@@ -271,14 +271,14 @@
      */
     private boolean canceledOrRestartCurrAction(String action) {
-    	Object[] options = { "Cancel", "Retry" };
-    	int selectedValue = JOptionPane.showOptionDialog( null,
-        		tr("Do you want to cancel completely\n"+
-        				"or just retry "+action+" ?"), "",
-        		JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE,
-        		null, options, options[0]);
+        Object[] options = { "Cancel", "Retry" };
+        int selectedValue = JOptionPane.showOptionDialog( null,
+                tr("Do you want to cancel completely\n"+
+                        "or just retry "+action+" ?"), "",
+                JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE,
+                null, options, options[0]);
         countMouseClicked = 0;
         if (selectedValue == 0) { // "Cancel"
-        	// remove layer
-        	Main.map.mapView.removeLayer(wmsLayer);
+            // remove layer
+            Main.map.mapView.removeLayer(wmsLayer);
             wmsLayer = null;
             Main.map.mapView.removeMouseListener(this);
Index: /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionLoadFromCache.java
===================================================================
--- /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionLoadFromCache.java	(revision 23189)
+++ /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionLoadFromCache.java	(revision 23190)
@@ -77,5 +77,5 @@
                     if (wmsLayer.getCacheControl().loadCache(file, layoutZone)) {
                         CadastrePlugin.addWMSLayer(wmsLayer);
-                    }                    
+                    }
                 }
             }
Index: /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionNewLocation.java
===================================================================
--- /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionNewLocation.java	(revision 23189)
+++ /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionNewLocation.java	(revision 23190)
@@ -25,27 +25,27 @@
 
     private static final long serialVersionUID = 1L;
-    
+
     private static final String departements[] = {
         "", tr("(optional)"),
         "001", "01 - Ain",                 "002", "02 - Aisne",              "003", "03 - Allier",                "004", "04 - Alpes de Haute-Provence", "005", "05 - Hautes-Alpes",
         "006", "06 - Alpes-Maritimes",     "007", "07 - Ard\u00eache",       "008", "08 - Ardennes",              "009", "09 - Ari\u00e8ge",             "010", "10 - Aube",
-        "011", "11 - Aude",                "012", "12 - Aveyron",            "013", "13 - Bouches-du-Rh\u00f4ne", "014", "14 - Calvados",                "015", "15 - Cantal", 
-        "016", "16 - Charente",            "017", "17 - Charente-Maritime",  "018", "18 - Cher",                  "019", "19 - Corr\u00e8ze", 
-        "02A", "2A - Corse-du-Sud",        "02B", "2B - Haute-Corse", 
-        "021", "21 - C\u00f4te-d'Or",      "022", "22 - C\u00f4tes d'Armor", "023", "23 - Creuse",                "024", "24 - Dordogne",                "025", "25 - Doubs", 
+        "011", "11 - Aude",                "012", "12 - Aveyron",            "013", "13 - Bouches-du-Rh\u00f4ne", "014", "14 - Calvados",                "015", "15 - Cantal",
+        "016", "16 - Charente",            "017", "17 - Charente-Maritime",  "018", "18 - Cher",                  "019", "19 - Corr\u00e8ze",
+        "02A", "2A - Corse-du-Sud",        "02B", "2B - Haute-Corse",
+        "021", "21 - C\u00f4te-d'Or",      "022", "22 - C\u00f4tes d'Armor", "023", "23 - Creuse",                "024", "24 - Dordogne",                "025", "25 - Doubs",
         "026", "26 - Dr\u00f4me",          "027", "27 - Eure",               "028", "28 - Eure-et-Loir",          "029", "29 - Finist\u00e8re",          "030", "30 - Gard",
-        "031", "31 - Haute-Garonne",       "032", "32 - Gers",               "033", "33 - Gironde",               "034", "34 - H\u00e9rault",            "035", "35 - Ille-et-Vilaine", 
+        "031", "31 - Haute-Garonne",       "032", "32 - Gers",               "033", "33 - Gironde",               "034", "34 - H\u00e9rault",            "035", "35 - Ille-et-Vilaine",
         "036", "36 - Indre",               "037", "37 - Indre-et-Loire",     "038", "38 - Is\u00e8re",            "039", "39 - Jura",                    "040", "40 - Landes",
-        "041", "41 - Loir-et-Cher",        "042", "42 - Loire",              "043", "43 - Haute-Loire",           "044", "44 - Loire-Atlantique",        "045", "45 - Loiret", 
+        "041", "41 - Loir-et-Cher",        "042", "42 - Loire",              "043", "43 - Haute-Loire",           "044", "44 - Loire-Atlantique",        "045", "45 - Loiret",
         "046", "46 - Lot",                 "047", "47 - Lot-et-Garonne",     "048", "48 - Loz\u00e8re",           "049", "49 - Maine-et-Loire",          "050", "50 - Manche",
-        "051", "51 - Marne",               "052", "52 - Haute-Marne",        "053", "53 - Mayenne",               "054", "54 - Meurthe-et-Moselle",      "055", "55 - Meuse", 
+        "051", "51 - Marne",               "052", "52 - Haute-Marne",        "053", "53 - Mayenne",               "054", "54 - Meurthe-et-Moselle",      "055", "55 - Meuse",
         "056", "56 - Morbihan",            "057", "57 - Moselle",            "058", "58 - Ni\u00e8vre",           "059", "59 - Nord",                    "060", "60 - Oise",
-        "061", "61 - Orne",                "062", "62 - Pas-de-Calais",      "063", "63 - Puy-de-D\u00f4me",      "064", "64 - Pyr\u00e9n\u00e9es-Atlantiques", "065", "65 - Hautes-Pyr\u00e9n\u00e9es", 
+        "061", "61 - Orne",                "062", "62 - Pas-de-Calais",      "063", "63 - Puy-de-D\u00f4me",      "064", "64 - Pyr\u00e9n\u00e9es-Atlantiques", "065", "65 - Hautes-Pyr\u00e9n\u00e9es",
         "066", "66 - Pyr\u00e9n\u00e9es-Orientales", "067", "67 - Bas-Rhin", "068", "68 - Haut-Rhin",             "069", "69 - Rh\u00f4ne",              "070", "70 - Haute-Sa\u00f4ne",
-        "071", "71 - Sa\u00f4ne-et-Loire", "072", "72 - Sarthe",             "073", "73 - Savoie",                "074", "74 - Haute-Savoie",            "075", "75 - Paris", 
+        "071", "71 - Sa\u00f4ne-et-Loire", "072", "72 - Sarthe",             "073", "73 - Savoie",                "074", "74 - Haute-Savoie",            "075", "75 - Paris",
         "076", "76 - Seine-Maritime",      "077", "77 - Seine-et-Marne",     "078", "78 - Yvelines",              "079", "79 - Deux-S\u00e8vres",        "080", "80 - Somme",
-        "081", "81 - Tarn",                "082", "82 - Tarn-et-Garonne",    "083", "83 - Var",                   "084", "84 - Vaucluse",                "085", "85 - Vend\u00e9e", 
+        "081", "81 - Tarn",                "082", "82 - Tarn-et-Garonne",    "083", "83 - Var",                   "084", "84 - Vaucluse",                "085", "85 - Vend\u00e9e",
         "086", "86 - Vienne",              "087", "87 - Haute-Vienne",       "088", "88 - Vosges",                "089", "89 - Yonne",                   "090", "90 - Territoire de Belfort",
-        "091", "91 - Essonne",             "092", "92 - Hauts-de-Seine",     "093", "93 - Seine-Saint-Denis",     "094", "94 - Val-de-Marne",            "095", "95 - Val-d'Oise", 
+        "091", "91 - Essonne",             "092", "92 - Hauts-de-Seine",     "093", "93 - Seine-Saint-Denis",     "094", "94 - Val-de-Marne",            "095", "95 - Val-d'Oise",
         "971", "971 - Guadeloupe",         "972", "972 - Martinique",        "973", "973 - Guyane",               "974", "974 - R\u00e9union"
     };
@@ -81,5 +81,5 @@
             for (int i=0; i < departements.length; i=i+2)
                 if (departements[i].equals(Main.pref.get("cadastrewms.codeDepartement")))
-                    inputDepartement.setSelectedIndex(i/2);        
+                    inputDepartement.setSelectedIndex(i/2);
         }
         p.add(labelSectionNewLocation, GBC.eol());
Index: /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/WMSLayer.java
===================================================================
--- /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/WMSLayer.java	(revision 23189)
+++ /applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/WMSLayer.java	(revision 23190)
@@ -104,5 +104,5 @@
 
     @Override
-	public void destroy() {
+    public void destroy() {
         // if the layer is currently saving the images in the cache, wait until it's finished
         if (cacheControl != null) {
@@ -305,5 +305,5 @@
         saveAsPng.setEnabled(isRaster);
         return new Action[] {
-        		LayerListDialog.getInstance().createShowHideLayerAction(),
+                LayerListDialog.getInstance().createShowHideLayerAction(),
                 LayerListDialog.getInstance().createDeleteLayerAction(),
                 new MenuActionLoadFromCache(),
Index: /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/CzechAddressPlugin.java
===================================================================
--- /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/CzechAddressPlugin.java	(revision 23189)
+++ /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/CzechAddressPlugin.java	(revision 23190)
@@ -86,5 +86,5 @@
 
     public CzechAddressPlugin(PluginInformation info) {
-    	super(info);
+        super(info);
 
         /*boolean x;
Index: /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/DatabaseLoadException.java
===================================================================
--- /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/DatabaseLoadException.java	(revision 23189)
+++ /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/DatabaseLoadException.java	(revision 23190)
@@ -6,5 +6,5 @@
 /**
  * Exception occuring during parsing the database.
- * 
+ *
  * <p>This exception is used during <i>download</i>, <i>extraction</i> or
  * <i>parsing</i> of the database. It can set a message to be displayed
Index: /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/NotNullList.java
===================================================================
--- /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/NotNullList.java	(revision 23189)
+++ /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/NotNullList.java	(revision 23190)
@@ -6,5 +6,5 @@
 /**
  * ArrayList, which refuses to add {@code null}.
- * 
+ *
  * @author Radomír Černoch, radomir.cernoch@gmail.com
  */
@@ -39,5 +39,5 @@
         if (c == null)
             return false;
-        
+
         if (c instanceof NotNullList)
             return super.addAll(c);
@@ -46,4 +46,4 @@
         return true;
     }
-    
+
 }
Index: /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/PrimUtils.java
===================================================================
--- /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/PrimUtils.java	(revision 23189)
+++ /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/PrimUtils.java	(revision 23190)
@@ -6,5 +6,5 @@
 /**
  * Utilities for handling {@link OsmPrimitive}s.
- * 
+ *
  * @author Radomír Černoch, radomir.cernoch@gmail.com
  */
Index: /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/StatusListener.java
===================================================================
--- /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/StatusListener.java	(revision 23189)
+++ /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/StatusListener.java	(revision 23190)
@@ -21,5 +21,5 @@
  *
  * @see CzechAddressPlugin
- * 
+ *
  * @author Radomír Černoch, radomir.cernoch@gmail.com
  */
Index: /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/StringUtils.java
===================================================================
--- /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/StringUtils.java	(revision 23189)
+++ /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/StringUtils.java	(revision 23190)
@@ -107,5 +107,5 @@
                 return false;
         }
-        
+
         return true;
     }
Index: /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/actions/ManagerAction.java
===================================================================
--- /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/actions/ManagerAction.java	(revision 23189)
+++ /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/actions/ManagerAction.java	(revision 23190)
@@ -11,5 +11,5 @@
  *
  * @author Radomír Černoch, radomir.cernoch@gmail.com
- * 
+ *
  * @see ManagerDialog
  */
Index: /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/actions/SplitAreaByEmptyWayAction.java
===================================================================
--- /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/actions/SplitAreaByEmptyWayAction.java	(revision 23189)
+++ /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/actions/SplitAreaByEmptyWayAction.java	(revision 23190)
@@ -63,5 +63,5 @@
                 if (!(prim2 instanceof Way)) continue;
                 if (prim2.equals(prim))      continue;
-               	Way border = (Way) prim2;
+                Way border = (Way) prim2;
                 if (border.getNodes().size() == 0)   continue;
                 if (border.keySet().size() > 0) continue;
Index: /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/addressdatabase/AddressElement.java
===================================================================
--- /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/addressdatabase/AddressElement.java	(revision 23189)
+++ /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/addressdatabase/AddressElement.java	(revision 23190)
@@ -14,5 +14,5 @@
  *
  * <p>Every element must have a <i>name</i> and may have a <i>parent</i>.</p>
- * 
+ *
  * @author Radomír Černoch radomir.cernoch@gmail.com
  */
@@ -99,5 +99,5 @@
             Node node = (Node) prim;
             result += " " + StringUtils.latLonToString(node.getCoor());
-            
+
         } else if (prim instanceof Way) {
             Way way = (Way) prim;
@@ -135,5 +135,5 @@
     /**
      * Compares 2 elements.
-     * 
+     *
      * <p>Basic criterion to comparing elements is their <i>name</i> and the
      * </i>parent</i>. Notice that this behaviour might be changed
@@ -217,7 +217,7 @@
     }
 
-    
+
     protected int[] getFieldMatchList(OsmPrimitive primitive) {
-        int[] result = {0};        
+        int[] result = {0};
         return result;
     }
@@ -242,9 +242,9 @@
      */
     public int getQ(OsmPrimitive primitive) {
-        
+
         // Firstly get integers representing a match of every matchable field.
         int[] fieldMatches = getFieldMatchList(primitive);
         assert fieldMatches.length > 0;
-        
+
         // Now find the max and min of this array.
         int minVal = fieldMatches[0];
@@ -260,10 +260,10 @@
         assert Math.abs(minVal) <= 1;
         assert Math.abs(maxVal) <= 1;
-        
+
         // If the best among all fields is 'neutral' match, the given primitive
         // has nothing to do with our field.
         if (maxVal <= 0)
             return Reasoner.MATCH_NOMATCH;
-        
+
         // If all fields are 1    --> ROCKSOLID MATCH
         // If some are 1, none -1 --> PARTIAL MATCH
@@ -274,5 +274,5 @@
             case +1 : return Reasoner.MATCH_ROCKSOLID;
         }
-        
+
         return 0; // <-- just to make compilers happy. We cannot get here.
     }
Index: /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/addressdatabase/Database.java
===================================================================
--- /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/addressdatabase/Database.java	(revision 23189)
+++ /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/addressdatabase/Database.java	(revision 23190)
@@ -9,5 +9,5 @@
  * <p>Contains the tree of all regions, municipalities, suburbs, streets
  * and houses in the Czech republic.</p>
- * 
+ *
  * @see AddressElement
  * @see DatabaseParser
Index: /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/addressdatabase/ElementWithHouses.java
===================================================================
--- /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/addressdatabase/ElementWithHouses.java	(revision 23189)
+++ /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/addressdatabase/ElementWithHouses.java	(revision 23190)
@@ -47,5 +47,5 @@
     /**
      * Returns all houses directly contained in this element.
-     * 
+     *
      * NOTICE: If a subclass element contains other data structured capable
      * of storing houses, they are not included in the returned set.
Index: /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/addressdatabase/ElementWithStreets.java
===================================================================
--- /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/addressdatabase/ElementWithStreets.java	(revision 23189)
+++ /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/addressdatabase/ElementWithStreets.java	(revision 23190)
@@ -24,5 +24,5 @@
     public void addStreet(Street streetToAdd) {
         //if (streetToAdd.getParent() instanceof ElementWithStreets)
-        
+
         streetToAdd.setParent(this);
         streets.add(streetToAdd);
@@ -79,10 +79,10 @@
         // We make an conservative estimate...
         List<House> result = new ArrayList<House>(20 * streets.size());
-        
+
         result.addAll(this.houses);
-        
+
         for (Street street : streets)
             result.addAll(street.getHouses());
-        
+
         return result;
     }
Index: /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/addressdatabase/House.java
===================================================================
--- /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/addressdatabase/House.java	(revision 23189)
+++ /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/addressdatabase/House.java	(revision 23190)
@@ -20,5 +20,5 @@
  * {@link ElementWithHouses}. The {@code setParent()} method should
  * be called immediatelly after the constructor.</p>
- * 
+ *
  * @author Radomír Černoch, radomir.cernoch@gmail.com
  */
@@ -44,9 +44,9 @@
 
         assert (co != null) || (cp != null);
-        
+
         //... but the the name is overwritten.
         this.name = generateName(this.cp, this.co);
     }
-    
+
     /**
      * Returns the number unique in a suburb (číslo popisné)
@@ -128,5 +128,5 @@
         super.setParent(parent);
     }
-    
+
     /**
      * Returns the parent of this house with type-checking.
@@ -159,5 +159,5 @@
         result[0] = matchField(this.cp, prim.get(PrimUtils.KEY_ADDR_CP));
         result[2] = matchField(name,    prim.get(PrimUtils.KEY_ADDR_HOUSE_N));
-        
+
         // Second field is the Housenumber
         if (parent instanceof Street)
@@ -178,5 +178,5 @@
     }
 
-    
+
 
     /**
@@ -188,5 +188,5 @@
     @Override
     public List<Proposal> getDiff(OsmPrimitive prim) {
-        
+
         List<Proposal> props = new NotNullList<Proposal>();
         ParentResolver resolver = new ParentResolver(this);
Index: /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/addressdatabase/Region.java
===================================================================
--- /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/addressdatabase/Region.java	(revision 23189)
+++ /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/addressdatabase/Region.java	(revision 23190)
@@ -10,8 +10,8 @@
  */
 public class Region extends ElementWithStreets {
-    
+
     private ArrayList<ViToCi> vitocis
             = new ArrayList<ViToCi>();
-    
+
     /**
      * Adds a single municipality into this element.
@@ -21,5 +21,5 @@
         vitocis.add(municipality);
     }
-    
+
     /**
      * Replaces the list of municipalities of this element.
@@ -30,5 +30,5 @@
             obec.setParent(this);
     }
-    
+
     /**
      * Returns the list of all municipalities in this region.
@@ -53,5 +53,5 @@
     String nuts3name = null;
     String nuts4name = null;
-    
+
     /**
      * Default constructor setting the name of this region.
@@ -61,5 +61,5 @@
         super(name);
     }
-    
+
     /**
      * Constructor which sets the region's name together with higher
@@ -71,13 +71,13 @@
         if (nuts4name != null) this.nuts4name = nuts4name;
     }
-    
+
     public String getNuts3Name() {
         return nuts3name;
     }
-    
+
     public String getNuts4Name() {
         return nuts4name;
     }
-    
+
     /**
      * Returns the name of this region. If the NUTS3 name was entered,
@@ -86,10 +86,10 @@
     @Override
     public String toString() {
-        
+
         String thisString = name;
-        
+
         if (nuts3name != null)
             thisString += " (kraj " + nuts3name + ")";
-        
+
         return thisString;
     }
Index: /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/addressdatabase/Street.java
===================================================================
--- /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/addressdatabase/Street.java	(revision 23189)
+++ /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/addressdatabase/Street.java	(revision 23190)
@@ -25,5 +25,5 @@
         super.setParent(parent);
     }
-    
+
     @Override
     public ElementWithStreets getParent() {
@@ -36,5 +36,5 @@
         int[] result = {0};
         if (!isMatchable(primitive)) return result;
-        
+
         result[0] = matchFieldAbbrev(name, primitive.get("name"));
         return result;
@@ -44,5 +44,5 @@
     public List<Proposal> getDiff(OsmPrimitive prim) {
         List<Proposal> props = new NotNullList<Proposal>();
-        
+
         props.add(getStringFieldDiff(PrimUtils.KEY_NAME, prim.get(PrimUtils.KEY_NAME), getName()));
         return props;
Index: /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/addressdatabase/Suburb.java
===================================================================
--- /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/addressdatabase/Suburb.java	(revision 23189)
+++ /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/addressdatabase/Suburb.java	(revision 23190)
@@ -6,5 +6,5 @@
 /**
  * Suburb is a part of a {@link Municipality}.
- * 
+ *
  * @author Radomír Černoch radomir.cernoch@gmail.com
  */
Index: /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/addressdatabase/ViToCi.java
===================================================================
--- /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/addressdatabase/ViToCi.java	(revision 23189)
+++ /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/addressdatabase/ViToCi.java	(revision 23190)
@@ -6,5 +6,5 @@
 /**
  * ViToCi is either a village, town or a city.
- * 
+ *
  * @author Radomír Černoch radomir.cernoch@gmail.com
  */
Index: /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/ConflictResolver.java
===================================================================
--- /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/ConflictResolver.java	(revision 23189)
+++ /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/ConflictResolver.java	(revision 23190)
@@ -234,5 +234,5 @@
                 if (r.translate(prim) != null)
                     r.unOverwrite(prim, r.translate(prim));
-                
+
                 ComboBoxModel model = candField.getModel();
                 for (int i = 0; i < model.getSize(); i++) {
@@ -242,5 +242,5 @@
                         r.unOverwrite(r.translate(elem), elem);
                 }
-                
+
                 r.doOverwrite(prim, (AddressElement) model.getSelectedItem());
             }
@@ -358,5 +358,5 @@
                                         +AddressElement.getName(prim) + "“");
                 primitives.add(-index-1, prim);
-                
+
                 ListDataEvent evt = new ListDataEvent(this,
                         ListDataEvent.INTERVAL_ADDED,
@@ -364,5 +364,5 @@
                 for (ListDataListener listener : listeners)
                     listener.intervalAdded(evt);
-                
+
                 if (mainField.getSelectedItem() == null)
                     mainField.setSelectedIndex(-index-1);
@@ -378,5 +378,5 @@
                                         + elem.getName() + "“");
                 elements.remove(index);
-                
+
                 if (selected == elem)
                     setSelectedItem(null);
@@ -401,5 +401,5 @@
                 if (selected == prim)
                     setSelectedItem(null);
-                
+
                 ListDataEvent evt = new ListDataEvent(this,
                         ListDataEvent.INTERVAL_REMOVED,
@@ -419,9 +419,9 @@
             elements.clear();
             primitives.clear();
-            
+
             for (ListDataListener listener : listeners)
                 listener.contentsChanged(evt);
         }
-        
+
         public void setSelectedItem(Object anItem) {
 
@@ -447,10 +447,10 @@
             if (index< elements.size())
                 return elements.get(index);
-            
+
             index -= elements.size();
 
             if (index< primitives.size())
                 return primitives.get(index);
-            
+
             return null;
         }
@@ -466,5 +466,5 @@
 
     private void updateCandidatesModel(Object selected) {
-        
+
         if (selected instanceof AddressElement) {
             AddressElement selElem = (AddressElement) selected;
Index: /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/FactoryDialog.java
===================================================================
--- /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/FactoryDialog.java	(revision 23189)
+++ /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/FactoryDialog.java	(revision 23190)
@@ -52,5 +52,5 @@
     private HouseListModel  houseModel  = new HouseListModel();
     private StreetListModel streetModel = new StreetListModel();
-    
+
     private FactoryDialog() {
 
@@ -89,5 +89,5 @@
             return;
         }
-        
+
         if (message == MESSAGE_LOCATION_CHANGED) {
             DataSet.selListeners.add(this);
@@ -99,5 +99,5 @@
             keepOddityCheckBox.setEnabled(true);
             return;
-        }        
+        }
     }
 
@@ -174,5 +174,5 @@
             do {
                 selectNextUnmatchedHouse();
-                    
+
                 String newStr = StringUtils.extractNumber(getSelectedHouse().getCO());
 
@@ -360,10 +360,10 @@
                 setFont(getFont().deriveFont(Font.PLAIN));
                 setText(((Street) value).getName());
-                
+
             } else if (value instanceof ElementWithHouses) {
                 setFont(getFont().deriveFont(Font.BOLD));
                 setText("[" + ((ElementWithHouses) value).getName() + "]");
             }
-            
+
             return c;
         }
@@ -435,5 +435,5 @@
             House house = (House) elem;
             int index = Collections.binarySearch(houses, house);
-            
+
             if (Reasoner.getInstance().translate(house) != null) {
                 if (index >= 0) houses.remove(index);
@@ -441,5 +441,5 @@
                 if (index < 0)  houses.add(-index-1, house);
             }
-            
+
             houseModel.notifyAllListeners();
         }
@@ -472,5 +472,5 @@
             this.selected = parent;
             this.parent   = parent;
-            
+
             metaElem.set(0, parent);
             metaElem.get(1).setHouses(parent.getAllHouses());
Index: /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/GroupManipulatorDialog.java
===================================================================
--- /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/GroupManipulatorDialog.java	(revision 23189)
+++ /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/GroupManipulatorDialog.java	(revision 23190)
@@ -124,5 +124,5 @@
 
         proposalTree.addKeyListener(new java.awt.event.KeyAdapter() {
-        	@Override
+            @Override
             public void keyReleased(java.awt.event.KeyEvent evt) {
                 proposalTreeKeyReleased(evt);
Index: /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/LocationSelector.java
===================================================================
--- /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/LocationSelector.java	(revision 23189)
+++ /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/LocationSelector.java	(revision 23190)
@@ -79,5 +79,5 @@
      *
      */
-	private void initLocationHints() {
+    private void initLocationHints() {
         boolean assertions = false;
         assert  assertions = true;
@@ -177,5 +177,5 @@
         int curHlIndex = 0;
 
-        for (int i = 0; i < list.getSize(); i++) 
+        for (int i = 0; i < list.getSize(); i++)
             for (int j = 0; j < hlList.size(); j++) {
                 Object t = list.getElementAt(i);
Index: /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/PointManipulatorDialog.java
===================================================================
--- /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/PointManipulatorDialog.java	(revision 23189)
+++ /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/PointManipulatorDialog.java	(revision 23190)
@@ -207,5 +207,5 @@
 
         alternateNumberEdit.addKeyListener(new java.awt.event.KeyAdapter() {
-        	@Override
+            @Override
             public void keyReleased(java.awt.event.KeyEvent evt) {
                 PointManipulatorDialog.this.keyReleased(evt);
@@ -228,5 +228,5 @@
         proposalList.addKeyListener(new java.awt.event.KeyAdapter() {
             @Override
-			public void keyReleased(java.awt.event.KeyEvent evt) {
+            public void keyReleased(java.awt.event.KeyEvent evt) {
                 proposalListKeyReleased(evt);
             }
Index: /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/databaseeditors/SuburbEditor.java
===================================================================
--- /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/databaseeditors/SuburbEditor.java	(revision 23189)
+++ /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/databaseeditors/SuburbEditor.java	(revision 23190)
@@ -28,5 +28,5 @@
         this.parent = suburb.getParent();
         nameField.setText(suburb.getName());
-        
+
         if (parent != null)
             parentField.setText(parent.getName());
Index: /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/utils/UniversalListRenderer.java
===================================================================
--- /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/utils/UniversalListRenderer.java	(revision 23189)
+++ /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/utils/UniversalListRenderer.java	(revision 23190)
@@ -15,5 +15,5 @@
     public Component getListCellRendererComponent(JList list, Object value,
                           int index, boolean isSelected, boolean cellHasFocus) {
-        
+
         Component c = super.getListCellRendererComponent(list, value, index,
                                                       isSelected, cellHasFocus);
Index: /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/utils/UniversalRenderer.java
===================================================================
--- /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/utils/UniversalRenderer.java	(revision 23189)
+++ /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/utils/UniversalRenderer.java	(revision 23190)
@@ -34,5 +34,5 @@
 
     public static ImageIcon getIcon(Object value) {
-        
+
              if (value instanceof AddKeyValueProposal)    return iconAdd;
         else if (value instanceof KeyValueChangeProposal) return iconEdit;
@@ -69,5 +69,5 @@
         if (value instanceof AddressElement)
             return ((AddressElement) value).getName();
-                
+
         if (value instanceof OsmPrimitive)
             return AddressElement.getName(value);
@@ -75,5 +75,5 @@
         if (value == null)
             return "";
-        
+
         return value.toString();
     }
Index: /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/intelligence/Reasoner.java
===================================================================
--- /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/intelligence/Reasoner.java	(revision 23189)
+++ /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/intelligence/Reasoner.java	(revision 23190)
@@ -99,5 +99,5 @@
      * modify the data in the reasoner.
      * The only exception is {@code reset()}.</p>
-     * 
+     *
      * <p>When there's an open transaction, the result of most output methods
      * undefined. Exceptions to this rules are indicated.</p>
@@ -387,5 +387,5 @@
         if (getStrictlyBest(elem) == prim)
             return elem;
-        
+
         return null;
     }
@@ -417,5 +417,5 @@
         if (getStrictlyBest(prim) == elem)
             return prim;
-        
+
         return null;
     }
@@ -515,5 +515,5 @@
                 best = cand;
         }
-        
+
         for (OsmPrimitive prim : elemMatchIndex.get(elem).keySet()) {
             int cand = elemMatchIndex.get(elem).get(prim);
@@ -542,5 +542,5 @@
      */
     public AddressElement getStrictlyBest(OsmPrimitive prim) {
-        
+
         AddressElement result = null;
         try {
@@ -563,5 +563,5 @@
                 }
             }
-            
+
         } catch (NullPointerException except) {
             System.err.println("Strange exception occured." +
@@ -601,5 +601,5 @@
                 return null;
             }
-            
+
             int bestQ = MATCH_NOMATCH;
             for (OsmPrimitive prim : matches.keySet()) {
@@ -683,5 +683,5 @@
             ProposalContainer container = new ProposalContainer(prim);
             container.addProposals(elem.getDiff(prim));
-            
+
             if (container.getProposals().size() > 0)
                 database.addContainer(container);
Index: /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/parser/DatabaseParser.java
===================================================================
--- /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/parser/DatabaseParser.java	(revision 23189)
+++ /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/parser/DatabaseParser.java	(revision 23190)
@@ -14,5 +14,5 @@
 /**
  * General superclass for any parser capable of filling the database.
- * 
+ *
  * @see Database
  *
@@ -43,5 +43,5 @@
     /**
      * The ultimate method, which starts filling the database.
-     * 
+     *
      * @throws DatabaseLoadException if anything goes wrong...
      */
@@ -60,5 +60,5 @@
     /**
      * The internal method, which does the actual parsing.
-     * 
+     *
      * @throws DatabaseLoadException should be thrown if anything gets wrong...
      */
@@ -87,5 +87,5 @@
      *
      * The URL is provided by {@code getDatabaseUrl()} method.
-     * 
+     *
      * @throws DatabaseLoadException if any error occurs during the download.
      */
Index: /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/parser/MvcrParser.java
===================================================================
--- /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/parser/MvcrParser.java	(revision 23189)
+++ /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/parser/MvcrParser.java	(revision 23190)
@@ -57,5 +57,5 @@
             return;
         }
-        
+
         // ========== PARSING STREET ========== //
         if (name.equals("ulice")) {
@@ -245,9 +245,9 @@
         ZipEntry zipEntry = null;
         try {
-	    zis = new ZipInputStream(new FileInputStream(getDatabasePath()));
-
-	    while ((zipEntry = zis.getNextEntry()) != null)
-	    	if (zipEntry.getName().equals("adresy.xml"))
-	    		break;
+        zis = new ZipInputStream(new FileInputStream(getDatabasePath()));
+
+        while ((zipEntry = zis.getNextEntry()) != null)
+            if (zipEntry.getName().equals("adresy.xml"))
+                break;
 
         } catch (IOException ioexp) {
@@ -256,5 +256,5 @@
 
         if (zipEntry == null)
-	    throw new DatabaseLoadException(
+        throw new DatabaseLoadException(
                     "ZIP archiv s databází neobsahuje soubor 'adresy.xml'.");
 
Index: /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/proposal/ProposalDatabase.java
===================================================================
--- /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/proposal/ProposalDatabase.java	(revision 23189)
+++ /applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/proposal/ProposalDatabase.java	(revision 23190)
@@ -85,5 +85,5 @@
     public void addProposals(OsmPrimitive primitive,
                              Collection<Proposal> proposal) {
-        
+
         ProposalContainer container = findContainer(primitive);
         if (container == null) {
@@ -114,5 +114,5 @@
     /**
      * Gives a reference to the internal list of {@link ProposalContainer}s.
-     * 
+     *
      * @return the refernence to internal changeset.
      */
Index: /applications/editors/josm/plugins/duplicateway/src/org/openstreetmap/josm/plugins/duplicateway/JVector.java
===================================================================
--- /applications/editors/josm/plugins/duplicateway/src/org/openstreetmap/josm/plugins/duplicateway/JVector.java	(revision 23189)
+++ /applications/editors/josm/plugins/duplicateway/src/org/openstreetmap/josm/plugins/duplicateway/JVector.java	(revision 23190)
@@ -15,5 +15,5 @@
  * A class encapsulating a line Segment treating it as a Vector (
  * direction and length). Includes Utility routines to perform various
- * transformations and Trigonometric operations 
+ * transformations and Trigonometric operations
  *
  * @author Brent Easton
@@ -21,13 +21,13 @@
  */
 public class JVector extends Line2D.Double {
-  
+
   public static final double EARTH_CIRCUMFERENCE = 40041455;
   protected static final double PI_ON_2 = Math.PI / 2.0;
   protected Point2D.Double slopeIntercept = null;
   protected Point2D.Double rtheta = null;
-  
+
   /**
    * Create new JVector joining two points
-   * 
+   *
    * @param x1
    * @param y1
@@ -38,8 +38,8 @@
     super(x1, y1, x2, y2);
   }
-  
+
   /**
    * Create new JVector from another JVector
-   * 
+   *
    * @param v JVector to copy
    */
@@ -51,8 +51,8 @@
     y2 = v.y2;
   }
-  
+
   /**
    * Create a new JVector based on a JOSM Segment object
-   * 
+   *
    * @param s
    */
@@ -60,5 +60,5 @@
     super(s.from.eastNorth.east(), s.from.eastNorth.north(), s.to.eastNorth.east(), s.to.eastNorth.north());
   }
-  
+
   /**
    * Calculate slope/intersect from cartesian co-ords
@@ -70,5 +70,5 @@
     slopeIntercept = new Point2D.Double(slope, intersect);
   }
-  
+
   /**
    * Return the slope of the JVector
@@ -81,5 +81,5 @@
     return slopeIntercept.x;
   }
-  
+
   /**
    * Return the Y intercept of the JVector
@@ -92,5 +92,5 @@
     return slopeIntercept.y;
   }
-  
+
   /**
    * Calculate the polar coordinates for this line as a ray with
@@ -104,5 +104,5 @@
     rtheta = new Point2D.Double(r, theta);
   }
-  
+
   /**
    * Return the length of the line segment
@@ -115,5 +115,5 @@
     return rtheta.x;
   }
-  
+
   /**
    * Return the angle of the line segment
@@ -126,5 +126,5 @@
     return rtheta.y;
   }
-  
+
   /**
    * Convert Polar co-ords to cartesian
@@ -137,8 +137,8 @@
     slopeIntercept = null;
   }
-  
+
   /**
    * Set the line segment using Polar co-ordinates
-   * 
+   *
    * @param r line length
    * @param theta angle
@@ -148,5 +148,5 @@
     polarToCartesian();
   }
-  
+
   /**
    * Set the length of the line segment
@@ -157,5 +157,5 @@
     polarToCartesian();
   }
-  
+
   /**
    * Reverse the direction of the segment
@@ -171,5 +171,5 @@
     rtheta = null;
   }
-  
+
   /**
    * Rotate the line segment about the origin
@@ -183,5 +183,5 @@
     polarToCartesian();
   }
-  
+
   /**
    * Rotate 90 degrees clockwise
@@ -191,5 +191,5 @@
     rotate(-PI_ON_2);
   }
-  
+
   /**
    * Rotate 90 degrees counterclockwise
@@ -199,5 +199,5 @@
     rotate(PI_ON_2);
   }
-  
+
   /**
    * Normalize theta to be in the range -PI < theta < PI
@@ -216,7 +216,7 @@
     return theta;
   }
- 
-  /**
-   * Rotate the line segment 90 degrees and set the length.  
+
+  /**
+   * Rotate the line segment 90 degrees and set the length.
    * @param offset length
    */
@@ -226,24 +226,24 @@
   }
 
-  /* 
-   * Return the distance of the given point from this line. Offset is 
+  /*
+   * Return the distance of the given point from this line. Offset is
    * -ve if the point is to the left of the line, or +ve if to the right
    */
-  
-  
-  /**
-   * Return the distance of the given point from this line. Offset is 
+
+
+  /**
+   * Return the distance of the given point from this line. Offset is
    * -ve if the point is to the left of the line, or +ve if to the right
-   * @param target 
+   * @param target
    */
   protected double calculateOffset(EastNorth target) {
-    
+
     // Calculate the perpendicular interceptor to this point
     EastNorth intersectPoint = perpIntersect(target);
     JVector intersectRay = new JVector(intersectPoint.east(), intersectPoint.north(), target.east(), target.north());
-    
+
     // Offset is equal to the length of the interceptor
     double offset = intersectRay.getLength();
-    
+
     // Check the angle between this line and the interceptor to calculate left/right
     double theta = normalize(getTheta() - intersectRay.getTheta());
@@ -251,8 +251,8 @@
       offset = -offset;
     }
-    
+
     return offset;
   }
-  
+
 
   /**
@@ -282,8 +282,8 @@
    * @return
    */
-  public static double perpDistance(Segment s, EastNorth en) {  
+  public static double perpDistance(Segment s, EastNorth en) {
    return Line2D.ptSegDist(s.from.eastNorth.east(), s.from.eastNorth.north(), s.to.eastNorth.east(), s.to.eastNorth.north(), en.east(), en.north());
   }
-  
+
   /**
    * Calculate the bisector between this and another Vector. A positive offset means
@@ -297,5 +297,5 @@
     double newTheta = Math.PI + ls.getTheta() - getTheta();
     newSeg.setPolar(Math.abs(offset), newSeg.getTheta() - newTheta/2.0);
-    
+
     double angle = normalize(getTheta() - newSeg.getTheta());
     if ((angle < 0 && offset > 0) || (angle > 0 && offset < 0)) {
@@ -304,5 +304,5 @@
     return newSeg;
   }
-  
+
   /**
    * Return the Perpendicular Intersector from a point to this line
@@ -313,5 +313,5 @@
     return perpIntersect(n.eastNorth);
   }
-  
+
   /**
    * Calculate the point on our line closest to the supplied point
@@ -320,5 +320,5 @@
    */
   public EastNorth perpIntersect(EastNorth en) {
-    
+
     /*
      * Calculate the coefficients for the two lines
@@ -326,7 +326,7 @@
      *  2. The perpendicular line through the new point: y = cx + d
      */
-    double perpSlope = -1 / getSlope();    
+    double perpSlope = -1 / getSlope();
     double perpIntercept = en.north() - (en.east() * perpSlope);
-    
+
     /*
      * Solve the simultaneous equation to calculate the intersection
@@ -334,9 +334,9 @@
      *  ax - cx = d - b
      *  x (a-c) = d - b
-     *  x = (d - b) / (a - c) 
+     *  x = (d - b) / (a - c)
      */
     double intersectE = (perpIntercept - getIntercept()) / (getSlope() - perpSlope);
     double intersectN = intersectE * getSlope() + getIntercept();
-    
+
     return new EastNorth(intersectE, intersectN);
   }
Index: /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/BooleanConfigurer.java
===================================================================
--- /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/BooleanConfigurer.java	(revision 23189)
+++ /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/BooleanConfigurer.java	(revision 23190)
@@ -23,69 +23,69 @@
  */
 public class BooleanConfigurer extends Configurer {
-	private javax.swing.JCheckBox box;
+    private javax.swing.JCheckBox box;
 
-	public BooleanConfigurer() {
-		this(false);
-	}
+    public BooleanConfigurer() {
+        this(false);
+    }
 
-	public BooleanConfigurer(boolean val) {
-		this(null, "", val);
-	}
+    public BooleanConfigurer(boolean val) {
+        this(null, "", val);
+    }
 
-	public BooleanConfigurer(String key, String name, Boolean val) {
-		super(key, name, val);
-	}
+    public BooleanConfigurer(String key, String name, Boolean val) {
+        super(key, name, val);
+    }
 
-	public BooleanConfigurer(String key, String name, boolean val) {
-		super(key, name, val ? Boolean.TRUE : Boolean.FALSE);
-	}
+    public BooleanConfigurer(String key, String name, boolean val) {
+        super(key, name, val ? Boolean.TRUE : Boolean.FALSE);
+    }
 
-	public BooleanConfigurer(String key, String name) {
-		this(key, name, Boolean.FALSE);
-	}
+    public BooleanConfigurer(String key, String name) {
+        this(key, name, Boolean.FALSE);
+    }
 
-	@Override
-	public String getValueString() {
-		return booleanValue().toString();
-	}
+    @Override
+    public String getValueString() {
+        return booleanValue().toString();
+    }
 
-	@Override
-	public void setValue(Object o) {
-		super.setValue(o);
-		if (box != null
-				&& !o.equals(box.isSelected())) {
-			box.setSelected(booleanValue().booleanValue());
-		}
-	}
+    @Override
+    public void setValue(Object o) {
+        super.setValue(o);
+        if (box != null
+                && !o.equals(box.isSelected())) {
+            box.setSelected(booleanValue().booleanValue());
+        }
+    }
 
-	@Override
-	public void setValue(String s) {
-		setValue(Boolean.valueOf(s));
-	}
+    @Override
+    public void setValue(String s) {
+        setValue(Boolean.valueOf(s));
+    }
 
-	@Override
-	public void setName(String s) {
-		super.setName(s);
-		if (box != null) {
-			box.setText(s);
-		}
-	}
+    @Override
+    public void setName(String s) {
+        super.setName(s);
+        if (box != null) {
+            box.setText(s);
+        }
+    }
 
-	@Override
-	public java.awt.Component getControls() {
-		if (box == null) {
-			box = new javax.swing.JCheckBox(getName());
-			box.setSelected(booleanValue().booleanValue());
-			box.addItemListener(new java.awt.event.ItemListener() {
-				public void itemStateChanged(java.awt.event.ItemEvent e) {
-					setValue(box.isSelected());
-				}
-			});
-		}
-		return box;
-	}
+    @Override
+    public java.awt.Component getControls() {
+        if (box == null) {
+            box = new javax.swing.JCheckBox(getName());
+            box.setSelected(booleanValue().booleanValue());
+            box.addItemListener(new java.awt.event.ItemListener() {
+                public void itemStateChanged(java.awt.event.ItemEvent e) {
+                    setValue(box.isSelected());
+                }
+            });
+        }
+        return box;
+    }
 
-	public Boolean booleanValue() {
-		return (Boolean) value;
-	}
+    public Boolean booleanValue() {
+        return (Boolean) value;
+    }
 }
Index: /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/Configurer.java
===================================================================
--- /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/Configurer.java	(revision 23189)
+++ /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/Configurer.java	(revision 23190)
@@ -14,5 +14,5 @@
  *
  * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, copies are available 
+ * License along with this library; if not, copies are available
  * at http://www.opensource.org.
  */
@@ -139,5 +139,5 @@
     changeSupport.addPropertyChangeListener(l);
   }
-  
+
   public void removePropertyChangeListener(PropertyChangeListener l) {
     changeSupport.removePropertyChangeListener(l);
Index: /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/DoubleConfigurer.java
===================================================================
--- /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/DoubleConfigurer.java	(revision 23189)
+++ /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/DoubleConfigurer.java	(revision 23190)
@@ -37,5 +37,5 @@
 
     @Override
-	public void setValue(String s) {
+    public void setValue(String s) {
         Double d = null;
         try {
@@ -50,5 +50,5 @@
 
     @Override
-	public void setValue(Object o) {
+    public void setValue(Object o) {
         if (!noUpdate && nameField != null && o != null) {
             nameField.setText(o.toString());
@@ -58,5 +58,5 @@
 
     @Override
-	public String getValueString() {
+    public String getValueString() {
         if (value == null || value.equals("")) {
             return null;
Index: /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/IntConfigurer.java
===================================================================
--- /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/IntConfigurer.java	(revision 23189)
+++ /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/IntConfigurer.java	(revision 23190)
@@ -24,53 +24,53 @@
 public class IntConfigurer extends StringConfigurer {
 
-	public IntConfigurer() {
-		super();
-	}
+    public IntConfigurer() {
+        super();
+    }
 
-	public IntConfigurer(String key, String name) {
-		this(key, name, 0);
-	}
+    public IntConfigurer(String key, String name) {
+        this(key, name, 0);
+    }
 
-	public IntConfigurer(String key, String name, Integer val) {
-		super(key, name);
-		if (val != null) {
-			setValue(val);
-		}
-	}
+    public IntConfigurer(String key, String name, Integer val) {
+        super(key, name);
+        if (val != null) {
+            setValue(val);
+        }
+    }
 
-	@Override
-	public void setValue(String s) {
-		Integer i = null;
-		try {
-			i = Integer.valueOf(s);
-		}
-		catch (NumberFormatException e) {
-			i = null;
-		}
-		if (i != null) {
-			setValue(i);
-		}
-	}
+    @Override
+    public void setValue(String s) {
+        Integer i = null;
+        try {
+            i = Integer.valueOf(s);
+        }
+        catch (NumberFormatException e) {
+            i = null;
+        }
+        if (i != null) {
+            setValue(i);
+        }
+    }
 
-	public int getIntValue(int defaultValue) {
-		if (getValue() instanceof Integer) {
-			return ((Integer)getValue()).intValue();
-		}
-		else {
-			return defaultValue;
-		}
-	}
+    public int getIntValue(int defaultValue) {
+        if (getValue() instanceof Integer) {
+            return ((Integer)getValue()).intValue();
+        }
+        else {
+            return defaultValue;
+        }
+    }
 
-	@Override
-	public void setValue(Object o) {
-		if (!noUpdate && nameField != null && o != null) {
-			nameField.setText(o.toString());
-		}
-		super.setValue(o);
-	}
+    @Override
+    public void setValue(Object o) {
+        if (!noUpdate && nameField != null && o != null) {
+            nameField.setText(o.toString());
+        }
+        super.setValue(o);
+    }
 
-	@Override
-	public String getValueString() {
-		return value == null ? null : value.toString();
-	}
+    @Override
+    public String getValueString() {
+        return value == null ? null : value.toString();
+    }
 }
Index: /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/Lakewalker.java
===================================================================
--- /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/Lakewalker.java	(revision 23189)
+++ /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/Lakewalker.java	(revision 23190)
@@ -84,128 +84,128 @@
     public ArrayList<double[]> trace(double lat, double lon, double tl_lon, double br_lon, double tl_lat, double br_lat, ProgressMonitor progressMonitor) throws LakewalkerException {
 
-    	progressMonitor.beginTask(null);
-
-    	try {
-
-    		LakewalkerWMS wms = new LakewalkerWMS(this.resolution, this.tilesize, this.wmslayer, this.workingdir);
-    		LakewalkerBBox bbox = new LakewalkerBBox(tl_lat,tl_lon,br_lat,br_lon);
-
-    		Boolean detect_loop = false;
-
-    		ArrayList<double[]> nodelist = new ArrayList<double[]>();
-
-    		int[] xy = geo_to_xy(lat,lon,this.resolution);
-
-    		if(!bbox.contains(lat, lon)){
-    			throw new LakewalkerException(tr("The starting location was not within the bbox"));
-    		}
-
-    		int v;
-
-    		progressMonitor.indeterminateSubTask(tr("Looking for shoreline..."));
-
-    		while(true){
-    			double[] geo = xy_to_geo(xy[0],xy[1],this.resolution);
-    			if(bbox.contains(geo[0],geo[1])==false){
-    				break;
-    			}
-
-    			v = wms.getPixel(xy[0], xy[1], progressMonitor.createSubTaskMonitor(0, false));
-    			if(v > this.threshold){
-    				break;
-    			}
-
-    			int delta_lat = this.dirslat[getDirectionIndex(this.startdir)];
-    			int delta_lon = this.dirslon[getDirectionIndex(this.startdir)];
-
-    			xy[0] = xy[0]+delta_lon;
-    			xy[1] = xy[1]+delta_lat;
-
-    		}
-
-    		int[] startxy = new int[] {xy[0], xy[1]};
-    		double[] startgeo = xy_to_geo(xy[0],xy[1],this.resolution);
-
-    		//System.out.printf("Found shore at lat %.4f lon %.4f\n",lat,lon);
-
-    		int last_dir = this.getDirectionIndex(this.startdir);
-
-    		for(int i = 0; i < this.maxnode; i++){
-
-    			// Print a counter
-    			if(i % 250 == 0){
-    				progressMonitor.indeterminateSubTask(tr("{0} nodes so far...",i));
-    				//System.out.println(i+" nodes so far...");
-    			}
-
-    			// Some variables we need
-    			int d;
-    			int test_x=0;
-    			int test_y=0;
-    			int new_dir = 0;
-
-    			// Loop through all the directions we can go
-    			for(d = 1; d <= this.dirslat.length; d++){
-
-    				// Decide which direction we want to look at from this pixel
-    				new_dir = (last_dir + d + 4) % 8;
-
-    				test_x = xy[0] + this.dirslon[new_dir];
-    				test_y = xy[1] + this.dirslat[new_dir];
-
-    				double[] geo = xy_to_geo(test_x,test_y,this.resolution);
-
-    				if(!bbox.contains(geo[0], geo[1])){
-    					System.out.println("Outside bbox");
-    					break;
-    				}
-
-    				v = wms.getPixel(test_x, test_y, progressMonitor.createSubTaskMonitor(0, false));
-    				if(v > this.threshold){
-    					break;
-    				}
-
-    				if(d == this.dirslat.length-1){
-    					System.out.println("Got stuck");
-    					break;
-    				}
-    			}
-
-    			// Remember this direction
-    			last_dir = new_dir;
-
-    			// Set the pixel we found as current
-    			xy[0] = test_x;
-    			xy[1] = test_y;
-
-    			// Break the loop if we managed to get back to our starting point
-    			if(xy[0] == startxy[0] && xy[1] == startxy[1]){
-    				break;
-    			}
-
-    			// Store this node
-    			double[] geo = xy_to_geo(xy[0],xy[1],this.resolution);
-    			nodelist.add(geo);
-    			//System.out.println("Adding node at "+xy[0]+","+xy[1]+" ("+geo[1]+","+geo[0]+")");
-
-    			// Check if we got stuck in a loop
-    			double start_proximity = Math.pow((geo[0] - startgeo[0]),2) + Math.pow((geo[1] - startgeo[1]),2);
-
-    			if(detect_loop){
-    				if(start_proximity < Math.pow(start_radius_small,2)){
-    					System.out.println("Detected loop");
-    					break;
-    				}
-    			}else{
-    				if(start_proximity > Math.pow(start_radius_big,2)){
-    					detect_loop = true;
-    				}
-    			}
-    		}
-
-    		return nodelist;
-    	} finally {
-    		progressMonitor.finishTask();
-    	}
+        progressMonitor.beginTask(null);
+
+        try {
+
+            LakewalkerWMS wms = new LakewalkerWMS(this.resolution, this.tilesize, this.wmslayer, this.workingdir);
+            LakewalkerBBox bbox = new LakewalkerBBox(tl_lat,tl_lon,br_lat,br_lon);
+
+            Boolean detect_loop = false;
+
+            ArrayList<double[]> nodelist = new ArrayList<double[]>();
+
+            int[] xy = geo_to_xy(lat,lon,this.resolution);
+
+            if(!bbox.contains(lat, lon)){
+                throw new LakewalkerException(tr("The starting location was not within the bbox"));
+            }
+
+            int v;
+
+            progressMonitor.indeterminateSubTask(tr("Looking for shoreline..."));
+
+            while(true){
+                double[] geo = xy_to_geo(xy[0],xy[1],this.resolution);
+                if(bbox.contains(geo[0],geo[1])==false){
+                    break;
+                }
+
+                v = wms.getPixel(xy[0], xy[1], progressMonitor.createSubTaskMonitor(0, false));
+                if(v > this.threshold){
+                    break;
+                }
+
+                int delta_lat = this.dirslat[getDirectionIndex(this.startdir)];
+                int delta_lon = this.dirslon[getDirectionIndex(this.startdir)];
+
+                xy[0] = xy[0]+delta_lon;
+                xy[1] = xy[1]+delta_lat;
+
+            }
+
+            int[] startxy = new int[] {xy[0], xy[1]};
+            double[] startgeo = xy_to_geo(xy[0],xy[1],this.resolution);
+
+            //System.out.printf("Found shore at lat %.4f lon %.4f\n",lat,lon);
+
+            int last_dir = this.getDirectionIndex(this.startdir);
+
+            for(int i = 0; i < this.maxnode; i++){
+
+                // Print a counter
+                if(i % 250 == 0){
+                    progressMonitor.indeterminateSubTask(tr("{0} nodes so far...",i));
+                    //System.out.println(i+" nodes so far...");
+                }
+
+                // Some variables we need
+                int d;
+                int test_x=0;
+                int test_y=0;
+                int new_dir = 0;
+
+                // Loop through all the directions we can go
+                for(d = 1; d <= this.dirslat.length; d++){
+
+                    // Decide which direction we want to look at from this pixel
+                    new_dir = (last_dir + d + 4) % 8;
+
+                    test_x = xy[0] + this.dirslon[new_dir];
+                    test_y = xy[1] + this.dirslat[new_dir];
+
+                    double[] geo = xy_to_geo(test_x,test_y,this.resolution);
+
+                    if(!bbox.contains(geo[0], geo[1])){
+                        System.out.println("Outside bbox");
+                        break;
+                    }
+
+                    v = wms.getPixel(test_x, test_y, progressMonitor.createSubTaskMonitor(0, false));
+                    if(v > this.threshold){
+                        break;
+                    }
+
+                    if(d == this.dirslat.length-1){
+                        System.out.println("Got stuck");
+                        break;
+                    }
+                }
+
+                // Remember this direction
+                last_dir = new_dir;
+
+                // Set the pixel we found as current
+                xy[0] = test_x;
+                xy[1] = test_y;
+
+                // Break the loop if we managed to get back to our starting point
+                if(xy[0] == startxy[0] && xy[1] == startxy[1]){
+                    break;
+                }
+
+                // Store this node
+                double[] geo = xy_to_geo(xy[0],xy[1],this.resolution);
+                nodelist.add(geo);
+                //System.out.println("Adding node at "+xy[0]+","+xy[1]+" ("+geo[1]+","+geo[0]+")");
+
+                // Check if we got stuck in a loop
+                double start_proximity = Math.pow((geo[0] - startgeo[0]),2) + Math.pow((geo[1] - startgeo[1]),2);
+
+                if(detect_loop){
+                    if(start_proximity < Math.pow(start_radius_small,2)){
+                        System.out.println("Detected loop");
+                        break;
+                    }
+                }else{
+                    if(start_proximity > Math.pow(start_radius_big,2)){
+                        detect_loop = true;
+                    }
+                }
+            }
+
+            return nodelist;
+        } finally {
+            progressMonitor.finishTask();
+        }
     }
 
Index: /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerAction.java
===================================================================
--- /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerAction.java	(revision 23189)
+++ /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerAction.java	(revision 23190)
@@ -155,7 +155,7 @@
                 }
 
-				@Override protected void cancel() {
-					LakewalkerAction.this.cancel();
-				}
+                @Override protected void cancel() {
+                    LakewalkerAction.this.cancel();
+                }
             };
             Thread executeThread = new Thread(lakewalkerTask);
@@ -247,5 +247,5 @@
 
                 } catch (Exception ex) {
-                	ex.printStackTrace();
+                    ex.printStackTrace();
                 }
 
Index: /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerException.java
===================================================================
--- /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerException.java	(revision 23189)
+++ /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerException.java	(revision 23190)
@@ -5,5 +5,5 @@
 class LakewalkerException extends Exception {
     public LakewalkerException(){
-    	super(tr("An unknown error has occurred"));
+        super(tr("An unknown error has occurred"));
     }
 
Index: /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerPlugin.java
===================================================================
--- /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerPlugin.java	(revision 23189)
+++ /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerPlugin.java	(revision 23190)
@@ -15,14 +15,14 @@
  */
 public class LakewalkerPlugin extends Plugin {
-	public LakewalkerPlugin(PluginInformation info) {
-		super(info);
-		MainMenu.add(Main.main.menu.toolsMenu, new LakewalkerAction(tr("Lake Walker")));
-	}
+    public LakewalkerPlugin(PluginInformation info) {
+        super(info);
+        MainMenu.add(Main.main.menu.toolsMenu, new LakewalkerAction(tr("Lake Walker")));
+    }
 
-	@Override
-	public PreferenceSetting getPreferenceSetting()
-	{
-		return new LakewalkerPreferences();
-	}
+    @Override
+    public PreferenceSetting getPreferenceSetting()
+    {
+        return new LakewalkerPreferences();
+    }
 
 }
Index: /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerWMS.java
===================================================================
--- /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerWMS.java	(revision 23189)
+++ /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerWMS.java	(revision 23190)
@@ -48,114 +48,114 @@
 
     public BufferedImage getTile(int x, int y, ProgressMonitor progressMonitor) throws LakewalkerException {
-    	progressMonitor.beginTask(tr("Downloading image tile..."));
-    	try {
-    		String layer = "global_mosaic_base";
-
-    		int[] bottom_left_xy = new int[2];
-    		bottom_left_xy[0] = floor(x,this.tilesize);
-    		bottom_left_xy[1] = floor(y,this.tilesize);
-
-    		int[] top_right_xy = new int[2];
-    		top_right_xy[0] = bottom_left_xy[0] + this.tilesize;
-    		top_right_xy[1] = bottom_left_xy[1] + this.tilesize;
-
-    		double[] topright_geo = xy_to_geo(top_right_xy[0],top_right_xy[1],this.resolution);
-    		double[] bottomleft_geo = xy_to_geo(bottom_left_xy[0],bottom_left_xy[1],this.resolution);
-
-    		String filename = this.wmslayer+"/landsat_"+this.resolution+"_"+this.tilesize+
-    		"_xy_"+bottom_left_xy[0]+"_"+bottom_left_xy[1]+".png";
-
-    		// The WMS server only understands decimal points using periods, so we need
-    		// to convert to a locale that uses that to build the proper URL
-    		NumberFormat nf = NumberFormat.getInstance(Locale.ENGLISH);
-    		DecimalFormat df = (DecimalFormat)nf;
-    		df.applyLocalizedPattern("0.000000");
-
-    		String urlloc = "http://onearth.jpl.nasa.gov/wms.cgi?request=GetMap&layers="+layer+
-    		"&styles="+wmslayer+"&srs=EPSG:4326&format=image/png"+
-    		"&bbox="+df.format(bottomleft_geo[1])+","+df.format(bottomleft_geo[0])+
-    		","+df.format(topright_geo[1])+","+df.format(topright_geo[0])+
-    		"&width="+this.tilesize+"&height="+this.tilesize;
-
-    		File file = new File(this.working_dir,filename);
-
-    		// Calculate the hashmap key
-    		String hashkey = Integer.toString(bottom_left_xy[0])+":"+Integer.toString(bottom_left_xy[1]);
-
-    		// See if this image is already loaded
-    		if(this.image != null){
-    			if(this.imagex != bottom_left_xy[0] || this.imagey != bottom_left_xy[1]){
-
-    				// Check if this image exists in the hashmap
-    				if(this.imageindex.containsKey(hashkey)){
-    					// Store which image we have
-    					this.imagex = bottom_left_xy[0];
-    					this.imagey = bottom_left_xy[1];
-
-    					// Retrieve from cache
-    					this.image = this.images.get(this.imageindex.get(hashkey));
-    					return this.image;
-    				} else {
-    					this.image = null;
-    				}
-    			} else {
-    				return this.image;
-    			}
-    		}
-
-    		try {
-    			System.out.println("Looking for image in disk cache: "+filename);
-
-    			// Read from a file
-    			this.image = ImageIO.read(file);
-
-    			this.images.add(this.image);
-    			this.imageindex.put(hashkey,this.images.size()-1);
-
-    		} catch(FileNotFoundException e){
-    			System.out.println("Could not find cached image, downloading.");
-    		} catch(IOException e){
-    			System.out.println(e.getMessage());
-    		} catch(Exception e){
-    			System.out.println(e.getMessage());
-    		}
-
-    		if(this.image == null){
-    			/**
-    			 * Try downloading the image
-    			 */
-    			try {
-    				System.out.println("Downloading from "+urlloc);
-
-    				// Read from a URL
-    				URL url = new URL(urlloc);
-    				this.image = ImageIO.read(url); // this can return null!
-    			} catch(MalformedURLException e){
-    				System.out.println(e.getMessage());
-    			} catch(IOException e){
-    				System.out.println(e.getMessage());
-    			} catch(Exception e){
-    				System.out.println(e.getMessage());
-    			}
-
-    			if (this.image != null) {
-    				this.images.add(this.image);
-    				this.imageindex.put(hashkey,this.images.size()-1);
-
-    				this.saveimage(file,this.image);
-    			}
-    		}
-
-    		this.imagex = bottom_left_xy[0];
-    		this.imagey = bottom_left_xy[1];
-
-    		if(this.image == null){
-    			throw new LakewalkerException(tr("Could not acquire image"));
-    		}
-
-    		return this.image;
-    	} finally {
-    		progressMonitor.finishTask();
-    	}
+        progressMonitor.beginTask(tr("Downloading image tile..."));
+        try {
+            String layer = "global_mosaic_base";
+
+            int[] bottom_left_xy = new int[2];
+            bottom_left_xy[0] = floor(x,this.tilesize);
+            bottom_left_xy[1] = floor(y,this.tilesize);
+
+            int[] top_right_xy = new int[2];
+            top_right_xy[0] = bottom_left_xy[0] + this.tilesize;
+            top_right_xy[1] = bottom_left_xy[1] + this.tilesize;
+
+            double[] topright_geo = xy_to_geo(top_right_xy[0],top_right_xy[1],this.resolution);
+            double[] bottomleft_geo = xy_to_geo(bottom_left_xy[0],bottom_left_xy[1],this.resolution);
+
+            String filename = this.wmslayer+"/landsat_"+this.resolution+"_"+this.tilesize+
+            "_xy_"+bottom_left_xy[0]+"_"+bottom_left_xy[1]+".png";
+
+            // The WMS server only understands decimal points using periods, so we need
+            // to convert to a locale that uses that to build the proper URL
+            NumberFormat nf = NumberFormat.getInstance(Locale.ENGLISH);
+            DecimalFormat df = (DecimalFormat)nf;
+            df.applyLocalizedPattern("0.000000");
+
+            String urlloc = "http://onearth.jpl.nasa.gov/wms.cgi?request=GetMap&layers="+layer+
+            "&styles="+wmslayer+"&srs=EPSG:4326&format=image/png"+
+            "&bbox="+df.format(bottomleft_geo[1])+","+df.format(bottomleft_geo[0])+
+            ","+df.format(topright_geo[1])+","+df.format(topright_geo[0])+
+            "&width="+this.tilesize+"&height="+this.tilesize;
+
+            File file = new File(this.working_dir,filename);
+
+            // Calculate the hashmap key
+            String hashkey = Integer.toString(bottom_left_xy[0])+":"+Integer.toString(bottom_left_xy[1]);
+
+            // See if this image is already loaded
+            if(this.image != null){
+                if(this.imagex != bottom_left_xy[0] || this.imagey != bottom_left_xy[1]){
+
+                    // Check if this image exists in the hashmap
+                    if(this.imageindex.containsKey(hashkey)){
+                        // Store which image we have
+                        this.imagex = bottom_left_xy[0];
+                        this.imagey = bottom_left_xy[1];
+
+                        // Retrieve from cache
+                        this.image = this.images.get(this.imageindex.get(hashkey));
+                        return this.image;
+                    } else {
+                        this.image = null;
+                    }
+                } else {
+                    return this.image;
+                }
+            }
+
+            try {
+                System.out.println("Looking for image in disk cache: "+filename);
+
+                // Read from a file
+                this.image = ImageIO.read(file);
+
+                this.images.add(this.image);
+                this.imageindex.put(hashkey,this.images.size()-1);
+
+            } catch(FileNotFoundException e){
+                System.out.println("Could not find cached image, downloading.");
+            } catch(IOException e){
+                System.out.println(e.getMessage());
+            } catch(Exception e){
+                System.out.println(e.getMessage());
+            }
+
+            if(this.image == null){
+                /**
+                 * Try downloading the image
+                 */
+                try {
+                    System.out.println("Downloading from "+urlloc);
+
+                    // Read from a URL
+                    URL url = new URL(urlloc);
+                    this.image = ImageIO.read(url); // this can return null!
+                } catch(MalformedURLException e){
+                    System.out.println(e.getMessage());
+                } catch(IOException e){
+                    System.out.println(e.getMessage());
+                } catch(Exception e){
+                    System.out.println(e.getMessage());
+                }
+
+                if (this.image != null) {
+                    this.images.add(this.image);
+                    this.imageindex.put(hashkey,this.images.size()-1);
+
+                    this.saveimage(file,this.image);
+                }
+            }
+
+            this.imagex = bottom_left_xy[0];
+            this.imagey = bottom_left_xy[1];
+
+            if(this.image == null){
+                throw new LakewalkerException(tr("Could not acquire image"));
+            }
+
+            return this.image;
+        } finally {
+            progressMonitor.finishTask();
+        }
     }
 
Index: /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/StringConfigurer.java
===================================================================
--- /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/StringConfigurer.java	(revision 23189)
+++ /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/StringConfigurer.java	(revision 23190)
@@ -73,5 +73,5 @@
       nameField.addKeyListener(new java.awt.event.KeyAdapter() {
         @Override
-		public void keyReleased(java.awt.event.KeyEvent evt) {
+        public void keyReleased(java.awt.event.KeyEvent evt) {
           noUpdate = true;
           setValue(nameField.getText());
Index: /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/StringEnumConfigurer.java
===================================================================
--- /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/StringEnumConfigurer.java	(revision 23189)
+++ /applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/StringEnumConfigurer.java	(revision 23190)
@@ -64,5 +64,5 @@
     }
     @Override
-	public Component getControls() {
+    public Component getControls() {
         if (panel == null) {
             panel = Box.createHorizontalBox();
@@ -85,5 +85,5 @@
 
     @Override
-	public void setValue(Object o) {
+    public void setValue(Object o) {
         if(o == null)
             o = 0;
@@ -94,5 +94,5 @@
 
     @Override
-	public void setValue(String s) {
+    public void setValue(String s) {
         Integer n = 0;
         for (int i = 0; i < transValues.length; ++i)
@@ -107,5 +107,5 @@
 
     @Override
-	public String getValueString() {
+    public String getValueString() {
         return validValues[(Integer)value];
     }
Index: /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/CalibrationFileFilter.java
===================================================================
--- /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/CalibrationFileFilter.java	(revision 23189)
+++ /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/CalibrationFileFilter.java	(revision 23190)
@@ -30,21 +30,21 @@
  */
 public class CalibrationFileFilter extends FileFilter {
-	
-	// Extension used by calibration files
-	public static final String EXTENSION = ".cal";
 
-	@Override
-	public boolean accept(File f) {
-	    String ext3 = ( f.getName().length() > 4 ) ?  f.getName().substring( f.getName().length() - 4 ).toLowerCase() : "";
+    // Extension used by calibration files
+    public static final String EXTENSION = ".cal";
 
-	    // TODO: check what is supported by Java :)
-	    return ( f.isDirectory() 
-	    	||	ext3.equals( EXTENSION )
-	    	);
-	}
+    @Override
+    public boolean accept(File f) {
+        String ext3 = ( f.getName().length() > 4 ) ?  f.getName().substring( f.getName().length() - 4 ).toLowerCase() : "";
 
-	@Override
-	public String getDescription() {
-		return tr("Calibration Files")+ " (*" + EXTENSION + ")";
-	}
+        // TODO: check what is supported by Java :)
+        return ( f.isDirectory()
+            ||  ext3.equals( EXTENSION )
+            );
+    }
+
+    @Override
+    public String getDescription() {
+        return tr("Calibration Files")+ " (*" + EXTENSION + ")";
+    }
 }
Index: /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/LoadPictureCalibrationAction.java
===================================================================
--- /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/LoadPictureCalibrationAction.java	(revision 23189)
+++ /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/LoadPictureCalibrationAction.java	(revision 23190)
@@ -44,40 +44,40 @@
 public class LoadPictureCalibrationAction extends JosmAction {
 
-	// Owner layer of the action
-	PicLayerAbstract m_owner = null;
-	
-	/**
-	 * Constructor
-	 */
-	public LoadPictureCalibrationAction( PicLayerAbstract owner ) {
-		super(tr("Load Picture Calibration..."), null, tr("Loads calibration data to a file"), null, false);
-		// Remember the owner...
-		m_owner = owner;
-	}
-	
-	/**
-	 * Action handler
-	 */
-	public void actionPerformed(ActionEvent arg0) {
-		// Save dialog
-		final JFileChooser fc = new JFileChooser();
-		fc.setAcceptAllFileFilterUsed( false );
-		fc.setFileFilter( new CalibrationFileFilter() );
-		fc.setSelectedFile( new File(m_owner.getPicLayerName() + CalibrationFileFilter.EXTENSION));
-		int result = fc.showOpenDialog(Main.parent );
+    // Owner layer of the action
+    PicLayerAbstract m_owner = null;
+    
+    /**
+     * Constructor
+     */
+    public LoadPictureCalibrationAction( PicLayerAbstract owner ) {
+        super(tr("Load Picture Calibration..."), null, tr("Loads calibration data to a file"), null, false);
+        // Remember the owner...
+        m_owner = owner;
+    }
+    
+    /**
+     * Action handler
+     */
+    public void actionPerformed(ActionEvent arg0) {
+        // Save dialog
+        final JFileChooser fc = new JFileChooser();
+        fc.setAcceptAllFileFilterUsed( false );
+        fc.setFileFilter( new CalibrationFileFilter() );
+        fc.setSelectedFile( new File(m_owner.getPicLayerName() + CalibrationFileFilter.EXTENSION));
+        int result = fc.showOpenDialog(Main.parent );
 
-		if ( result == JFileChooser.APPROVE_OPTION ) {
-					
-			// Load	
-			try {
-				Properties props = new Properties();
-				props.load(new FileInputStream(fc.getSelectedFile()));
-				m_owner.loadCalibration(props);
-			} catch (Exception e) {
-				// Error
-				e.printStackTrace();
-				JOptionPane.showMessageDialog(Main.parent , tr("Loading file failed: {0}", e.getMessage()));
-			}
-		}
-	}
+        if ( result == JFileChooser.APPROVE_OPTION ) {
+                    
+            // Load 
+            try {
+                Properties props = new Properties();
+                props.load(new FileInputStream(fc.getSelectedFile()));
+                m_owner.loadCalibration(props);
+            } catch (Exception e) {
+                // Error
+                e.printStackTrace();
+                JOptionPane.showMessageDialog(Main.parent , tr("Loading file failed: {0}", e.getMessage()));
+            }
+        }
+    }
 }
Index: /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/MovePictureAction.java
===================================================================
--- /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/MovePictureAction.java	(revision 23189)
+++ /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/MovePictureAction.java	(revision 23190)
@@ -38,23 +38,23 @@
  * This class handles the input during moving the picture.
  */
-public class MovePictureAction extends MapMode implements MouseListener, MouseMotionListener 
+public class MovePictureAction extends MapMode implements MouseListener, MouseMotionListener
 {
-	// Action ongoing?
-	private boolean mb_dragging = false;
-	
-	// Last mouse position
-	private EastNorth m_prevEastNorth;
-	
-	// The layer we're working on
-	private PicLayerAbstract m_currentLayer = null;
-	
-	/**
-	 * Constructor
-	 */
-	public MovePictureAction(MapFrame frame) {
-		super(tr("PicLayer move"), "move", tr("Drag to move the picture"), frame, ImageProvider.getCursor("crosshair", null));
-	}
+    // Action ongoing?
+    private boolean mb_dragging = false;
 
-    @Override 
+    // Last mouse position
+    private EastNorth m_prevEastNorth;
+
+    // The layer we're working on
+    private PicLayerAbstract m_currentLayer = null;
+
+    /**
+     * Constructor
+     */
+    public MovePictureAction(MapFrame frame) {
+        super(tr("PicLayer move"), "move", tr("Drag to move the picture"), frame, ImageProvider.getCursor("crosshair", null));
+    }
+
+    @Override
     public void enterMode() {
         super.enterMode();
@@ -63,32 +63,32 @@
     }
 
-    @Override 
+    @Override
     public void exitMode() {
         super.exitMode();
         Main.map.mapView.removeMouseListener(this);
         Main.map.mapView.removeMouseMotionListener(this);
-    }	
-	
-    @Override 
+    }
+
+    @Override
     public void mousePressed(MouseEvent e) {
-       
-    	// If everything is OK, we start dragging/moving the picture
-    	if ( Main.map.mapView.getActiveLayer() instanceof PicLayerAbstract ) {
-	        m_currentLayer = (PicLayerAbstract)Main.map.mapView.getActiveLayer();
-	        
-	        if ( m_currentLayer != null && e.getButton() == MouseEvent.BUTTON1 ) {
-	        	mb_dragging = true;
-	        	m_prevEastNorth=Main.map.mapView.getEastNorth(e.getX(),e.getY());
-	        }
-    	}
-    }   
-    
-    @Override 
+
+        // If everything is OK, we start dragging/moving the picture
+        if ( Main.map.mapView.getActiveLayer() instanceof PicLayerAbstract ) {
+            m_currentLayer = (PicLayerAbstract)Main.map.mapView.getActiveLayer();
+
+            if ( m_currentLayer != null && e.getButton() == MouseEvent.BUTTON1 ) {
+                mb_dragging = true;
+                m_prevEastNorth=Main.map.mapView.getEastNorth(e.getX(),e.getY());
+            }
+        }
+    }
+
+    @Override
     public void mouseDragged(MouseEvent e) {
-    	// Picture moving is ongoing
+        // Picture moving is ongoing
         if(mb_dragging) {
             EastNorth eastNorth = Main.map.mapView.getEastNorth(e.getX(),e.getY());
             m_currentLayer.movePictureBy(
-            	eastNorth.east()-m_prevEastNorth.east(), 
+                eastNorth.east()-m_prevEastNorth.east(),
                 eastNorth.north()-m_prevEastNorth.north()
             );
@@ -96,11 +96,11 @@
             Main.map.mapView.repaint();
         }
-    }    
-    
-    @Override 
+    }
+
+    @Override
     public void mouseReleased(MouseEvent e) {
-    	// Stop moving
-    	mb_dragging = false;
-    }    
+        // Stop moving
+        mb_dragging = false;
+    }
 
 }
Index: /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/NewLayerFromClipboardAction.java
===================================================================
--- /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/NewLayerFromClipboardAction.java	(revision 23189)
+++ /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/NewLayerFromClipboardAction.java	(revision 23190)
@@ -35,30 +35,30 @@
  */
 public class NewLayerFromClipboardAction extends JosmAction {
-	
-	/**
-	 * Constructor...
-	 */
-	public NewLayerFromClipboardAction() {
-		super(tr("New picture layer from clipboard"), null, null, null, false);
-	}
 
-	/**
-	 * Action handler
-	 */
-	public void actionPerformed(ActionEvent arg0) {
-		// Create layer from clipboard
-		PicLayerFromClipboard layer = new PicLayerFromClipboard();
-		// Add layer only if successfully initialized
-		try {
-			layer.initialize();
-		}
-		catch (IOException e) {
-			// Failed
-			System.out.println( "NewLayerFromClipboardAction::actionPerformed - " + e.getMessage() );
-			JOptionPane.showMessageDialog(null, e.getMessage() );  
-			return;
-		}
-		// Add layer
-		Main.main.addLayer( layer );
-	}
+    /**
+     * Constructor...
+     */
+    public NewLayerFromClipboardAction() {
+        super(tr("New picture layer from clipboard"), null, null, null, false);
+    }
+
+    /**
+     * Action handler
+     */
+    public void actionPerformed(ActionEvent arg0) {
+        // Create layer from clipboard
+        PicLayerFromClipboard layer = new PicLayerFromClipboard();
+        // Add layer only if successfully initialized
+        try {
+            layer.initialize();
+        }
+        catch (IOException e) {
+            // Failed
+            System.out.println( "NewLayerFromClipboardAction::actionPerformed - " + e.getMessage() );
+            JOptionPane.showMessageDialog(null, e.getMessage() );
+            return;
+        }
+        // Add layer
+        Main.main.addLayer( layer );
+    }
 }
Index: /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/NewLayerFromFileAction.java
===================================================================
--- /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/NewLayerFromFileAction.java	(revision 23189)
+++ /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/NewLayerFromFileAction.java	(revision 23190)
@@ -39,68 +39,68 @@
  */
 public class NewLayerFromFileAction extends JosmAction {
-	
-	/**
-	 * Provides filtering of only image files.
-	 */
-	private class ImageFileFilter extends FileFilter {
 
-		@Override
-		public boolean accept(File f) {
-		    
-		    String ext3 = ( f.getName().length() > 4 ) ?  f.getName().substring( f.getName().length() - 4 ).toLowerCase() : "";
-		    String ext4 = ( f.getName().length() > 5 ) ?  f.getName().substring( f.getName().length() - 5 ).toLowerCase() : "";
+    /**
+     * Provides filtering of only image files.
+     */
+    private class ImageFileFilter extends FileFilter {
 
-		    // TODO: check what is supported by Java :)
-		    return ( f.isDirectory() 
-		    	||	ext3.equals( ".jpg" )
-		    	||	ext4.equals( ".jpeg" )
-		    	||	ext3.equals( ".png" )
-		    	);
-		}
+        @Override
+        public boolean accept(File f) {
+
+            String ext3 = ( f.getName().length() > 4 ) ?  f.getName().substring( f.getName().length() - 4 ).toLowerCase() : "";
+            String ext4 = ( f.getName().length() > 5 ) ?  f.getName().substring( f.getName().length() - 5 ).toLowerCase() : "";
+
+            // TODO: check what is supported by Java :)
+            return ( f.isDirectory()
+                ||  ext3.equals( ".jpg" )
+                ||  ext4.equals( ".jpeg" )
+                ||  ext3.equals( ".png" )
+                );
+        }
 
 
-		@Override
-		public String getDescription() {
-			return tr("Image files");
-		}
-		
-	}
-	
-	/**
-	 * Constructor...
-	 */
-	public NewLayerFromFileAction() {
-		super(tr("New picture layer from file..."), null, null, null, false);
-	}
+        @Override
+        public String getDescription() {
+            return tr("Image files");
+        }
 
-	/**
-	 * Action handler
-	 */
-	public void actionPerformed(ActionEvent arg0) {
-		
-		// Choose a file
-		JFileChooser fc = new JFileChooser();
-		fc.setAcceptAllFileFilterUsed( false );
-		fc.setFileFilter( new ImageFileFilter() );
-		int result = fc.showOpenDialog( Main.parent );
-		
-		// Create a layer?
-		if ( result == JFileChooser.APPROVE_OPTION ) {
-			// Create layer from file
-			PicLayerFromFile layer = new PicLayerFromFile( fc.getSelectedFile() );
-			// Add layer only if successfully initialized
-			try {
-				layer.initialize();
-			}
-			catch (IOException e) {
-				// Failed
-				System.out.println( "NewLayerFromFileAction::actionPerformed - " + e.getMessage() );
-				JOptionPane.showMessageDialog(null, e.getMessage() );  
-				return;
-			}
-			// Add layer
-			Main.main.addLayer( layer );
-		}
-		
-	}
+    }
+
+    /**
+     * Constructor...
+     */
+    public NewLayerFromFileAction() {
+        super(tr("New picture layer from file..."), null, null, null, false);
+    }
+
+    /**
+     * Action handler
+     */
+    public void actionPerformed(ActionEvent arg0) {
+
+        // Choose a file
+        JFileChooser fc = new JFileChooser();
+        fc.setAcceptAllFileFilterUsed( false );
+        fc.setFileFilter( new ImageFileFilter() );
+        int result = fc.showOpenDialog( Main.parent );
+
+        // Create a layer?
+        if ( result == JFileChooser.APPROVE_OPTION ) {
+            // Create layer from file
+            PicLayerFromFile layer = new PicLayerFromFile( fc.getSelectedFile() );
+            // Add layer only if successfully initialized
+            try {
+                layer.initialize();
+            }
+            catch (IOException e) {
+                // Failed
+                System.out.println( "NewLayerFromFileAction::actionPerformed - " + e.getMessage() );
+                JOptionPane.showMessageDialog(null, e.getMessage() );
+                return;
+            }
+            // Add layer
+            Main.main.addLayer( layer );
+        }
+
+    }
 }
Index: /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/PicLayerAbstract.java
===================================================================
--- /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/PicLayerAbstract.java	(revision 23189)
+++ /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/PicLayerAbstract.java	(revision 23190)
@@ -275,13 +275,13 @@
      */
     public void saveCalibration( Properties props ) {
-    	// Save
-    	props.put(INITIAL_POS_X, "" + m_initial_position.getX());
-    	props.put(INITIAL_POS_Y, "" + m_initial_position.getY());
-    	props.put(POSITION_X, "" + m_position.getX());
-    	props.put(POSITION_Y, "" + m_position.getY());
-    	props.put(INITIAL_SCALE, "" + m_initial_scale);
-    	props.put(SCALEX, "" + m_scalex);
-    	props.put(SCALEY, "" + m_scaley);
-    	props.put(ANGLE, "" + m_angle);
+        // Save
+        props.put(INITIAL_POS_X, "" + m_initial_position.getX());
+        props.put(INITIAL_POS_Y, "" + m_initial_position.getY());
+        props.put(POSITION_X, "" + m_position.getX());
+        props.put(POSITION_Y, "" + m_position.getY());
+        props.put(INITIAL_SCALE, "" + m_initial_scale);
+        props.put(SCALEX, "" + m_scalex);
+        props.put(SCALEY, "" + m_scaley);
+        props.put(ANGLE, "" + m_angle);
     }
 
@@ -292,20 +292,20 @@
      */
     public void loadCalibration( Properties props ) {
-    	// Load
-    		double pos_x = Double.valueOf( props.getProperty(POSITION_X));
-    		double pos_y = Double.valueOf( props.getProperty(POSITION_Y));
-    		double in_pos_x = Double.valueOf( props.getProperty(INITIAL_POS_X));
-    		double in_pos_y = Double.valueOf( props.getProperty(INITIAL_POS_Y));
-    		double angle = Double.valueOf( props.getProperty(ANGLE));
-    		double in_scale = Double.valueOf( props.getProperty(INITIAL_SCALE));
-    		double scale_x = Double.valueOf( props.getProperty(SCALEX));
-    		double scale_y = Double.valueOf( props.getProperty(SCALEY));
-  			m_position.setLocation(pos_x, pos_y);
-    		m_initial_position.setLocation(pos_x, pos_y);
-    		m_angle = angle;
-    		m_scalex = scale_x;
-    		m_scaley = scale_y;
-    		m_initial_scale = in_scale;
-    		// Refresh
+        // Load
+            double pos_x = Double.valueOf( props.getProperty(POSITION_X));
+            double pos_y = Double.valueOf( props.getProperty(POSITION_Y));
+            double in_pos_x = Double.valueOf( props.getProperty(INITIAL_POS_X));
+            double in_pos_y = Double.valueOf( props.getProperty(INITIAL_POS_Y));
+            double angle = Double.valueOf( props.getProperty(ANGLE));
+            double in_scale = Double.valueOf( props.getProperty(INITIAL_SCALE));
+            double scale_x = Double.valueOf( props.getProperty(SCALEX));
+            double scale_y = Double.valueOf( props.getProperty(SCALEY));
+            m_position.setLocation(pos_x, pos_y);
+            m_initial_position.setLocation(pos_x, pos_y);
+            m_angle = angle;
+            m_scalex = scale_x;
+            m_scaley = scale_y;
+            m_initial_scale = in_scale;
+            // Refresh
             Main.map.mapView.repaint();
     }
@@ -313,24 +313,24 @@
     private class ResetSubmenuAction extends AbstractAction implements LayerAction {
 
-    	public ResetSubmenuAction() {
-    		super(tr("Reset"));
-		}
-
-		public void actionPerformed(ActionEvent e) {
-		}
-
-		public Component createMenuComponent() {
-			JMenu reset_submenu = new JMenu(this);
-	        reset_submenu.add( new ResetPictureAllAction( PicLayerAbstract.this ) );
-	        reset_submenu.addSeparator();
-	        reset_submenu.add( new ResetPicturePositionAction( PicLayerAbstract.this ) );
-	        reset_submenu.add( new ResetPictureAngleAction( PicLayerAbstract.this ) );
-	        reset_submenu.add( new ResetPictureScaleAction( PicLayerAbstract.this ) );
-	        return reset_submenu;
-		}
-
-		public boolean supportLayers(List<Layer> layers) {
-			return layers.size() == 1 && layers.get(0) instanceof PicLayerAbstract;
-		}
+        public ResetSubmenuAction() {
+            super(tr("Reset"));
+        }
+
+        public void actionPerformed(ActionEvent e) {
+        }
+
+        public Component createMenuComponent() {
+            JMenu reset_submenu = new JMenu(this);
+            reset_submenu.add( new ResetPictureAllAction( PicLayerAbstract.this ) );
+            reset_submenu.addSeparator();
+            reset_submenu.add( new ResetPicturePositionAction( PicLayerAbstract.this ) );
+            reset_submenu.add( new ResetPictureAngleAction( PicLayerAbstract.this ) );
+            reset_submenu.add( new ResetPictureScaleAction( PicLayerAbstract.this ) );
+            return reset_submenu;
+        }
+
+        public boolean supportLayers(List<Layer> layers) {
+            return layers.size() == 1 && layers.get(0) instanceof PicLayerAbstract;
+        }
 
     }
Index: /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/PicLayerFromClipboard.java
===================================================================
--- /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/PicLayerFromClipboard.java	(revision 23189)
+++ /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/PicLayerFromClipboard.java	(revision 23190)
@@ -35,15 +35,15 @@
 public class PicLayerFromClipboard extends PicLayerAbstract {
 
-	@Override
-	protected Image createImage() throws IOException {
-		// Return item
-		Image image = null;
-		// Access the clipboard
+    @Override
+    protected Image createImage() throws IOException {
+        // Return item
+        Image image = null;
+        // Access the clipboard
         Transferable t = Toolkit.getDefaultToolkit().getSystemClipboard().getContents(null);
         // Check result
         if ( t == null ) {
-        	throw new IOException(tr("Nothing in clipboard"));
+            throw new IOException(tr("Nothing in clipboard"));
         }
-        
+
         // TODO: Why is it so slow?
         // Try to make it an image data
@@ -52,17 +52,17 @@
                 image = (Image)t.getTransferData(DataFlavor.imageFlavor);
             } else {
-            	throw new IOException(tr("The clipboard data is not an image"));
+                throw new IOException(tr("The clipboard data is not an image"));
             }
         } catch (UnsupportedFlavorException e) {
-        	throw new IOException( e.getMessage() );
-        } 
-        
+            throw new IOException( e.getMessage() );
+        }
+
         return image;
-	}
+    }
 
-	@Override
-	protected String getPicLayerName() {
-		return "Clipboard";
-	}
+    @Override
+    protected String getPicLayerName() {
+        return "Clipboard";
+    }
 
 }
Index: /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/PicLayerFromFile.java
===================================================================
--- /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/PicLayerFromFile.java	(revision 23189)
+++ /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/PicLayerFromFile.java	(revision 23190)
@@ -30,28 +30,28 @@
  */
 public class PicLayerFromFile extends PicLayerAbstract {
-	
-	// File to load from.
-	private File m_file;
-	// Tooltip text
-	private String m_tooltiptext;
+
+    // File to load from.
+    private File m_file;
+    // Tooltip text
+    private String m_tooltiptext;
 
     public PicLayerFromFile( File file ) {
-    	// Remember the file
-    	m_file = file;
-    	// Generate tooltip text
-    	m_tooltiptext = m_file.getAbsolutePath();
-    }	
-    
-	@Override
-	protected Image createImage() throws IOException {
+        // Remember the file
+        m_file = file;
+        // Generate tooltip text
+        m_tooltiptext = m_file.getAbsolutePath();
+    }
+
+    @Override
+    protected Image createImage() throws IOException {
         // Try to load file
-		Image image = null;
-		image = ImageIO.read( m_file );
-		return image;
-	}
+        Image image = null;
+        image = ImageIO.read( m_file );
+        return image;
+    }
 
-	@Override
-	protected String getPicLayerName() {
-		return m_tooltiptext;
-	}	
+    @Override
+    protected String getPicLayerName() {
+        return m_tooltiptext;
+    }
 }
Index: /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/PicLayerPlugin.java
===================================================================
--- /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/PicLayerPlugin.java	(revision 23189)
+++ /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/PicLayerPlugin.java	(revision 23190)
@@ -59,6 +59,6 @@
      */
     public PicLayerPlugin(PluginInformation info) {
-    	super(info);
-    	
+        super(info);
+
         // Create menu entry
         if ( Main.main.menu != null ) {
Index: /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/ResetPictureAllAction.java
===================================================================
--- /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/ResetPictureAllAction.java	(revision 23189)
+++ /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/ResetPictureAllAction.java	(revision 23190)
@@ -35,26 +35,26 @@
 public class ResetPictureAllAction extends JosmAction {
 
-	// Owner layer of the action
-	PicLayerAbstract m_owner = null;
-	
-	/**
-	 * Constructor
-	 */
-	public ResetPictureAllAction( PicLayerAbstract owner ) {
-		super(tr("All"), null, tr("Resets picture calibration"), null, false);
-		// Remember the owner...
-		m_owner = owner;
-	}
-	
-	/**
-	 * Action handler
-	 */
-	public void actionPerformed(ActionEvent arg0) {
-		// Reset
-		m_owner.resetAngle();
-		m_owner.resetPosition();
-		m_owner.resetScale();
-		// Redraw
+    // Owner layer of the action
+    PicLayerAbstract m_owner = null;
+    
+    /**
+     * Constructor
+     */
+    public ResetPictureAllAction( PicLayerAbstract owner ) {
+        super(tr("All"), null, tr("Resets picture calibration"), null, false);
+        // Remember the owner...
+        m_owner = owner;
+    }
+    
+    /**
+     * Action handler
+     */
+    public void actionPerformed(ActionEvent arg0) {
+        // Reset
+        m_owner.resetAngle();
+        m_owner.resetPosition();
+        m_owner.resetScale();
+        // Redraw
         Main.map.mapView.repaint();
-	}
+    }
 }
Index: /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/ResetPictureAngleAction.java
===================================================================
--- /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/ResetPictureAngleAction.java	(revision 23189)
+++ /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/ResetPictureAngleAction.java	(revision 23190)
@@ -35,24 +35,24 @@
 public class ResetPictureAngleAction extends JosmAction {
 
-	// Owner layer of the action
-	PicLayerAbstract m_owner = null;
-	
-	/**
-	 * Constructor
-	 */
-	public ResetPictureAngleAction( PicLayerAbstract owner ) {
-		super(tr("Angle"), null, tr("Resets picture rotation"), null, false);
-		// Remember the owner...
-		m_owner = owner;
-	}
-	
-	/**
-	 * Action handler
-	 */
-	public void actionPerformed(ActionEvent arg0) {
-		// Reset
-		m_owner.resetAngle();
-		// Redraw
+    // Owner layer of the action
+    PicLayerAbstract m_owner = null;
+    
+    /**
+     * Constructor
+     */
+    public ResetPictureAngleAction( PicLayerAbstract owner ) {
+        super(tr("Angle"), null, tr("Resets picture rotation"), null, false);
+        // Remember the owner...
+        m_owner = owner;
+    }
+    
+    /**
+     * Action handler
+     */
+    public void actionPerformed(ActionEvent arg0) {
+        // Reset
+        m_owner.resetAngle();
+        // Redraw
         Main.map.mapView.repaint();
-	}
+    }
 }
Index: /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/ResetPicturePositionAction.java
===================================================================
--- /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/ResetPicturePositionAction.java	(revision 23189)
+++ /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/ResetPicturePositionAction.java	(revision 23190)
@@ -35,24 +35,24 @@
 public class ResetPicturePositionAction extends JosmAction {
 
-	// Owner layer of the action
-	PicLayerAbstract m_owner = null;
-	
-	/**
-	 * Constructor
-	 */
-	public ResetPicturePositionAction( PicLayerAbstract owner ) {
-		super(tr("Reset position"), null, tr("Resets picture position"), null, false);
-		// Remember the owner...
-		m_owner = owner;
-	}
-	
-	/**
-	 * Action handler
-	 */
-	public void actionPerformed(ActionEvent arg0) {
-		// Reset
-		m_owner.resetPosition();
-		// Redraw
+    // Owner layer of the action
+    PicLayerAbstract m_owner = null;
+    
+    /**
+     * Constructor
+     */
+    public ResetPicturePositionAction( PicLayerAbstract owner ) {
+        super(tr("Reset position"), null, tr("Resets picture position"), null, false);
+        // Remember the owner...
+        m_owner = owner;
+    }
+    
+    /**
+     * Action handler
+     */
+    public void actionPerformed(ActionEvent arg0) {
+        // Reset
+        m_owner.resetPosition();
+        // Redraw
         Main.map.mapView.repaint();
-	}
+    }
 }
Index: /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/ResetPictureScaleAction.java
===================================================================
--- /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/ResetPictureScaleAction.java	(revision 23189)
+++ /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/ResetPictureScaleAction.java	(revision 23190)
@@ -35,24 +35,24 @@
 public class ResetPictureScaleAction extends JosmAction {
 
-	// Owner layer of the action
-	PicLayerAbstract m_owner = null;
-	
-	/**
-	 * Constructor
-	 */
-	public ResetPictureScaleAction( PicLayerAbstract owner ) {
-		super(tr("Scale"), null, tr("Resets picture scale"), null, false);
-		// Remember the owner...
-		m_owner = owner;
-	}
-	
-	/**
-	 * Action handler
-	 */
-	public void actionPerformed(ActionEvent arg0) {
-		// Reset
-		m_owner.resetScale();
-		// Redraw
+    // Owner layer of the action
+    PicLayerAbstract m_owner = null;
+    
+    /**
+     * Constructor
+     */
+    public ResetPictureScaleAction( PicLayerAbstract owner ) {
+        super(tr("Scale"), null, tr("Resets picture scale"), null, false);
+        // Remember the owner...
+        m_owner = owner;
+    }
+    
+    /**
+     * Action handler
+     */
+    public void actionPerformed(ActionEvent arg0) {
+        // Reset
+        m_owner.resetScale();
+        // Redraw
         Main.map.mapView.repaint();
-	}
+    }
 }
Index: /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/RotatePictureAction.java
===================================================================
--- /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/RotatePictureAction.java	(revision 23189)
+++ /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/RotatePictureAction.java	(revision 23190)
@@ -37,24 +37,24 @@
  * This class handles the input during rotating the picture.
  */
-public class RotatePictureAction extends MapMode implements MouseListener, MouseMotionListener 
+public class RotatePictureAction extends MapMode implements MouseListener, MouseMotionListener
 {
-	// Action ongoing?
-	private boolean mb_dragging = false;
-	
-	// Last mouse position
-	private int m_prevY;
-	
-	// Layer we're working on
-	private PicLayerAbstract m_currentLayer = null;
-	
-	/**
-	 * Constructor
-	 */
-	public RotatePictureAction(MapFrame frame) {
-		super(tr("PicLayer rotate"), "rotate", tr("Drag to rotate the picture"), frame, ImageProvider.getCursor("crosshair", null));
-		// TODO Auto-generated constructor stub
-	}
+    // Action ongoing?
+    private boolean mb_dragging = false;
 
-    @Override 
+    // Last mouse position
+    private int m_prevY;
+
+    // Layer we're working on
+    private PicLayerAbstract m_currentLayer = null;
+
+    /**
+     * Constructor
+     */
+    public RotatePictureAction(MapFrame frame) {
+        super(tr("PicLayer rotate"), "rotate", tr("Drag to rotate the picture"), frame, ImageProvider.getCursor("crosshair", null));
+        // TODO Auto-generated constructor stub
+    }
+
+    @Override
     public void enterMode() {
         super.enterMode();
@@ -63,27 +63,27 @@
     }
 
-    @Override 
+    @Override
     public void exitMode() {
         super.exitMode();
         Main.map.mapView.removeMouseListener(this);
         Main.map.mapView.removeMouseMotionListener(this);
-    }	
-	
-    @Override 
+    }
+
+    @Override
     public void mousePressed(MouseEvent e) {
-    	// Start rotating
-    	if ( Main.map.mapView.getActiveLayer() instanceof PicLayerAbstract ) {
-	        m_currentLayer = (PicLayerAbstract)Main.map.mapView.getActiveLayer();
-	        
-	        if ( m_currentLayer != null && e.getButton() == MouseEvent.BUTTON1 ) {
-	        	mb_dragging = true;
-	        	m_prevY=e.getY();
-	        }
-    	}
-    }   
-    
-    @Override 
+        // Start rotating
+        if ( Main.map.mapView.getActiveLayer() instanceof PicLayerAbstract ) {
+            m_currentLayer = (PicLayerAbstract)Main.map.mapView.getActiveLayer();
+
+            if ( m_currentLayer != null && e.getButton() == MouseEvent.BUTTON1 ) {
+                mb_dragging = true;
+                m_prevY=e.getY();
+            }
+        }
+    }
+
+    @Override
     public void mouseDragged(MouseEvent e) {
-    	// Rotate the picture
+        // Rotate the picture
         if(mb_dragging) {
             // TODO: Magic number
@@ -92,10 +92,10 @@
             Main.map.mapView.repaint();
         }
-    }    
-    
+    }
+
     @Override public void mouseReleased(MouseEvent e) {
-    	// End rotating
-    	mb_dragging = false;
-    }    
+        // End rotating
+        mb_dragging = false;
+    }
 
 }
Index: /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/SavePictureCalibrationAction.java
===================================================================
--- /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/SavePictureCalibrationAction.java	(revision 23189)
+++ /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/SavePictureCalibrationAction.java	(revision 23190)
@@ -43,47 +43,47 @@
 public class SavePictureCalibrationAction extends JosmAction {
 
-	// Owner layer of the action
-	PicLayerAbstract m_owner = null;
-	
-	/**
-	 * Constructor
-	 */
-	public SavePictureCalibrationAction( PicLayerAbstract owner ) {
-		super(tr("Save Picture Calibration..."), null, tr("Saves calibration data to a file"), null, false);
-		// Remember the owner...
-		m_owner = owner;
-	}
-	
-	/**
-	 * Action handler
-	 */
-	public void actionPerformed(ActionEvent arg0) {
-		// Save dialog
-		final JFileChooser fc = new JFileChooser();
-		fc.setAcceptAllFileFilterUsed( false );
-		fc.setFileFilter( new CalibrationFileFilter() );
-		fc.setSelectedFile( new File(m_owner.getPicLayerName() + CalibrationFileFilter.EXTENSION));
-		int result = fc.showSaveDialog( Main.parent );
+    // Owner layer of the action
+    PicLayerAbstract m_owner = null;
+    
+    /**
+     * Constructor
+     */
+    public SavePictureCalibrationAction( PicLayerAbstract owner ) {
+        super(tr("Save Picture Calibration..."), null, tr("Saves calibration data to a file"), null, false);
+        // Remember the owner...
+        m_owner = owner;
+    }
+    
+    /**
+     * Action handler
+     */
+    public void actionPerformed(ActionEvent arg0) {
+        // Save dialog
+        final JFileChooser fc = new JFileChooser();
+        fc.setAcceptAllFileFilterUsed( false );
+        fc.setFileFilter( new CalibrationFileFilter() );
+        fc.setSelectedFile( new File(m_owner.getPicLayerName() + CalibrationFileFilter.EXTENSION));
+        int result = fc.showSaveDialog( Main.parent );
 
-		if ( result == JFileChooser.APPROVE_OPTION ) {
-			// Check file extension and force it to be valid
-			File file = fc.getSelectedFile();
-			String path = file.getAbsolutePath();
-			if ( path.length() < CalibrationFileFilter.EXTENSION.length()
-				|| !path.substring( path.length() - 4 ).equals(CalibrationFileFilter.EXTENSION)) {
-				file = new File( path + CalibrationFileFilter.EXTENSION );
-			}
-						
-			// Save
-			Properties props = new Properties();
-			m_owner.saveCalibration(props);
-			try {
-				props.store(new FileOutputStream(file), tr("JOSM PicLayer plugin calibration data"));
-			} catch (Exception e) {
-				// Error
-				e.printStackTrace();
-				JOptionPane.showMessageDialog(Main.parent , tr("Saving file failed: {0}", e.getMessage()));
-			}
-		}	
-	}
+        if ( result == JFileChooser.APPROVE_OPTION ) {
+            // Check file extension and force it to be valid
+            File file = fc.getSelectedFile();
+            String path = file.getAbsolutePath();
+            if ( path.length() < CalibrationFileFilter.EXTENSION.length()
+                || !path.substring( path.length() - 4 ).equals(CalibrationFileFilter.EXTENSION)) {
+                file = new File( path + CalibrationFileFilter.EXTENSION );
+            }
+                        
+            // Save
+            Properties props = new Properties();
+            m_owner.saveCalibration(props);
+            try {
+                props.store(new FileOutputStream(file), tr("JOSM PicLayer plugin calibration data"));
+            } catch (Exception e) {
+                // Error
+                e.printStackTrace();
+                JOptionPane.showMessageDialog(Main.parent , tr("Saving file failed: {0}", e.getMessage()));
+            }
+        }   
+    }
 }
Index: /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/ScalePictureActionAbstract.java
===================================================================
--- /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/ScalePictureActionAbstract.java	(revision 23189)
+++ /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/ScalePictureActionAbstract.java	(revision 23190)
@@ -35,24 +35,24 @@
  * This class handles the input during scaling the picture.
  */
-public abstract class ScalePictureActionAbstract extends MapMode implements MouseListener, MouseMotionListener 
+public abstract class ScalePictureActionAbstract extends MapMode implements MouseListener, MouseMotionListener
 {
-	// Scaling ongoing?
-	private boolean mb_dragging = false;
-	
-	// Last mouse position
-	private int m_prevY;
-	
-	// Layer we're working on
-	protected PicLayerAbstract m_currentLayer = null;
-	
-	/**
-	 * Constructor
-	 */
-	public ScalePictureActionAbstract (String name, String icon, String tooltip, MapFrame frame) {
-		super(name, icon, tooltip, frame, ImageProvider.getCursor("crosshair", null));
-		// TODO Auto-generated constructor stub
-	}
+    // Scaling ongoing?
+    private boolean mb_dragging = false;
 
-    @Override 
+    // Last mouse position
+    private int m_prevY;
+
+    // Layer we're working on
+    protected PicLayerAbstract m_currentLayer = null;
+
+    /**
+     * Constructor
+     */
+    public ScalePictureActionAbstract (String name, String icon, String tooltip, MapFrame frame) {
+        super(name, icon, tooltip, frame, ImageProvider.getCursor("crosshair", null));
+        // TODO Auto-generated constructor stub
+    }
+
+    @Override
     public void enterMode() {
         super.enterMode();
@@ -61,27 +61,27 @@
     }
 
-    @Override 
+    @Override
     public void exitMode() {
         super.exitMode();
         Main.map.mapView.removeMouseListener(this);
         Main.map.mapView.removeMouseMotionListener(this);
-    }	
-	
-    @Override 
+    }
+
+    @Override
     public void mousePressed(MouseEvent e) {
-    	// Start scaling
-    	if ( Main.map.mapView.getActiveLayer() instanceof PicLayerAbstract ) {
-	        m_currentLayer = (PicLayerAbstract)Main.map.mapView.getActiveLayer();
-	        
-	        if ( m_currentLayer != null && e.getButton() == MouseEvent.BUTTON1 ) {
-	        	mb_dragging = true;
-	        	m_prevY = e.getY();
-	        }
-    	}
-    }   
-    
-    @Override 
+        // Start scaling
+        if ( Main.map.mapView.getActiveLayer() instanceof PicLayerAbstract ) {
+            m_currentLayer = (PicLayerAbstract)Main.map.mapView.getActiveLayer();
+
+            if ( m_currentLayer != null && e.getButton() == MouseEvent.BUTTON1 ) {
+                mb_dragging = true;
+                m_prevY = e.getY();
+            }
+        }
+    }
+
+    @Override
     public void mouseDragged(MouseEvent e) {
-    	// Scale the picture
+        // Scale the picture
         if(mb_dragging) {
             doTheScale( ( e.getY() - m_prevY ) / 500.0 );
@@ -90,11 +90,11 @@
         }
     }
-    
-    @Override 
+
+    @Override
     public void mouseReleased(MouseEvent e) {
-    	// Stop scaling
-    	mb_dragging = false;
+        // Stop scaling
+        mb_dragging = false;
     }
-    
+
     /**
     * Does the actual scaling in the inherited class.
Index: /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/ScaleXPictureAction.java
===================================================================
--- /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/ScaleXPictureAction.java	(revision 23189)
+++ /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/ScaleXPictureAction.java	(revision 23190)
@@ -33,15 +33,15 @@
  * This class handles the input during scaling the picture.
  */
-public class ScaleXPictureAction extends ScalePictureActionAbstract 
+public class ScaleXPictureAction extends ScalePictureActionAbstract
 {
-	/*
-	 * Constructor
-	 */
-	public ScaleXPictureAction(MapFrame frame) {
-		super(tr("PicLayer scale X"), "scale_x", tr("Drag to scale the picture in the X Axis"), frame);
-		// TODO Auto-generated constructor stub
-	}
+    /*
+     * Constructor
+     */
+    public ScaleXPictureAction(MapFrame frame) {
+        super(tr("PicLayer scale X"), "scale_x", tr("Drag to scale the picture in the X Axis"), frame);
+        // TODO Auto-generated constructor stub
+    }
 
-	public void doTheScale( double scale ) {
+    public void doTheScale( double scale ) {
             m_currentLayer.scalePictureBy( scale, 0.0 );
         }
Index: /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/ScaleXYPictureAction.java
===================================================================
--- /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/ScaleXYPictureAction.java	(revision 23189)
+++ /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/ScaleXYPictureAction.java	(revision 23190)
@@ -33,15 +33,15 @@
  * This class handles the input during scaling the picture.
  */
-public class ScaleXYPictureAction extends ScalePictureActionAbstract 
+public class ScaleXYPictureAction extends ScalePictureActionAbstract
 {
-	/*
-	 * Constructor
-	 */
-	public ScaleXYPictureAction(MapFrame frame) {
-		super(tr("PicLayer scale"), "scale", tr("Drag to scale the picture in the X and Y Axis"), frame);
-		// TODO Auto-generated constructor stub
-	}
+    /*
+     * Constructor
+     */
+    public ScaleXYPictureAction(MapFrame frame) {
+        super(tr("PicLayer scale"), "scale", tr("Drag to scale the picture in the X and Y Axis"), frame);
+        // TODO Auto-generated constructor stub
+    }
 
-	public void doTheScale( double scale ) {
+    public void doTheScale( double scale ) {
             m_currentLayer.scalePictureBy( scale, scale );
         }
Index: /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/ScaleYPictureAction.java
===================================================================
--- /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/ScaleYPictureAction.java	(revision 23189)
+++ /applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/ScaleYPictureAction.java	(revision 23190)
@@ -33,15 +33,15 @@
  * This class handles the input during scaling the picture.
  */
-public class ScaleYPictureAction extends ScalePictureActionAbstract 
+public class ScaleYPictureAction extends ScalePictureActionAbstract
 {
-	/*
-	 * Constructor
-	 */
-	public ScaleYPictureAction(MapFrame frame) {
-		super(tr("PicLayer scale Y"), "scale_y", tr("Drag to scale the picture in the Y Axis"), frame);
-		// TODO Auto-generated constructor stub
-	}
+    /*
+     * Constructor
+     */
+    public ScaleYPictureAction(MapFrame frame) {
+        super(tr("PicLayer scale Y"), "scale_y", tr("Drag to scale the picture in the Y Axis"), frame);
+        // TODO Auto-generated constructor stub
+    }
 
-	public void doTheScale( double scale ) {
+    public void doTheScale( double scale ) {
             m_currentLayer.scalePictureBy( 0.0, scale );
         }
Index: /applications/editors/josm/plugins/slippymap/src/org/openstreetmap/josm/plugins/slippymap/SlippyMapKey.java
===================================================================
--- /applications/editors/josm/plugins/slippymap/src/org/openstreetmap/josm/plugins/slippymap/SlippyMapKey.java	(revision 23189)
+++ /applications/editors/josm/plugins/slippymap/src/org/openstreetmap/josm/plugins/slippymap/SlippyMapKey.java	(revision 23190)
@@ -1,4 +1,4 @@
 /**
- * 
+ *
  */
 package org.openstreetmap.josm.plugins.slippymap;
@@ -9,5 +9,5 @@
  * {@link #equals(Object)} and also {@link #toString()}.
  * </p>
- * 
+ *
  * @author LuVar <lubomir.varga@freemap.sk>
  * @author Dave Hansen <dave@sr71.net>
@@ -15,64 +15,64 @@
  */
 public class SlippyMapKey {
-	private final int x;
-	private final int y;
-	private final int level;
-	
-	/**
-	 * <p>
-	 * Constructs key for hashmaps for some tile describedy by X and Y position. X and Y are tiles
-	 * positions on discrete map.
-	 * </p>
-	 * 
-	 * @param x	x position in tiles table
-	 * @param y	y position in tiles table
-	 */
-	public final boolean valid;
-	public SlippyMapKey(int x, int y, int level) {
-		this.x = x;
-		this.y = y;
-		this.level = level;
-		if (level <= 0 || x < 0 || y < 0) {
-			this.valid = false;
-			System.err.println("invalid SlippyMapKey("+level+", "+x+", "+y+")");
-		} else {
-			this.valid = true;
-		}
-	}
-	
-	/**
-	 * <p>
-	 * Returns true ONLY if x and y are equals.
-	 * </p>
-	 * 
-	 * @see java.lang.Object#equals(java.lang.Object)
-	 */
-	@Override
-	public boolean equals(Object obj) {
-		if (obj instanceof SlippyMapKey) {
-			SlippyMapKey smk = (SlippyMapKey) obj;
-			if((smk.x == this.x) && (smk.y == this.y) && (smk.level == this.level)) {
-				return true;
-			}
-		}
-		return false;
-	}
-	
-	/**
-	 * @return	return new Integer(this.x + this.y * 10000).hashCode();
-	 * @see java.lang.Object#hashCode()
-	 */
-	@Override
-	public int hashCode() {
-		return new Integer(this.x + this.y * 10000 + this.level * 100000).hashCode();
-	}
-	
-	/**
-	 * @see java.lang.Object#toString()
-	 */
-	@Override
-	public String toString() {
-		return "SlippyMapKey(x=" + this.x + ",y=" + this.y + ",level=" + level + ")";
-	}
-	
+    private final int x;
+    private final int y;
+    private final int level;
+
+    /**
+     * <p>
+     * Constructs key for hashmaps for some tile describedy by X and Y position. X and Y are tiles
+     * positions on discrete map.
+     * </p>
+     *
+     * @param x x position in tiles table
+     * @param y y position in tiles table
+     */
+    public final boolean valid;
+    public SlippyMapKey(int x, int y, int level) {
+        this.x = x;
+        this.y = y;
+        this.level = level;
+        if (level <= 0 || x < 0 || y < 0) {
+            this.valid = false;
+            System.err.println("invalid SlippyMapKey("+level+", "+x+", "+y+")");
+        } else {
+            this.valid = true;
+        }
+    }
+
+    /**
+     * <p>
+     * Returns true ONLY if x and y are equals.
+     * </p>
+     *
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    @Override
+    public boolean equals(Object obj) {
+        if (obj instanceof SlippyMapKey) {
+            SlippyMapKey smk = (SlippyMapKey) obj;
+            if((smk.x == this.x) && (smk.y == this.y) && (smk.level == this.level)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * @return  return new Integer(this.x + this.y * 10000).hashCode();
+     * @see java.lang.Object#hashCode()
+     */
+    @Override
+    public int hashCode() {
+        return new Integer(this.x + this.y * 10000 + this.level * 100000).hashCode();
+    }
+
+    /**
+     * @see java.lang.Object#toString()
+     */
+    @Override
+    public String toString() {
+        return "SlippyMapKey(x=" + this.x + ",y=" + this.y + ",level=" + level + ")";
+    }
+
 }
Index: /applications/editors/josm/plugins/slippymap/src/org/openstreetmap/josm/plugins/slippymap/SlippyMapLayer.java
===================================================================
--- /applications/editors/josm/plugins/slippymap/src/org/openstreetmap/josm/plugins/slippymap/SlippyMapLayer.java	(revision 23189)
+++ /applications/editors/josm/plugins/slippymap/src/org/openstreetmap/josm/plugins/slippymap/SlippyMapLayer.java	(revision 23190)
@@ -212,5 +212,5 @@
         // FIXME: currently ran in errors
 
-		tileOptionMenu.add(new JMenuItem(
+        tileOptionMenu.add(new JMenuItem(
                 new AbstractAction(tr("Snap to tile size")) {
                     public void actionPerformed(ActionEvent ae) {
@@ -252,13 +252,13 @@
                 MapView.addLayerChangeListener(new LayerChangeListener() {
                     public void activeLayerChange(Layer oldLayer, Layer newLayer) {
-                    	//
+                        //
                     }
 
                     public void layerAdded(Layer newLayer) {
-                    	//
+                        //
                     }
 
                     public void layerRemoved(Layer oldLayer) {
-                    	MapView.removeLayerChangeListener(this);
+                        MapView.removeLayerChangeListener(this);
                     }
                 });
Index: /applications/editors/josm/plugins/slippymap/src/org/openstreetmap/josm/plugins/slippymap/SlippyMapPlugin.java
===================================================================
--- /applications/editors/josm/plugins/slippymap/src/org/openstreetmap/josm/plugins/slippymap/SlippyMapPlugin.java	(revision 23189)
+++ /applications/editors/josm/plugins/slippymap/src/org/openstreetmap/josm/plugins/slippymap/SlippyMapPlugin.java	(revision 23190)
@@ -21,10 +21,10 @@
     public SlippyMapPlugin(PluginInformation info)
     {
-    	super(info);
-    	Main.pref.addPreferenceChangeListener(this);
+        super(info);
+        Main.pref.addPreferenceChangeListener(this);
     }
 
     @Override
-	public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame)
+    public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame)
     {
         if (newFrame != null && SlippyMapPreferences.getMapSource() != SlippyMapPreferences.NO_DEFAULT_TILE_SOURCE) {
@@ -53,21 +53,21 @@
      */
     public void preferenceChanged(PreferenceChangeEvent event) {
-    	if (!Main.isDisplayingMapView()) {
-    		return;
-    	}
-    	List<SlippyMapLayer> layes = Main.map.mapView.getLayersOfType(SlippyMapLayer.class);
-    	assert layes.size() <= 1;
-    	SlippyMapLayer layer = layes.isEmpty()?null:layes.get(0);
+        if (!Main.isDisplayingMapView()) {
+            return;
+        }
+        List<SlippyMapLayer> layes = Main.map.mapView.getLayersOfType(SlippyMapLayer.class);
+        assert layes.size() <= 1;
+        SlippyMapLayer layer = layes.isEmpty()?null:layes.get(0);
 
         if (event.getKey().equals(SlippyMapPreferences.PREFERENCE_TILE_SOURCE)) {
-        	if (layer == null && SlippyMapPreferences.getMapSource() != SlippyMapPreferences.NO_DEFAULT_TILE_SOURCE) {
-        		Main.map.mapView.addLayer(new SlippyMapLayer());
-        	} else if (layer != null && SlippyMapPreferences.getMapSource() == SlippyMapPreferences.NO_DEFAULT_TILE_SOURCE) {
-        		Main.map.mapView.removeLayer(layer);
-        	} else if (layer == null && SlippyMapPreferences.getMapSource() == SlippyMapPreferences.NO_DEFAULT_TILE_SOURCE) {
-        		// Do nothing
-        	} else {
-        		layer.newTileStorage();
-        	}
+            if (layer == null && SlippyMapPreferences.getMapSource() != SlippyMapPreferences.NO_DEFAULT_TILE_SOURCE) {
+                Main.map.mapView.addLayer(new SlippyMapLayer());
+            } else if (layer != null && SlippyMapPreferences.getMapSource() == SlippyMapPreferences.NO_DEFAULT_TILE_SOURCE) {
+                Main.map.mapView.removeLayer(layer);
+            } else if (layer == null && SlippyMapPreferences.getMapSource() == SlippyMapPreferences.NO_DEFAULT_TILE_SOURCE) {
+                // Do nothing
+            } else {
+                layer.newTileStorage();
+            }
         } else  if (event.getKey().startsWith(SlippyMapPreferences.PREFERENCE_PREFIX) && layer != null) {
             // System.err.println(this + ".preferenceChanged('" + key + "', '"
Index: /applications/editors/josm/plugins/slippymap/src/org/openstreetmap/josm/plugins/slippymap/SlippyMapPreferenceSetting.java
===================================================================
--- /applications/editors/josm/plugins/slippymap/src/org/openstreetmap/josm/plugins/slippymap/SlippyMapPreferenceSetting.java	(revision 23189)
+++ /applications/editors/josm/plugins/slippymap/src/org/openstreetmap/josm/plugins/slippymap/SlippyMapPreferenceSetting.java	(revision 23190)
@@ -114,8 +114,8 @@
      * Actualy this method loads and sets this params:<br>
      * <ul>
-     * 	<li>autozoom - {@link #autozoomActive} - {@link SlippyMapPreferences#getAutozoom()}</li>
-     * 	<li>autoload - {@link #autoloadTiles} - {@link SlippyMapPreferences#getAutoloadTiles()}</li>
-     * 	<li>maxZoomLvl - {@link #maxZoomLvl} - {@link SlippyMapPreferences#getMaxZoomLvl()}</li>
-     * 	<li>minZoomLvl - {@link #minZoomLvl} - {@link SlippyMapPreferences#getMaxZoomLvl()}</li>
+     *  <li>autozoom - {@link #autozoomActive} - {@link SlippyMapPreferences#getAutozoom()}</li>
+     *  <li>autoload - {@link #autoloadTiles} - {@link SlippyMapPreferences#getAutoloadTiles()}</li>
+     *  <li>maxZoomLvl - {@link #maxZoomLvl} - {@link SlippyMapPreferences#getMaxZoomLvl()}</li>
+     *  <li>minZoomLvl - {@link #minZoomLvl} - {@link SlippyMapPreferences#getMaxZoomLvl()}</li>
      * </ul>
      * </p>
@@ -139,5 +139,5 @@
     public boolean ok()
     {
-    	SlippyMapPreferences.setMapSource((TileSource)this.tileSourceCombo.getSelectedItem());
+        SlippyMapPreferences.setMapSource((TileSource)this.tileSourceCombo.getSelectedItem());
         SlippyMapPreferences.setAutozoom(this.autozoomActive.isSelected());
         SlippyMapPreferences.setAutoloadTiles(this.autoloadTiles.isSelected());
Index: /applications/editors/josm/plugins/slippymap/src/org/openstreetmap/josm/plugins/slippymap/SlippyMapPreferences.java
===================================================================
--- /applications/editors/josm/plugins/slippymap/src/org/openstreetmap/josm/plugins/slippymap/SlippyMapPreferences.java	(revision 23189)
+++ /applications/editors/josm/plugins/slippymap/src/org/openstreetmap/josm/plugins/slippymap/SlippyMapPreferences.java	(revision 23190)
@@ -21,5 +21,5 @@
 public class SlippyMapPreferences
 {
-	public static final String NO_DEFAULT_TILE_SOURCE_NAME = "{%no_default%}";
+    public static final String NO_DEFAULT_TILE_SOURCE_NAME = "{%no_default%}";
     public static final String PREFERENCE_PREFIX   = "slippymap";
 
@@ -47,7 +47,7 @@
     public static TileSource getMapSource(String name)
     {
-    	if (NO_DEFAULT_TILE_SOURCE_NAME.equals(name)) {
-    		return NO_DEFAULT_TILE_SOURCE; // User don't want to load slippy layer on startup
-    	}
+        if (NO_DEFAULT_TILE_SOURCE_NAME.equals(name)) {
+            return NO_DEFAULT_TILE_SOURCE; // User don't want to load slippy layer on startup
+        }
 
         List<TileSource> sources = SlippyMapPreferences.getAllMapSources();
@@ -60,5 +60,5 @@
         for (TileSource s : sources) {
             if (name.equals(s.getName()))
-            	return s;
+                return s;
         }
 
@@ -67,5 +67,5 @@
 
     public static void setMapSource(TileSource source) {
-    	Main.pref.put(SlippyMapPreferences.PREFERENCE_TILE_SOURCE, source == NO_DEFAULT_TILE_SOURCE?NO_DEFAULT_TILE_SOURCE_NAME:source.getName());
+        Main.pref.put(SlippyMapPreferences.PREFERENCE_TILE_SOURCE, source == NO_DEFAULT_TILE_SOURCE?NO_DEFAULT_TILE_SOURCE_NAME:source.getName());
     }
 
@@ -76,5 +76,5 @@
         if (autozoom == null || "".equals(autozoom))
         {
-        	autozoom = "true";
+            autozoom = "true";
             Main.pref.put(PREFERENCE_AUTOZOOM, autozoom);
         }
@@ -84,16 +84,16 @@
 
     public static void setAutozoom(boolean autozoom) {
-    	Main.pref.put(SlippyMapPreferences.PREFERENCE_AUTOZOOM, autozoom);
+        Main.pref.put(SlippyMapPreferences.PREFERENCE_AUTOZOOM, autozoom);
     }
 
     public static void setDrawDebug(boolean drawDebug) {
-    	Main.pref.put(SlippyMapPreferences.PREFERENCE_DRAW_DEBUG, drawDebug);
+        Main.pref.put(SlippyMapPreferences.PREFERENCE_DRAW_DEBUG, drawDebug);
     }
 
     public static void setLastZoom(int zoom) {
-    	Main.pref.put(SlippyMapPreferences.PREFERENCE_LAST_ZOOM, ""+zoom);
+        Main.pref.put(SlippyMapPreferences.PREFERENCE_LAST_ZOOM, ""+zoom);
     }
     public static int getLastZoom() {
-    	int ret = -1;
+        int ret = -1;
         String pref = Main.pref.get(SlippyMapPreferences.PREFERENCE_LAST_ZOOM);
         try {
@@ -110,5 +110,5 @@
         if (drawDebug == null || "".equals(drawDebug))
         {
-        	drawDebug = "false";
+            drawDebug = "false";
             Main.pref.put(PREFERENCE_DRAW_DEBUG, drawDebug);
         }
@@ -123,5 +123,5 @@
         if (autoloadTiles == null || "".equals(autoloadTiles))
         {
-        	autoloadTiles = "true";
+            autoloadTiles = "true";
             Main.pref.put(PREFERENCE_AUTOLOADTILES, autoloadTiles);
         }
@@ -131,10 +131,10 @@
 
     public static void setFadeBackground(float fadeBackground) {
-    	Main.pref.put(SlippyMapPreferences.PREFERENCE_FADE_BACKGROUND, fadeBackground + "");
+        Main.pref.put(SlippyMapPreferences.PREFERENCE_FADE_BACKGROUND, fadeBackground + "");
     }
 
     /**
      *
-     * @return	number between 0 and 1, inclusive
+     * @return  number between 0 and 1, inclusive
      */
     public static float getFadeBackground() {
@@ -143,5 +143,5 @@
         if (fadeBackground == null || "".equals(fadeBackground))
         {
-        	fadeBackground = "0.0";
+            fadeBackground = "0.0";
             Main.pref.put(PREFERENCE_FADE_BACKGROUND, fadeBackground);
         }
@@ -149,16 +149,16 @@
         float parsed;
         try {
-        	parsed = Float.parseFloat(fadeBackground);
+            parsed = Float.parseFloat(fadeBackground);
         } catch (Exception ex) {
-        	setFadeBackground(0.1f);
-        	System.out.println("Error while parsing setting fade background to float! returning 0.1, because of error:");
-        	ex.printStackTrace(System.out);
-        	return 0.1f;
+            setFadeBackground(0.1f);
+            System.out.println("Error while parsing setting fade background to float! returning 0.1, because of error:");
+            ex.printStackTrace(System.out);
+            return 0.1f;
         }
         if(parsed < 0f) {
-        	parsed = 0f;
+            parsed = 0f;
         } else {
-        	if(parsed > 1f) {
-            	parsed = 1f;
+            if(parsed > 1f) {
+                parsed = 1f;
             }
         }
@@ -167,5 +167,5 @@
 
     public static void setAutoloadTiles(boolean autoloadTiles) {
-    	Main.pref.put(SlippyMapPreferences.PREFERENCE_AUTOLOADTILES, autoloadTiles);
+        Main.pref.put(SlippyMapPreferences.PREFERENCE_AUTOLOADTILES, autoloadTiles);
     }
 
@@ -174,10 +174,10 @@
         int pref;
         try {
-        	//Should we use Main.pref.getInteger(str)?
-        	pref = Main.pref.getInteger(prefName, def);
+            //Should we use Main.pref.getInteger(str)?
+            pref = Main.pref.getInteger(prefName, def);
         } catch (Exception ex) {
             String str = Main.pref.get(prefName);
             Main.pref.put(prefName, null);
-        	throw new RuntimeException("Problem while converting string to int. "
+            throw new RuntimeException("Problem while converting string to int. "
                                        + "Converting value of preferences "
                                        + prefName + ". Value=\"" + str
@@ -190,15 +190,15 @@
     static int checkMaxZoomLvl(int maxZoomLvl)
     {
-    	if(maxZoomLvl > MAX_ZOOM) {
-    		System.err.println("MaxZoomLvl shouldnt be more than 30! Setting to 30.");
-    		maxZoomLvl = MAX_ZOOM;
-    	}
-    	if(maxZoomLvl < SlippyMapPreferences.__getMinZoomLvl()) {
-    		System.err.println("maxZoomLvl shouldnt be more than minZoomLvl! Setting to minZoomLvl.");
-    		maxZoomLvl = SlippyMapPreferences.__getMinZoomLvl();
-    	}
+        if(maxZoomLvl > MAX_ZOOM) {
+            System.err.println("MaxZoomLvl shouldnt be more than 30! Setting to 30.");
+            maxZoomLvl = MAX_ZOOM;
+        }
+        if(maxZoomLvl < SlippyMapPreferences.__getMinZoomLvl()) {
+            System.err.println("maxZoomLvl shouldnt be more than minZoomLvl! Setting to minZoomLvl.");
+            maxZoomLvl = SlippyMapPreferences.__getMinZoomLvl();
+        }
         TileSource ts = getMapSource();
         if (ts != null && ts.getMaxZoom() < SlippyMapPreferences.__getMinZoomLvl()) {
-    		System.err.println("decreasing maxZoomLvl to match new tile source");
+            System.err.println("decreasing maxZoomLvl to match new tile source");
             maxZoomLvl = ts.getMaxZoom();
         }
@@ -214,5 +214,5 @@
     public static void setMaxZoomLvl(int maxZoomLvl) {
         maxZoomLvl = checkMaxZoomLvl(maxZoomLvl);
-    	Main.pref.put(SlippyMapPreferences.PREFERENCE_MAX_ZOOM_LVL, "" + maxZoomLvl);
+        Main.pref.put(SlippyMapPreferences.PREFERENCE_MAX_ZOOM_LVL, "" + maxZoomLvl);
     }
 
@@ -220,11 +220,11 @@
     {
         if(minZoomLvl < MIN_ZOOM) {
-    		System.err.println("minZoomLvl shouldnt be lees than "+MIN_ZOOM+"! Setting to that.");
-    		minZoomLvl = MIN_ZOOM;
-    	}
-    	if(minZoomLvl > SlippyMapPreferences.getMaxZoomLvl()) {
-    		System.err.println("minZoomLvl shouldnt be more than maxZoomLvl! Setting to maxZoomLvl.");
-    		minZoomLvl = SlippyMapPreferences.getMaxZoomLvl();
-    	}
+            System.err.println("minZoomLvl shouldnt be lees than "+MIN_ZOOM+"! Setting to that.");
+            minZoomLvl = MIN_ZOOM;
+        }
+        if(minZoomLvl > SlippyMapPreferences.getMaxZoomLvl()) {
+            System.err.println("minZoomLvl shouldnt be more than maxZoomLvl! Setting to maxZoomLvl.");
+            minZoomLvl = SlippyMapPreferences.getMaxZoomLvl();
+        }
         return minZoomLvl;
     }
@@ -242,11 +242,11 @@
     public static void setMinZoomLvl(int minZoomLvl) {
         minZoomLvl = checkMinZoomLvl(minZoomLvl);
-    	Main.pref.put(SlippyMapPreferences.PREFERENCE_MIN_ZOOM_LVL, "" + minZoomLvl);
+        Main.pref.put(SlippyMapPreferences.PREFERENCE_MIN_ZOOM_LVL, "" + minZoomLvl);
     }
 
     public static TileSource NO_DEFAULT_TILE_SOURCE = new AbstractOsmTileSource(tr("(none)"), "") {
-		public TileUpdate getTileUpdate() {
-			return null;
-		}
+        public TileUpdate getTileUpdate() {
+            return null;
+        }
     };
 
@@ -282,10 +282,10 @@
 
         @Override
-		public int getMaxZoom() {
+        public int getMaxZoom() {
             return 21;
         }
 
         @Override
-		public String getTilePath(int zoom, int tilex, int tiley) {
+        public String getTilePath(int zoom, int tilex, int tiley) {
             return "z=" + zoom + "&x=" + tilex + "&y=" + tiley;
         }
@@ -303,11 +303,11 @@
 
         @Override
-		public int getMaxZoom() {
+        public int getMaxZoom() {
             return 21;
         }
 
         @Override
-		public String getTilePath(int zoom, int tilex, int tiley) {
-        	return "/" + zoom + "/" + tilex + "/" + tiley + ".png";
+        public String getTilePath(int zoom, int tilex, int tiley) {
+            return "/" + zoom + "/" + tilex + "/" + tiley + ".png";
         }
 
Index: /applications/editors/josm/plugins/walkingpapers/src/org/openstreetmap/josm/plugins/walkingpapers/WalkingPapersAddLayerAction.java
===================================================================
--- /applications/editors/josm/plugins/walkingpapers/src/org/openstreetmap/josm/plugins/walkingpapers/WalkingPapersAddLayerAction.java	(revision 23189)
+++ /applications/editors/josm/plugins/walkingpapers/src/org/openstreetmap/josm/plugins/walkingpapers/WalkingPapersAddLayerAction.java	(revision 23190)
@@ -21,12 +21,12 @@
 
     public WalkingPapersAddLayerAction() {
-        super(tr("Scanned Map..."), "walkingpapers", 
-        	tr("Display a map that was previously scanned and uploaded to walking-papers.org"), null, false);
+        super(tr("Scanned Map..."), "walkingpapers",
+            tr("Display a map that was previously scanned and uploaded to walking-papers.org"), null, false);
     }
 
     public void actionPerformed(ActionEvent e) {
-        String wpid = JOptionPane.showInputDialog(Main.parent, 
-        	tr("Enter a walking-papers.org URL or ID (the bit after the ?id= in the URL)"),
-        		Main.pref.get("walkingpapers.last-used-id"));
+        String wpid = JOptionPane.showInputDialog(Main.parent,
+            tr("Enter a walking-papers.org URL or ID (the bit after the ?id= in the URL)"),
+                Main.pref.get("walkingpapers.last-used-id"));
 
         if (wpid == null || wpid.equals("")) return;
@@ -42,5 +42,5 @@
         Pattern spanPattern = Pattern.compile("<span class=\"(\\S+)\">(\\S+)</span>");
         Matcher m;
-        
+
         double north = 0;
         double south = 0;
@@ -52,22 +52,22 @@
 
         try {
-        	BufferedReader r = new BufferedReader(new InputStreamReader(new URL(wpUrl).openStream(), "utf-8"));
-        	for (String line = r.readLine(); line != null; line = r.readLine()) {
-        		m = spanPattern.matcher(line);
-        		if (m.find()) {
-        			if ("tile".equals(m.group(1))) tile = m.group(2);
-        			else if ("north".equals(m.group(1))) north = Double.parseDouble(m.group(2));
-        			else if ("south".equals(m.group(1))) south = Double.parseDouble(m.group(2));
-        			else if ("east".equals(m.group(1))) east = Double.parseDouble(m.group(2));
-        			else if ("west".equals(m.group(1))) west = Double.parseDouble(m.group(2));
-        			else if ("minzoom".equals(m.group(1))) minz = Integer.parseInt(m.group(2));
-        			else if ("maxzoom".equals(m.group(1))) maxz = Integer.parseInt(m.group(2));
-        		}
-        	}
-        	r.close();
-        	if ((tile == null) || (north == 0 && south == 0) || (east == 0 && west == 0)) throw new Exception();
+            BufferedReader r = new BufferedReader(new InputStreamReader(new URL(wpUrl).openStream(), "utf-8"));
+            for (String line = r.readLine(); line != null; line = r.readLine()) {
+                m = spanPattern.matcher(line);
+                if (m.find()) {
+                    if ("tile".equals(m.group(1))) tile = m.group(2);
+                    else if ("north".equals(m.group(1))) north = Double.parseDouble(m.group(2));
+                    else if ("south".equals(m.group(1))) south = Double.parseDouble(m.group(2));
+                    else if ("east".equals(m.group(1))) east = Double.parseDouble(m.group(2));
+                    else if ("west".equals(m.group(1))) west = Double.parseDouble(m.group(2));
+                    else if ("minzoom".equals(m.group(1))) minz = Integer.parseInt(m.group(2));
+                    else if ("maxzoom".equals(m.group(1))) maxz = Integer.parseInt(m.group(2));
+                }
+            }
+            r.close();
+            if ((tile == null) || (north == 0 && south == 0) || (east == 0 && west == 0)) throw new Exception();
         } catch (Exception ex) {
-        	JOptionPane.showMessageDialog(Main.parent,tr("Could not read information from walking-papers.org the id \"{0}\"", mungedWpId));
-        	return;
+            JOptionPane.showMessageDialog(Main.parent,tr("Could not read information from walking-papers.org the id \"{0}\"", mungedWpId));
+            return;
         }
 
@@ -82,5 +82,5 @@
 
         Bounds b = new Bounds(new LatLon(south, west), new LatLon(north, east));
-        
+
         WalkingPapersLayer wpl = new WalkingPapersLayer(mungedWpId, tile, b, minz, maxz);
         Main.main.addLayer(wpl);
Index: /applications/editors/josm/plugins/walkingpapers/src/org/openstreetmap/josm/plugins/walkingpapers/WalkingPapersKey.java
===================================================================
--- /applications/editors/josm/plugins/walkingpapers/src/org/openstreetmap/josm/plugins/walkingpapers/WalkingPapersKey.java	(revision 23189)
+++ /applications/editors/josm/plugins/walkingpapers/src/org/openstreetmap/josm/plugins/walkingpapers/WalkingPapersKey.java	(revision 23190)
@@ -1,4 +1,4 @@
 /**
- * 
+ *
  */
 package org.openstreetmap.josm.plugins.walkingpapers;
@@ -9,5 +9,5 @@
  * {@link #equals(Object)} and also {@link #toString()}.
  * </p>
- * 
+ *
  * @author LuVar <lubomir.varga@freemap.sk>
  * @author Dave Hansen <dave@sr71.net>
@@ -15,64 +15,64 @@
  */
 public class WalkingPapersKey {
-	private final int x;
-	private final int y;
-	private final int level;
-	
-	/**
-	 * <p>
-	 * Constructs key for hashmaps for some tile describedy by X and Y position. X and Y are tiles
-	 * positions on discrete map.
-	 * </p>
-	 * 
-	 * @param x	x position in tiles table
-	 * @param y	y position in tiles table
-	 */
-	public final boolean valid;
-	public WalkingPapersKey(int level, int x, int y) {
-		this.x = x;
-		this.y = y;
-		this.level = level;
-		if (level <= 0 || x < 0 || y < 0) {
-			this.valid = false;
-			System.err.println("invalid WalkingPapersKey("+level+", "+x+", "+y+")");
-		} else {
-			this.valid = true;
-		}
-	}
-	
-	/**
-	 * <p>
-	 * Returns true ONLY if x and y are equals.
-	 * </p>
-	 * 
-	 * @see java.lang.Object#equals(java.lang.Object)
-	 */
-	@Override
-	public boolean equals(Object obj) {
-		if (obj instanceof WalkingPapersKey) {
-			WalkingPapersKey smk = (WalkingPapersKey) obj;
-			if((smk.x == this.x) && (smk.y == this.y) && (smk.level == this.level)) {
-				return true;
-			}
-		}
-		return false;
-	}
-	
-	/**
-	 * @return	return new Integer(this.x + this.y * 10000).hashCode();
-	 * @see java.lang.Object#hashCode()
-	 */
-	@Override
-	public int hashCode() {
-		return new Integer(this.x + this.y * 10000 + this.level * 100000).hashCode();
-	}
-	
-	/**
-	 * @see java.lang.Object#toString()
-	 */
-	@Override
-	public String toString() {
-		return "WalkingPapersKey(x=" + this.x + ",y=" + this.y + ",level=" + level + ")";
-	}
-	
+    private final int x;
+    private final int y;
+    private final int level;
+
+    /**
+     * <p>
+     * Constructs key for hashmaps for some tile describedy by X and Y position. X and Y are tiles
+     * positions on discrete map.
+     * </p>
+     *
+     * @param x x position in tiles table
+     * @param y y position in tiles table
+     */
+    public final boolean valid;
+    public WalkingPapersKey(int level, int x, int y) {
+        this.x = x;
+        this.y = y;
+        this.level = level;
+        if (level <= 0 || x < 0 || y < 0) {
+            this.valid = false;
+            System.err.println("invalid WalkingPapersKey("+level+", "+x+", "+y+")");
+        } else {
+            this.valid = true;
+        }
+    }
+
+    /**
+     * <p>
+     * Returns true ONLY if x and y are equals.
+     * </p>
+     *
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    @Override
+    public boolean equals(Object obj) {
+        if (obj instanceof WalkingPapersKey) {
+            WalkingPapersKey smk = (WalkingPapersKey) obj;
+            if((smk.x == this.x) && (smk.y == this.y) && (smk.level == this.level)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * @return  return new Integer(this.x + this.y * 10000).hashCode();
+     * @see java.lang.Object#hashCode()
+     */
+    @Override
+    public int hashCode() {
+        return new Integer(this.x + this.y * 10000 + this.level * 100000).hashCode();
+    }
+
+    /**
+     * @see java.lang.Object#toString()
+     */
+    @Override
+    public String toString() {
+        return "WalkingPapersKey(x=" + this.x + ",y=" + this.y + ",level=" + level + ")";
+    }
+
 }
Index: /applications/editors/josm/plugins/walkingpapers/src/org/openstreetmap/josm/plugins/walkingpapers/WalkingPapersLayer.java
===================================================================
--- /applications/editors/josm/plugins/walkingpapers/src/org/openstreetmap/josm/plugins/walkingpapers/WalkingPapersLayer.java	(revision 23189)
+++ /applications/editors/josm/plugins/walkingpapers/src/org/openstreetmap/josm/plugins/walkingpapers/WalkingPapersLayer.java	(revision 23190)
@@ -36,176 +36,176 @@
  */
 public class WalkingPapersLayer extends Layer implements ImageObserver {
-	/**
-	 * Actual zoom lvl. Initial zoom lvl is set to
-	 * {@link WalkingPapersPreferences#getMinZoomLvl()}.
-	 */
-	private int currentZoomLevel;
-	private HashMap<WalkingPapersKey, WalkingPapersTile> tileStorage = null;
-
-	private Point[][] pixelpos = new Point[21][21];
-	private LatLon lastTopLeft;
-	private LatLon lastBotRight;
-	private int viewportMinX, viewportMaxX, viewportMinY, viewportMaxY;
-	private Image bufferImage;
-	private boolean needRedraw;
-
-	private int minzoom, maxzoom;
-	private Bounds printBounds;
-	private String tileUrlTemplate;
-	private String walkingPapersId;
-
-	@SuppressWarnings("serial")
-	public WalkingPapersLayer(String id, String tile, Bounds b, int minz, int maxz) {
-		super(tr("Walking Papers: {0}", id));
-		setBackgroundLayer(true);
-		walkingPapersId = id;
-
-		tileUrlTemplate = tile;
-		this.printBounds = b;
-		this.minzoom = minz; this.maxzoom = maxz;
-		currentZoomLevel = minz;
-
-		clearTileStorage();
-
-	    MapView.addLayerChangeListener(new LayerChangeListener() {
-	        public void activeLayerChange(Layer oldLayer, Layer newLayer) {
-	        	// if user changes to a walking papers layer, zoom there just as if
-	        	// it was newly added
-	        	layerAdded(newLayer);
-	        }
-
-	        public void layerAdded(Layer newLayer) {
-	        	// only do something if we are affected
-	        	if (newLayer != WalkingPapersLayer.this) return;
-	        	BoundingXYVisitor bbox = new BoundingXYVisitor();
-	        	bbox.visit(printBounds);
-	        	Main.map.mapView.recalculateCenterScale(bbox);
-	        	needRedraw = true;
-	        }
-
-	        public void layerRemoved(Layer oldLayer) {
-	        	if (oldLayer == WalkingPapersLayer.this) {
-	        		MapView.removeLayerChangeListener(this);
-	        	}
-	        }
-	    });
-	}
-
-	/**
-	 * Zoom in, go closer to map.
-	 */
-	public void increaseZoomLevel() {
-		if (currentZoomLevel < maxzoom) {
-			currentZoomLevel++;
-			needRedraw = true;
-		}
-	}
-
-	/**
-	 * Zoom out from map.
-	 */
-	public void decreaseZoomLevel() {
-		if (currentZoomLevel > minzoom) {
-			currentZoomLevel--;
-			needRedraw = true;
-		}
-	}
-
-	public void clearTileStorage() {
-		tileStorage = new HashMap<WalkingPapersKey, WalkingPapersTile>();
-		checkTileStorage();
-	}
-
-	static class TileTimeComp implements Comparator<WalkingPapersTile> {
-		public int compare(WalkingPapersTile s1, WalkingPapersTile s2) {
-			long t1 = s1.access_time();
-			long t2 = s2.access_time();
-			if (s1 == s2) return 0;
-			if (t1 == t2) {
-				t1 = s1.hashCode();
-				t2 = s2.hashCode();
-			}
-			if (t1 < t2) return -1;
-			return 1;
-		}
-	}
-
-	long lastCheck = 0;
-	/**
-	 * <p>
-	 * Check if tiles.size() is not more than max_nr_tiles. If yes, oldest tiles by timestamp
-	 * are fired out from cache.
-	 * </p>
-	 */
-	public void checkTileStorage() {
-		long now = System.currentTimeMillis();
-		if (now - lastCheck < 1000) return;
-		lastCheck = now;
-		TreeSet<WalkingPapersTile> tiles = new TreeSet<WalkingPapersTile>(new TileTimeComp());
-		tiles.addAll(tileStorage.values());
-		int max_nr_tiles = 100;
-		if (tiles.size() < max_nr_tiles) {
-			return;
-		}
-		int dropCount = tiles.size() - max_nr_tiles;;
-		for (WalkingPapersTile t : tiles) {
-			if (dropCount <= 0)
-				break;
-			t.dropImage();
-			dropCount--;
-		}
-	}
-
-	void loadSingleTile(WalkingPapersTile tile) {
-		tile.loadImage();
-		this.checkTileStorage();
-	}
-
-	/*
-	 * Attempt to approximate how much the image is
-	 * being scaled.  For instance, a 100x100 image
-	 * being scaled to 50x50 would return 0.25.
-	 */
-	Double getImageScaling(Image img, Point p0, Point p1) {
-		int realWidth = img.getWidth(this);
-		int realHeight = img.getHeight(this);
-		if (realWidth == -1 || realHeight == -1)
-				return null;
-		int drawWidth = p1.x - p0.x;
-		int drawHeight = p1.x - p0.x;
-
-		double drawArea = drawWidth * drawHeight;
-		double realArea = realWidth * realHeight;
-
-		return drawArea / realArea;
-	}
-
-	/**
-     */
-	@Override
-	public void paint(Graphics2D g, MapView mv, Bounds bounds) {
-		LatLon topLeft = mv.getLatLon(0, 0);
-		LatLon botRight = mv.getLatLon(mv.getWidth(), mv.getHeight());
-		Graphics2D oldg = g;
-
-		if (botRight.lon() == 0.0 || botRight.lat() == 0) {
-				// probably still initializing
-				return;
-		}
-		if (lastTopLeft != null && lastBotRight != null
-				&& topLeft.equalsEpsilon(lastTopLeft)
-				&& botRight.equalsEpsilon(lastBotRight) && bufferImage != null
-				&& mv.getWidth() == bufferImage.getWidth(null)
-				&& mv.getHeight() == bufferImage.getHeight(null) && !needRedraw) {
-
-			g.drawImage(bufferImage, 0, 0, null);
-			return;
-		}
-
-		needRedraw = false;
-		lastTopLeft = topLeft;
-		lastBotRight = botRight;
-		bufferImage = mv.createImage(mv.getWidth(), mv.getHeight());
-		g = (Graphics2D) bufferImage.getGraphics();
+    /**
+     * Actual zoom lvl. Initial zoom lvl is set to
+     * {@link WalkingPapersPreferences#getMinZoomLvl()}.
+     */
+    private int currentZoomLevel;
+    private HashMap<WalkingPapersKey, WalkingPapersTile> tileStorage = null;
+
+    private Point[][] pixelpos = new Point[21][21];
+    private LatLon lastTopLeft;
+    private LatLon lastBotRight;
+    private int viewportMinX, viewportMaxX, viewportMinY, viewportMaxY;
+    private Image bufferImage;
+    private boolean needRedraw;
+
+    private int minzoom, maxzoom;
+    private Bounds printBounds;
+    private String tileUrlTemplate;
+    private String walkingPapersId;
+
+    @SuppressWarnings("serial")
+    public WalkingPapersLayer(String id, String tile, Bounds b, int minz, int maxz) {
+        super(tr("Walking Papers: {0}", id));
+        setBackgroundLayer(true);
+        walkingPapersId = id;
+
+        tileUrlTemplate = tile;
+        this.printBounds = b;
+        this.minzoom = minz; this.maxzoom = maxz;
+        currentZoomLevel = minz;
+
+        clearTileStorage();
+
+        MapView.addLayerChangeListener(new LayerChangeListener() {
+            public void activeLayerChange(Layer oldLayer, Layer newLayer) {
+                // if user changes to a walking papers layer, zoom there just as if
+                // it was newly added
+                layerAdded(newLayer);
+            }
+
+            public void layerAdded(Layer newLayer) {
+                // only do something if we are affected
+                if (newLayer != WalkingPapersLayer.this) return;
+                BoundingXYVisitor bbox = new BoundingXYVisitor();
+                bbox.visit(printBounds);
+                Main.map.mapView.recalculateCenterScale(bbox);
+                needRedraw = true;
+            }
+
+            public void layerRemoved(Layer oldLayer) {
+                if (oldLayer == WalkingPapersLayer.this) {
+                    MapView.removeLayerChangeListener(this);
+                }
+            }
+        });
+    }
+
+    /**
+     * Zoom in, go closer to map.
+     */
+    public void increaseZoomLevel() {
+        if (currentZoomLevel < maxzoom) {
+            currentZoomLevel++;
+            needRedraw = true;
+        }
+    }
+
+    /**
+     * Zoom out from map.
+     */
+    public void decreaseZoomLevel() {
+        if (currentZoomLevel > minzoom) {
+            currentZoomLevel--;
+            needRedraw = true;
+        }
+    }
+
+    public void clearTileStorage() {
+        tileStorage = new HashMap<WalkingPapersKey, WalkingPapersTile>();
+        checkTileStorage();
+    }
+
+    static class TileTimeComp implements Comparator<WalkingPapersTile> {
+        public int compare(WalkingPapersTile s1, WalkingPapersTile s2) {
+            long t1 = s1.access_time();
+            long t2 = s2.access_time();
+            if (s1 == s2) return 0;
+            if (t1 == t2) {
+                t1 = s1.hashCode();
+                t2 = s2.hashCode();
+            }
+            if (t1 < t2) return -1;
+            return 1;
+        }
+    }
+
+    long lastCheck = 0;
+    /**
+     * <p>
+     * Check if tiles.size() is not more than max_nr_tiles. If yes, oldest tiles by timestamp
+     * are fired out from cache.
+     * </p>
+     */
+    public void checkTileStorage() {
+        long now = System.currentTimeMillis();
+        if (now - lastCheck < 1000) return;
+        lastCheck = now;
+        TreeSet<WalkingPapersTile> tiles = new TreeSet<WalkingPapersTile>(new TileTimeComp());
+        tiles.addAll(tileStorage.values());
+        int max_nr_tiles = 100;
+        if (tiles.size() < max_nr_tiles) {
+            return;
+        }
+        int dropCount = tiles.size() - max_nr_tiles;;
+        for (WalkingPapersTile t : tiles) {
+            if (dropCount <= 0)
+                break;
+            t.dropImage();
+            dropCount--;
+        }
+    }
+
+    void loadSingleTile(WalkingPapersTile tile) {
+        tile.loadImage();
+        this.checkTileStorage();
+    }
+
+    /*
+     * Attempt to approximate how much the image is
+     * being scaled.  For instance, a 100x100 image
+     * being scaled to 50x50 would return 0.25.
+     */
+    Double getImageScaling(Image img, Point p0, Point p1) {
+        int realWidth = img.getWidth(this);
+        int realHeight = img.getHeight(this);
+        if (realWidth == -1 || realHeight == -1)
+                return null;
+        int drawWidth = p1.x - p0.x;
+        int drawHeight = p1.x - p0.x;
+
+        double drawArea = drawWidth * drawHeight;
+        double realArea = realWidth * realHeight;
+
+        return drawArea / realArea;
+    }
+
+    /**
+     */
+    @Override
+    public void paint(Graphics2D g, MapView mv, Bounds bounds) {
+        LatLon topLeft = mv.getLatLon(0, 0);
+        LatLon botRight = mv.getLatLon(mv.getWidth(), mv.getHeight());
+        Graphics2D oldg = g;
+
+        if (botRight.lon() == 0.0 || botRight.lat() == 0) {
+                // probably still initializing
+                return;
+        }
+        if (lastTopLeft != null && lastBotRight != null
+                && topLeft.equalsEpsilon(lastTopLeft)
+                && botRight.equalsEpsilon(lastBotRight) && bufferImage != null
+                && mv.getWidth() == bufferImage.getWidth(null)
+                && mv.getHeight() == bufferImage.getHeight(null) && !needRedraw) {
+
+            g.drawImage(bufferImage, 0, 0, null);
+            return;
+        }
+
+        needRedraw = false;
+        lastTopLeft = topLeft;
+        lastBotRight = botRight;
+        bufferImage = mv.createImage(mv.getWidth(), mv.getHeight());
+        g = (Graphics2D) bufferImage.getGraphics();
 
         if (!LatLon.isValidLat(topLeft.lat())  ||
@@ -215,213 +215,213 @@
             return;
 
-		viewportMinX = lonToTileX(topLeft.lon());
-		viewportMaxX = lonToTileX(botRight.lon());
-		viewportMinY = latToTileY(topLeft.lat());
-		viewportMaxY = latToTileY(botRight.lat());
-
-		if (viewportMinX > viewportMaxX) {
-			int tmp = viewportMinX;
-			viewportMinX = viewportMaxX;
-			viewportMaxX = tmp;
-		}
-		if (viewportMinY > viewportMaxY) {
-			int tmp = viewportMinY;
-			viewportMinY = viewportMaxY;
-			viewportMaxY = tmp;
-		}
-
-		if (viewportMaxX-viewportMinX > 18) return;
-		if (viewportMaxY-viewportMinY > 18) return;
-
-		for (int x = viewportMinX - 1; x <= viewportMaxX + 1; x++) {
-			double lon = tileXToLon(x);
-			for (int y = viewportMinY - 1; y <= viewportMaxY + 1; y++) {
-				LatLon tmpLL = new LatLon(tileYToLat(y), lon);
-				pixelpos[x - viewportMinX + 1][y - viewportMinY + 1] = mv.getPoint(Main.proj
-						.latlon2eastNorth(tmpLL));
-			}
-		}
-
-		g.setColor(Color.DARK_GRAY);
-
-		Double imageScale = null;
-		int count = 0;
-
-		for (int x = viewportMinX-1; x <= viewportMaxX; x++) {
-
-			for (int y = viewportMinY-1; y <= viewportMaxY; y++) {
-				WalkingPapersKey key = new WalkingPapersKey(currentZoomLevel, x, y);
-				WalkingPapersTile tile;
-				tile = tileStorage.get(key);
-				if (!key.valid) continue;
-				if (tile == null) {
-					// check if tile is in range
-					Bounds tileBounds = new Bounds(new LatLon(tileYToLat(y+1), tileXToLon(x)),
-						new LatLon(tileYToLat(y), tileXToLon(x+1)));
-					if (!tileBounds.asRect().intersects(printBounds.asRect())) continue;
-					tile = new WalkingPapersTile(x, y, currentZoomLevel, this);
-					tileStorage.put(key, tile);
-					loadSingleTile(tile);
-					checkTileStorage();
-				}
-				Image img = tile.getImage();
-
-				if (img != null) {
-					Point p = pixelpos[x - viewportMinX + 1][y - viewportMinY + 1];
-					Point p2 = pixelpos[x - viewportMinX + 2][y - viewportMinY + 2];
-					g.drawImage(img, p.x, p.y, p2.x - p.x, p2.y - p.y, this);
-					if (imageScale == null)
-						imageScale = getImageScaling(img, p, p2);
-					count++;
-				}
-			}
-		}
-
-		if (count == 0)
-		{
-			//System.out.println("no images on " + walkingPapersId + ", return");
-			return;
-		}
-
-		oldg.drawImage(bufferImage, 0, 0, null);
-
-		if (imageScale != null) {
-			// If each source image pixel is being stretched into > 3
-			// drawn pixels, zoom in... getting too pixelated
-			if (imageScale > 3) {
-				increaseZoomLevel();
-				this.paint(oldg, mv, bounds);
-			}
-
-			// If each source image pixel is being squished into > 0.32
-			// of a drawn pixels, zoom out.
-			else if (imageScale < 0.32) {
-				decreaseZoomLevel();
-				this.paint(oldg, mv, bounds);
-			}
-		}
-	}// end of paint metod
-
-	WalkingPapersTile getTileForPixelpos(int px, int py) {
-		int tilex = viewportMaxX;
-		int tiley = viewportMaxY;
-		for (int x = viewportMinX; x <= viewportMaxX; x++) {
-			if (pixelpos[x - viewportMinX + 1][0].x > px) {
-				tilex = x - 1;
-				break;
-			}
-		}
-
-		if (tilex == -1) return null;
-
-		for (int y = viewportMinY; y <= viewportMaxY; y++) {
-			if (pixelpos[0][y - viewportMinY + 1].y > py) {
-				tiley = y - 1;
-				break;
-			}
-		}
-
-		if (tiley == -1) return null;
-
-		WalkingPapersKey key = new WalkingPapersKey(currentZoomLevel, tilex, tiley);
-		if (!key.valid) {
-			System.err.println("getTileForPixelpos("+px+","+py+") made invalid key");
-			return null;
-		}
-		WalkingPapersTile tile = tileStorage.get(key);
-		if (tile == null)
-			tileStorage.put(key, tile = new WalkingPapersTile(tilex, tiley, currentZoomLevel, this));
-		checkTileStorage();
-		return tile;
-	}
-
-	@Override
-	public Icon getIcon() {
-		return ImageProvider.get("walkingpapers");
-	}
-
-	@Override
-	public Object getInfoComponent() {
-		return getToolTipText();
-	}
-
-	@Override
-	public Action[] getMenuEntries() {
-		return new Action[] {
-				LayerListDialog.getInstance().createShowHideLayerAction(),
-				LayerListDialog.getInstance().createDeleteLayerAction(),
-				SeparatorLayerAction.INSTANCE,
-				// color,
-				// new JMenuItem(new RenameLayerAction(associatedFile, this)),
-				SeparatorLayerAction.INSTANCE,
-				new LayerListPopup.InfoAction(this) };
-	}
-
-	@Override
-	public String getToolTipText() {
-		return tr("Walking Papers layer ({0}) in zoom {1}", this.getWalkingPapersId(), currentZoomLevel);
-	}
-
-	@Override
-	public boolean isMergable(Layer other) {
-		return false;
-	}
-
-	@Override
-	public void mergeFrom(Layer from) {
-	}
-
-	@Override
-	public void visitBoundingBox(BoundingXYVisitor v) {
+        viewportMinX = lonToTileX(topLeft.lon());
+        viewportMaxX = lonToTileX(botRight.lon());
+        viewportMinY = latToTileY(topLeft.lat());
+        viewportMaxY = latToTileY(botRight.lat());
+
+        if (viewportMinX > viewportMaxX) {
+            int tmp = viewportMinX;
+            viewportMinX = viewportMaxX;
+            viewportMaxX = tmp;
+        }
+        if (viewportMinY > viewportMaxY) {
+            int tmp = viewportMinY;
+            viewportMinY = viewportMaxY;
+            viewportMaxY = tmp;
+        }
+
+        if (viewportMaxX-viewportMinX > 18) return;
+        if (viewportMaxY-viewportMinY > 18) return;
+
+        for (int x = viewportMinX - 1; x <= viewportMaxX + 1; x++) {
+            double lon = tileXToLon(x);
+            for (int y = viewportMinY - 1; y <= viewportMaxY + 1; y++) {
+                LatLon tmpLL = new LatLon(tileYToLat(y), lon);
+                pixelpos[x - viewportMinX + 1][y - viewportMinY + 1] = mv.getPoint(Main.proj
+                        .latlon2eastNorth(tmpLL));
+            }
+        }
+
+        g.setColor(Color.DARK_GRAY);
+
+        Double imageScale = null;
+        int count = 0;
+
+        for (int x = viewportMinX-1; x <= viewportMaxX; x++) {
+
+            for (int y = viewportMinY-1; y <= viewportMaxY; y++) {
+                WalkingPapersKey key = new WalkingPapersKey(currentZoomLevel, x, y);
+                WalkingPapersTile tile;
+                tile = tileStorage.get(key);
+                if (!key.valid) continue;
+                if (tile == null) {
+                    // check if tile is in range
+                    Bounds tileBounds = new Bounds(new LatLon(tileYToLat(y+1), tileXToLon(x)),
+                        new LatLon(tileYToLat(y), tileXToLon(x+1)));
+                    if (!tileBounds.asRect().intersects(printBounds.asRect())) continue;
+                    tile = new WalkingPapersTile(x, y, currentZoomLevel, this);
+                    tileStorage.put(key, tile);
+                    loadSingleTile(tile);
+                    checkTileStorage();
+                }
+                Image img = tile.getImage();
+
+                if (img != null) {
+                    Point p = pixelpos[x - viewportMinX + 1][y - viewportMinY + 1];
+                    Point p2 = pixelpos[x - viewportMinX + 2][y - viewportMinY + 2];
+                    g.drawImage(img, p.x, p.y, p2.x - p.x, p2.y - p.y, this);
+                    if (imageScale == null)
+                        imageScale = getImageScaling(img, p, p2);
+                    count++;
+                }
+            }
+        }
+
+        if (count == 0)
+        {
+            //System.out.println("no images on " + walkingPapersId + ", return");
+            return;
+        }
+
+        oldg.drawImage(bufferImage, 0, 0, null);
+
+        if (imageScale != null) {
+            // If each source image pixel is being stretched into > 3
+            // drawn pixels, zoom in... getting too pixelated
+            if (imageScale > 3) {
+                increaseZoomLevel();
+                this.paint(oldg, mv, bounds);
+            }
+
+            // If each source image pixel is being squished into > 0.32
+            // of a drawn pixels, zoom out.
+            else if (imageScale < 0.32) {
+                decreaseZoomLevel();
+                this.paint(oldg, mv, bounds);
+            }
+        }
+    }// end of paint metod
+
+    WalkingPapersTile getTileForPixelpos(int px, int py) {
+        int tilex = viewportMaxX;
+        int tiley = viewportMaxY;
+        for (int x = viewportMinX; x <= viewportMaxX; x++) {
+            if (pixelpos[x - viewportMinX + 1][0].x > px) {
+                tilex = x - 1;
+                break;
+            }
+        }
+
+        if (tilex == -1) return null;
+
+        for (int y = viewportMinY; y <= viewportMaxY; y++) {
+            if (pixelpos[0][y - viewportMinY + 1].y > py) {
+                tiley = y - 1;
+                break;
+            }
+        }
+
+        if (tiley == -1) return null;
+
+        WalkingPapersKey key = new WalkingPapersKey(currentZoomLevel, tilex, tiley);
+        if (!key.valid) {
+            System.err.println("getTileForPixelpos("+px+","+py+") made invalid key");
+            return null;
+        }
+        WalkingPapersTile tile = tileStorage.get(key);
+        if (tile == null)
+            tileStorage.put(key, tile = new WalkingPapersTile(tilex, tiley, currentZoomLevel, this));
+        checkTileStorage();
+        return tile;
+    }
+
+    @Override
+    public Icon getIcon() {
+        return ImageProvider.get("walkingpapers");
+    }
+
+    @Override
+    public Object getInfoComponent() {
+        return getToolTipText();
+    }
+
+    @Override
+    public Action[] getMenuEntries() {
+        return new Action[] {
+                LayerListDialog.getInstance().createShowHideLayerAction(),
+                LayerListDialog.getInstance().createDeleteLayerAction(),
+                SeparatorLayerAction.INSTANCE,
+                // color,
+                // new JMenuItem(new RenameLayerAction(associatedFile, this)),
+                SeparatorLayerAction.INSTANCE,
+                new LayerListPopup.InfoAction(this) };
+    }
+
+    @Override
+    public String getToolTipText() {
+        return tr("Walking Papers layer ({0}) in zoom {1}", this.getWalkingPapersId(), currentZoomLevel);
+    }
+
+    @Override
+    public boolean isMergable(Layer other) {
+        return false;
+    }
+
+    @Override
+    public void mergeFrom(Layer from) {
+    }
+
+    @Override
+    public void visitBoundingBox(BoundingXYVisitor v) {
         if (printBounds != null)
             v.visit(printBounds);
-	}
-
-	private int latToTileY(double lat) {
-		double l = lat / 180 * Math.PI;
-		double pf = Math.log(Math.tan(l) + (1 / Math.cos(l)));
-		return (int) (Math.pow(2.0, currentZoomLevel - 1) * (Math.PI - pf) / Math.PI);
-	}
-
-	private int lonToTileX(double lon) {
-		return (int) (Math.pow(2.0, currentZoomLevel - 3) * (lon + 180.0) / 45.0);
-	}
-
-	private double tileYToLat(int y) {
-		return Math.atan(Math.sinh(Math.PI
-				- (Math.PI * y / Math.pow(2.0, currentZoomLevel - 1))))
-				* 180 / Math.PI;
-	}
-
-	private double tileXToLon(int x) {
-		return x * 45.0 / Math.pow(2.0, currentZoomLevel - 3) - 180.0;
-	}
-
-	public boolean imageUpdate(Image img, int infoflags, int x, int y,
-			int width, int height) {
-		boolean done = ((infoflags & (ERROR | FRAMEBITS | ALLBITS)) != 0);
-		if ((infoflags & ERROR) != 0) return false;
-		// Repaint immediately if we are done, otherwise batch up
-		// repaint requests every 100 milliseconds
-		needRedraw = true;
-		Main.map.repaint(done ? 0 : 100);
-		return !done;
-	}
-
-	public String getWalkingPapersId() {
-		return walkingPapersId;
-	}
-
-	public URL formatImageUrl(int x, int y, int z) {
-		String urlstr = tileUrlTemplate.
-			replace("{x}", String.valueOf(x)).
-			replace("{y}", String.valueOf(y)).
-			replace("{z}", String.valueOf(z));
-		try {
-			return new URL(urlstr);
-		} catch (Exception ex) {
-			return null;
-		}
-	}
+    }
+
+    private int latToTileY(double lat) {
+        double l = lat / 180 * Math.PI;
+        double pf = Math.log(Math.tan(l) + (1 / Math.cos(l)));
+        return (int) (Math.pow(2.0, currentZoomLevel - 1) * (Math.PI - pf) / Math.PI);
+    }
+
+    private int lonToTileX(double lon) {
+        return (int) (Math.pow(2.0, currentZoomLevel - 3) * (lon + 180.0) / 45.0);
+    }
+
+    private double tileYToLat(int y) {
+        return Math.atan(Math.sinh(Math.PI
+                - (Math.PI * y / Math.pow(2.0, currentZoomLevel - 1))))
+                * 180 / Math.PI;
+    }
+
+    private double tileXToLon(int x) {
+        return x * 45.0 / Math.pow(2.0, currentZoomLevel - 3) - 180.0;
+    }
+
+    public boolean imageUpdate(Image img, int infoflags, int x, int y,
+            int width, int height) {
+        boolean done = ((infoflags & (ERROR | FRAMEBITS | ALLBITS)) != 0);
+        if ((infoflags & ERROR) != 0) return false;
+        // Repaint immediately if we are done, otherwise batch up
+        // repaint requests every 100 milliseconds
+        needRedraw = true;
+        Main.map.repaint(done ? 0 : 100);
+        return !done;
+    }
+
+    public String getWalkingPapersId() {
+        return walkingPapersId;
+    }
+
+    public URL formatImageUrl(int x, int y, int z) {
+        String urlstr = tileUrlTemplate.
+            replace("{x}", String.valueOf(x)).
+            replace("{y}", String.valueOf(y)).
+            replace("{z}", String.valueOf(z));
+        try {
+            return new URL(urlstr);
+        } catch (Exception ex) {
+            return null;
+        }
+    }
 
 }
Index: /applications/editors/josm/plugins/walkingpapers/src/org/openstreetmap/josm/plugins/walkingpapers/WalkingPapersPlugin.java
===================================================================
--- /applications/editors/josm/plugins/walkingpapers/src/org/openstreetmap/josm/plugins/walkingpapers/WalkingPapersPlugin.java	(revision 23189)
+++ /applications/editors/josm/plugins/walkingpapers/src/org/openstreetmap/josm/plugins/walkingpapers/WalkingPapersPlugin.java	(revision 23190)
@@ -26,5 +26,5 @@
     public WalkingPapersPlugin(PluginInformation info)
     {
-    	super(info);
+        super(info);
         MainMenu menu = Main.main.menu;
         walkingPapersMenu = menu.addMenu(marktr("Walking Papers"), KeyEvent.VK_K, menu.defaultMenuPos, ht("/Plugin/WalkingPapers"));
Index: /applications/editors/josm/plugins/walkingpapers/src/org/openstreetmap/josm/plugins/walkingpapers/WalkingPapersTile.java
===================================================================
--- /applications/editors/josm/plugins/walkingpapers/src/org/openstreetmap/josm/plugins/walkingpapers/WalkingPapersTile.java	(revision 23189)
+++ /applications/editors/josm/plugins/walkingpapers/src/org/openstreetmap/josm/plugins/walkingpapers/WalkingPapersTile.java	(revision 23190)
@@ -7,18 +7,18 @@
 /**
  * Class that contains information about one single slippy map tile.
- * 
+ *
  * @author Frederik Ramm <frederik@remote.org>
  * @author LuVar <lubomir.varga@freemap.sk>
  * @author Dave Hansen <dave@sr71.net>
- * 
+ *
  */
 public class WalkingPapersTile {
     private Image tileImage;
-	long timestamp;
+    long timestamp;
 
     int x;
     int y;
     int z;
-    
+
     WalkingPapersLayer parentLayer;
 
@@ -29,9 +29,9 @@
         this.z = z;
         parentLayer = parent;
-		timestamp = System.currentTimeMillis();
+        timestamp = System.currentTimeMillis();
     }
 
     public URL getImageUrl() {
-    	return parentLayer.formatImageUrl(x, y, z);
+        return parentLayer.formatImageUrl(x, y, z);
     }
 
@@ -39,6 +39,6 @@
         URL imageUrl = this.getImageUrl();
         tileImage = Toolkit.getDefaultToolkit().createImage(imageUrl);
-		Toolkit.getDefaultToolkit().sync();
-   		timestamp = System.currentTimeMillis();
+        Toolkit.getDefaultToolkit().sync();
+        timestamp = System.currentTimeMillis();
     }
 
@@ -49,8 +49,8 @@
 
     public void dropImage() {
-		tileImage = null;
-		//  This should work in theory but doesn't seem to actually
-		//  reduce the X server memory usage
-		//tileImage.flush();
+        tileImage = null;
+        //  This should work in theory but doesn't seem to actually
+        //  reduce the X server memory usage
+        //tileImage.flush();
     }
 
Index: /applications/editors/josm/plugins/waypoint_search/src/org/openstreetmap/josm/plugins/waypointSearch/Engine.java
===================================================================
--- /applications/editors/josm/plugins/waypoint_search/src/org/openstreetmap/josm/plugins/waypointSearch/Engine.java	(revision 23189)
+++ /applications/editors/josm/plugins/waypoint_search/src/org/openstreetmap/josm/plugins/waypointSearch/Engine.java	(revision 23190)
@@ -9,42 +9,42 @@
 
 public class Engine {
-	
-	public List<Marker> searchGpxWaypoints(String waypointSearchPattern) {
-		List<Marker> returnList = new ArrayList<Marker>();
-		if (gpxLayersExist()) {
-			//Loop over marker (waypoint) layers.. it could be more than one
-			for (Iterator<MarkerLayer> layerIterator = Main.map.mapView.getLayersOfType(MarkerLayer.class).iterator(); layerIterator.hasNext();) {
-				//loop over each marker (waypoint)
-				for (Iterator<Marker> markerIterator = layerIterator.next().data.iterator(); markerIterator.hasNext();) {
-					Marker marker = markerIterator.next();
-					if (Pattern.matches(".*\\Q"+waypointSearchPattern.toLowerCase()+"\\E.*", marker.getText().toLowerCase())) {
-						returnList.add(marker);
-					}
-				}				
-			}
-		} 
-		return returnList;
-	}	
-		
-		
-		
-	
+    
+    public List<Marker> searchGpxWaypoints(String waypointSearchPattern) {
+        List<Marker> returnList = new ArrayList<Marker>();
+        if (gpxLayersExist()) {
+            //Loop over marker (waypoint) layers.. it could be more than one
+            for (Iterator<MarkerLayer> layerIterator = Main.map.mapView.getLayersOfType(MarkerLayer.class).iterator(); layerIterator.hasNext();) {
+                //loop over each marker (waypoint)
+                for (Iterator<Marker> markerIterator = layerIterator.next().data.iterator(); markerIterator.hasNext();) {
+                    Marker marker = markerIterator.next();
+                    if (Pattern.matches(".*\\Q"+waypointSearchPattern.toLowerCase()+"\\E.*", marker.getText().toLowerCase())) {
+                        returnList.add(marker);
+                    }
+                }               
+            }
+        } 
+        return returnList;
+    }   
+        
+        
+        
+    
 
-	
-	
-	
+    
+    
+    
     public boolean gpxLayersExist() {
-  	  boolean rv = false;
-  	  if (Main.map != null) {
-  		  if (Main.map.mapView.hasLayers()) {
-  			  if (Main.map.mapView.getLayersOfType(MarkerLayer.class).size()>0) {
-  				  rv = true;
-  			  }
-  		  }
-  	  }
-  	  return rv;
+      boolean rv = false;
+      if (Main.map != null) {
+          if (Main.map.mapView.hasLayers()) {
+              if (Main.map.mapView.getLayersOfType(MarkerLayer.class).size()>0) {
+                  rv = true;
+              }
+          }
+      }
+      return rv;
     }
-	
-	
-	
+    
+    
+    
 }
Index: /applications/editors/josm/plugins/waypoint_search/src/org/openstreetmap/josm/plugins/waypointSearch/SelectWaypointDialog.java
===================================================================
--- /applications/editors/josm/plugins/waypoint_search/src/org/openstreetmap/josm/plugins/waypointSearch/SelectWaypointDialog.java	(revision 23189)
+++ /applications/editors/josm/plugins/waypoint_search/src/org/openstreetmap/josm/plugins/waypointSearch/SelectWaypointDialog.java	(revision 23190)
@@ -20,43 +20,43 @@
 public class SelectWaypointDialog extends ToggleDialog implements KeyListener, MouseListener {
 
-	private JTextField searchPattern = new JTextField(20);
-	private DefaultListModel listModel = new DefaultListModel();
-	private JList searchResult = new JList(listModel);
-	private List<Marker> SearchResultObjectCache = new ArrayList<Marker>();
-	private boolean first_time_search = true;
-	private Engine engine = new Engine();
-	
-	
-	public SelectWaypointDialog(String name, String iconName, String tooltip,
-			Shortcut shortcut, int preferredHeight) {
-		super(name, iconName, tooltip, shortcut, preferredHeight);
-		build();
-	}
-	
+    private JTextField searchPattern = new JTextField(20);
+    private DefaultListModel listModel = new DefaultListModel();
+    private JList searchResult = new JList(listModel);
+    private List<Marker> SearchResultObjectCache = new ArrayList<Marker>();
+    private boolean first_time_search = true;
+    private Engine engine = new Engine();
+    
+    
+    public SelectWaypointDialog(String name, String iconName, String tooltip,
+            Shortcut shortcut, int preferredHeight) {
+        super(name, iconName, tooltip, shortcut, preferredHeight);
+        build();
+    }
+    
 
     protected void build() {
-    	//add panel - all the gui of the plugin goes in here
-    	JPanel panel = new JPanel(new BorderLayout());
-    	
-    	//search field
-    	searchPattern.setText(tr("Enter search expression here.."));
-    	searchPattern.addKeyListener(this);
-    	searchPattern.addMouseListener(this);
-    	panel.add(searchPattern,BorderLayout.NORTH);
-    	
-    	//add result table
-    	searchResult.setLayoutOrientation(JList.VERTICAL);
-    	searchResult.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
-    	searchResult.addMouseListener(this);
-    	JScrollPane scrollPane = new JScrollPane(searchResult);
-    	scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
-    	panel.add(scrollPane,BorderLayout.CENTER);
-    	
-    	//add label
-    	JLabel label = new JLabel(tr("Select waypoint to move map"));
-    	panel.add(label,BorderLayout.SOUTH);
-    	
-    	//add panel to JOSM gui
-    	add(panel,BorderLayout.CENTER);
+        //add panel - all the gui of the plugin goes in here
+        JPanel panel = new JPanel(new BorderLayout());
+        
+        //search field
+        searchPattern.setText(tr("Enter search expression here.."));
+        searchPattern.addKeyListener(this);
+        searchPattern.addMouseListener(this);
+        panel.add(searchPattern,BorderLayout.NORTH);
+        
+        //add result table
+        searchResult.setLayoutOrientation(JList.VERTICAL);
+        searchResult.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+        searchResult.addMouseListener(this);
+        JScrollPane scrollPane = new JScrollPane(searchResult);
+        scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+        panel.add(scrollPane,BorderLayout.CENTER);
+        
+        //add label
+        JLabel label = new JLabel(tr("Select waypoint to move map"));
+        panel.add(label,BorderLayout.SOUTH);
+        
+        //add panel to JOSM gui
+        add(panel,BorderLayout.CENTER);
     }
 
@@ -78,15 +78,15 @@
     
 
-	@Override
-	public void keyPressed(KeyEvent arg0) {
-		// TODO Auto-generated method stub
-	}
+    @Override
+    public void keyPressed(KeyEvent arg0) {
+        // TODO Auto-generated method stub
+    }
 
 
-	@Override
-	public void keyReleased(KeyEvent arg0) {
-		// TODO Auto-generated method stub
-		updateSearchResults();
-	}
+    @Override
+    public void keyReleased(KeyEvent arg0) {
+        // TODO Auto-generated method stub
+        updateSearchResults();
+    }
 
 
@@ -97,43 +97,43 @@
 
 
-	@Override
-	public void mouseClicked(MouseEvent e) {
-		if (e.getSource()==searchResult) {
-			//click on the search result box
-			Marker marker = SearchResultObjectCache.get(searchResult.getSelectedIndex());
-			Main.map.mapView.zoomTo(marker.getCoor());
-		} else {
-			//click on the text field (input search expression)
-		}
-	}
+    @Override
+    public void mouseClicked(MouseEvent e) {
+        if (e.getSource()==searchResult) {
+            //click on the search result box
+            Marker marker = SearchResultObjectCache.get(searchResult.getSelectedIndex());
+            Main.map.mapView.zoomTo(marker.getCoor());
+        } else {
+            //click on the text field (input search expression)
+        }
+    }
 
 
-	@Override
-	public void mouseEntered(MouseEvent arg0) {
-		// TODO Auto-generated method stub
-		
-	}
+    @Override
+    public void mouseEntered(MouseEvent arg0) {
+        // TODO Auto-generated method stub
+        
+    }
 
 
-	@Override
-	public void mouseExited(MouseEvent arg0) {
-		// TODO Auto-generated method stub
-		
-	}
+    @Override
+    public void mouseExited(MouseEvent arg0) {
+        // TODO Auto-generated method stub
+        
+    }
 
 
-	@Override
-	public void mousePressed(MouseEvent arg0) {
-		if (searchPattern.getSelectedText()==null) {
-			searchPattern.selectAll();
-		}
-		
-	}
+    @Override
+    public void mousePressed(MouseEvent arg0) {
+        if (searchPattern.getSelectedText()==null) {
+            searchPattern.selectAll();
+        }
+        
+    }
 
 
-	@Override
-	public void mouseReleased(MouseEvent arg0) {
-		// TODO Auto-generated method stub
-		
-	}
+    @Override
+    public void mouseReleased(MouseEvent arg0) {
+        // TODO Auto-generated method stub
+        
+    }
 }
Index: /applications/editors/josm/plugins/waypoint_search/src/org/openstreetmap/josm/plugins/waypointSearch/WaypointSearchPlugin.java
===================================================================
--- /applications/editors/josm/plugins/waypoint_search/src/org/openstreetmap/josm/plugins/waypointSearch/WaypointSearchPlugin.java	(revision 23189)
+++ /applications/editors/josm/plugins/waypoint_search/src/org/openstreetmap/josm/plugins/waypointSearch/WaypointSearchPlugin.java	(revision 23190)
@@ -10,12 +10,12 @@
 
 public class WaypointSearchPlugin extends Plugin implements LayerChangeListener  {
-	/**
+    /**
     * Will be invoked by JOSM to bootstrap the plugin
     *
     * @param info  information about the plugin and its local installation    
     */
-	private Engine engine = new Engine();
-	private SelectWaypointDialog waypointDialog = new SelectWaypointDialog(tr("Waypoint search"), "ToolbarIcon", tr("Search after waypoint. Click and move the map view to the waypoint."), null, 100);
-	
+    private Engine engine = new Engine();
+    private SelectWaypointDialog waypointDialog = new SelectWaypointDialog(tr("Waypoint search"), "ToolbarIcon", tr("Search after waypoint. Click and move the map view to the waypoint."), null, 100);
+    
     public WaypointSearchPlugin(PluginInformation info) {
        super(info);
@@ -23,9 +23,9 @@
     }
      
-	@Override
-	public void activeLayerChange(Layer oldLayer, Layer newLayer) {
-		// TODO Auto-generated method stub
-		
-	}
+    @Override
+    public void activeLayerChange(Layer oldLayer, Layer newLayer) {
+        // TODO Auto-generated method stub
+        
+    }
 
 	
@@ -44,10 +44,10 @@
 
 
-	@Override
-	public void layerRemoved(Layer oldLayer) {
-		if (!engine.gpxLayersExist()) {
-			waypointDialog.updateSearchResults();
-		}	
-	}
+    @Override
+    public void layerRemoved(Layer oldLayer) {
+        if (!engine.gpxLayersExist()) {
+            waypointDialog.updateSearchResults();
+        }   
+    }
  
 }
Index: /applications/editors/josm/plugins/wms-turbo-challenge2/src/wmsturbochallenge/EngineSound.java
===================================================================
--- /applications/editors/josm/plugins/wms-turbo-challenge2/src/wmsturbochallenge/EngineSound.java	(revision 23189)
+++ /applications/editors/josm/plugins/wms-turbo-challenge2/src/wmsturbochallenge/EngineSound.java	(revision 23190)
@@ -17,149 +17,149 @@
 
 class engine {
-	public engine() {
-		rpm = 0.0;
-	}
+    public engine() {
+        rpm = 0.0;
+    }
 
-	public void start() {
-		rpm = 0.3;
-		speed = 0.0;
-		n = 0;
+    public void start() {
+        rpm = 0.3;
+        speed = 0.0;
+        n = 0;
 
-		if (output != null)
-			stop();
+        if (output != null)
+            stop();
 
-		AudioFormat output_format =
-			new AudioFormat(S_RATE, 16, 1, true, true);
-		DataLine.Info info =
-			new DataLine.Info(SourceDataLine.class, output_format);
+        AudioFormat output_format =
+            new AudioFormat(S_RATE, 16, 1, true, true);
+        DataLine.Info info =
+            new DataLine.Info(SourceDataLine.class, output_format);
 
-		/* Get the data line, open it and initialise the device */
-		try {
-			output = (SourceDataLine) AudioSystem.getLine(info);
-			output.open(output_format);
-			output.start();
-			frames_written = 0;
-			reschedule(0);
-		} catch (Exception e) {
-			output = null;
-			System.out.println("Audio not available: " +
-					e.getClass().getSimpleName());
-		}
-	}
+        /* Get the data line, open it and initialise the device */
+        try {
+            output = (SourceDataLine) AudioSystem.getLine(info);
+            output.open(output_format);
+            output.start();
+            frames_written = 0;
+            reschedule(0);
+        } catch (Exception e) {
+            output = null;
+            System.out.println("Audio not available: " +
+                    e.getClass().getSimpleName());
+        }
+    }
 
-	public void stop() {
-		rpm = 0.0;
-		n = 0;
+    public void stop() {
+        rpm = 0.0;
+        n = 0;
 
-		if (output == null)
-			return;
+        if (output == null)
+            return;
 
-		tick.cancel();
-		tick.purge();
+        tick.cancel();
+        tick.purge();
 
-		output.stop();
-		output.flush();
-		output.close();
-		output = null;
-	}
+        output.stop();
+        output.flush();
+        output.close();
+        output = null;
+    }
 
-	public void set_speed(double speed) {
-		/* This engine is equipped with an automatic gear box that
-		 * switches gears when the RPM becomes too high or too low.  */
-		double new_speed = Math.abs(speed);
-		double accel = new_speed - this.speed;
-		this.speed = new_speed;
+    public void set_speed(double speed) {
+        /* This engine is equipped with an automatic gear box that
+         * switches gears when the RPM becomes too high or too low.  */
+        double new_speed = Math.abs(speed);
+        double accel = new_speed - this.speed;
+        this.speed = new_speed;
 
-		if (accel > 0.05)
-			accel = 0.05;
-		else if (accel < -0.05)
-			accel = -0.05;
-		rpm += accel;
+        if (accel > 0.05)
+            accel = 0.05;
+        else if (accel < -0.05)
+            accel = -0.05;
+        rpm += accel;
 
-		if (accel > 0.0 && rpm > 1.0 + n * 0.2 && speed > 0.0) {
-			rpm = 0.3 + n * 0.2;
-			n ++;
-		} else if (accel < 0.0 && rpm < 0.3) {
-			if (n > 0) {
-				rpm = 0.7 + n * 0.1;
-				n --;
-			} else
-				rpm = 0.2;
-		}
-		if (speed < 2.0)
-			n = 0;
-	}
+        if (accel > 0.0 && rpm > 1.0 + n * 0.2 && speed > 0.0) {
+            rpm = 0.3 + n * 0.2;
+            n ++;
+        } else if (accel < 0.0 && rpm < 0.3) {
+            if (n > 0) {
+                rpm = 0.7 + n * 0.1;
+                n --;
+            } else
+                rpm = 0.2;
+        }
+        if (speed < 2.0)
+            n = 0;
+    }
 
-	public boolean is_on() {
-		return output != null;
-	}
+    public boolean is_on() {
+        return output != null;
+    }
 
-	protected double speed;
-	protected double rpm;
-	protected int n;
+    protected double speed;
+    protected double rpm;
+    protected int n;
 
-	protected SourceDataLine output = null;
-	protected long frames_written;
-	protected Timer tick = new Timer();
+    protected SourceDataLine output = null;
+    protected long frames_written;
+    protected Timer tick = new Timer();
 
-	/* Audio parameters.  */
-	protected static final int S_RATE = 44100;
-	protected static final int MIN_BUFFER = 4096;
-	protected static final double volume = 0.3;
+    /* Audio parameters.  */
+    protected static final int S_RATE = 44100;
+    protected static final int MIN_BUFFER = 4096;
+    protected static final double volume = 0.3;
 
-	protected class audio_task extends TimerTask {
-		public void run() {
-			if (output == null)
-				return;
+    protected class audio_task extends TimerTask {
+        public void run() {
+            if (output == null)
+                return;
 
-			/* If more than a two buffers left to play,
-			 * reschedule and try to wake up closer to the
-			 * end of already written data.  */
-			long frames_current = output.getLongFramePosition();
-			if (frames_current < frames_written - MIN_BUFFER * 2) {
-				reschedule(frames_current);
-				return;
-			}
+            /* If more than a two buffers left to play,
+             * reschedule and try to wake up closer to the
+             * end of already written data.  */
+            long frames_current = output.getLongFramePosition();
+            if (frames_current < frames_written - MIN_BUFFER * 2) {
+                reschedule(frames_current);
+                return;
+            }
 
-			/* Build a new buffer */
-			/* double freq = 20 * Math.pow(1.3, rpm * 5.0); */
-			double freq = (rpm - 0.1) * 160.0;
-			int wavelen = (int) (S_RATE / freq);
-			int bufferlen = MIN_BUFFER - (MIN_BUFFER % wavelen) +
-				wavelen;
-			int value = (int) (0x7fff * volume);
+            /* Build a new buffer */
+            /* double freq = 20 * Math.pow(1.3, rpm * 5.0); */
+            double freq = (rpm - 0.1) * 160.0;
+            int wavelen = (int) (S_RATE / freq);
+            int bufferlen = MIN_BUFFER - (MIN_BUFFER % wavelen) +
+                wavelen;
+            int value = (int) (0x7fff * volume);
 
-			bufferlen *= 2;
-			byte[] buffer = new byte[bufferlen];
-			for (int b = 0; b < bufferlen; ) {
-				int j;
-				for (j = wavelen / 2; j > 0; j --) {
-					buffer[b ++] = (byte) (value >> 8);
-					buffer[b ++] = (byte) (value & 0xff);
-				}
-				value = 0x10000 - value;
-				for (j = wavelen - wavelen / 2; j > 0; j --) {
-					buffer[b ++] = (byte) (value >> 8);
-					buffer[b ++] = (byte) (value & 0xff);
-				}
-				value = 0x10000 - value;
-			}
+            bufferlen *= 2;
+            byte[] buffer = new byte[bufferlen];
+            for (int b = 0; b < bufferlen; ) {
+                int j;
+                for (j = wavelen / 2; j > 0; j --) {
+                    buffer[b ++] = (byte) (value >> 8);
+                    buffer[b ++] = (byte) (value & 0xff);
+                }
+                value = 0x10000 - value;
+                for (j = wavelen - wavelen / 2; j > 0; j --) {
+                    buffer[b ++] = (byte) (value >> 8);
+                    buffer[b ++] = (byte) (value & 0xff);
+                }
+                value = 0x10000 - value;
+            }
 
-			frames_written +=
-				output.write(buffer, 0, bufferlen) / 2;
+            frames_written +=
+                output.write(buffer, 0, bufferlen) / 2;
 
-			reschedule(frames_current);
-		}
-	}
+            reschedule(frames_current);
+        }
+    }
 
-	protected void reschedule(long frames) {
-		/* Send a new buffer as close to the end of the
-		 * currently playing buffer as possible (aim at
-		 * about half into the last frame).  */
-		long delay = (frames_written - frames - MIN_BUFFER / 2) *
-			1000 / S_RATE;
-		if (delay < 0)
-			delay = 0;
-		tick.schedule(new audio_task(), delay);
-	}
+    protected void reschedule(long frames) {
+        /* Send a new buffer as close to the end of the
+         * currently playing buffer as possible (aim at
+         * about half into the last frame).  */
+        long delay = (frames_written - frames - MIN_BUFFER / 2) *
+            1000 / S_RATE;
+        if (delay < 0)
+            delay = 0;
+        tick.schedule(new audio_task(), delay);
+    }
 }
Index: /applications/editors/josm/plugins/wms-turbo-challenge2/src/wmsturbochallenge/FakeMapView.java
===================================================================
--- /applications/editors/josm/plugins/wms-turbo-challenge2/src/wmsturbochallenge/FakeMapView.java	(revision 23189)
+++ /applications/editors/josm/plugins/wms-turbo-challenge2/src/wmsturbochallenge/FakeMapView.java	(revision 23190)
@@ -26,106 +26,106 @@
 
 class fake_map_view extends MapView {
-	public ProjectionBounds view_bounds;
-	public MapView parent;
+    public ProjectionBounds view_bounds;
+    public MapView parent;
 
-	public Graphics2D graphics;
-	public BufferedImage ground_image;
-	public int ground_width = -1;
-	public int ground_height = -1;
-	public double scale;
-	public double max_east_west;
+    public Graphics2D graphics;
+    public BufferedImage ground_image;
+    public int ground_width = -1;
+    public int ground_height = -1;
+    public double scale;
+    public double max_east_west;
 
-	public fake_map_view(MapView parent, double scale) {
-		super(null); //TODO MapView constructor contains registering listeners and other code, that probably shouldn't be called in fake map view
-		this.parent = parent;
-		this.scale = scale;
+    public fake_map_view(MapView parent, double scale) {
+        super(null); //TODO MapView constructor contains registering listeners and other code, that probably shouldn't be called in fake map view
+        this.parent = parent;
+        this.scale = scale;
 
-		ProjectionBounds parent_bounds = parent.getProjectionBounds();
-		max_east_west =
-			parent_bounds.max.east() - parent_bounds.min.east();
-	}
+        ProjectionBounds parent_bounds = parent.getProjectionBounds();
+        max_east_west =
+            parent_bounds.max.east() - parent_bounds.min.east();
+    }
 
-	public void setProjectionBounds(ProjectionBounds bounds) {
-		view_bounds = bounds;
+    public void setProjectionBounds(ProjectionBounds bounds) {
+        view_bounds = bounds;
 
-		if (bounds.max.east() - bounds.min.east() > max_east_west) {
-			max_east_west = bounds.max.east() - bounds.min.east();
+        if (bounds.max.east() - bounds.min.east() > max_east_west) {
+            max_east_west = bounds.max.east() - bounds.min.east();
 
-			/* We need to set the parent MapView's bounds (i.e.
-			 * zoom level) to the same as ours max possible
-			 * bounds to avoid WMSLayer thinking we're zoomed
-			 * out more than we are or it'll pop up an annoying
-			 * "requested area is too large" popup.
-			 */
-			EastNorth parent_center = parent.getCenter();
-			parent.zoomTo(new ProjectionBounds(
-					new EastNorth(
-						parent_center.east() -
-						max_east_west / 2,
-						parent_center.north()),
-					new EastNorth(
-						parent_center.east() +
-						max_east_west / 2,
-						parent_center.north())));
+            /* We need to set the parent MapView's bounds (i.e.
+             * zoom level) to the same as ours max possible
+             * bounds to avoid WMSLayer thinking we're zoomed
+             * out more than we are or it'll pop up an annoying
+             * "requested area is too large" popup.
+             */
+            EastNorth parent_center = parent.getCenter();
+            parent.zoomTo(new ProjectionBounds(
+                    new EastNorth(
+                        parent_center.east() -
+                        max_east_west / 2,
+                        parent_center.north()),
+                    new EastNorth(
+                        parent_center.east() +
+                        max_east_west / 2,
+                        parent_center.north())));
 
-			/* Request again because NavigatableContent adds
-			 * a border just to be sure.
-			 */
-			ProjectionBounds new_bounds =
-				parent.getProjectionBounds();
-			max_east_west =
-				new_bounds.max.east() - new_bounds.min.east();
-		}
+            /* Request again because NavigatableContent adds
+             * a border just to be sure.
+             */
+            ProjectionBounds new_bounds =
+                parent.getProjectionBounds();
+            max_east_west =
+                new_bounds.max.east() - new_bounds.min.east();
+        }
 
-		Point vmin = getPoint(bounds.min);
-		Point vmax = getPoint(bounds.max);
-		int w = vmax.x + 1;
-		int h = vmin.y + 1;
+        Point vmin = getPoint(bounds.min);
+        Point vmax = getPoint(bounds.max);
+        int w = vmax.x + 1;
+        int h = vmin.y + 1;
 
-		if (w <= ground_width && h <= ground_height) {
-			graphics.setClip(0, 0, w, h);
-			return;
-		}
+        if (w <= ground_width && h <= ground_height) {
+            graphics.setClip(0, 0, w, h);
+            return;
+        }
 
-		if (w > ground_width)
-			ground_width = w;
-		if (h > ground_height)
-			ground_height = h;
+        if (w > ground_width)
+            ground_width = w;
+        if (h > ground_height)
+            ground_height = h;
 
-		ground_image = new BufferedImage(ground_width,
-				ground_height,
-				BufferedImage.TYPE_INT_RGB);
-		graphics = ground_image.createGraphics();
-		graphics.setClip(0, 0, w, h);
-	}
+        ground_image = new BufferedImage(ground_width,
+                ground_height,
+                BufferedImage.TYPE_INT_RGB);
+        graphics = ground_image.createGraphics();
+        graphics.setClip(0, 0, w, h);
+    }
 
-	public ProjectionBounds getProjectionBounds() {
-		return view_bounds;
-	}
+    public ProjectionBounds getProjectionBounds() {
+        return view_bounds;
+    }
 
-	public Point getPoint(EastNorth p) {
-		double x = p.east() - view_bounds.min.east();
-		double y = view_bounds.max.north() - p.north();
-		x /= this.scale;
-		y /= this.scale;
+    public Point getPoint(EastNorth p) {
+        double x = p.east() - view_bounds.min.east();
+        double y = view_bounds.max.north() - p.north();
+        x /= this.scale;
+        y /= this.scale;
 
-		return new Point((int) x, (int) y);
-	}
+        return new Point((int) x, (int) y);
+    }
 
-	public EastNorth getEastNorth(int x, int y) {
-		return new EastNorth(
-			view_bounds.min.east() + x * this.scale,
-			view_bounds.min.north() - y * this.scale);
-	}
+    public EastNorth getEastNorth(int x, int y) {
+        return new EastNorth(
+            view_bounds.min.east() + x * this.scale,
+            view_bounds.min.north() - y * this.scale);
+    }
 
-	public boolean isVisible(int x, int y) {
-		return true;
-	}
+    public boolean isVisible(int x, int y) {
+        return true;
+    }
 
-	public Graphics getGraphics() {
-		return graphics;
-	}
+    public Graphics getGraphics() {
+        return graphics;
+    }
 
-	public void repaint() {
-	}
+    public void repaint() {
+    }
 }
Index: /applications/editors/josm/plugins/wms-turbo-challenge2/src/wmsturbochallenge/GameWindow.java
===================================================================
--- /applications/editors/josm/plugins/wms-turbo-challenge2/src/wmsturbochallenge/GameWindow.java	(revision 23189)
+++ /applications/editors/josm/plugins/wms-turbo-challenge2/src/wmsturbochallenge/GameWindow.java	(revision 23190)
@@ -42,660 +42,660 @@
 
 public class GameWindow extends JFrame implements ActionListener {
-	public GameWindow(Layer ground) {
-		setTitle("The Ultimate WMS Super-speed Turbo Challenge II");
-		setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
-		setUndecorated(true);
-		setSize(s.getScreenSize().width, s.getScreenSize().height);
-		setLocationRelativeTo(null);
-		setResizable(false);
-
-		while (s.getScreenSize().width < width * scale ||
-				s.getScreenSize().height < height * scale)
-			scale --;
-		add(panel);
-
-		setVisible(true);
-
-		/* TODO: "Intro" screen perhaps with "Hall of Fame" */
-
-		screen_image = new BufferedImage(width, height,
-				BufferedImage.TYPE_INT_RGB);
-		screen = screen_image.getGraphics();
-
-		this.ground = ground;
-		ground_view = new fake_map_view(Main.map.mapView, 0.0000001);
-
-		/* Retrieve start position */
-		EastNorth start = ground_view.parent.getCenter();
-		lat = start.north();
-		lon = start.east();
-
-		addKeyListener(new TAdapter());
-
-		timer = new Timer(80, this);
-		timer.start();
-
-		car_gps = new gps();
-		car_gps.start();
-
-		car_engine = new engine();
-		car_engine.start();
-
-		for (int i = 0; i < maxsprites; i ++)
-			sprites[i] = new sprite_pos();
-
-		generate_sky();
-	}
-
-	protected engine car_engine;
-
-	protected gps car_gps;
-	protected class gps extends Timer implements ActionListener {
-		public gps() {
-			super(1000, null);
-			addActionListener(this);
-
-			trackSegs = new ArrayList<Collection<WayPoint>>();
-		}
-
-		protected Collection<WayPoint> segment;
-		protected Collection<Collection<WayPoint>> trackSegs;
-
-		public void actionPerformed(ActionEvent e) {
-			/* We should count the satellites here, see if we
-			 * have a fix and add any distortions.  */
-
-			segment.add(new WayPoint(Main.proj.eastNorth2latlon(
-					new EastNorth(lon, lat))));
-		}
-
-		public void start() {
-			super.start();
-
-			/* Start recording */
-			segment = new ArrayList<WayPoint>();
-			trackSegs.add(segment);
-			actionPerformed(null);
-		}
-
-		public void save_trace() {
-			int len = 0;
-			for (Collection<WayPoint> seg : trackSegs)
-				len += seg.size();
-
-			/* Don't save traces shorter than 5s */
-			if (len <= 5)
-				return;
-
-			GpxData data = new GpxData();
-			data.tracks.add(new ImmutableGpxTrack(trackSegs,
-						new HashMap<String, Object>()));
-
-			ground_view.parent.addLayer(
-					new GpxLayer(data, "Car GPS trace"));
-		}
-	}
-
-	/* These are EastNorth, not actual LatLon */
-	protected double lat, lon;
-	/* Camera's altitude above surface (same units as lat/lon above) */
-	protected double ele = 0.000003;
-	/* Cut off at ~75px from bottom of the screen */
-	protected double horizon = 0.63;
-	/* Car's distance from the camera lens */
-	protected double cardist = ele * 3;
-
-	/* Pixels per pixel, the bigger the more oldschool :-)  */
-	protected int scale = 5;
-
-	protected BufferedImage screen_image;
-	protected Graphics screen;
-	protected int width = 320;
-	protected int height = 200;
-	protected int centre = width / 2;
-
-	double maxdist = ele / (horizon - 0.6);
-	double realwidth = maxdist * width / height;
-	double pixelperlat = 1.0 * width / realwidth;
-	double sratio = 0.85;
-	protected int sw = (int) (2 * Math.PI * maxdist * pixelperlat * sratio);
-
-	/* TODO: figure out how to load these dynamically after splash
-	 * screen is shown */
-	protected static final ImageIcon car[] = new ImageIcon[] {
-	        new ImageIcon(Toolkit.getDefaultToolkit().createImage(
-					WMSRacer.class.getResource(
-						"/images/car0-l.png"))),
-	        new ImageIcon(Toolkit.getDefaultToolkit().createImage(
-					WMSRacer.class.getResource(
-						"/images/car0.png"))),
-	        new ImageIcon(Toolkit.getDefaultToolkit().createImage(
-					WMSRacer.class.getResource(
-						"/images/car0-r.png"))),
-	        new ImageIcon(Toolkit.getDefaultToolkit().createImage(
-					WMSRacer.class.getResource(
-						"/images/car1-l.png"))),
-	        new ImageIcon(Toolkit.getDefaultToolkit().createImage(
-					WMSRacer.class.getResource(
-						"/images/car1.png"))),
-	        new ImageIcon(Toolkit.getDefaultToolkit().createImage(
-					WMSRacer.class.getResource(
-						"/images/car1-r.png"))),
-	};
-	protected static final ImageIcon bg[] = new ImageIcon[] {
-	        new ImageIcon(Toolkit.getDefaultToolkit().createImage(
-					WMSRacer.class.getResource(
-						"/images/bg0.png"))),
-	};
-	protected static final ImageIcon skyline[] = new ImageIcon[] {
-	        new ImageIcon(Toolkit.getDefaultToolkit().createImage(
-					WMSRacer.class.getResource(
-						"/images/horizon.png"))),
-	};
-	protected static final ImageIcon cactus[] = new ImageIcon[] {
-	        new ImageIcon(Toolkit.getDefaultToolkit().createImage(
-					WMSRacer.class.getResource(
-						"/images/cactus0.png"))),
-	        new ImageIcon(Toolkit.getDefaultToolkit().createImage(
-					WMSRacer.class.getResource(
-						"/images/cactus1.png"))),
-	        new ImageIcon(Toolkit.getDefaultToolkit().createImage(
-					WMSRacer.class.getResource(
-						"/images/cactus2.png"))),
-	};
-	protected static final ImageIcon cloud[] = new ImageIcon[] {
-	        new ImageIcon(Toolkit.getDefaultToolkit().createImage(
-					WMSRacer.class.getResource(
-						"/images/cloud0.png"))),
-	        new ImageIcon(Toolkit.getDefaultToolkit().createImage(
-					WMSRacer.class.getResource(
-						"/images/cloud1.png"))),
-	        new ImageIcon(Toolkit.getDefaultToolkit().createImage(
-					WMSRacer.class.getResource(
-						"/images/cloud2.png"))),
-	        new ImageIcon(Toolkit.getDefaultToolkit().createImage(
-					WMSRacer.class.getResource(
-						"/images/cloud3.png"))),
-	        new ImageIcon(Toolkit.getDefaultToolkit().createImage(
-					WMSRacer.class.getResource(
-						"/images/cloud4.png"))),
-	};
-	protected static final ImageIcon aircraft[] = new ImageIcon[] {
-	        new ImageIcon(Toolkit.getDefaultToolkit().createImage(
-					WMSRacer.class.getResource(
-						"/images/aircraft0.png"))),
-	};
-	protected static final ImageIcon loading = new ImageIcon(
-			Toolkit.getDefaultToolkit().createImage(
-					WMSRacer.class.getResource(
-						"/images/loading.png")));
-	protected static Toolkit s = Toolkit.getDefaultToolkit();
-	protected int current_bg = 0;
-	protected int current_car = 0;
-	protected boolean cacti_on = true;
-	protected List<EastNorth> cacti = new ArrayList<EastNorth>();
-	protected List<EastNorth> todelete = new ArrayList<EastNorth>();
-	protected int splashframe = -1;
-	protected EastNorth splashcactus;
-
-	protected Layer ground;
-	protected double heading = 0.0;
-	protected double wheelangle = 0.0;
-	protected double speed = 0.0;
-	protected boolean key_down[] = new boolean[] {
-		false, false, false, false, };
-
-	protected void move() {
-		/* Left */
-		/* (At high speeds make more gentle turns) */
-		if (key_down[0])
-			wheelangle -= 0.1 / (1.0 + Math.abs(speed));
-		/* Right */
-		if (key_down[1])
-			wheelangle += 0.1 / (1.0 + Math.abs(speed));
-		if (wheelangle > 0.3)
-			wheelangle = 0.3; /* Radians */
-		if (wheelangle < -0.3)
-			wheelangle = -0.3;
-
-		wheelangle *= 0.7;
-
-		/* Up */
-		if (key_down[2])
-			speed += speed >= 0.0 ? 1.0 / (2.0 + speed) : 0.5;
-		/* Down */
-		if (key_down[3]) {
-			if (speed >= 0.5) /* Brake (TODO: sound) */
-				speed -= 0.5;
-			else if (speed >= 0.01) /* Brake (TODO: sound) */
-				speed = 0.0;
-			else /* Reverse */
-				speed -= 0.5 / (4.0 - speed);
-		}
-
-		speed *= 0.97;
-		car_engine.set_speed(speed);
-
-		if (speed > -0.1 && speed < 0.1)
-			speed = 0;
-
-		heading += wheelangle * speed;
-
-		boolean chop = false;
-		double newlat = lat + Math.cos(heading) * speed * ele * 0.2;
-		double newlon = lon + Math.sin(heading) * speed * ele * 0.2;
-		for (EastNorth pos : cacti) {
-			double alat = Math.abs(pos.north() - newlat);
-			double alon = Math.abs(pos.east() - newlon);
-			if (alat + alon < ele * 1.0) {
-				if (Math.abs(speed) < 2.0) {
-					if (speed > 0.0)
-						speed = -0.5;
-					else
-						speed = 0.3;
-					newlat = lat;
-					newlon = lon;
-					break;
-				}
-
-				chop = true;
-				splashframe = 0;
-				splashcactus = pos;
-				todelete.add(pos);
-			}
-		}
-
-		lat = newlat;
-		lon = newlon;
-
-		/* Seed a new cactus if we're moving.
-		 * TODO: hook into data layers and avoid putting the cactus on
-		 * the road!
-		 */
-		if (cacti_on && Math.random() * 30.0 < speed) {
-			double left_x = maxdist * (width - centre) / height;
-			double right_x = maxdist * (0 - centre) / height;
-			double x = left_x + Math.random() * (right_x - left_x);
-			double clat = lat + (maxdist - cardist) *
-				Math.cos(heading) - x * Math.sin(heading);
-			double clon = lon + (maxdist - cardist) *
-				Math.sin(heading) + x * Math.cos(heading);
-
-			cacti.add(new EastNorth(clon, clat));
-			chop = true;
-		}
-
-		/* Chop down any cactus far enough that it can't
-		 * be seen.  ``If a cactus falls in a forest and
-		 * there is nobody around did it make a sound?''
-		 */
-		if (chop) {
-			for (EastNorth pos : cacti) {
-				double alat = Math.abs(pos.north() - lat);
-				double alon = Math.abs(pos.east() - lon);
-				if (alat + alon > 2 * maxdist)
-					todelete.add(pos);
-			}
-			cacti.removeAll(todelete);
-			todelete = new ArrayList<EastNorth>();
-		}
-	}
-
-	int frame;
-	boolean downloading = false;
-	protected void screen_repaint() {
-		/* Draw background first */
-		sky_paint();
-
-		/* On top of it project the floor */
-		ground_paint();
-
-		/* Messages */
-		frame ++;
-		if ((frame & 8) == 0 && downloading)
-			screen.drawImage(loading.getImage(), centre -
-					loading.getIconWidth() / 2, 50, this);
-
-		/* Sprites */
-		sprites_paint();
-	}
-
-	static double max3(double x[]) {
-		return x[0] > x[1] ? x[2] > x[0] ? x[2] : x[0] :
-			(x[2] > x[1] ? x[2] : x[1]);
-	}
-	static double min3(double x[]) {
-		return x[0] < x[1] ? x[2] < x[0] ? x[2] : x[0] :
-			(x[2] < x[1] ? x[2] : x[1]);
-	}
-
-	protected void ground_paint() {
-		double sin = Math.sin(heading);
-		double cos = Math.cos(heading);
-
-		/* First calculate the bounding box for the visible area.
-		 * The area will be (nearly) a triangle, so calculate the
-		 * EastNorth for the three corners and make a bounding box.
-		 */
-		double left_x = maxdist * (width - centre) / height;
-		double right_x = maxdist * (0 - centre) / height;
-		double e_lat[] = new double[] {
-			lat + (maxdist - cardist) * cos - left_x * sin,
-			lat + (maxdist - cardist) * cos - right_x * sin,
-			lat - cardist * cos, };
-		double e_lon[] = new double[] {
-			lon + (maxdist - cardist) * sin + left_x * cos,
-			lon + (maxdist - cardist) * sin + right_x * cos,
-			lon - cardist * sin, };
-		ground_view.setProjectionBounds(new ProjectionBounds(
-				new EastNorth(min3(e_lon), min3(e_lat)),
-				new EastNorth(max3(e_lon), max3(e_lat))));
-
-		/* If the layer is a WMS layer, check if any tiles are
-		 * missing */
-		if (ground instanceof wmsplugin.WMSLayer) {
-			wmsplugin.WMSLayer wms = (wmsplugin.WMSLayer) ground;
-			downloading = wms.hasAutoDownload() && (
-					null == wms.findImage(new EastNorth(
-							e_lon[0], e_lat[0])) ||
-					null == wms.findImage(new EastNorth(
-							e_lon[0], e_lat[0])) ||
-					null == wms.findImage(new EastNorth(
-							e_lon[0], e_lat[0])));
-		}
-
-		/* Request the image from ground layer */
-		ground.paint(ground_view.graphics, ground_view, null);
-
-		for (int y = (int) (height * horizon + 0.1); y < height; y ++) {
-			/* Assume a 60 deg vertical Field of View when
-			 * calculating the distance at given pixel.  */
-			double dist = ele / (1.0 * y / height - 0.6);
-			double lat_off = lat + (dist - cardist) * cos;
-			double lon_off = lon + (dist - cardist) * sin;
-
-			for (int x = 0; x < width; x ++) {
-				double p_x = dist * (x - centre) / height;
-
-				EastNorth en = new EastNorth(
-						lon_off + p_x * cos,
-						lat_off - p_x * sin);
-
-				Point pt = ground_view.getPoint(en);
-
-				int rgb = ground_view.ground_image.getRGB(
-						pt.x, pt.y);
-				screen_image.setRGB(x, y, rgb);
-			}
-		}
-	}
-
-	protected BufferedImage sky_image;
-	protected Graphics sky;
-	public void generate_sky() {
-		sky_image = new BufferedImage(sw, 70,
-				BufferedImage.TYPE_INT_ARGB);
-		sky = sky_image.getGraphics();
-
-		int n = (int) (Math.random() * sw * 0.03);
-		for (int i = 0; i < n; i ++) {
-			int t = (int) (Math.random() * 5.0);
-			int x = (int) (Math.random() *
-					(sw - cloud[t].getIconWidth()));
-			int y = (int) ((1 - Math.random() * Math.random()) *
-					(70 - cloud[t].getIconHeight()));
-			sky.drawImage(cloud[t].getImage(), x, y, this);
-		}
-
-		if (Math.random() < 0.5) {
-			int t = 0;
-			int x = (int) (300 + Math.random() * (sw - 500 -
-						aircraft[t].getIconWidth()));
-			sky.drawImage(aircraft[t].getImage(), x, 0, this);
-		}
-	}
-
-	public void sky_paint() {
-		/* for x -> 0, lim sin(x) / x = 1 */
-		int hx = (int) (-heading * maxdist * pixelperlat);
-		int hw = skyline[current_bg].getIconWidth();
-		hx = ((hx % hw) - hw) % hw;
-
-		int sx = (int) (-heading * maxdist * pixelperlat * sratio);
-		sx = ((sx % sw) - sw) % sw;
-
-		screen.drawImage(bg[current_bg].getImage(), 0, 0, this);
-		screen.drawImage(sky_image, sx, 50, this);
-		if (sw + sx < width)
-			screen.drawImage(sky_image, sx + sw, 50, this);
-		screen.drawImage(skyline[current_bg].getImage(), hx, 66, this);
-		if (hw + hx < width)
-			screen.drawImage(skyline[current_bg].getImage(),
-					hx + hw, 66, this);
-	}
-
-	protected class sprite_pos implements Comparable {
-		double dist;
-
-		int x, y, sx, sy;
-		Image sprite;
-
-		public sprite_pos() {
-		}
-
-		public int compareTo(Object x) {
-			sprite_pos other = (sprite_pos) x;
-			return (int) ((other.dist - this.dist) * 1000000.0);
-		}
-	}
-
-	/* sizes decides how many zoom levels the sprites have.  We
-	 * could do just normal scalling according to distance but
-	 * that's not what old games did, they had prescaled sprites
-	 * for the different distances and you could see the feature
-	 * grow discretely as you approached it.  */
-	protected final static int sizes = 8;
-
-	protected final static int maxsprites = 32;
-	protected sprite_pos sprites[] = new sprite_pos[maxsprites];
-
-	protected void sprites_paint() {
-		/* The vehicle */
-		int orientation = (wheelangle > -0.02 ? wheelangle < 0.02 ?
-				1 : 2 : 0) + current_car * 3;
-		sprites[0].sprite = car[orientation].getImage();
-		sprites[0].dist = cardist;
-		sprites[0].sx = car[orientation].getIconWidth();
-		sprites[0].x = centre - sprites[0].sx / 2;
-		sprites[0].sy = car[orientation].getIconHeight();
-		sprites[0].y = height - sprites[0].sy - 10; /* TODO */
-
-		/* The cacti */
-		double sin = Math.sin(-heading);
-		double cos = Math.cos(-heading);
-		int i = 1;
-
-		for (EastNorth ll : cacti) {
-			double clat = ll.north() - lat;
-			double clon = ll.east() - lon;
-			double dist = (clat * cos - clon * sin) + cardist;
-			double p_x = clat * sin + clon * cos;
-
-			if (dist * 8 <= cardist || dist > maxdist)
-				continue;
-
-			int x = (int) (p_x * height / dist + centre);
-			int y = (int) ((ele / dist + 0.6) * height);
-
-			if (i >= maxsprites)
-				break;
-			if (x < -10 || x > width + 10)
-				continue;
-
-			int type = (((int) (ll.north() * 10000000.0) & 31) % 3);
-			int sx = cactus[type].getIconWidth();
-			int sy = cactus[type].getIconHeight();
-
-			sprite_pos pos = sprites[i ++];
-			pos.dist = dist;
-			pos.sprite = cactus[type].getImage();
-			pos.sx = (int) (sx * cardist * 0.7 / dist);
-			pos.sy = (int) (sy * cardist * 0.7 / dist);
-			pos.x = x - pos.sx / 2;
-			pos.y = y - pos.sy;
-		}
-
-		Arrays.sort(sprites, 0, i);
-		for (sprite_pos sprite : sprites)
-			if (i --> 0)
-				screen.drawImage(sprite.sprite,
-						sprite.x, sprite.y,
-						sprite.sx, sprite.sy, this);
-			else
-				break;
-
-		if (splashframe >= 0) {
-			splashframe ++;
-			if (splashframe >= 8)
-				splashframe = -1;
-
-			int type = (((int) (splashcactus.north() *
-							10000000.0) & 31) % 3);
-			int sx = cactus[type].getIconWidth();
-			int sy = cactus[type].getIconHeight();
-			Image image = cactus[type].getImage();
-
-			for (i = 0; i < 50; i ++) {
-				int x = (int) (Math.random() * sx);
-				int y = (int) (Math.random() * sy);
-				int w = (int) (Math.random() * 20);
-				int h = (int) (Math.random() * 20);
-				int nx = centre + splashframe * (x - sx / 2);
-				int ny = height - splashframe * (sy - y);
-				int nw = w + splashframe;
-				int nh = h + splashframe;
-
-				screen.drawImage(image,
-						nx, ny, nx + nw, ny + nh,
-						x, y, x + w, y + h, this);
-			}
-		}
-	}
-
-	public boolean no_super_repaint = false;
-	protected class GamePanel extends JPanel {
-		public GamePanel() {
-			setBackground(Color.BLACK);
-			setDoubleBuffered(true);
-		}
-
-		public void paint(Graphics g) {
-			int w = (int) getSize().getWidth();
-			int h = (int) getSize().getHeight();
-
-			if (no_super_repaint)
-				no_super_repaint = false;
-			else
-				super.paint(g);
-
-			g.drawImage(screen_image, (w - width * scale) / 2,
-					(h - height * scale) / 2,
-					width * scale, height * scale, this);
-
-			Toolkit.getDefaultToolkit().sync();
-		}
-	}
-	JPanel panel = new GamePanel();
-
-	protected void quit() {
-		timer.stop();
-
-		car_engine.stop();
-
-		car_gps.stop();
-		car_gps.save_trace();
-
-		setVisible(false);
-		panel = null;
-		screen_image = null;
-		screen = null;
-		dispose();
-	}
-
-	/*
-	 * Supposedly a thread drawing frames and sleeping in a loop is
-	 * better than for animating than swing Timers.  For the moment
-	 * I'll use a timer because I don't want to deal with all the
-	 * potential threading issues.
-	 */
-	protected Timer timer;
-	public void actionPerformed(ActionEvent e) {
-		move();
-		screen_repaint();
-
-		no_super_repaint = true;
-		panel.repaint();
-	}
-
-	protected class TAdapter extends KeyAdapter {
-		public void keyPressed(KeyEvent e) {
-			int key = e.getKeyCode();
-
-			if (key == KeyEvent.VK_LEFT && !key_down[0]) {
-				wheelangle -= 0.02;
-				key_down[0] = true;
-			}
-
-			if (key == KeyEvent.VK_RIGHT && !key_down[1]) {
-				wheelangle += 0.02;
-				key_down[1] = true;
-			}
-
-			if (key == KeyEvent.VK_UP)
-				key_down[2] = true;
-
-			if (key == KeyEvent.VK_DOWN)
-				key_down[3] = true;
-
-			if (key == KeyEvent.VK_ESCAPE)
-				quit();
-
-			/* Toggle sound */
-			if (key == KeyEvent.VK_S) {
-				if (car_engine.is_on())
-					car_engine.stop();
-				else
-					car_engine.start();
-			}
-
-			/* Toggle cacti */
-			if (key == KeyEvent.VK_C) {
-				cacti_on = !cacti_on;
-				if (!cacti_on)
-					cacti = new ArrayList<EastNorth>();
-			}
-
-			/* Switch vehicle */
-			if (key == KeyEvent.VK_V)
-				if (current_car ++>= 1)
-					current_car = 0;
-		}
-
-		public void keyReleased(KeyEvent e) {
-			int key = e.getKeyCode();
-
-			if (key == KeyEvent.VK_LEFT)
-				key_down[0] = false;
-
-			if (key == KeyEvent.VK_RIGHT)
-				key_down[1] = false;
-
-			if (key == KeyEvent.VK_UP)
-				key_down[2] = false;
-
-			if (key == KeyEvent.VK_DOWN)
-				key_down[3] = false;
-		}
-	}
-	protected fake_map_view ground_view;
+    public GameWindow(Layer ground) {
+        setTitle("The Ultimate WMS Super-speed Turbo Challenge II");
+        setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+        setUndecorated(true);
+        setSize(s.getScreenSize().width, s.getScreenSize().height);
+        setLocationRelativeTo(null);
+        setResizable(false);
+
+        while (s.getScreenSize().width < width * scale ||
+                s.getScreenSize().height < height * scale)
+            scale --;
+        add(panel);
+
+        setVisible(true);
+
+        /* TODO: "Intro" screen perhaps with "Hall of Fame" */
+
+        screen_image = new BufferedImage(width, height,
+                BufferedImage.TYPE_INT_RGB);
+        screen = screen_image.getGraphics();
+
+        this.ground = ground;
+        ground_view = new fake_map_view(Main.map.mapView, 0.0000001);
+
+        /* Retrieve start position */
+        EastNorth start = ground_view.parent.getCenter();
+        lat = start.north();
+        lon = start.east();
+
+        addKeyListener(new TAdapter());
+
+        timer = new Timer(80, this);
+        timer.start();
+
+        car_gps = new gps();
+        car_gps.start();
+
+        car_engine = new engine();
+        car_engine.start();
+
+        for (int i = 0; i < maxsprites; i ++)
+            sprites[i] = new sprite_pos();
+
+        generate_sky();
+    }
+
+    protected engine car_engine;
+
+    protected gps car_gps;
+    protected class gps extends Timer implements ActionListener {
+        public gps() {
+            super(1000, null);
+            addActionListener(this);
+
+            trackSegs = new ArrayList<Collection<WayPoint>>();
+        }
+
+        protected Collection<WayPoint> segment;
+        protected Collection<Collection<WayPoint>> trackSegs;
+
+        public void actionPerformed(ActionEvent e) {
+            /* We should count the satellites here, see if we
+             * have a fix and add any distortions.  */
+
+            segment.add(new WayPoint(Main.proj.eastNorth2latlon(
+                    new EastNorth(lon, lat))));
+        }
+
+        public void start() {
+            super.start();
+
+            /* Start recording */
+            segment = new ArrayList<WayPoint>();
+            trackSegs.add(segment);
+            actionPerformed(null);
+        }
+
+        public void save_trace() {
+            int len = 0;
+            for (Collection<WayPoint> seg : trackSegs)
+                len += seg.size();
+
+            /* Don't save traces shorter than 5s */
+            if (len <= 5)
+                return;
+
+            GpxData data = new GpxData();
+            data.tracks.add(new ImmutableGpxTrack(trackSegs,
+                        new HashMap<String, Object>()));
+
+            ground_view.parent.addLayer(
+                    new GpxLayer(data, "Car GPS trace"));
+        }
+    }
+
+    /* These are EastNorth, not actual LatLon */
+    protected double lat, lon;
+    /* Camera's altitude above surface (same units as lat/lon above) */
+    protected double ele = 0.000003;
+    /* Cut off at ~75px from bottom of the screen */
+    protected double horizon = 0.63;
+    /* Car's distance from the camera lens */
+    protected double cardist = ele * 3;
+
+    /* Pixels per pixel, the bigger the more oldschool :-)  */
+    protected int scale = 5;
+
+    protected BufferedImage screen_image;
+    protected Graphics screen;
+    protected int width = 320;
+    protected int height = 200;
+    protected int centre = width / 2;
+
+    double maxdist = ele / (horizon - 0.6);
+    double realwidth = maxdist * width / height;
+    double pixelperlat = 1.0 * width / realwidth;
+    double sratio = 0.85;
+    protected int sw = (int) (2 * Math.PI * maxdist * pixelperlat * sratio);
+
+    /* TODO: figure out how to load these dynamically after splash
+     * screen is shown */
+    protected static final ImageIcon car[] = new ImageIcon[] {
+            new ImageIcon(Toolkit.getDefaultToolkit().createImage(
+                    WMSRacer.class.getResource(
+                        "/images/car0-l.png"))),
+            new ImageIcon(Toolkit.getDefaultToolkit().createImage(
+                    WMSRacer.class.getResource(
+                        "/images/car0.png"))),
+            new ImageIcon(Toolkit.getDefaultToolkit().createImage(
+                    WMSRacer.class.getResource(
+                        "/images/car0-r.png"))),
+            new ImageIcon(Toolkit.getDefaultToolkit().createImage(
+                    WMSRacer.class.getResource(
+                        "/images/car1-l.png"))),
+            new ImageIcon(Toolkit.getDefaultToolkit().createImage(
+                    WMSRacer.class.getResource(
+                        "/images/car1.png"))),
+            new ImageIcon(Toolkit.getDefaultToolkit().createImage(
+                    WMSRacer.class.getResource(
+                        "/images/car1-r.png"))),
+    };
+    protected static final ImageIcon bg[] = new ImageIcon[] {
+            new ImageIcon(Toolkit.getDefaultToolkit().createImage(
+                    WMSRacer.class.getResource(
+                        "/images/bg0.png"))),
+    };
+    protected static final ImageIcon skyline[] = new ImageIcon[] {
+            new ImageIcon(Toolkit.getDefaultToolkit().createImage(
+                    WMSRacer.class.getResource(
+                        "/images/horizon.png"))),
+    };
+    protected static final ImageIcon cactus[] = new ImageIcon[] {
+            new ImageIcon(Toolkit.getDefaultToolkit().createImage(
+                    WMSRacer.class.getResource(
+                        "/images/cactus0.png"))),
+            new ImageIcon(Toolkit.getDefaultToolkit().createImage(
+                    WMSRacer.class.getResource(
+                        "/images/cactus1.png"))),
+            new ImageIcon(Toolkit.getDefaultToolkit().createImage(
+                    WMSRacer.class.getResource(
+                        "/images/cactus2.png"))),
+    };
+    protected static final ImageIcon cloud[] = new ImageIcon[] {
+            new ImageIcon(Toolkit.getDefaultToolkit().createImage(
+                    WMSRacer.class.getResource(
+                        "/images/cloud0.png"))),
+            new ImageIcon(Toolkit.getDefaultToolkit().createImage(
+                    WMSRacer.class.getResource(
+                        "/images/cloud1.png"))),
+            new ImageIcon(Toolkit.getDefaultToolkit().createImage(
+                    WMSRacer.class.getResource(
+                        "/images/cloud2.png"))),
+            new ImageIcon(Toolkit.getDefaultToolkit().createImage(
+                    WMSRacer.class.getResource(
+                        "/images/cloud3.png"))),
+            new ImageIcon(Toolkit.getDefaultToolkit().createImage(
+                    WMSRacer.class.getResource(
+                        "/images/cloud4.png"))),
+    };
+    protected static final ImageIcon aircraft[] = new ImageIcon[] {
+            new ImageIcon(Toolkit.getDefaultToolkit().createImage(
+                    WMSRacer.class.getResource(
+                        "/images/aircraft0.png"))),
+    };
+    protected static final ImageIcon loading = new ImageIcon(
+            Toolkit.getDefaultToolkit().createImage(
+                    WMSRacer.class.getResource(
+                        "/images/loading.png")));
+    protected static Toolkit s = Toolkit.getDefaultToolkit();
+    protected int current_bg = 0;
+    protected int current_car = 0;
+    protected boolean cacti_on = true;
+    protected List<EastNorth> cacti = new ArrayList<EastNorth>();
+    protected List<EastNorth> todelete = new ArrayList<EastNorth>();
+    protected int splashframe = -1;
+    protected EastNorth splashcactus;
+
+    protected Layer ground;
+    protected double heading = 0.0;
+    protected double wheelangle = 0.0;
+    protected double speed = 0.0;
+    protected boolean key_down[] = new boolean[] {
+        false, false, false, false, };
+
+    protected void move() {
+        /* Left */
+        /* (At high speeds make more gentle turns) */
+        if (key_down[0])
+            wheelangle -= 0.1 / (1.0 + Math.abs(speed));
+        /* Right */
+        if (key_down[1])
+            wheelangle += 0.1 / (1.0 + Math.abs(speed));
+        if (wheelangle > 0.3)
+            wheelangle = 0.3; /* Radians */
+        if (wheelangle < -0.3)
+            wheelangle = -0.3;
+
+        wheelangle *= 0.7;
+
+        /* Up */
+        if (key_down[2])
+            speed += speed >= 0.0 ? 1.0 / (2.0 + speed) : 0.5;
+        /* Down */
+        if (key_down[3]) {
+            if (speed >= 0.5) /* Brake (TODO: sound) */
+                speed -= 0.5;
+            else if (speed >= 0.01) /* Brake (TODO: sound) */
+                speed = 0.0;
+            else /* Reverse */
+                speed -= 0.5 / (4.0 - speed);
+        }
+
+        speed *= 0.97;
+        car_engine.set_speed(speed);
+
+        if (speed > -0.1 && speed < 0.1)
+            speed = 0;
+
+        heading += wheelangle * speed;
+
+        boolean chop = false;
+        double newlat = lat + Math.cos(heading) * speed * ele * 0.2;
+        double newlon = lon + Math.sin(heading) * speed * ele * 0.2;
+        for (EastNorth pos : cacti) {
+            double alat = Math.abs(pos.north() - newlat);
+            double alon = Math.abs(pos.east() - newlon);
+            if (alat + alon < ele * 1.0) {
+                if (Math.abs(speed) < 2.0) {
+                    if (speed > 0.0)
+                        speed = -0.5;
+                    else
+                        speed = 0.3;
+                    newlat = lat;
+                    newlon = lon;
+                    break;
+                }
+
+                chop = true;
+                splashframe = 0;
+                splashcactus = pos;
+                todelete.add(pos);
+            }
+        }
+
+        lat = newlat;
+        lon = newlon;
+
+        /* Seed a new cactus if we're moving.
+         * TODO: hook into data layers and avoid putting the cactus on
+         * the road!
+         */
+        if (cacti_on && Math.random() * 30.0 < speed) {
+            double left_x = maxdist * (width - centre) / height;
+            double right_x = maxdist * (0 - centre) / height;
+            double x = left_x + Math.random() * (right_x - left_x);
+            double clat = lat + (maxdist - cardist) *
+                Math.cos(heading) - x * Math.sin(heading);
+            double clon = lon + (maxdist - cardist) *
+                Math.sin(heading) + x * Math.cos(heading);
+
+            cacti.add(new EastNorth(clon, clat));
+            chop = true;
+        }
+
+        /* Chop down any cactus far enough that it can't
+         * be seen.  ``If a cactus falls in a forest and
+         * there is nobody around did it make a sound?''
+         */
+        if (chop) {
+            for (EastNorth pos : cacti) {
+                double alat = Math.abs(pos.north() - lat);
+                double alon = Math.abs(pos.east() - lon);
+                if (alat + alon > 2 * maxdist)
+                    todelete.add(pos);
+            }
+            cacti.removeAll(todelete);
+            todelete = new ArrayList<EastNorth>();
+        }
+    }
+
+    int frame;
+    boolean downloading = false;
+    protected void screen_repaint() {
+        /* Draw background first */
+        sky_paint();
+
+        /* On top of it project the floor */
+        ground_paint();
+
+        /* Messages */
+        frame ++;
+        if ((frame & 8) == 0 && downloading)
+            screen.drawImage(loading.getImage(), centre -
+                    loading.getIconWidth() / 2, 50, this);
+
+        /* Sprites */
+        sprites_paint();
+    }
+
+    static double max3(double x[]) {
+        return x[0] > x[1] ? x[2] > x[0] ? x[2] : x[0] :
+            (x[2] > x[1] ? x[2] : x[1]);
+    }
+    static double min3(double x[]) {
+        return x[0] < x[1] ? x[2] < x[0] ? x[2] : x[0] :
+            (x[2] < x[1] ? x[2] : x[1]);
+    }
+
+    protected void ground_paint() {
+        double sin = Math.sin(heading);
+        double cos = Math.cos(heading);
+
+        /* First calculate the bounding box for the visible area.
+         * The area will be (nearly) a triangle, so calculate the
+         * EastNorth for the three corners and make a bounding box.
+         */
+        double left_x = maxdist * (width - centre) / height;
+        double right_x = maxdist * (0 - centre) / height;
+        double e_lat[] = new double[] {
+            lat + (maxdist - cardist) * cos - left_x * sin,
+            lat + (maxdist - cardist) * cos - right_x * sin,
+            lat - cardist * cos, };
+        double e_lon[] = new double[] {
+            lon + (maxdist - cardist) * sin + left_x * cos,
+            lon + (maxdist - cardist) * sin + right_x * cos,
+            lon - cardist * sin, };
+        ground_view.setProjectionBounds(new ProjectionBounds(
+                new EastNorth(min3(e_lon), min3(e_lat)),
+                new EastNorth(max3(e_lon), max3(e_lat))));
+
+        /* If the layer is a WMS layer, check if any tiles are
+         * missing */
+        if (ground instanceof wmsplugin.WMSLayer) {
+            wmsplugin.WMSLayer wms = (wmsplugin.WMSLayer) ground;
+            downloading = wms.hasAutoDownload() && (
+                    null == wms.findImage(new EastNorth(
+                            e_lon[0], e_lat[0])) ||
+                    null == wms.findImage(new EastNorth(
+                            e_lon[0], e_lat[0])) ||
+                    null == wms.findImage(new EastNorth(
+                            e_lon[0], e_lat[0])));
+        }
+
+        /* Request the image from ground layer */
+        ground.paint(ground_view.graphics, ground_view, null);
+
+        for (int y = (int) (height * horizon + 0.1); y < height; y ++) {
+            /* Assume a 60 deg vertical Field of View when
+             * calculating the distance at given pixel.  */
+            double dist = ele / (1.0 * y / height - 0.6);
+            double lat_off = lat + (dist - cardist) * cos;
+            double lon_off = lon + (dist - cardist) * sin;
+
+            for (int x = 0; x < width; x ++) {
+                double p_x = dist * (x - centre) / height;
+
+                EastNorth en = new EastNorth(
+                        lon_off + p_x * cos,
+                        lat_off - p_x * sin);
+
+                Point pt = ground_view.getPoint(en);
+
+                int rgb = ground_view.ground_image.getRGB(
+                        pt.x, pt.y);
+                screen_image.setRGB(x, y, rgb);
+            }
+        }
+    }
+
+    protected BufferedImage sky_image;
+    protected Graphics sky;
+    public void generate_sky() {
+        sky_image = new BufferedImage(sw, 70,
+                BufferedImage.TYPE_INT_ARGB);
+        sky = sky_image.getGraphics();
+
+        int n = (int) (Math.random() * sw * 0.03);
+        for (int i = 0; i < n; i ++) {
+            int t = (int) (Math.random() * 5.0);
+            int x = (int) (Math.random() *
+                    (sw - cloud[t].getIconWidth()));
+            int y = (int) ((1 - Math.random() * Math.random()) *
+                    (70 - cloud[t].getIconHeight()));
+            sky.drawImage(cloud[t].getImage(), x, y, this);
+        }
+
+        if (Math.random() < 0.5) {
+            int t = 0;
+            int x = (int) (300 + Math.random() * (sw - 500 -
+                        aircraft[t].getIconWidth()));
+            sky.drawImage(aircraft[t].getImage(), x, 0, this);
+        }
+    }
+
+    public void sky_paint() {
+        /* for x -> 0, lim sin(x) / x = 1 */
+        int hx = (int) (-heading * maxdist * pixelperlat);
+        int hw = skyline[current_bg].getIconWidth();
+        hx = ((hx % hw) - hw) % hw;
+
+        int sx = (int) (-heading * maxdist * pixelperlat * sratio);
+        sx = ((sx % sw) - sw) % sw;
+
+        screen.drawImage(bg[current_bg].getImage(), 0, 0, this);
+        screen.drawImage(sky_image, sx, 50, this);
+        if (sw + sx < width)
+            screen.drawImage(sky_image, sx + sw, 50, this);
+        screen.drawImage(skyline[current_bg].getImage(), hx, 66, this);
+        if (hw + hx < width)
+            screen.drawImage(skyline[current_bg].getImage(),
+                    hx + hw, 66, this);
+    }
+
+    protected class sprite_pos implements Comparable {
+        double dist;
+
+        int x, y, sx, sy;
+        Image sprite;
+
+        public sprite_pos() {
+        }
+
+        public int compareTo(Object x) {
+            sprite_pos other = (sprite_pos) x;
+            return (int) ((other.dist - this.dist) * 1000000.0);
+        }
+    }
+
+    /* sizes decides how many zoom levels the sprites have.  We
+     * could do just normal scalling according to distance but
+     * that's not what old games did, they had prescaled sprites
+     * for the different distances and you could see the feature
+     * grow discretely as you approached it.  */
+    protected final static int sizes = 8;
+
+    protected final static int maxsprites = 32;
+    protected sprite_pos sprites[] = new sprite_pos[maxsprites];
+
+    protected void sprites_paint() {
+        /* The vehicle */
+        int orientation = (wheelangle > -0.02 ? wheelangle < 0.02 ?
+                1 : 2 : 0) + current_car * 3;
+        sprites[0].sprite = car[orientation].getImage();
+        sprites[0].dist = cardist;
+        sprites[0].sx = car[orientation].getIconWidth();
+        sprites[0].x = centre - sprites[0].sx / 2;
+        sprites[0].sy = car[orientation].getIconHeight();
+        sprites[0].y = height - sprites[0].sy - 10; /* TODO */
+
+        /* The cacti */
+        double sin = Math.sin(-heading);
+        double cos = Math.cos(-heading);
+        int i = 1;
+
+        for (EastNorth ll : cacti) {
+            double clat = ll.north() - lat;
+            double clon = ll.east() - lon;
+            double dist = (clat * cos - clon * sin) + cardist;
+            double p_x = clat * sin + clon * cos;
+
+            if (dist * 8 <= cardist || dist > maxdist)
+                continue;
+
+            int x = (int) (p_x * height / dist + centre);
+            int y = (int) ((ele / dist + 0.6) * height);
+
+            if (i >= maxsprites)
+                break;
+            if (x < -10 || x > width + 10)
+                continue;
+
+            int type = (((int) (ll.north() * 10000000.0) & 31) % 3);
+            int sx = cactus[type].getIconWidth();
+            int sy = cactus[type].getIconHeight();
+
+            sprite_pos pos = sprites[i ++];
+            pos.dist = dist;
+            pos.sprite = cactus[type].getImage();
+            pos.sx = (int) (sx * cardist * 0.7 / dist);
+            pos.sy = (int) (sy * cardist * 0.7 / dist);
+            pos.x = x - pos.sx / 2;
+            pos.y = y - pos.sy;
+        }
+
+        Arrays.sort(sprites, 0, i);
+        for (sprite_pos sprite : sprites)
+            if (i --> 0)
+                screen.drawImage(sprite.sprite,
+                        sprite.x, sprite.y,
+                        sprite.sx, sprite.sy, this);
+            else
+                break;
+
+        if (splashframe >= 0) {
+            splashframe ++;
+            if (splashframe >= 8)
+                splashframe = -1;
+
+            int type = (((int) (splashcactus.north() *
+                            10000000.0) & 31) % 3);
+            int sx = cactus[type].getIconWidth();
+            int sy = cactus[type].getIconHeight();
+            Image image = cactus[type].getImage();
+
+            for (i = 0; i < 50; i ++) {
+                int x = (int) (Math.random() * sx);
+                int y = (int) (Math.random() * sy);
+                int w = (int) (Math.random() * 20);
+                int h = (int) (Math.random() * 20);
+                int nx = centre + splashframe * (x - sx / 2);
+                int ny = height - splashframe * (sy - y);
+                int nw = w + splashframe;
+                int nh = h + splashframe;
+
+                screen.drawImage(image,
+                        nx, ny, nx + nw, ny + nh,
+                        x, y, x + w, y + h, this);
+            }
+        }
+    }
+
+    public boolean no_super_repaint = false;
+    protected class GamePanel extends JPanel {
+        public GamePanel() {
+            setBackground(Color.BLACK);
+            setDoubleBuffered(true);
+        }
+
+        public void paint(Graphics g) {
+            int w = (int) getSize().getWidth();
+            int h = (int) getSize().getHeight();
+
+            if (no_super_repaint)
+                no_super_repaint = false;
+            else
+                super.paint(g);
+
+            g.drawImage(screen_image, (w - width * scale) / 2,
+                    (h - height * scale) / 2,
+                    width * scale, height * scale, this);
+
+            Toolkit.getDefaultToolkit().sync();
+        }
+    }
+    JPanel panel = new GamePanel();
+
+    protected void quit() {
+        timer.stop();
+
+        car_engine.stop();
+
+        car_gps.stop();
+        car_gps.save_trace();
+
+        setVisible(false);
+        panel = null;
+        screen_image = null;
+        screen = null;
+        dispose();
+    }
+
+    /*
+     * Supposedly a thread drawing frames and sleeping in a loop is
+     * better than for animating than swing Timers.  For the moment
+     * I'll use a timer because I don't want to deal with all the
+     * potential threading issues.
+     */
+    protected Timer timer;
+    public void actionPerformed(ActionEvent e) {
+        move();
+        screen_repaint();
+
+        no_super_repaint = true;
+        panel.repaint();
+    }
+
+    protected class TAdapter extends KeyAdapter {
+        public void keyPressed(KeyEvent e) {
+            int key = e.getKeyCode();
+
+            if (key == KeyEvent.VK_LEFT && !key_down[0]) {
+                wheelangle -= 0.02;
+                key_down[0] = true;
+            }
+
+            if (key == KeyEvent.VK_RIGHT && !key_down[1]) {
+                wheelangle += 0.02;
+                key_down[1] = true;
+            }
+
+            if (key == KeyEvent.VK_UP)
+                key_down[2] = true;
+
+            if (key == KeyEvent.VK_DOWN)
+                key_down[3] = true;
+
+            if (key == KeyEvent.VK_ESCAPE)
+                quit();
+
+            /* Toggle sound */
+            if (key == KeyEvent.VK_S) {
+                if (car_engine.is_on())
+                    car_engine.stop();
+                else
+                    car_engine.start();
+            }
+
+            /* Toggle cacti */
+            if (key == KeyEvent.VK_C) {
+                cacti_on = !cacti_on;
+                if (!cacti_on)
+                    cacti = new ArrayList<EastNorth>();
+            }
+
+            /* Switch vehicle */
+            if (key == KeyEvent.VK_V)
+                if (current_car ++>= 1)
+                    current_car = 0;
+        }
+
+        public void keyReleased(KeyEvent e) {
+            int key = e.getKeyCode();
+
+            if (key == KeyEvent.VK_LEFT)
+                key_down[0] = false;
+
+            if (key == KeyEvent.VK_RIGHT)
+                key_down[1] = false;
+
+            if (key == KeyEvent.VK_UP)
+                key_down[2] = false;
+
+            if (key == KeyEvent.VK_DOWN)
+                key_down[3] = false;
+        }
+    }
+    protected fake_map_view ground_view;
 }
Index: /applications/editors/josm/plugins/wms-turbo-challenge2/src/wmsturbochallenge/WMSRacer.java
===================================================================
--- /applications/editors/josm/plugins/wms-turbo-challenge2/src/wmsturbochallenge/WMSRacer.java	(revision 23189)
+++ /applications/editors/josm/plugins/wms-turbo-challenge2/src/wmsturbochallenge/WMSRacer.java	(revision 23190)
@@ -20,98 +20,98 @@
 
 public class WMSRacer extends Plugin implements LayerChangeListener {
-	public WMSRacer(PluginInformation info) {
-		super(info);
-		driveAction.updateEnabledState();
+    public WMSRacer(PluginInformation info) {
+        super(info);
+        driveAction.updateEnabledState();
 
-		JMenu toolsMenu = Main.main.menu.toolsMenu;
-		toolsMenu.addSeparator();
-		toolsMenu.add(new JMenuItem(driveAction));
-	}
+        JMenu toolsMenu = Main.main.menu.toolsMenu;
+        toolsMenu.addSeparator();
+        toolsMenu.add(new JMenuItem(driveAction));
+    }
 
-	/* Rather than add an action or main menu entry we should add
-	 * an entry in the new layer's context menus in layerAdded
-	 * but there doesn't seem to be any way to do that :( */
-	protected class DriveAction extends JosmAction {
-		public MapFrame frame = null;
-		public Layer currentLayer = null;
-		protected Layer groundLayer = null;
+    /* Rather than add an action or main menu entry we should add
+     * an entry in the new layer's context menus in layerAdded
+     * but there doesn't seem to be any way to do that :( */
+    protected class DriveAction extends JosmAction {
+        public MapFrame frame = null;
+        public Layer currentLayer = null;
+        protected Layer groundLayer = null;
 
-		public DriveAction() {
-			super("Go driving", "wmsracer",
-					"Drive a race car on this layer",
-					null, true);
-			setEnabled(false);
-		}
+        public DriveAction() {
+            super("Go driving", "wmsracer",
+                    "Drive a race car on this layer",
+                    null, true);
+            setEnabled(false);
+        }
 
-		public void actionPerformed(ActionEvent ev) {
-			if (groundLayer == null ||
-					!groundLayer.isBackgroundLayer())
-				return;
+        public void actionPerformed(ActionEvent ev) {
+            if (groundLayer == null ||
+                    !groundLayer.isBackgroundLayer())
+                return;
 
-			new GameWindow(groundLayer);
-		}
+            new GameWindow(groundLayer);
+        }
 
-		public void updateEnabledState() {
-			if (frame == null) {
-				groundLayer = null;
-				setEnabled(false);
-				return;
-			}
+        public void updateEnabledState() {
+            if (frame == null) {
+                groundLayer = null;
+                setEnabled(false);
+                return;
+            }
 
-			if (currentLayer != null &&
-					currentLayer.isBackgroundLayer()) {
-				groundLayer = currentLayer;
-				setEnabled(true);
-				return;
-			}
+            if (currentLayer != null &&
+                    currentLayer.isBackgroundLayer()) {
+                groundLayer = currentLayer;
+                setEnabled(true);
+                return;
+            }
 
-			/* TODO: should only iterate through visible layers?
-			 * or only wms layers? or perhaps we should allow
-			 * driving on data/gpx layers too, or the full layer
-			 * stack (by calling mapView.paint() instead of
-			 * layer.paint()?  Nah.
-			 * (Note that for GPX or Data layers we could do
-			 * some clever rendering directly on our perspectivic
-			 * pseudo-3d surface by defining a strange projection
-			 * like that or rendering in "stripes" at different
-			 * horizontal scanlines (lines equidistant from
-			 * camera eye)) */
-			for (Layer l : frame.mapView.getAllLayers())
-				if (l.isBackgroundLayer()) {
-					groundLayer = l;
-					setEnabled(true);
-					return;
-				}
+            /* TODO: should only iterate through visible layers?
+             * or only wms layers? or perhaps we should allow
+             * driving on data/gpx layers too, or the full layer
+             * stack (by calling mapView.paint() instead of
+             * layer.paint()?  Nah.
+             * (Note that for GPX or Data layers we could do
+             * some clever rendering directly on our perspectivic
+             * pseudo-3d surface by defining a strange projection
+             * like that or rendering in "stripes" at different
+             * horizontal scanlines (lines equidistant from
+             * camera eye)) */
+            for (Layer l : frame.mapView.getAllLayers())
+                if (l.isBackgroundLayer()) {
+                    groundLayer = l;
+                    setEnabled(true);
+                    return;
+                }
 
-			groundLayer = null;
-			setEnabled(false);
-		}
-	}
+            groundLayer = null;
+            setEnabled(false);
+        }
+    }
 
-	protected DriveAction driveAction = new DriveAction();
+    protected DriveAction driveAction = new DriveAction();
 
-	public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) {
-		if (oldFrame != null)
-			oldFrame.mapView.removeLayerChangeListener(this);
+    public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) {
+        if (oldFrame != null)
+            oldFrame.mapView.removeLayerChangeListener(this);
 
-		driveAction.frame = newFrame;
-		driveAction.updateEnabledState();
+        driveAction.frame = newFrame;
+        driveAction.updateEnabledState();
 
-		if (newFrame != null)
-			newFrame.mapView.addLayerChangeListener(this);
-	}
+        if (newFrame != null)
+            newFrame.mapView.addLayerChangeListener(this);
+    }
 
-	/* LayerChangeListener methods */
-	public void activeLayerChange(Layer oldLayer, Layer newLayer) {
-		driveAction.currentLayer = newLayer;
-		driveAction.updateEnabledState();
-	}
+    /* LayerChangeListener methods */
+    public void activeLayerChange(Layer oldLayer, Layer newLayer) {
+        driveAction.currentLayer = newLayer;
+        driveAction.updateEnabledState();
+    }
 
-	public void layerAdded(Layer newLayer) {
-		driveAction.updateEnabledState();
-	}
+    public void layerAdded(Layer newLayer) {
+        driveAction.updateEnabledState();
+    }
 
-	public void layerRemoved(Layer oldLayer) {
-		driveAction.updateEnabledState();
-	}
+    public void layerRemoved(Layer oldLayer) {
+        driveAction.updateEnabledState();
+    }
 }
