]> granicus.if.org Git - graphviz/commitdiff
Add cylinder (database) shape; fix some missing entries in files
authorEmden R. Gansner <erg@emdenrg.net>
Sat, 13 Feb 2016 18:55:33 +0000 (13:55 -0500)
committerEmden R. Gansner <erg@emdenrg.net>
Sat, 13 Feb 2016 18:55:33 +0000 (13:55 -0500)
and repository.

doc/info/Makefile.am
doc/info/cylinder.gif [new file with mode: 0644]
doc/info/plain.gif [new file with mode: 0644]
doc/info/shapes.html
doc/infosrc/Makefile.old
doc/infosrc/shapelist
lib/common/const.h
lib/common/shapes.c

index 725e009221b54ef534bd242edfbeae10da9fe12f..b1733fff4e64514f6aff8c21c284a91e7a090838 100644 (file)
@@ -18,12 +18,12 @@ html_DATA = attrs.html colors.html command.html \
   aa_ornormal.gif aa_rbox.gif aa_rcrow.gif aa_rdiamond.gif aa_rinv.gif \
   aa_rnormal.gif aa_rtee.gif aa_rvee.gif aa_tee.gif aa_vee.gif back.gif \
   both.gif box.gif box3d.gif circle.gif colorlist.gif component.gif underline.gif \
-  constraint.gif diamond.gif doublecircle.gif doubleoctagon.gif egg.gif \
+  constraint.gif cylinder.gif diamond.gif doublecircle.gif doubleoctagon.gif egg.gif \
   ellipse.gif fill.gif folder.gif forward.gif hexagon.gif house.gif \
   g_lin0.png g_lin270.png g_lin45.png g_rad0.png g_rad270.png g_rad45.png \
   g_lin180.png g_lin360.png g_lin90.png g_rad180.png g_rad360.png g_rad90.png \
   html1.gif html2.gif html3.gif html4.gif invhouse.gif invtrapezium.gif \
-  invtriangle.gif mrecord.gif nohead.gif none.gif note.gif octagon.gif \
+  invtriangle.gif mrecord.gif nohead.gif none.gif plain.gif note.gif octagon.gif \
   oval.gif parallelogram.gif pentagon.gif plaintext.gif point.gif polygon.gif \
   record.gif record2.gif rect.gif rectangle.gif round.gif septagon.gif tab.gif \
   trapezium.gif triangle.gif tripleoctagon.gif sdlshapes.jpg sdlshapes.png \
diff --git a/doc/info/cylinder.gif b/doc/info/cylinder.gif
new file mode 100644 (file)
index 0000000..9344b38
Binary files /dev/null and b/doc/info/cylinder.gif differ
diff --git a/doc/info/plain.gif b/doc/info/plain.gif
new file mode 100644 (file)
index 0000000..5162660
Binary files /dev/null and b/doc/info/plain.gif differ
index 011aebcd34f548bfc802128f4feb08f8169731cb..d8b966a617b4b8b708f4baff8eb5c2b25c3bfcd9 100644 (file)
@@ -130,81 +130,83 @@ The possible polygon-based shapes are displayed below.
   </TR>
   <TR ALIGN=CENTER>
     <TD><IMG SRC=underline.gif>
+    <TD><IMG SRC=cylinder.gif>
     <TD><IMG SRC=note.gif>
     <TD><IMG SRC=tab.gif>
-    <TD><IMG SRC=folder.gif>
   </TR>
   <TR ALIGN=CENTER>
     <TD><A NAME=d:underline>underline</A>
+    <TD><A NAME=d:cylinder>cylinder</A>
     <TD><A NAME=d:note>note</A>
     <TD><A NAME=d:tab>tab</A>
-    <TD><A NAME=d:folder>folder</A>
   </TR>
   <TR ALIGN=CENTER>
+    <TD><IMG SRC=folder.gif>
     <TD><IMG SRC=box3d.gif>
     <TD><IMG SRC=component.gif>
     <TD><IMG SRC=promoter.gif>
-    <TD><IMG SRC=cds.gif>
   </TR>
   <TR ALIGN=CENTER>
+    <TD><A NAME=d:folder>folder</A>
     <TD><A NAME=d:box3d>box3d</A>
     <TD><A NAME=d:component>component</A>
     <TD><A NAME=d:promoter>promoter</A>
-    <TD><A NAME=d:cds>cds</A>
   </TR>
   <TR ALIGN=CENTER>
+    <TD><IMG SRC=cds.gif>
     <TD><IMG SRC=terminator.gif>
     <TD><IMG SRC=utr.gif>
     <TD><IMG SRC=primersite.gif>
-    <TD><IMG SRC=restrictionsite.gif>
   </TR>
   <TR ALIGN=CENTER>
+    <TD><A NAME=d:cds>cds</A>
     <TD><A NAME=d:terminator>terminator</A>
     <TD><A NAME=d:utr>utr</A>
     <TD><A NAME=d:primersite>primersite</A>
-    <TD><A NAME=d:restrictionsite>restrictionsite</A>
   </TR>
   <TR ALIGN=CENTER>
+    <TD><IMG SRC=restrictionsite.gif>
     <TD><IMG SRC=fivepoverhang.gif>
     <TD><IMG SRC=threepoverhang.gif>
     <TD><IMG SRC=noverhang.gif>
-    <TD><IMG SRC=assembly.gif>
   </TR>
   <TR ALIGN=CENTER>
+    <TD><A NAME=d:restrictionsite>restrictionsite</A>
     <TD><A NAME=d:fivepoverhang>fivepoverhang</A>
     <TD><A NAME=d:threepoverhang>threepoverhang</A>
     <TD><A NAME=d:noverhang>noverhang</A>
-    <TD><A NAME=d:assembly>assembly</A>
   </TR>
   <TR ALIGN=CENTER>
+    <TD><IMG SRC=assembly.gif>
     <TD><IMG SRC=signature.gif>
     <TD><IMG SRC=insulator.gif>
     <TD><IMG SRC=ribosite.gif>
-    <TD><IMG SRC=rnastab.gif>
   </TR>
   <TR ALIGN=CENTER>
+    <TD><A NAME=d:assembly>assembly</A>
     <TD><A NAME=d:signature>signature</A>
     <TD><A NAME=d:insulator>insulator</A>
     <TD><A NAME=d:ribosite>ribosite</A>
-    <TD><A NAME=d:rnastab>rnastab</A>
   </TR>
   <TR ALIGN=CENTER>
+    <TD><IMG SRC=rnastab.gif>
     <TD><IMG SRC=proteasesite.gif>
     <TD><IMG SRC=proteinstab.gif>
     <TD><IMG SRC=rpromoter.gif>
-    <TD><IMG SRC=rarrow.gif>
   </TR>
   <TR ALIGN=CENTER>
+    <TD><A NAME=d:rnastab>rnastab</A>
     <TD><A NAME=d:proteasesite>proteasesite</A>
     <TD><A NAME=d:proteinstab>proteinstab</A>
     <TD><A NAME=d:rpromoter>rpromoter</A>
-    <TD><A NAME=d:rarrow>rarrow</A>
   </TR>
   <TR ALIGN=CENTER>
+    <TD><IMG SRC=rarrow.gif>
     <TD><IMG SRC=larrow.gif>
     <TD><IMG SRC=lpromoter.gif>
   </TR>
   <TR ALIGN=CENTER>
+    <TD><A NAME=d:rarrow>rarrow</A>
     <TD><A NAME=d:larrow>larrow</A>
     <TD><A NAME=d:lpromoter>lpromoter</A>
   </TR>
index 744c65f5b5e8255a82f92f0c7b7b9f69fe13d33d..72391669d8b2b163efeb803f4cde8349a1fb5f8b 100644 (file)
@@ -50,11 +50,11 @@ SGIF = Mcircle.gif Mdiamond.gif Msquare.gif box.gif \
       circle.gif diamond.gif doublecircle.gif \
       doubleoctagon.gif egg.gif ellipse.gif hexagon.gif house.gif \
       invhouse.gif invtrapezium.gif invtriangle.gif none.gif underline.gif \
-      octagon.gif oval.gif parallelogram.gif plaintext.gif \
-      point.gif polygon.gif trapezium.gif triangle.gif \
-      tripleoctagon.gif pentagon.gif septagon.gif rect.gif \
-      rectangle.gif square.gif star.gif tab.gif folder.gif box3d.gif component.gif \
-      promoter.gif cds.gif terminator.gif utr.gif \
+      octagon.gif oval.gif parallelogram.gif plaintext.gif note.gif \
+      point.gif polygon.gif trapezium.gif triangle.gif cylinder.gif \
+      tripleoctagon.gif pentagon.gif septagon.gif rect.gif plain.gif \
+      rectangle.gif square.gif star.gif tab.gif folder.gif box3d.gif \
+      component.gif promoter.gif cds.gif terminator.gif utr.gif \
       primersite.gif restrictionsite.gif fivepoverhang.gif \
       threepoverhang.gif noverhang.gif assembly.gif signature.gif \
       insulator.gif ribosite.gif rnastab.gif proteasesite.gif \
index 26294c242a8011ce8c3edf509eb6ffb8769326e3..d4444d69951890b0a2d9592a263681507c47fa9a 100644 (file)
@@ -31,6 +31,7 @@ square
 star
 none
 underline
+cylinder
 note
 tab
 folder
index 1c4c47355d7b38d780f926fbeffdb7d84e6f7d7e..2c3763462f6f4822f833698ed5977ce9a239728b 100644 (file)
 #define RARROW         (23 << 24)
 #define LARROW         (24 << 24)
 #define LPROMOTER      (25 << 24)
+#define CYLINDER       (26 << 24)
 
 /* fill types */
 #define FILL           1
index c2ebbe4d0d1f664d8df5b2af583d4e0dbd3346ff..c0fcd58b0d5d688d59b29b893cb5a39a2386bb0e 100644 (file)
@@ -70,6 +70,15 @@ static poly_desc_t star_gen = {
     star_vertices,
 };
 
+static pointf cylinder_size (pointf);
+static void cylinder_vertices (pointf*, pointf*);
+static void cylinder_draw(GVJ_t * job, pointf * AF, int sides, int style, int filled);
+/* static boolean cylinder_inside(inside_t * inside_context, pointf p); */
+static poly_desc_t cylinder_gen = {
+    cylinder_size,
+    cylinder_vertices,
+};
+
 /* polygon descriptions.  "polygon" with 0 sides takes all user control */
 
 /*                            regul perip sides orien disto skew */
@@ -98,6 +107,7 @@ static polygon_t p_folder = { FALSE, 1, 4, 0., 0., 0., FOLDER };
 static polygon_t p_box3d = { FALSE, 1, 4, 0., 0., 0., BOX3D };
 static polygon_t p_component = { FALSE, 1, 4, 0., 0., 0., COMPONENT };
 static polygon_t p_underline = { FALSE, 1, 4, 0., 0., 0., UNDERLINE };
+static polygon_t p_cylinder = { FALSE, 1, 19, 0., 0., 0., CYLINDER, (pointf*)&cylinder_gen };
 
 /* redundant and undocumented builtin polygons */
 static polygon_t p_doublecircle = { TRUE, 2, 1, 0., 0., 0. };
@@ -211,6 +221,14 @@ static shape_functions star_fns = {
     poly_path,
     poly_gencode
 };
+static shape_functions cylinder_fns = {
+    poly_init,
+    poly_free,
+    poly_port,
+    poly_inside,
+    poly_path,
+    poly_gencode
+};
 
 static shape_desc Shapes[] = { /* first entry is default for no such shape */
     {"box", &poly_fns, &p_box},
@@ -237,6 +255,7 @@ static shape_desc Shapes[] = {      /* first entry is default for no such shape */
     {"folder", &poly_fns, &p_folder},
     {"box3d", &poly_fns, &p_box3d},
     {"component", &poly_fns, &p_component},
+    {"cylinder", &cylinder_fns, &p_cylinder},
     {"rect", &poly_fns, &p_box},
     {"rectangle", &poly_fns, &p_box},
     {"square", &poly_fns, &p_square},
@@ -508,6 +527,10 @@ void round_corners(GVJ_t * job, pointf * AF, int sides, int style, int filled)
        mode = shape;
     else
        mode = ROUNDED;
+    if (mode == CYLINDER) {
+       cylinder_draw (job, AF, sides, style, filled);
+       return;
+    } 
     B = N_NEW(4 * sides + 4, pointf);
     i = 0;
     /* rbconst is distance offset from a corner of the polygon.
@@ -3981,6 +4004,89 @@ static boolean star_inside(inside_t * inside_context, pointf p)
     return TRUE;
 }
 
+static pointf cylinder_size (pointf sz)
+{
+    sz.y *= 1.375;
+    return sz;
+}
+
+static void cylinder_vertices (pointf* vertices, pointf* bb)
+{
+    double x = bb->x/2;
+    double y = bb->y/2;
+    double yr = bb->y/11;
+
+    vertices[0].x = x;
+    vertices[0].y = y-yr;
+    vertices[1].x = x;
+    vertices[1].y = y-(1-0.551784)*yr;
+    vertices[2].x = 0.551784*x;
+    vertices[2].y = y;
+    vertices[3].x = 0;
+    vertices[3].y = y;
+    vertices[4].x = -0.551784*x;
+    vertices[4].y = y;
+    vertices[5].x = -x;
+    vertices[5].y = vertices[1].y;
+    vertices[6].x = -x;
+    vertices[6].y = y-yr;
+    vertices[7] = vertices[6];
+    vertices[8].x = -x;
+    vertices[8].y = yr-y;
+    vertices[9] = vertices[8];
+    vertices[10].x = -x;
+    vertices[10].y = -vertices[1].y;
+    vertices[11].x = vertices[4].x;
+    vertices[11].y = -vertices[4].y;
+    vertices[12].x = vertices[3].x;
+    vertices[12].y = -vertices[3].y;
+    vertices[13].x = vertices[2].x;
+    vertices[13].y = -vertices[2].y;
+    vertices[14].x = vertices[1].x;
+    vertices[14].y = -vertices[1].y;
+    vertices[15].x = vertices[0].x;
+    vertices[15].y = -vertices[0].y;
+    vertices[16] = vertices[15];
+    vertices[18] = vertices[17] = vertices[0];
+}
+
+static void cylinder_draw(GVJ_t * job, pointf * AF, int sides, int style, int filled)
+{
+    pointf vertices[7];
+    double y0 = AF[0].y;
+    double y02 = y0+y0;
+
+    vertices[0] = AF[0];
+    vertices[1].x = AF[1].x;
+    vertices[1].y = y02 - AF[1].y;
+    vertices[2].x = AF[2].x;
+    vertices[2].y = y02 - AF[2].y;
+    vertices[3].x = AF[3].x;
+    vertices[3].y = y02 - AF[3].y;
+    vertices[4].x = AF[4].x;
+    vertices[4].y = y02 - AF[4].y;
+    vertices[5].x = AF[5].x;
+    vertices[5].y = y02 - AF[5].y;
+    vertices[6] = AF[6];
+
+    gvrender_beziercurve(job, AF, sides, FALSE, FALSE, filled);
+    gvrender_beziercurve(job, vertices, 7, FALSE, FALSE, FALSE);
+}
+
+#if 0
+/* cylinder_inside:
+ * At present, we use just the polygonal outline provided by vertices.
+ * This cold be made more precise by using a finer-grained polyline path
+ * to the spline top and bottom. Another approach might be to approximate
+ * the top and bottom by ellipses. Then the test would involve a check if
+ * the point is in the rectangle or one of the two ellipses.
+ */ 
+static boolean cylinder_inside(inside_t * inside_context, pointf p)
+{
+    return TRUE;
+}
+#endif
+
 static char *side_port[] = { "s", "e", "n", "w" };
 
 static point cvtPt(pointf p, int rankdir)