Node n = new Node(Main.map.mapView.getLatLon(e.getX(), e.getY()));
EastNorth A = ws.getFirstNode().getEastNorth();
EastNorth B = ws.getSecondNode().getEastNorth();
n.setEastNorth(Geometry.closestPointToSegment(A, B, n.getEastNorth()));
Way wnew = new Way(ws.way);
wnew.addNode(ws.lowerIndex+1, n);
SequenceCommand cmds = new SequenceCommand(tr("Add a new node to an existing way"),
new AddCommand(n), new ChangeCommand(ws.way, wnew));
Main.main.undoRedo.add(cmds);
}
}