GDT provides a flexible architecture for managing constraints. Different types of constraint can be concurrently applied on nodes and edges, which are taken into account by the involved layout algorithms. The base undi_graph class provides in fact a set of methods for applying and removing constraints, which are then automatically propagated when the graph is promoted to any other derived class.
- Preserving constraints while manipulating the graph
The main issue with constraints comes when the node/edge they are applied on is deleted, split or merged. In such cases, each constraint has to be removed or transformed and/or propagated to other adjacent nodes and edges, according to the type of the constraint itself.
- Encapsulation and polymorphism at work
The solution adopted in GDT is to make constraints intelligent, that is, to make them react according to their type to all the relevant events occurring on their node/edge. Each type of constraint is represented by a specific class, which encapsulates its behavior with respect to changes of the node/edge it is applied on. In particular, an abstract class provides the set of virtual reaction methods common to all the derived constraint classes, while each derived class provides its own implementation for each reaction method.
- Reaction methods
The main events with a potential impact on a constraint applied on a given node/edge are the deletion, the split and the merge of that node/edge. For each of those events, each constraint class provides a specific reacting method. When an edge is split, in example, the corresponding "update_after_edge_split" reaction method is invoked on all the constraints applied on that edge, so that each constraint executes the class-specific method implementation.
The following list describes the constraints currently available to the GDT developer. Constraints management is one of the most interesting and promising development area of the GDT project, and many more constraints should be available in the next released versions.
Base abstract class for representing a constraint. It declares as virtual the reaction methods common to all the derived constraint classes. Each specific constraint class provides in fact its own implementation, which depends on the semantics of the constraint itself.
Planarization constraint specifying that a given edge cannot be crossed by any other.
Constraint on the number of bends along a given edge of an orthogonal/upward drawing. This constraint allows to specify two different policies : NONE (no bends, i.e. straight edge) or ANY (any number of bends along the edge).
Constraint on the direction of the bends along a given edge of an orthogonal/upward drawing. This constraint allows to specify two different policies (left- or right-turning bends) by choosing the start extremal node of the edge.
Planarization constraint specifying that a set of nodes must belong to the same face.
Planarization constraint specifying that an ordered set of nodes must belong to the same face, and must be placed along the face border in accordance with the specified order.
Constraint for specifying the width of a node in the drawing.
Constraint for specifying the height of a node in the drawing.
Constraint for specifying the angle formed by an edge with its right
Last update: July 31, 2002
Website design by INTEGRA Sistemi, www.IntegraSistemi.it