Difference between revisions of "Connector tool tutorial"
m (Comment re connection points and connectors)
Revision as of 08:33, 15 December 2005
Using the Connector tool
The connector tool currently supports autorouting polyline connectors. These connectors can be attached to the shapes, i.e. pretty much anything that is not an open path. When the shape is moved the connector will update itself to follow the shape. In addition, connectors will avoid objects marked as 'avoided' and reroute if one of these objects is placed on their existing path, or is moved and frees up a new path.
Mark shapes as 'avoided' or 'ignored' for connector routing.
While in the connector context there are two toolbar buttons on the tool toolbar. The first of these marks all the objects in the current selection as avoided for connector routing. Correctors will avoid these shapes. The second button marks all objects in the current selection as ignored for connector routing.
Currently, just the shapes bounding box is used for the avoidance. The preferred approach is to use each shapes convez hull. Currently Inkscape's NR::ConvexHull only uses a rectangular bounding box. Once proper convex hull code is in the codebase connector routing will be switched to using that.
Drawing new connectors
Click and drag from any empty point on the canvas to create a new connector. If you begin or end the connector over a connection point, then the connector will be attached to that shape. Connection points are currently shown at the center (of the bounding box) of any shape, and are shown when the mouse cursor is over the object.
Rerouting an existing connector
If you click on a connector in the connector context, a handle will be shown for each of its endpoints. Dragging either of these will alter the endpoint of the connector. If the endpoint was attached to a shape then this connection will be removed. Again, if the this dragging ends over a connection point, then that end of the connector will be attached to the object. Connectors will automatically reroute during this operation.
If an 'avoided' shape is placed over an existing connector route, then the connector will automatically reroute to avoid the shape. Also, if moving or deleting a shape frees up a better (currrently meaning shorter) path then the connector will again be rerouted.
There is lots more interesting things to do. One of the important ones (I think) is to allow conectors to be attached to user placeable connection points. This is something I would like to get people's thoughts on, i.e., what would you use them for, what would you want from them, etc.
Also, please have a play with connectors and let me know what you like/dislike. What works for you, what doesn't. I'm very interested in hearing peoples opinions and in working further on making this part of Inkscape realy useful to users.
-- Michael Wybrow
I think having user placeable connection points would be really helpful; it could allow you to do things like flow charts in Inkscape. That would open up Inkscape to usage as a helpful charting tool as well. - cam
Besides user placeable connection points it would be cool if it would be possible to use an outset of the convex hull. It would allow arrows or lines to clearly point to an object while not touching it. Often this is visually more pleasing. Another point would be to "fix" markers such that it is possible to use the tip of the arrow as the endpoint of a polyline instead of the point the marker is placed on. - Paul
I second Paul's suggestions. In 0.43, the effect can be created with an invisible dynamic offset, but its a bit of a cludge. - Jon
Yes, user-placeable connection points are the one single missing feature that just stopped me from using Inkscape for some control system block diagrams. I could easily do them in dia, but I was looking for a tool which can easily generate nice-looking "presentable" graphics. I will now probably draw them in Xfig. One more comment regarding connectors: it would be nice if the arrowheads and other shapes that can be used for either the connection end points or in the middle would automatically inherit colour etc. from the connection line. Currently they always come up as black, and it takes some SVG/XML tweaking to get them right. Just my 2 cts worth. - Helmut Walle.
Still to do: (lifted from src/connector-context.cpp)
o Have shapes avoid coonvex hulls of objects, rather than their bounding box. Possibly implement the unfinished ConvexHull class in libnr. o Draw connectors to shape edges rather than bounding box. o Fix minor endpoint position error for connected objects. o Show a visual indicator for objects with the 'avoid' property set. o Create an interface for setting markers (arrow heads). o Better distinguish between paths and connectors to prevent problems in the node tool and paths accidently being turned into connectors in the connector tool. Perhaps have a way to convert between. o Allow doubleclicking on connectors to swap to the connector context. o Cleanup to remove unecessary borrowed DrawContext code. o Allow user-placeable connection points. o Deal sanely with connectors with both endpoints attached to the same connection point, and drawing of connectors attaching overlaping shapes (currently tries to adjust connector to be outside both bounding boxes). o Fix many special cases related to connectors updating, e.g., copying a couple of shapes and a connector that are attached to each other. e.g., detach connector when it is moved or transformed in one of the other contexts.