Index: applications/editors/josm/plugins/terracer/src/terracer/TerracerAction.java
===================================================================
--- applications/editors/josm/plugins/terracer/src/terracer/TerracerAction.java	(revision 14048)
+++ applications/editors/josm/plugins/terracer/src/terracer/TerracerAction.java	(revision 16162)
@@ -1,7 +1,7 @@
 /**
  * Terracer: A JOSM Plugin for terraced houses.
- * 
+ *
  * Copyright 2009 CloudMade Ltd.
- * 
+ *
  * Released under the GPLv2, see LICENSE file for details.
  */
@@ -11,5 +11,4 @@
 import static org.openstreetmap.josm.tools.I18n.trn;
 
-import java.awt.BorderLayout;
 import java.awt.Choice;
 import java.awt.Component;
@@ -20,15 +19,9 @@
 import java.awt.event.KeyEvent;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.HashMap;
 import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.TreeMap;
 import java.util.TreeSet;
 
-import javax.swing.JComponent;
 import javax.swing.JFormattedTextField;
 import javax.swing.JLabel;
@@ -36,7 +29,5 @@
 import javax.swing.JPanel;
 import javax.swing.JSpinner;
-import javax.swing.JTextField;
 import javax.swing.SpinnerNumberModel;
-import javax.swing.SpringLayout;
 import javax.swing.event.ChangeEvent;
 import javax.swing.event.ChangeListener;
@@ -53,5 +44,4 @@
 import org.openstreetmap.josm.data.osm.RelationMember;
 import org.openstreetmap.josm.data.osm.Way;
-import org.openstreetmap.josm.gui.tagging.TaggingPreset.Item;
 import org.openstreetmap.josm.tools.AutoCompleteComboBox;
 import org.openstreetmap.josm.tools.GBC;
@@ -62,9 +52,9 @@
  * Terraces a quadrilateral, closed way into a series of quadrilateral,
  * closed ways.
- * 
+ *
  * At present it only works on quadrilaterals, but there is no reason
- * why it couldn't be extended to work with other shapes too. The 
- * algorithm employed is naive, but it works in the simple case. 
- * 
+ * why it couldn't be extended to work with other shapes too. The
+ * algorithm employed is naive, but it works in the simple case.
+ *
  * @author zere
  */
@@ -76,10 +66,10 @@
 
 	public TerracerAction() {
-		super(tr("Terrace a building"), 
-				"terrace", 
+		super(tr("Terrace a building"),
+				"terrace",
 				tr("Creates individual buildings from a long building."),
-				Shortcut.registerShortcut("tools:Terracer", 
+				Shortcut.registerShortcut("tools:Terracer",
 						tr("Tool: {0}", tr("Terrace a building")),
-						KeyEvent.VK_T, Shortcut.GROUP_EDIT, 
+						KeyEvent.VK_T, Shortcut.GROUP_EDIT,
 						Shortcut.SHIFT_DEFAULT),
 						true);
@@ -112,13 +102,13 @@
 					optionPane.createDialog(Main.parent, title).setVisible(true);
 					Object answerObj = optionPane.getValue();
-					if (answerObj != null && 
+					if (answerObj != null &&
 							answerObj != JOptionPane.UNINITIALIZED_VALUE &&
-							(answerObj instanceof Integer && 
+							(answerObj instanceof Integer &&
 									(Integer)answerObj == JOptionPane.OK_OPTION)) {
 
 						// call out to the method which does the actual
 						// terracing.
-						terraceBuilding(way, 
-								dialog.numberFrom(), 
+						terraceBuilding(way,
+								dialog.numberFrom(),
 								dialog.numberTo(),
 								dialog.stepSize(),
@@ -137,5 +127,5 @@
 
 		if (badSelect) {
-			JOptionPane.showMessageDialog(Main.parent, 
+			JOptionPane.showMessageDialog(Main.parent,
 					tr("Select a single, closed way of at least four nodes."));
 		}
@@ -144,10 +134,10 @@
 	/**
 	 * Terraces a single, closed, quadrilateral way.
-	 * 
+	 *
 	 * Any node must be adjacent to both a short and long edge, we naively
 	 * choose the longest edge and its opposite and interpolate along them
 	 * linearly to produce new nodes. Those nodes are then assembled into
 	 * closed, quadrilateral ways and left in the selection.
-	 * 
+	 *
 	 * @param w The closed, quadrilateral way to terrace.
 	 */
@@ -167,8 +157,8 @@
 		Collection<Way> ways = new LinkedList<Way>();
 
-		// create intermediate nodes by interpolating. 
+		// create intermediate nodes by interpolating.
 		for (int i = 0; i <= nb; ++i) {
-			new_nodes[0][i] = interpolateAlong(interp.a, frontLength * (double)(i) / (double)(nb));
-			new_nodes[1][i] = interpolateAlong(interp.b, backLength * (double)(i) / (double)(nb));
+			new_nodes[0][i] = interpolateAlong(interp.a, frontLength * (i) / (nb));
+			new_nodes[1][i] = interpolateAlong(interp.b, backLength * (i) / (nb));
 			commands.add(new AddCommand(new_nodes[0][i]));
 			commands.add(new AddCommand(new_nodes[1][i]));
@@ -214,9 +204,9 @@
 	 * Creates a node at a certain distance along a way, as calculated by the
 	 * great circle distance.
-	 * 
-	 * Note that this really isn't an efficient way to do this and leads to 
+	 *
+	 * Note that this really isn't an efficient way to do this and leads to
 	 * O(N^2) running time for the main algorithm, but its simple and easy
 	 * to understand, and probably won't matter for reasonable-sized ways.
-	 * 
+	 *
 	 * @param w The way to interpolate.
 	 * @param l The length at which to place the node.
@@ -226,5 +216,5 @@
 		Node n = null;
 		for (Pair<Node,Node> p : w.getNodePairs(false)) {
-			final double seg_length = p.a.coor.greatCircleDistance(p.b.coor);
+			final double seg_length = p.a.getCoor().greatCircleDistance(p.b.getCoor());
 			if (l <= seg_length) {
 				n = interpolateNode(p.a, p.b, l / seg_length);
@@ -245,5 +235,5 @@
 	 * Calculates the great circle length of a way by summing the great circle
 	 * distance of each pair of nodes.
-	 * 
+	 *
 	 * @param w The way to calculate length of.
 	 * @return The length of the way.
@@ -252,5 +242,5 @@
 		double length = 0.0;
 		for (Pair<Node,Node> p : w.getNodePairs(false)) {
-			length += p.a.coor.greatCircleDistance(p.b.coor);
+			length += p.a.getCoor().greatCircleDistance(p.b.getCoor());
 		}
 		return length;
@@ -258,8 +248,8 @@
 
 	/**
-	 * Given a way, try and find a definite front and back by looking at the 
+	 * Given a way, try and find a definite front and back by looking at the
 	 * segments to find the "sides". Sides are assumed to be single segments
 	 * which cannot be contiguous.
-	 * 
+	 *
 	 * @param w The way to analyse.
 	 * @return A pair of ways (front, back) pointing in the same directions.
@@ -327,5 +317,5 @@
 		Node a = w.nodes.get(i);
 		Node b = w.nodes.get((i+1) % (w.nodes.size() - 1));
-		return a.coor.greatCircleDistance(b.coor);
+		return a.getCoor().greatCircleDistance(b.getCoor());
 	}
 
@@ -334,10 +324,10 @@
 	 * into order and return the array of indexes such that, for a returned array
 	 * x, a[x[i]] is sorted for ascending index i.
-	 * 
+	 *
 	 * This isn't efficient at all, but should be fine for the small arrays we're
 	 * expecting. If this gets slow - replace it with some more efficient algorithm.
-	 * 
+	 *
 	 * @param a The array to sort.
-	 * @return An array of indexes, the same size as the input, such that a[x[i]] 
+	 * @return An array of indexes, the same size as the input, such that a[x[i]]
 	 * is in sorted order.
 	 */
@@ -370,5 +360,5 @@
 
 	/**
-	 * Calculate "sideness" metric for each segment in a way.  
+	 * Calculate "sideness" metric for each segment in a way.
 	 */
 	private double[] calculateSideness(Way w) {
@@ -385,5 +375,5 @@
 		}
 		sideness[length-1] = calculateSideness(
-				w.nodes.get(length - 2), w.nodes.get(length - 1), 
+				w.nodes.get(length - 2), w.nodes.get(length - 1),
 				w.nodes.get(length), w.nodes.get(1));
 
@@ -397,10 +387,10 @@
 	 */
 	private double calculateSideness(Node a, Node b, Node c, Node d) {
-		final double ndx = b.coor.getX() - a.coor.getX();
-		final double pdx = d.coor.getX() - c.coor.getX();
-		final double ndy = b.coor.getY() - a.coor.getY();
-		final double pdy = d.coor.getY() - c.coor.getY();
-
-		return (ndx * pdx + ndy * pdy) / 
+		final double ndx = b.getCoor().getX() - a.getCoor().getX();
+		final double pdx = d.getCoor().getX() - c.getCoor().getX();
+		final double ndy = b.getCoor().getY() - a.getCoor().getY();
+		final double pdy = d.getCoor().getY() - c.getCoor().getY();
+
+		return (ndx * pdx + ndy * pdy) /
 		Math.sqrt((ndx * ndx + ndy * ndy) * (pdx * pdx + pdy * pdy));
 	}
@@ -426,10 +416,10 @@
 			chi = new JSpinner(hi);
 
-			lo.addChangeListener(new ChangeListener() { 
+			lo.addChangeListener(new ChangeListener() {
 				public void stateChanged(ChangeEvent e) {
 					hi.setMinimum((Integer)lo.getNumber());
 				}
 			});
-			hi.addChangeListener(new ChangeListener() { 
+			hi.addChangeListener(new ChangeListener() {
 				public void stateChanged(ChangeEvent e) {
 					lo.setMaximum((Integer)hi.getNumber());
@@ -521,5 +511,5 @@
 
 	/**
-	 * Generates a list of all visible names of highways in order to do 
+	 * Generates a list of all visible names of highways in order to do
 	 * autocompletion on the road name.
 	 */
@@ -539,5 +529,5 @@
 	 * Creates a new node at the interpolated position between the argument
 	 * nodes. Interpolates linearly in Lat/Lon coordinates.
-	 * 
+	 *
 	 * @param a First node, at which f=0.
 	 * @param b Last node, at which f=1.
@@ -551,7 +541,7 @@
 
 	/**
-	 * Calculates the interpolated position between the argument nodes. Interpolates 
+	 * Calculates the interpolated position between the argument nodes. Interpolates
 	 * linearly in Lat/Lon coordinates.
-	 * 
+	 *
 	 * @param a First node, at which f=0.
 	 * @param b Last node, at which f=1.
@@ -563,6 +553,6 @@
 		// screen coordinates rather than lat/lon, but it doesn't seem to
 		// make a great deal of difference at the scale of most terraces.
-		return new LatLon(a.coor.lat() * (1.0 - f) + b.coor.lat() * f,
-				a.coor.lon() * (1.0 - f) + b.coor.lon() * f);
+		return new LatLon(a.getCoor().lat() * (1.0 - f) + b.getCoor().lat() * f,
+				a.getCoor().lon() * (1.0 - f) + b.getCoor().lon() * f);
 	}
 }
