]> granicus.if.org Git - graphviz/commitdiff
Add additional flag for array packing, in which the graphs are
authorEmden R. Gansner <erg@alum.mit.edu>
Tue, 29 Oct 2013 19:07:45 +0000 (15:07 -0400)
committerEmden R. Gansner <erg@alum.mit.edu>
Tue, 29 Oct 2013 19:07:45 +0000 (15:07 -0400)
sorted at all but just inserted in input order.

cmd/tools/gvpack.1
lib/pack/pack.c
lib/pack/pack.h

index e40785ecff6972c36cdcbfb8a35c2e3c55970443..9b2953fe35fb78b20bb1a6f1f7f5762703d78f42 100644 (file)
@@ -54,13 +54,17 @@ integer \fIn\fP is supplied, this indicates the number of columns to use.
 .TP 
 
 If optional flags are supplied, these consist of an underscore followed
-by any of the letters "c", "t", "b", "l", "r" or "u".
+by any of the letters "c", "t", "b", "l", "r", "u" or "i".
 If "c" is supplied, the graphs are packed in column-major order, in which
 case a final integer specifies the number of rows.
 The flags "t", "b", "l", "r" indicate that components are aligned
 along the top, bottom, left or right, respectively.
-The "u" flag indicates that the insertion order is based on the
+By default, the insertion order is determined by sorting the graphs by size,
+largest to smallest. If
+the "u" flag is set, the graphs are sorted based on the non-negative integer
 \fIsortv\fP attribute attached to each graph.
+The "i" flag indicates that no sorting is done, with the graphs inserted in
+input order.
 .TP
 .BI \-G "name\fB=\fPvalue"
 Specifies attributes to be added to the resulting union graph. For
index dbde2feb027b14475e6feef0997f3655123f6c87..e1e3c7f2951224ef2df302aeea58d66b8609c553 100644 (file)
@@ -668,7 +668,7 @@ arrayRects (int ng, boxf* gs, pack_info* pinfo)
        userVals = pinfo->vals;
        qsort(sinfo, ng, sizeof(ainfo *), ucmpf);
     }
-    else {
+    else if (!(pinfo->flags & PK_INPUT_ORDER)) {
        qsort(sinfo, ng, sizeof(ainfo *), acmpf);
     }
 
@@ -937,7 +937,7 @@ point *putGraphs(int ng, Agraph_t ** gs, Agraph_t * root,
 
     if (pinfo->mode == l_array) {
        if (pinfo->flags & PK_USER_VALS) {
-           pinfo->vals = N_NEW(ng, unsigned char);
+           pinfo->vals = N_NEW(ng, packval_t);
            for (i = 0; i < ng; i++) {
                s = agget (gs[i], "sortv");
                if (s && (sscanf (s, "%d", &v) > 0) && (v >= 0))
@@ -1218,6 +1218,10 @@ chkFlags (char* p, pack_info* pinfo)
            pinfo->flags |= PK_COL_MAJOR;
            p++;
            break;
+       case 'i' :
+           pinfo->flags |= PK_INPUT_ORDER;
+           p++;
+           break;
        case 'u' :
            pinfo->flags |= PK_USER_VALS;
            p++;
index e0e0637c63f2b06bd7760b5498c81a3f7f6b52be..57660dd279d665530c44e3ee0f3f2f825449e5b8 100644 (file)
@@ -42,8 +42,9 @@ extern "C" {
 #define PK_RIGHT_ALIGN (1 << 3)
 #define PK_TOP_ALIGN   (1 << 4)
 #define PK_BOT_ALIGN   (1 << 5)
+#define PK_INPUT_ORDER (1 << 6)
 
-typedef unsigned char packval_t;
+typedef unsigned int packval_t;
 
     typedef struct {
        float aspect;           /* desired aspect ratio */