Index: /applications/editors/josm/plugins/tracer/src/org/openstreetmap/josm/plugins/tracer/TracerAction.java
===================================================================
--- /applications/editors/josm/plugins/tracer/src/org/openstreetmap/josm/plugins/tracer/TracerAction.java	(revision 19880)
+++ /applications/editors/josm/plugins/tracer/src/org/openstreetmap/josm/plugins/tracer/TracerAction.java	(revision 19881)
@@ -36,4 +36,5 @@
 import org.openstreetmap.josm.data.osm.BBox;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
+import org.openstreetmap.josm.tools.Pair;
 
 class TracerAction extends MapMode implements MouseListener {
@@ -126,6 +127,5 @@
         List<Command> cmds = new LinkedList<Command>();
         Way newWay = new Way(way);
-        for (int i = 1; i < way.getNodesCount(); i++) {
-            Node n = way.getNode(i);
+        for (Node n : way.getNodes()) {
             LatLon ll = n.getCoor();
             BBox bbox = new BBox(
@@ -153,18 +153,10 @@
             //System.out.println("-------");
             if (nearestNode == null) {
-                tryConnectNodeToAnyWay(way, newWay, n, cmds);
+                cmds.addAll(tryConnectNodeToAnyWay(n));
             } else {
-                nearestNode.setCoor(ll.getCenter(nearestNode.getCoor()));
-                int j = newWay.getNodes().indexOf(n);
-                newWay.addNode(j, nearestNode);
-                if (j == 0) {
-                    // first + last point
-                    newWay.addNode(newWay.getNodesCount(), nearestNode);
-                }
-                newWay.removeNode(n);
-                cmds.add(new DeleteCommand(n));
-            }
-        }
-        trySplitWayByAnyNodes(way, newWay);
+                cmds.add(mergeNodes(nearestNode, n, newWay));
+            }
+        }
+        newWay = trySplitWayByAnyNodes(way);
 
         cmds.add(new ChangeCommand(way, newWay));
@@ -175,20 +167,38 @@
 
     /**
-     * Try connect node "node" from way "oldWay" to way of other building.
+     * Merges two nodes
+     * @param n1 First node
+     * @param n2 Second node
+     * @param way Way containing first node
+     * @return Command
+     */
+    private Command mergeNodes(Node n1, Node n2, Way way){
+        n2.setCoor(n1.getCoor().getCenter(n2.getCoor()));
+        int j = way.getNodes().indexOf(n1);
+        way.addNode(j, n2);
+        if (j == 0) {
+            // first + last point
+            way.addNode(way.getNodesCount(), n2);
+        }
+        way.removeNode(n1);
+        return new DeleteCommand(n1);
+    }
+
+    /**
+     * Try connect node "node" from way "way" to way of other building.
      *
      * Zkusi zjistit, zda node neni tak blizko nejake usecky existujici budovy,
      * ze by mel byt zacnenen do teto usecky. Pokud ano, provede to.
      *
-     * @param oldWay Way which contains node "node".
-     * @param newWay Modified way.
      * @param node Node to connect.
-     * @param cmds Command list.
      * @throws IllegalStateException
      * @throws IndexOutOfBoundsException
+     * @return List of Commands.
      */
-    private void tryConnectNodeToAnyWay(Way oldWay, Way newWay, Node node, List<Command> cmds)
+    private List<Command> tryConnectNodeToAnyWay(Node node)
             throws IllegalStateException, IndexOutOfBoundsException {
-
+        
         final double MIN_DISTANCE = 0.000015;
+        List<Command> cmds = new LinkedList<Command>();
 
         LatLon ll = node.getCoor();
@@ -206,15 +216,13 @@
         int nearestNodeIndex = 0;
         for (Way ww : ways) {
-            if (!ww.isUsable() || ww == oldWay || ww == newWay || !isBuilding(ww)) {
+            if (!ww.isUsable() || ww.containsNode(node) || !isBuilding(ww)) {
                 continue;
             }
-            for (int nindex = 0; nindex < ww.getNodesCount(); nindex++) {
-                Node n1 = ww.getNode(nindex);
-                Node n2 = ww.getNode((nindex + 1) % ww.getNodesCount());
-                double dist = TracerGeometry.distanceFromSegment(ll, n1.getCoor(), n2.getCoor());
+            for (Pair<Node, Node> np : ww.getNodePairs(false)) {
+                double dist = TracerGeometry.distanceFromSegment(ll, np.a.getCoor(), np.b.getCoor());
                 if (dist < minDist) {
                     minDist = dist;
                     nearestWay = ww;
-                    nearestNodeIndex = nindex;
+                    nearestNodeIndex = ww.getNodes().indexOf(np.a);
                 }
             }
@@ -227,4 +235,5 @@
             cmds.add(new ChangeCommand(nearestWay, newNWay));
         }
+        return cmds;
     }
 
@@ -232,29 +241,34 @@
      * Try split way by any existing buiding nodes.
      *
-     * Zkusi zjistit zda nejake usecka z oldWay by nemela prochazet nejakym existujicim bodem,
+     * Zkusi zjistit zda nejake usecka z way by nemela prochazet nejakym existujicim bodem,
      * ktery je ji velmi blizko. Pokud ano, tak puvodni usecku rozdeli na dve tak, aby
      * prochazela takovym bodem.
      *
-     * @param oldWay Way to split.
-     * @param newWay Modified way.
+     * @param way Way to split.
      * @throws IndexOutOfBoundsException
      * @throws IllegalStateException
+     * @return Modified way
      */
-    private void trySplitWayByAnyNodes(Way oldWay, Way newWay)
+    private Way trySplitWayByAnyNodes(Way way)
             throws IndexOutOfBoundsException, IllegalStateException {
 
         // projdi kazdou novou usecku a zjisti, zda by nemela vest pres existujici body
         int i = 0;
-        while (i < newWay.getNodesCount()) {
+        while (i < way.getNodesCount()) {
             // usecka n1, n2
-            LatLon n1 = newWay.getNodes().get(i).getCoor();
-            LatLon n2 = newWay.getNodes().get((i + 1) % newWay.getNodesCount()).getCoor();
-            //System.out.println(newWay.getNodes().get(i) + "-----" + newWay.getNodes().get((i + 1) % newWay.getNodesCount()));
+            LatLon n1 = way.getNodes().get(i).getCoor();
+            LatLon n2 = way.getNodes().get((i + 1) % way.getNodesCount()).getCoor();
+            //System.out.println(way.getNodes().get(i) + "-----" + way.getNodes().get((i + 1) % way.getNodesCount()));
             double minDistanceSq = 0.000015;
             double maxAngle = 15;
-            List<Node> nodes = Main.main.getCurrentDataSet().searchNodes(new BBox(Math.min(n1.getX(), n2.getX()) - minDistanceSq, Math.min(n1.getY(), n2.getY()) - minDistanceSq, Math.max(n1.getX(), n2.getX()) + minDistanceSq, Math.max(n1.getY(), n2.getY()) + minDistanceSq));
+            List<Node> nodes = Main.main.getCurrentDataSet().searchNodes(new BBox(
+                Math.min(n1.getX(), n2.getX()) - minDistanceSq,
+                Math.min(n1.getY(), n2.getY()) - minDistanceSq,
+                Math.max(n1.getX(), n2.getX()) + minDistanceSq,
+                Math.max(n1.getY(), n2.getY()) + minDistanceSq
+            ));
             Node nearestNode = null;
             for (Node nod : nodes) {
-                if (!nod.isUsable() || oldWay.containsNode(nod) || newWay.containsNode(nod) || !isInBuilding(nod)) {
+                if (!nod.isUsable() || way.containsNode(nod) || !isInBuilding(nod)) {
                     continue;
                 }
@@ -275,12 +289,13 @@
             } else {
                 // rozdeleni usecky
-                newWay.addNode(i + 1, nearestNode);
+                way.addNode(i + 1, nearestNode);
                 continue; // i nezvetsuji, treba bude treba rozdelit usecku znovu
             }
         }
+        return way;
     }
 
     private void tagBuilding(Way way) {
-        way.put("building", "yes");
+        if(alt) way.put("building", "yes");
         way.put("source", "cuzk:km");
     }
Index: /applications/editors/josm/plugins/tracer/src/org/openstreetmap/josm/plugins/tracer/TracerGeometry.java
===================================================================
--- /applications/editors/josm/plugins/tracer/src/org/openstreetmap/josm/plugins/tracer/TracerGeometry.java	(revision 19880)
+++ /applications/editors/josm/plugins/tracer/src/org/openstreetmap/josm/plugins/tracer/TracerGeometry.java	(revision 19881)
@@ -44,4 +44,5 @@
         double r_numerator = (cx - ax) * (bx - ax) + (cy - ay) * (by - ay);
         double r_denomenator = (bx - ax) * (bx - ax) + (by - ay) * (by - ay);
+        if(r_denomenator == 0)System.out.println("r_denomenator == 0    ------------");
         double r = r_numerator / r_denomenator;
         double s = ((ay - cy) * (bx - ax) - (ax - cx) * (by - ay)) / r_denomenator;
Index: /applications/editors/josm/plugins/tracer/src/org/openstreetmap/josm/plugins/tracer/TracerPlugin.java
===================================================================
--- /applications/editors/josm/plugins/tracer/src/org/openstreetmap/josm/plugins/tracer/TracerPlugin.java	(revision 19880)
+++ /applications/editors/josm/plugins/tracer/src/org/openstreetmap/josm/plugins/tracer/TracerPlugin.java	(revision 19881)
@@ -5,5 +5,5 @@
  */
 
-package tracer;
+package org.openstreetmap.josm.plugins.tracer;
 
 import org.openstreetmap.josm.Main;
Index: /applications/editors/josm/plugins/tracer/src/org/openstreetmap/josm/plugins/tracer/TracerServer.java
===================================================================
--- /applications/editors/josm/plugins/tracer/src/org/openstreetmap/josm/plugins/tracer/TracerServer.java	(revision 19880)
+++ /applications/editors/josm/plugins/tracer/src/org/openstreetmap/josm/plugins/tracer/TracerServer.java	(revision 19881)
@@ -47,8 +47,8 @@
      * @return Building border.
      */
-    public ArrayList<double[]> trace(LatLon pos) {
+    public ArrayList<LatLon> trace(LatLon pos) {
         try {
             String content = callServer("trace/simple/" + pos.lat() + ";" + pos.lon());
-            ArrayList<double[]> nodelist = new ArrayList<double[]>();
+            ArrayList<LatLon> nodelist = new ArrayList<LatLon>();
             String[] lines = content.split("\\|");
             for (String line : lines) {
@@ -56,13 +56,9 @@
                 double x = Double.parseDouble(items[0]);
                 double y = Double.parseDouble(items[1]);
-                double[] d = new double[2];
-                d[0] = x;
-                d[1] = y;
-                nodelist.add(d);
+                nodelist.add(new LatLon(x, y));
             }
             return nodelist;
         } catch (Exception e) {
-            ArrayList<double[]> nodelist = new ArrayList<double[]>();
-            return nodelist;
+            return new ArrayList<LatLon>();
         }
     }
Index: plications/editors/josm/plugins/tracer/src/tracer/TracerAction.java
===================================================================
--- /applications/editors/josm/plugins/tracer/src/tracer/TracerAction.java	(revision 19880)
+++ 	(revision )
@@ -1,433 +1,0 @@
-/**
- * Tracer - plugin for JOSM
- * Jan Bilak
- * This program is free software and licensed under GPL.
- */
-
-package tracer;
-
-import static org.openstreetmap.josm.tools.I18n.tr;
-import java.awt.Cursor;
-import java.awt.Point;
-import java.awt.event.ActionEvent;
-import java.awt.event.InputEvent;
-import java.awt.event.KeyEvent;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.LinkedList;
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-import java.net.URL;
-import java.util.List;
-import org.openstreetmap.josm.Main;
-import org.openstreetmap.josm.actions.mapmode.MapMode;
-import org.openstreetmap.josm.command.AddCommand;
-import org.openstreetmap.josm.command.ChangeCommand;
-import org.openstreetmap.josm.command.Command;
-import org.openstreetmap.josm.command.DeleteCommand;
-import org.openstreetmap.josm.command.SequenceCommand;
-import org.openstreetmap.josm.data.coor.LatLon;
-import org.openstreetmap.josm.data.osm.Node;
-import org.openstreetmap.josm.data.osm.Way;
-import org.openstreetmap.josm.gui.PleaseWaitRunnable;
-import org.openstreetmap.josm.gui.progress.ProgressMonitor;
-import org.openstreetmap.josm.gui.MapFrame;
-import org.openstreetmap.josm.tools.ImageProvider;
-import org.openstreetmap.josm.tools.Shortcut;
-import org.xml.sax.SAXException;
-import org.openstreetmap.josm.data.osm.BBox;
-import org.openstreetmap.josm.data.osm.OsmPrimitive;
-
-/**
- * Interface to Darryl Shpak's Tracer module
- *
- * @author Brent Easton
- */
-class TracerAction extends MapMode implements MouseListener {
-
-    private static final long serialVersionUID = 1L;
-    protected Thread executeThread;
-    protected boolean cancel;
-    private boolean ctrl;
-    private boolean alt;
-    private boolean shift;
-   
-    public TracerAction(MapFrame mapFrame) {
-        super(tr("Tracer"), "tracer-sml", tr("Tracer."), Shortcut.registerShortcut("tools:tracer", tr("Tool: {0}", tr("Tracer")), KeyEvent.VK_T, Shortcut.GROUP_EDIT), mapFrame, getCursor());
-    }
-
-   @Override public void enterMode() {
-       if (!isEnabled())
-           return;
-       super.enterMode();
-       Main.map.mapView.setCursor(getCursor());
-       Main.map.mapView.addMouseListener(this);
-   }
-
-   @Override public void exitMode() {
-       super.exitMode();
-       Main.map.mapView.removeMouseListener(this);
-   }
-
-   private static Cursor getCursor() {
-         return ImageProvider.getCursor("crosshair", "tracer-sml");
-    }
-
-
-
-    /**
-     * check for presence of cache folder and trim cache to specified size.
-     * size/age limit is on a per folder basis.
-     */
-    protected void trace(Point clickPoint) {
-        cancel = false;
-        /**
-         * Positional data
-         */
-        final LatLon pos = Main.map.mapView.getLatLon(clickPoint.x, clickPoint.y);
-        final LatLon topLeft = Main.map.mapView.getLatLon(0, 0);
-        final LatLon botRight = Main.map.mapView.getLatLon(Main.map.mapView.getWidth(), Main.map.mapView.getHeight());
-
-        try {
-            PleaseWaitRunnable tracerTask = new PleaseWaitRunnable(tr("Tracing")) {
-
-                @Override
-                protected void realRun() throws SAXException {
-                    processnodelist(pos, topLeft, botRight,
-                            progressMonitor.createSubTaskMonitor(ProgressMonitor.ALL_TICKS, false));
-                }
-
-                @Override
-                protected void finish() {
-                }
-
-                @Override
-                protected void cancel() {
-                    TracerAction.this.cancel();
-                }
-            };
-            Thread executeTraceThread = new Thread(tracerTask);
-            executeTraceThread.start();
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-
-    private String callWeb(String urlString) {
-        try {
-            URL url = new URL(urlString);
-            BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
-
-            StringBuilder sb = new StringBuilder();
-            String sx;
-            while ((sx = reader.readLine()) != null) {
-                sb.append(sx);
-            }
-            return sb.toString();
-        } catch (Exception e) {
-            return "";
-        }
-    }
-
-    private ArrayList<double[]> getNodeList(LatLon pos) {
-        try {
-            String content = callWeb("http://localhost:5050/trace/simple/" + pos.lat() + ";" + pos.lon());
-            ArrayList<double[]> nodelist = new ArrayList<double[]>();
-            String[] lines = content.split("\\|");
-            for (String line : lines) {
-                String[] items = line.split(";");
-                double x = Double.parseDouble(items[0]);
-                double y = Double.parseDouble(items[1]);
-                double[] d = new double[2];
-                d[0] = x;
-                d[1] = y;
-                nodelist.add(d);
-            }
-
-            return nodelist;
-        } catch (Exception e) {
-            ArrayList<double[]> nodelist = new ArrayList<double[]>();
-            return nodelist;
-        }
-    }
-
-    private boolean isBuilding(Way w){
-        return (w.getKeys().get("building") == null ? false : w.getKeys().get("building").equals("yes"));
-    }
-
-    private boolean isInBuilding(Node n){
-        for(OsmPrimitive op :n.getReferrers())
-            if(op instanceof Way)
-                if(isBuilding((Way) op))
-                    return true;
-            return false;
-    }
-
-
-    private Command connectObjects(Way way){
-            List<Command> cmds = new LinkedList<Command>();
-            Way newWay = new Way(way);
-            for (int i = 1; i < way.getNodesCount(); i++) {
-                Node n = way.getNode(i);
-                if (cancel) {
-                    return null;
-                }
-
-                    LatLon ll = n.getCoor();
-
-                    double minDistanceSq = 0.000015;
-                    List<Node> nodes = Main.main.getCurrentDataSet().searchNodes(new BBox(
-                            ll.getX() - minDistanceSq,
-                            ll.getY() - minDistanceSq,
-                            ll.getX() + minDistanceSq,
-                            ll.getY() + minDistanceSq
-                            ));
-                    Node nearestNode = null;
-                    for (Node nn : nodes) {
-                        if (!nn.isUsable() || way.containsNode(nn) || newWay.containsNode(nn) || !isInBuilding(nn)) {
-                            continue;
-                        }
-                        double dist = nn.getCoor().distance(ll);
-                        if (dist < minDistanceSq) {
-                            minDistanceSq = dist;
-                            nearestNode = nn;
-                        }
-                    }
-
-                    //System.out.println("Nearest: " + nearestNode);
-                    //System.out.println("-------");
-                    if (nearestNode == null) {
-                        // hledani blizke usecky, kam bod pridat ... nebo vytvorit samostatny bod?
-                        List<Way> ways = Main.main.getCurrentDataSet().searchWays(new BBox(
-                                ll.getX() - minDistanceSq,
-                                ll.getY() - minDistanceSq,
-                                ll.getX() + minDistanceSq,
-                                ll.getY() + minDistanceSq
-                                ));
-                        double minDist = Double.MAX_VALUE;
-                        Way nearestWay = null;
-                        int nearestNodeIndex = 0;
-
-
-                        for (Way ww : ways) {
-                            if (!ww.isUsable() || ww == way || ww == newWay || !isBuilding(ww)) {
-                                continue;
-                            }
-                            for (int nindex = 0; nindex < ww.getNodesCount(); nindex++) {
-                                Node n1 = ww.getNode(nindex);
-                                Node n2 = ww.getNode((nindex + 1) % ww.getNodesCount());
-
-                                double dist = distanceFromSegment(ll, n1.getCoor(), n2.getCoor());
-                                if (dist < minDist) {
-                                    minDist = dist;
-                                    nearestWay = ww;
-                                    nearestNodeIndex = nindex;
-                                }
-                            }
-                        }
-
-                        //System.out.println("Nearest way:" + nearestWay);
-                        if (minDist < 0.000015) {
-                            Way newNWay = new Way(nearestWay);
-                            newNWay.addNode(nearestNodeIndex + 1, n);
-                            //System.out.println("New way:" + newNWay);
-                            cmds.add(new ChangeCommand(nearestWay, newNWay));
-                        }
-                    } else {
-                          nearestNode.setCoor(ll.getCenter(nearestNode.getCoor()));
-                          int j = newWay.getNodes().indexOf(n);
-                          newWay.addNode(j, nearestNode);
-                          if(j == 0)newWay.addNode(newWay.getNodesCount(), nearestNode);
-                          newWay.removeNode(n);
-                          cmds.add(new DeleteCommand(n));
-                    }
-            }
-            // projdi kazdou novou usecku a zjisti, zda by nemela vest pres existujici body
-            int i = 0;
-            while (i < newWay.getNodesCount()) {
-                if (cancel) {
-                    return null;
-                }
-
-                callWeb("http://localhost:5050/log/i/" + i);
-
-                // usecka n1, n2
-                LatLon n1 = newWay.getNodes().get(i).getCoor();
-                LatLon n2 = newWay.getNodes().get((i + 1) % newWay.getNodesCount()).getCoor();
-                //System.out.println(newWay.getNodes().get(i) + "-----" + newWay.getNodes().get((i + 1) % newWay.getNodesCount()));
-
-                double minDistanceSq = 0.000015;
-                double maxAngle = 15;
-                List<Node> nodes = Main.main.getCurrentDataSet().searchNodes(new BBox(
-                        Math.min(n1.getX(), n2.getX()) - minDistanceSq,
-                        Math.min(n1.getY(), n2.getY()) - minDistanceSq,
-                        Math.max(n1.getX(), n2.getX()) + minDistanceSq,
-                        Math.max(n1.getY(), n2.getY()) + minDistanceSq
-                        ));
-                Node nearestNode = null;
-                for (Node nod : nodes) {
-                    if (!nod.isUsable() || way.containsNode(nod) || newWay.containsNode(nod) || !isInBuilding(nod)) {
-                        continue;
-                    }
-                    LatLon nn = nod.getCoor();
-                    double dist = distanceFromSegment(nn, n1, n2);
-                    double angle = angleOfLines(n1, nn, nn, n2);
-
-                    if (!n1.equalsEpsilon(nn) && !n2.equalsEpsilon(nn) && dist < minDistanceSq)
-                    {
-                        callWeb("http://localhost:5050/log/n1/" + n1.toDisplayString());
-                        callWeb("http://localhost:5050/log/nn/" + nn.toDisplayString());
-                        callWeb("http://localhost:5050/log/n2/" + n2.toDisplayString());
-                        callWeb("http://localhost:5050/log/angle/" + Math.abs(angle));
-                    }
-                    if (!n1.equalsEpsilon(nn) && !n2.equalsEpsilon(nn) && dist < minDistanceSq && Math.abs(angle) < maxAngle) {
-                        callWeb("http://localhost:5050/log/ok");
-                        maxAngle = angle;
-                        nearestNode = nod;
-                    }
-                }
-
-                //System.out.println("Nearest_: " + nearestNode);
-                //System.out.println("");
-                if (nearestNode == null) {
-                    // tato usecka se nerozdeli
-                    i++;
-                    continue;
-                } else {
-                    // rozdeleni usecky
-                    newWay.addNode(i+1, nearestNode);
-                    continue; // i nezvetsuji, treba bude treba rozdelit usecku znovu
-                }
-
-            }
-
-                cmds.add(new ChangeCommand(way, newWay));
-
-            Command cmd = new SequenceCommand(tr("Merge objects nodes"), cmds);
-            return cmd;
-    }
-
-    private void processnodelist(LatLon pos, LatLon topLeft, LatLon botRight, ProgressMonitor progressMonitor) {
-        Collection<Command> commands = new LinkedList<Command>();
-
-        progressMonitor.beginTask(null, 3);
-        try {
-            ArrayList<double[]> nodelist = new ArrayList<double[]>();
-            nodelist = getNodeList(pos);
-
-            if (nodelist.size() == 0) {
-                return;
-            }
-
-            /**
-             * Turn the arraylist into osm nodes
-             */
-            Way way = new Way();
-            Node n = null;
-            Node fn = null;
-
-            double eastOffset = 0;
-            double northOffset = 0;
-
-            for (double[] node : nodelist) {
-                if (cancel) {
-                    return;
-                }
-                LatLon ll = new LatLon(node[0] + northOffset, node[1] + eastOffset);
-
-                n = new Node(ll);
-                if(fn == null) fn = n;
-                commands.add(new AddCommand(n));
-                way.addNode(n);
-            }
-
-            way.put("building", "yes");
-            way.put("source", "cuzk:km");
-
-            way.addNode(fn);
-
-            commands.add(new AddCommand(way));
-            if(!ctrl) commands.add(connectObjects(way));
-            
-            if (!commands.isEmpty()) {
-                Main.main.undoRedo.add(new SequenceCommand(tr("Tracer building"), commands));
-
-                if(shift) Main.main.getCurrentDataSet().addSelected(way);
-                else Main.main.getCurrentDataSet().setSelected(way);
-            } else {
-                System.out.println("Failed");
-            }
-
-        } finally {
-            progressMonitor.finishTask();
-        }
-    }
-
-    private double angleOfLines(LatLon a, LatLon b, LatLon c, LatLon d) {
-        return (Math.abs(Math.atan2(a.lat() - b.lat(), a.lon() - b.lon()) - Math.atan2(c.lat() - d.lat(), c.lon() - d.lon())) / Math.PI * 180) % 360;
-    }
-
-    private double distanceFromSegment(LatLon c, LatLon a, LatLon b) {
-        return distanceFromSegment(c.getX(), c.getY(), a.getX(), a.getY(), b.getX(), b.getY());
-    }
-
-    private double distanceFromSegment(double cx, double cy, double ax, double ay, double bx, double by) {
-        double r_numerator = (cx - ax) * (bx - ax) + (cy - ay) * (by - ay);
-        double r_denomenator = (bx - ax) * (bx - ax) + (by - ay) * (by - ay);
-        double r = r_numerator / r_denomenator;
-        double s = ((ay - cy) * (bx - ax) - (ax - cx) * (by - ay)) / r_denomenator;
-        double distanceLine = Math.abs(s) * Math.sqrt(r_denomenator);
-
-        if ((r >= 0) && (r <= 1)) {
-            return distanceLine;
-        } else {
-            double dist1 = (cx - ax) * (cx - ax) + (cy - ay) * (cy - ay);
-            double dist2 = (cx - bx) * (cx - bx) + (cy - by) * (cy - by);
-            if (dist1 < dist2) {
-                return Math.sqrt(dist1);
-            } else {
-                return Math.sqrt(dist2);
-            }
-        }
-    }
-
-    public void cancel() {
-        cancel = true;
-    }
-
-    @Override
-    public void mouseClicked(MouseEvent e) {
-    }
-
-    @Override
-    public void mouseEntered(MouseEvent e) {
-    }
-
-    @Override
-    public void mouseExited(MouseEvent e) {
-    }
-
-    @Override
-    public void mousePressed(MouseEvent e) {
-        if(!Main.map.mapView.isActiveLayerDrawable())
-           return;
-
-        updateKeyModifiers(e);
-        if (e.getButton() == MouseEvent.BUTTON1) {
-            trace(e.getPoint());
-        }
-    }
-    
-    private void updateKeyModifiers(MouseEvent e) {
-        ctrl = (e.getModifiers() & ActionEvent.CTRL_MASK) != 0;
-        alt = (e.getModifiers() & (ActionEvent.ALT_MASK|InputEvent.ALT_GRAPH_MASK)) != 0;
-        shift = (e.getModifiers() & ActionEvent.SHIFT_MASK) != 0;
-    }
-
-
-    @Override
-    public void mouseReleased(MouseEvent e) {
-    }
-}
Index: plications/editors/josm/plugins/tracer/src/tracer/TracerException.java
===================================================================
--- /applications/editors/josm/plugins/tracer/src/tracer/TracerException.java	(revision 19880)
+++ 	(revision )
@@ -1,20 +1,0 @@
-/**
- * Tracer - plugin for JOSM
- * Jan Bilak
- * This program is free software and licensed under GPL.
- */
-
-package tracer;
-
-import static org.openstreetmap.josm.tools.I18n.tr;
-
-class TracerException extends Exception {
-
-    public TracerException() {
-        super(tr("An unknown error has occurred"));
-    }
-
-    public TracerException(String err) {
-        super(err);
-    }
-}
Index: plications/editors/josm/plugins/tracer/src/tracer/TracerPlugin.java
===================================================================
--- /applications/editors/josm/plugins/tracer/src/tracer/TracerPlugin.java	(revision 19880)
+++ 	(revision )
@@ -1,20 +1,0 @@
-/**
- * Tracer - plugin for JOSM
- * Jan Bilak
- * This program is free software and licensed under GPL.
- */
-
-package tracer;
-
-import org.openstreetmap.josm.Main;
-import org.openstreetmap.josm.gui.MainMenu;
-import org.openstreetmap.josm.plugins.Plugin;
-import org.openstreetmap.josm.plugins.PluginInformation;
-
-public class TracerPlugin extends Plugin {
-
-    public TracerPlugin(PluginInformation info) {
-        super(info);
-        MainMenu.add(Main.main.menu.toolsMenu, new TracerAction(Main.map));
-    }
-}
