Adaptagrams
Public Member Functions | List of all members
dialect::SepCo Struct Reference

#include <constraints.h>

Collaboration diagram for dialect::SepCo:
Collaboration graph

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.
 

Detailed Description

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).

Constructor & Destructor Documentation

◆ SepCo()

dialect::SepCo::SepCo ( vpsc::Dim  dim,
Node_SP  left,
Node_SP  right,
double  gap,
bool  exact = false 
)
inline

Standard constructor.

Parameters
[in]dimThe dimension in which the constraint acts.
[in]leftThe lefthand Node (i.e. the one with smaller coordinate)
[in]rightThe righthand Node (i.e. the one with larger coordinate)
[in]gapThe desired gap between the centres of the Nodes
[in]exactSays whether the gap is exact or a minimum.

Member Function Documentation

◆ generateColaConstraints()

void SepCo::generateColaConstraints ( const ColaGraphRep cgr,
cola::CompoundConstraints ccs 
)

Allocate cola::CompoundConstraints to represent this SepCo.

Parameters
[in]cgrA ColaGraphRep so that Node Id's can be mapped to Rectangle indices.
[out]ccsA CompoundConstraints vector to which to add pointers to the allocated constraints.

References cola::AlignmentConstraint::addShape(), and dialect::ColaGraphRep::id2ix.

Here is the call graph for this function:

◆ getDirecRelativeToNode()

CardinalDir SepCo::getDirecRelativeToNode ( Node_SP  baseNode) const

Determine the constrained direction from one Node to the other.

Parameters
[in]baseNodeThe Node relative to which the direction is understood.
Returns
A CardinalDir giving the direction from baseNode to the other node.

References dialect::EAST, and vpsc::HORIZONTAL.


The documentation for this struct was generated from the following files: