Connector Tool Improvements
In Inkscape, it is possible to connect two shapes from their centers. But if you want to make a schematic with represent a family (for example), it's not possible to add connectors from an edge of a shape.
It will be great if connectors can be added to edge of shape, in a way that auto adaptation to "best path" is still possible.
Another idea is to implement a tool that can *restrict* the connector to vertical and horizontal lines only. For now, Inkscape is tracing straight lines or broken line if there is an shape in the path, but lines go in any direction.
It will be great if connectors can be configured in a way that they must avoid others shapes, AND pass through some specific points, AND stay even horizontal even vertical.
I do not speak yet about the functionality of making a little "bridge" when two lines cross each others and are not connected. This is a functionality that exists in M$ Visio but does not work very well :-/
Thanks for reading !
I'd like to formalise aspects of this project proposal. I'm the author of libavoid (the library used for routing in Inkscape) and the person who added the existing connector tool. I'd also probably be the most appropriate person to mentor this project if it were undertaken as a Google Summer of Code (GSoC) project. Below are some connector improvement tasks, along with some comments.
1) Drawing to shape edge, rather than bounding box: Currently, the connector tool only draws connectors to the bounding box of shapes. It should (probably) instead draw them up to the first intersection point with the shape's stroke. This is probably quite easy to achieve now that lib2geom is included in Inkscape -- 2geom can find intersection points between lines or curves making up shapes. Otherwise, the old Boolean Ops code could be used instead.
2) Connector ports (Connecting to a specific point on a shape): libavoid is able to route connectors to specific points. This work would require adding a GUI for this feature to Inkscape so that users could define connector ports on shapes. These would need to be editable through the canvas and the information saved and loaded from files. I think this activity, along with the other minor items on this list, would form the basis of a good GSoC project.
3) Orthogonal connector support (vertical and horizontal lines only): This is something I am working on in libavoid right now. An initial version will be complete during the 2009 GSoC period, so this feature will shortly become fairly trivial to add to Inkscape.
4) Routing connectors through specific points: This is not currently a feature of libavoid, though it is a fundamentally easy thing to do. I would be able to add this feature to libavoid fairly easily, and then the work would be in creating an interface for creating such points and working with them in Inkscape.
5) Visualising connector crossings: libavoid can be queried to determine where connector crossings occur. Thus, Inkscape could be updated to use this information to modify the connector's path to visualise the crossings distinctly (such as by drawing a little "bridge").
6) Curved poly-line and orthogonal connectors: Inkscape can return versions of poly-line or orthogonal connector paths with curved corners. This is purely an aesthetic improvement. Inkscape could be fairly easily modified to add an option for this and to use this feature of libavoid.
7) Routing preferences and penalties: libavoid can provide routes that have less segments, or that have less large bends. It does this by penalising these features when determining the routes. These options could be exposed within Inkscape to give users more control over the quality of the generated paths for connectors.
I'm willing to mentor and assist an interested student who is willing to work on one or more of these tasks. -- Michael
GSoC 2013 Project
I spent this GSoC improving the connectors tool. Here is an overview of the changes:
- Added Points, 0-dimensional SVG elements (inkscape:point) with nothing but an X and a Y coordinate.
- Removed routing to *shapes*. Now, the ends of a connector must terminate in Points. The connector's path is always drawn up to that point and not clipped where it intersects some shape. To emulate the old behavior, place a Point on the shape's outline.
- Made the routing infrastructure more extensible. Now, libavoid routing is only one special case.
- Added simple, non object-avoiding straight and orthogonal routers.
- Modified the UI to accomodate the backend changes. Now, normal object selection is possible. Selections can contain both regular objects and Points.
As previously, there is a connector tool in the main toolbar that will enter the connector editing context. In this context, shapes and Points can be selected and moved or deleted. To place a point, press Shift and click on the document. I found requiring shift to be pressed is necessary to avoid spurious points from being created everywhere I do not want them. Once a point is created, a connector can be started from it by clicking it. Once started, the connector can be aborted by pressing Escape or finished by clicking somewhere (including on other points). To select Points, shift-click them. Control-click and control-shift-click should work as in the normal selection tool, bypassing group restrictions.
To add a Point to a group, select nothing but the group and then create a Point by shift-clicking in the document. This part of the UI does not feel very finished yet as there is no way yet to remove a point from a group or to add it to one after the Point has been created.
These changes break compatibility with the old implementation since the code intersecting connectors with objects and finding object centers has been removed. I do not think that is too much of a problem since the old implementation did not appear to have found very widespread use (-- Sebastian).
SVG generated by the new implementation still contains connectors as Paths with a "inkscape:connector-type" attribute. This is a pretty bad hack that is to be fixed. The ends are indicated by URIs contained in the "inkscape:connection-start" and "inkscape:connection-end" attributes. This might change in future revisions to a single attribute containing a list of points to support intermediate points.