add bitmap graph style (TODO: documentation)
[PyX/mjg.git] / manual / connector.rst
blob3c6640bc775080eabfd50918aa829ce8d833ed47
2 .. module:: connector
4 ***********************
5 Module :mod:`connector`
6 ***********************
8 This module provides classes for connecting two :class:`box`\ -instances with
9 lines, arcs or curves. All constructors of the following connector-classes take
10 two :class:`box`\ -instances as the two first arguments. They return a
11 connecting path from the first to the second box. The overall geometry of the
12 path is such that is starts/ends at the boxes' centers. It is then cut by the
13 boxes' outlines. The resulting :class:`connector` will additionally be shortened
14 by lengths given in the *boxdists* (a list of two lengths,
15 default ``[0,0]``).
17 Angle keywords can be either absolute or relative. The absolute angles refer to
18 the angle between x-axis and the running tangent of the connector, while the
19 relative angles are between the direct connecting line of the box-centers and
20 the running tangent (see figure. :ref:`fig_connector`).
22 The bulge-keywords parameterize the deviation of the connector from the
23 connecting line. It has different meanings for different connectors (see figure.
24 :ref:`fig_connector`).
27 Class :class:`line`
28 ===================
30 The constructor of the :class:`line` class accepts only boxes and the
31 *boxdists*.
34 Class :class:`arc`
35 ==================
37 The constructor takes either the *relangle* or a combination
38 of *relbulge* and *absbulge*. The "bulge" is meant to be a
39 hint for the greatest distance between the connecting arc and the straight
40 connection between the box-centers. (Default: ``relangle=45``,
41 ``relbulge=None``, ``absbulge=None``)
43 Note that the bulge-keywords override the angle-keyword.
45 If both *relbulge* and *absbulge* are given, they will be
46 added.
49 Class :class:`curve`
50 ====================
52 The constructor takes both angle- and bulge-keywords. Here, the bulges are used
53 as distances between the control points of the cubic BeziĆ©r-curve. For the signs
54 of the angle- and bulge-keywords refer to figure :ref:`fig_connector`.
56 *absangle1* or *relangle1* ---  *absangle2* or
57 *relangle2*, where the absolute angle overrides the relative if both
58 are given. (Default: ``relangle1=45``, ``relangle2=45``, ``absangle1=None``,
59 ``absangle2=None``)
61 *absbulge* and *relbulge*, where they will be added if both
62 are given. ---  (Default: ``absbulge=None``, ``relbulge=0.39``; these default
63 values produce output similar to the defaults of :class:`arc`.)
65 .. _fig_connector:
66 .. figure:: connector.*
67    :align:  center
69    The angle-parameters of the connector.arc (left panel) and the connector.curve (right panel) classes.
72 Class :class:`twolines`
73 =======================
75 This class returns two connected straight lines. There is a vast variety of
76 combinations for angle- and length-keywords. The user has to make sure to
77 provide a non-ambiguous set of keywords:
79 *absangle1* or *relangle1* for the first angle, ---
80 *relangleM* for the middle angle and ---  *absangle2* or
81 *relangle2* for the ending angle. Again, the absolute angle overrides
82 the relative if both are given. (Default: all five angles are ``None``)
84 *length1* and *length2* for the lengths of the connecting
85 lines. (Default: ``None``)