logo separator

R: [mkgmap-dev] [PATCH v3] - merge nodes to remove evil short arcs

From marco_certelli at yahoo.it marco_certelli at yahoo.it on Wed May 27 17:05:53 BST 2009

Hi, I switched on the mkgmap logging and I noticed, compiling "the most simple failing map" I attched to a mail yesterday, that when the routing is faulty (routing nodes collapsing) the TableA used by the NOD builder has 5 nodes and 5 arcs. This should means that the central node (the collapsed) has a routing Arc going to itself. This may cause the problem.

In the file \parabola\imgfmt\app\net\NOD1Part.java there is the function that populates the TableA. The original function is:

    /**
     * Add a node to this part.
     *
     * The node is used to populate the tables. If an
     * arc points outside the bbox, we know it's not
     * an internal arc. It might still turn into an
     * external arc at a deeper level of recursion.
     */
    public void addNode(RouteNode node) {
        assert bbox == null || bbox.contains(node.getCoord())
            : "trying to add out-of-bounds node: " + node;

        bboxActual.extend(node.getCoord());
        nodes.add(node);
        for (RouteArc arc : node.arcsIteration()) {
            tabA.addArc(arc);
            RouteNode dest = arc.getDest();
            if (bbox != null && !bbox.contains(dest.getCoord())) {
                arc.setInternal(false);
                tabB.addNode(dest);
            }
        }
        nodesSize += node.boundSize();
    }

The instruction adding the arcs to the table A is tabA.addArc(arc). We should try to change the function avoiding to add an arc to Table A if the arc from a node points to itself. I propose to change the code in a way similar to the following:

....
nodes.add(node);
for (RouteArc arc : node.arcsIteration()) {
    RouteNode dest = arc.getDest();
    if (dest!=node)
        tabA.addArc(arc);
    if (bbox != null && !bbox.contains(dest.getCoord())) {
.....

I don't know if this works, (for example I don't if the comparison dest!=node can be done like that) but it should easy to try.

Ciao.



      



More information about the mkgmap-dev mailing list