Adaptagrams
|
#include <constraints.h>
Public Member Functions | |
SepCo (vpsc::Dim dim, Node_SP left, Node_SP right, double gap, bool exact=false) | |
Standard constructor. More... | |
void | generateColaConstraints (const ColaGraphRep &cgr, cola::CompoundConstraints &ccs) |
Allocate cola::CompoundConstraints to represent this SepCo. More... | |
CardinalDir | getDirecRelativeToNode (Node_SP baseNode) const |
Determine the constrained direction from one Node to the other. More... | |
void | addToMatrix (SepMatrix &matrix) const |
Add this constraint to a SepMatrix. | |
double | violation (void) const |
Determine the extent to which this separation constraint is currently violated. | |
std::string | toString (void) const |
Write a string representation. | |
Simple struct to represent separation constraints in one dimension, in terms of Nodes (rather than Rectangle indices).
Also supports separation constraints with negative gaps (unlike VPSC). Such constraints are perhaps better called "containment constraints". To illustrate, in the figure below
| a | ---—| — | | — | | b | | — |
the separation constraint b.x - 100 <= a.x might mean that node b is constrained to stay to the left of the dashed line (which moves with node a).
|
inline |
Standard constructor.
[in] | dim | The dimension in which the constraint acts. |
[in] | left | The lefthand Node (i.e. the one with smaller coordinate) |
[in] | right | The righthand Node (i.e. the one with larger coordinate) |
[in] | gap | The desired gap between the centres of the Nodes |
[in] | exact | Says whether the gap is exact or a minimum. |
void SepCo::generateColaConstraints | ( | const ColaGraphRep & | cgr, |
cola::CompoundConstraints & | ccs | ||
) |
Allocate cola::CompoundConstraints to represent this SepCo.
[in] | cgr | A ColaGraphRep so that Node Id's can be mapped to Rectangle indices. |
[out] | ccs | A CompoundConstraints vector to which to add pointers to the allocated constraints. |
References cola::AlignmentConstraint::addShape(), and dialect::ColaGraphRep::id2ix.
CardinalDir SepCo::getDirecRelativeToNode | ( | Node_SP | baseNode | ) | const |
Determine the constrained direction from one Node to the other.
[in] | baseNode | The Node relative to which the direction is understood. |
References dialect::EAST, and vpsc::HORIZONTAL.