chiark / gitweb /
elimtrivial concats the pnames; new spec. for mov feat processing
authorian <ian>
Sun, 20 Mar 2005 16:55:06 +0000 (16:55 +0000)
committerian <ian>
Sun, 20 Mar 2005 16:55:06 +0000 (16:55 +0000)
layout/redactgraph.c

index 004f3e21210204e671ef9a3ff726e1f8975ee724..4ec2e6f6f15aac9e59a26cf204e92691099698ed 100644 (file)
@@ -250,37 +250,44 @@ static void node_surely_orphaned(Node *node) {
    *
    * SECOND STAGE:
    *
-   * We split nodes: every node which has (only) edges which are part
-   * of the same segment is split into one node for each position and
-   * direction (directions are end0-to-side0+end1-to-side1 and
-   * end0-to-side1+end1-to-side0), to which the corresponding edges
-   * are connected.  Any resulting node which has only one edge is
-   * removed together with the edge.
+   * We remove stub moveable edges: whenever, at a node which has only
+   * edges which are part of the same segment, we find an edge on one
+   * side in which is not matched exactly (moveable feature settings
+   * and direction) by an edge on the other side, we delete that extra
+   * edge:
    *
-   * For example, when we start with:
+   * is split into one node
+   * for each position and direction (directions are
+   * end0-to-side0+end1-to-side1 and end0-to-side1+end1-to-side0), to
+   * which the corresponding edges are connected.  Any resulting node
+   * which has only one edge is removed together with the edge.
    *
-   *     ,---A1/P0J0---. 
-   * ...*----A1/P0J1----*---A1/P0J1---*...
-   *     `---A1/P1J0---' `--A1/P1J1--'
-   *      `--A1/P1J1--'
+   * For example (neglecting direction for the purposes of the
+   * example), when we start with:
    *
-   * the middle node is split like this (neglecting directions for
-   * clarity):
+   *             ,---A1/P0J0---.                  
+   *        ...*----A1/P0J1----*---A1/P0J1---*...
+   *            `---A1/P1J0---' `--A1/P1J1--'    
+   *             `--A1/P1J1--'                   
    *
-   *     ,---A1/P0J0----*
-   * ...*----A1/P0J1----*---A1/P0J1---*...
-   *     `---A1/P1J0----*            /
-   *      `--A1/P1J1----*---A1/P1J1-'
+   * the edges A1/P0J0 and A1/P1J1 are not matched on the RHS of the node,
+   * so they are removed:
    *
-   * and then the stub edges and nodes are removed, leaving this:
+   *         ...*----A1/P0J1----*---A1/P0J1---*...
+   *            `---A1/P1J0---' `--A1/P1J1--'    
    *
-   * ...*----A1/P0J1----*---A1/P0J1---*...
-   *     \                           /
-   *      `--A1/P1J1----*---A1/P1J1-'
    *
-   * The actual implementation of the second stage simply considers
-   * whether to create each node as it goes along, rather than
-   * inventing nodes merely to delete them.
+   * THIRD STAGE:
+   *
+   * We split nodes: every node which has only edges which are part of
+   * the same segment is split into one node for each kind of edge
+   * which goes through it.  The 2nd stage ensures that this is always
+   * straightforward.
+   *
+   * Our example above turns into:
+   *
+   *         ...*----A1/P0J1----*---A1/P0J1---*...
+   *            `---A1/P1J0----*---A1/P1J1--'
    */
 
 static void movfeatmultedges(void) {
@@ -402,6 +409,8 @@ static void elimtrivial(void) {
       continue;
     }
     trace(" yes:\n");
+    rightedge->edge->pname=
+      masprintf("%s+%s", leftedge->edge->pname, rightedge->edge->pname);
     rightedge->edge->distance += leftedge->edge->distance;
     edgeend_replumb(rightedge, edgeend_otherend(leftedge)->node);
     edge_delete(leftedge->edge);