public OsmPathElement getLink(final long n1, final long n2) {
        OsmPathElementHolder h = nodesMap.get(n2);
        while (h != null) {
            final OsmPathElement e1 = h.node.origin;
            if (e1 != null && e1.getIdFromPos() == n1) {
                return h.node;
            }
            h = h.nextHolder;
        }
        return null;
    }
writes the track in binary-format to a file

@param filename the filename to write to
main/src/main/java/cgeo/geocaching/brouter/core/OsmTrack.java