]> granicus.if.org Git - graphviz/commitdiff
Fix bug 1181
authorerg <devnull@localhost>
Tue, 4 Sep 2007 21:40:01 +0000 (21:40 +0000)
committererg <devnull@localhost>
Tue, 4 Sep 2007 21:40:01 +0000 (21:40 +0000)
lib/common/shapes.c
lib/common/types.h
lib/neatogen/neatosplines.c

index e0e4c9fcb323979b2cec5db46b5085cf40487d6f..f8d2c5d2819cdbbf65f96f2aff8b8a0fd36e249a 100644 (file)
@@ -454,8 +454,10 @@ shape_kind shapeOf(node_t * n)
        return SH_RECORD;
     else if (ifn == point_init)
        return SH_POINT;
+    else if (ifn == epsf_init)
+       return SH_EPSF;
     else
-       return SH_USER;
+       return SH_UNSET;
 }
 
 boolean isPolygon(node_t * n)
index 0db6da3847ab8f1e760e08d2b51f94057deb329a..edfc93c4f928b7fd322e95770c6915b9cdf361b1 100644 (file)
@@ -176,8 +176,7 @@ extern "C" {
        void (*codefn) (GVJ_t * job, node_t * n);       /* emits graphics code for node */
     } shape_functions;
 
-    typedef enum { SH_UNSET, SH_POLY, SH_RECORD, SH_POINT, SH_EPSF,
-           SH_USER } shape_kind;
+    typedef enum { SH_UNSET, SH_POLY, SH_RECORD, SH_POINT, SH_EPSF} shape_kind;
 
     typedef struct shape_desc {        /* read-only shape descriptor */
        char *name;             /* as read from graph file */
index edbb47533399b249b782b07da8ceb365aea9acee..a520e654876bfe3284da1b1fb696a40b5e78abd4 100644 (file)
@@ -470,8 +470,6 @@ static void makeStraightEdge(graph_t * g, edge_t * e)
  *
  * The polygon has its vertices in CW order.
  * 
- * N.B. Point, epsf and user shapes are not handled. Point should
- * be easy, and user shapes are boxes. FIX
  */
 Ppoly_t *makeObstacle(node_t * n, double SEP)
 {
@@ -483,9 +481,11 @@ Ppoly_t *makeObstacle(node_t * n, double SEP)
     box b;
     point pt;
     field_t *fld;
+    epsf_t *desc;
 
     switch (shapeOf(n)) {
     case SH_POLY:
+    case SH_POINT:
        obs = NEW(Ppoly_t);
        poly = (polygon_t *) ND_shape_info(n);
        if (poly->sides >= 3) {
@@ -525,6 +525,18 @@ Ppoly_t *makeObstacle(node_t * n, double SEP)
        obs->ps[2] = recPt(b.UR.x, b.UR.y, pt, SEP);
        obs->ps[3] = recPt(b.UR.x, b.LL.y, pt, SEP);
        break;
+    case SH_EPSF:
+       desc = (epsf_t *) (ND_shape_info(n));
+       obs = NEW(Ppoly_t);
+       obs->pn = 4;
+       obs->ps = N_NEW(4, Ppoint_t);
+       /* CW order */
+       pt = ND_coord_i(n);
+       obs->ps[0] = recPt(-ND_lw_i(n), -ND_ht_i(n), pt, SEP);
+       obs->ps[1] = recPt(-ND_lw_i(n), ND_ht_i(n), pt, SEP);
+       obs->ps[2] = recPt(ND_rw_i(n), ND_ht_i(n), pt, SEP);
+       obs->ps[3] = recPt(ND_rw_i(n), -ND_ht_i(n), pt, SEP);
+       break;
     default:
        obs = NULL;
        break;