]> granicus.if.org Git - graphviz/commitdiff
interpret 'none' as a gap - fixes bug#2345 (include arr_none.gv test graph)
authorJohn Ellson <ellson@research.att.com>
Wed, 4 Sep 2013 16:03:17 +0000 (12:03 -0400)
committerJohn Ellson <ellson@research.att.com>
Wed, 4 Sep 2013 16:03:17 +0000 (12:03 -0400)
graphs/directed/arr_none.gv [new file with mode: 0644]
lib/common/arrows.c

diff --git a/graphs/directed/arr_none.gv b/graphs/directed/arr_none.gv
new file mode 100644 (file)
index 0000000..4466c7a
--- /dev/null
@@ -0,0 +1,19 @@
+digraph {
+       node [shape=point label=none]
+       a->b[arrowhead="nonenonenonenone"]
+       c->d[arrowhead="teenonenonenone"]
+       e->f[arrowhead="noneteenonenone"]
+       g->h[arrowhead="teeteenonenone"]
+       i->j[arrowhead="nonenoneteenone"]
+       k->l[arrowhead="teenoneteenone"]
+       m->n[arrowhead="noneteeteenone"]
+       o->p[arrowhead="teeteeteenone"]
+       q->r[arrowhead="nonenonenoneteenone"]
+       s->t[arrowhead="teenonenonetee"]
+       u->v[arrowhead="noneteenonetee"]
+       w->y[arrowhead="teeteenonetee"]
+       x->z[arrowhead="nonenoneteetee"]
+       A->B[arrowhead="teenoneteetee"]
+       C->D[arrowhead="noneteeteetee"]
+       E->F[arrowhead="teeteeteetee"]
+}
index 3532433a2a9d3716e6da15e46e8615493a69c7ba..4d5a25162fb9eb1e1de8d734d77f57781bd98273 100644 (file)
@@ -24,7 +24,7 @@
 
 #define BITS_PER_ARROW 8
 
-#define BITS_PER_ARROW_TYPE 3
+#define BITS_PER_ARROW_TYPE 4
 /* arrow types (in BITS_PER_ARROW_TYPE bits) */
 #define ARR_TYPE_NONE    (ARR_NONE)
 #define ARR_TYPE_NORM    1
 #define ARR_TYPE_BOX     4
 #define ARR_TYPE_DIAMOND  5
 #define ARR_TYPE_DOT      6
-#define ARR_TYPE_CURVE  7
-/* Spare:  #define ARR_TYPE_xxx      7 */
+#define ARR_TYPE_CURVE    7
+#define ARR_TYPE_GAP      8
+/* Spare: 9-15 */
 
 /* arrow mods (in (BITS_PER_ARROW - BITS_PER_ARROW_TYPE) bits) */
 #define ARR_MOD_OPEN      (1<<(BITS_PER_ARROW_TYPE+0))
 #define ARR_MOD_INV       (1<<(BITS_PER_ARROW_TYPE+1))
 #define ARR_MOD_LEFT      (1<<(BITS_PER_ARROW_TYPE+2))
 #define ARR_MOD_RIGHT     (1<<(BITS_PER_ARROW_TYPE+3))
-/* Spare:  #define ARR_MOD_xxx       (1<<(BITS_PER_ARROW_TYPE+4))  */
+/* No spares */
 
 typedef struct arrowdir_t {
     char *dir;
@@ -86,7 +87,9 @@ static arrowname_t Arrownames[] = {
     {"box", ARR_TYPE_BOX},
     {"diamond", ARR_TYPE_DIAMOND},
     {"dot", ARR_TYPE_DOT},
-    {"none", ARR_TYPE_NONE},
+//    {"none", ARR_TYPE_NONE},
+    {"none", ARR_TYPE_GAP},
+//    {"gap", ARR_TYPE_GAP},
     /* ARR_MOD_INV is used only here to define two additional shapes
        since not all types can use it */
     {"inv", (ARR_TYPE_NORM | ARR_MOD_INV)},
@@ -117,6 +120,7 @@ static void arrow_type_box(GVJ_t * job, pointf p, pointf u, double arrowsize, do
 static void arrow_type_diamond(GVJ_t * job, pointf p, pointf u, double arrowsize, double penwidth, int flag);
 static void arrow_type_dot(GVJ_t * job, pointf p, pointf u, double arrowsize, double penwidth, int flag);
 static void arrow_type_curve(GVJ_t * job, pointf p, pointf u, double arrowsize, double penwidth, int flag);
+static void arrow_type_gap(GVJ_t * job, pointf p, pointf u, double arrowsize, double penwidth, int flag);
 
 static arrowtype_t Arrowtypes[] = {
     {ARR_TYPE_NORM, 1.0, arrow_type_normal},
@@ -126,6 +130,7 @@ static arrowtype_t Arrowtypes[] = {
     {ARR_TYPE_DIAMOND, 1.2, arrow_type_diamond},
     {ARR_TYPE_DOT, 0.8, arrow_type_dot},
     {ARR_TYPE_CURVE, 1.0, arrow_type_curve},
+    {ARR_TYPE_GAP, 0.5, arrow_type_gap},
     {ARR_TYPE_NONE, 0.0, NULL}
 };
 
@@ -174,6 +179,8 @@ static void arrow_match_name(char *name, int *flag)
     for (i = 0; *rest != '\0' && i < NUMB_OF_ARROW_HEADS; ) {
        f = ARR_TYPE_NONE;
         rest = arrow_match_shape(rest, &f);
+       if (f == ARR_TYPE_GAP && i == (NUMB_OF_ARROW_HEADS -1))
+           f = ARR_TYPE_NONE;
        if (f != ARR_TYPE_NONE)
            *flag |= (f << (i++ * BITS_PER_ARROW));
     }
@@ -504,6 +511,17 @@ static void arrow_type_crow(GVJ_t * job, pointf p, pointf u, double arrowsize, d
        gvrender_polygon(job, a, 9, 1);
 }
 
+static void arrow_type_gap(GVJ_t * job, pointf p, pointf u, double arrowsize, double penwidth, int flag)
+{
+    pointf q, a[2];
+
+    q.x = p.x + u.x;
+    q.y = p.y + u.y;
+    a[0] = p;
+    a[1] = q;
+    gvrender_polyline(job, a, 2);
+}
+
 static void arrow_type_tee(GVJ_t * job, pointf p, pointf u, double arrowsize, double penwidth, int flag)
 {
     pointf m, n, q, v, a[4];