Server IP : 195.201.23.43 / Your IP : 18.217.163.75 Web Server : Apache System : Linux webserver2.vercom.be 5.4.0-192-generic #212-Ubuntu SMP Fri Jul 5 09:47:39 UTC 2024 x86_64 User : kdecoratie ( 1041) PHP Version : 7.1.33-63+ubuntu20.04.1+deb.sury.org+1 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/share/doc/groff/html/ |
Upload File : |
<!-- Creator : groff version 1.22.4 --> <!-- CreationDate: Sat Mar 21 12:27:30 2020 --> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta name="generator" content="groff -Thtml, see www.gnu.org"> <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> <meta name="Content-Style" content="text/css"> <style type="text/css"> p { margin-top: 0; margin-bottom: 0; vertical-align: top } pre { margin-top: 0; margin-bottom: 0; vertical-align: top } table { margin-top: 0; margin-bottom: 0; vertical-align: top } h1 { text-align: center } </style> <title>pic-11.html</title> </head> <hr> [ <a href="pic-10.html">prev</a> | <a href="pic-12.html">next</a> | <a href="pic.html">top</a> ] <hr> <h2>11. Object Groups <a name="11. Object Groups"></a> </h2> <p style="margin-top: 1em"><font color="#000000">There are two different ways to group objects in <b>pic</b>; <i>brace grouping</i> and <i>block composites</i>.</font></p> <h3>11.1. Brace Grouping <a name="11.1. Brace Grouping"></a> </h3> <p style="margin-top: 1em"><font color="#000000">The simpler method is simply to group a set of objects within curly bracket or brace characters. On exit from this grouping, the current position and direction are restored to their value when the opening brace was encountered.</font></p> <h3>11.2. Block Composites <a name="11.2. Block Composites"></a> </h3> <p style="margin-top: 1em"><font color="#000000">A block composite object is created a series of commands enclosed by square brackets. The composite can be treated for most purposes like a single closed object, with the size and shape of its bounding box. Here is an example. The program fragment</font></p> <p style="margin-left:10%; margin-top: 1em"><font color="#000000">A: [ <br> circle; <br> line up 1 at last circle .n; <br> line down 1 at last circle .s; <br> line right 1 at last circle .e; <br> line left 1 at last circle .w; <br> box dashed with .nw at last circle .se + (0.2, -0.2); <br> Caption: center of last box; <br> ]</font></p> <p style="margin-top: 1em"><font color="#000000">yields the block in figure 11-1, which we show both with and without its attachment points. The block’s location becomes the value of <b>A</b>.</font></p> <p align="center" style="margin-top: 1em"><font color="#000000"><img src="img/pic39.png" alt="Image img/pic39.png"></font></p> <p align="center" style="margin-top: 1em"><font color="#000000">Figure 11-1: A sample composite object</font></p> <p style="margin-top: 1em"><font color="#000000">To refer to one of the composite’s attachment points, you can say (for example) <b>A .s</b>. For purposes of object naming, composites are a class. You could write <b>last [] .s</b> as an equivalent reference, usable anywhere a location is needed. This construction is very important for putting together large, multi-part diagrams.</font></p> <p style="margin-top: 1em"><font color="#000000">Blocks are also a variable-scoping mechanism, like a <i>groff</i>(1) environment. All variable assignments done inside a block are undone at the end of it. To get at values within a block, write a name of the block followed by a dot, followed by the label you want. For example, we could refer the center of the box in the above composite as <b>last [] .Caption</b> or <b>A.Caption</b>.</font></p> <p style="margin-top: 1em"><font color="#000000">This kind of reference to a label can be used in any way any other location can be. For example, if we added <b>"Hi!" at A.Caption</b> the result would look like this:</font></p> <p align="center" style="margin-top: 1em"><font color="#000000"><img src="img/pic40.png" alt="Image img/pic40.png"></font></p> <p align="center" style="margin-top: 1em"><font color="#000000">Figure 11-2: Adding a caption using interior labeling</font></p> <p style="margin-top: 1em"><font color="#000000">You can also use interior labels in either part of a <b>with</b> modifier. This means that the example composite could be placed relative to its caption box by a command containing <b>with A.Caption at</b>.</font></p> <p style="margin-top: 1em"><font color="#000000">Note that both width and height of the block composite object are always positive:</font></p> <p align="center" style="margin-top: 1em"><font color="#000000"><img src="img/pic41.png" alt="Image img/pic41.png"></font></p> <p align="center" style="margin-top: 1em"><font color="#000000">Figure 11-3: Composite block objects always have positive width and height</font></p> <p style="margin-top: 1em"><font color="#000000">Blocks may be nested. This means you can use block attachment points to build up complex diagrams hierarchically, from the inside out. Note that <b>last</b> and the other sequential naming mechanisms don’t look inside blocks, so if you have a program that looks like</font></p> <p style="margin-left:10%; margin-top: 1em"><font color="#000000">.PS <br> P: [box "foo"; ellipse "bar"]; <br> Q: [</font></p> <table width="100%" border="0" rules="none" frame="void" cellspacing="0" cellpadding="0"> <tr valign="top" align="left"> <td width="10%"></td> <td width="90%"> <p><font color="#000000">[box "baz"; ellipse "quxx"]</font></p> </td></tr> <tr valign="top" align="left"> <td width="10%"></td> <td width="90%"> <p><font color="#000000">"random text";</font></p> </td></tr> </table> <p style="margin-left:10%;"><font color="#000000">] <br> arrow from 2nd last []; <br> .PE</font></p> <p style="margin-top: 1em"><font color="#000000">the arrow in the last line is attached to object <b>P</b>, not object <b>Q</b>.</font></p> <p style="margin-top: 1em"><font color="#000000">In DWB <b>pic</b>, only references one level deep into enclosed blocks were permitted. GNU <b>gpic</b> removes this restriction.</font></p> <p style="margin-top: 1em"><font color="#000000">The combination of block variable scoping, assignability of labels and the macro facility that we’ll describe later on can be used to simulate functions with local variables (just wrap the macro body in block braces).</font></p> <hr> [ <a href="pic-10.html">prev</a> | <a href="pic-12.html">next</a> | <a href="pic.html">top</a> ] <hr>Private