Adaptagrams
Public Member Functions | Public Attributes | List of all members
cola::BoundaryConstraint Class Reference

A boundary constraint specifies a bounding line that a set of nodes must be either to the left or right of. More...

#include <compound_constraints.h>

Inheritance diagram for cola::BoundaryConstraint:
Inheritance graph
Collaboration diagram for cola::BoundaryConstraint:
Collaboration graph

Public Member Functions

 BoundaryConstraint (const vpsc::Dim dim)
 Constructs a new BoundaryConstraint in the specified dimension. More...
 
void addShape (const unsigned int index, const double offset)
 Mark a node as being part of this boundary constraint. More...
 
std::string toString (void) const
 Returns a textual description of the compound constraint. More...
 
void generateVariables (const vpsc::Dim dim, vpsc::Variables &vars)
 Implemented by the compound constraint to generate any additional required variables in the given dimension. More...
 
void generateSeparationConstraints (const vpsc::Dim dim, vpsc::Variables &vars, vpsc::Constraints &cs, vpsc::Rectangles &bbs)
 Implemented by the compound constraint to generate the low-level separation constraints in the given dimension. More...
 
void updatePosition (const vpsc::Dim dim)
 Implemented by the compound constraint to send position information back to the interface. More...
 

Public Attributes

double position
 Holds the position of the boundary line, once layout is complete.
 

Detailed Description

A boundary constraint specifies a bounding line that a set of nodes must be either to the left or right of.

A boundary constraint gives a bounding line in a particular dimension (with position stored in a variable) and a set of nodes required to be to the left of that line and nodes required to be to the right of the line. Separations are determined by offsets passed to addShape().

Constructor & Destructor Documentation

◆ BoundaryConstraint()

cola::BoundaryConstraint::BoundaryConstraint ( const vpsc::Dim  dim)

Constructs a new BoundaryConstraint in the specified dimension.

Parameters
[in]dimThe dimension the constraints will operate in.

Member Function Documentation

◆ addShape()

void cola::BoundaryConstraint::addShape ( const unsigned int  index,
const double  offset 
)

Mark a node as being part of this boundary constraint.

Parameters
[in]indexThe index of the node in the Rectangles vector.
[in]offsetThe minimum amount to separate the node from the boundary line. Negative if left-of, positive if right-of. Will usually be equal to half a node's size plus a buffer amount.

◆ generateSeparationConstraints()

void cola::BoundaryConstraint::generateSeparationConstraints ( const vpsc::Dim  dim,
vpsc::Variables var,
vpsc::Constraints cs,
vpsc::Rectangles bbs 
)
virtual

Implemented by the compound constraint to generate the low-level separation constraints in the given dimension.

These constraints will be added to the list of constraints cs.

Parameters
[in]dimThe current active dimension.
[in]varsThe list of variables for the overall problem instance.
[in,out]csThe list of constraints to which the generated constraints will be added.
[in]bbsThe list of bounding boxes for all rectangles in the current problem. It has the same order as vars.

Implements cola::CompoundConstraint.

◆ generateVariables()

void cola::BoundaryConstraint::generateVariables ( const vpsc::Dim  dim,
vpsc::Variables vars 
)
virtual

Implemented by the compound constraint to generate any additional required variables in the given dimension.

Generate any additional variables required by this compound constraint when operating in the given dimension dim and add them to vars. These variables should be cleaned up by the caller after the VPSC problem is solved.

The variables' ideal position and weight should be set by the compound constraint and they should be added to the end of vars.

Parameters
[in]dimThe current active dimension.
[in,out]varsThe list of variables for the overall problem instance to which any variables generated should be appended.

Implements cola::CompoundConstraint.

References position.

◆ toString()

std::string cola::BoundaryConstraint::toString ( void  ) const
virtual

Returns a textual description of the compound constraint.

Returns
A string describing the compound constraint.

Implements cola::CompoundConstraint.

◆ updatePosition()

void cola::BoundaryConstraint::updatePosition ( const vpsc::Dim  dim)
virtual

Implemented by the compound constraint to send position information back to the interface.

This will be called for each compound constraint once the VPSC instance is solved to allow them to pass information such as variable values back to the graphical user interface.

Parameters
[in]dimThe current active dimension.

Reimplemented from cola::CompoundConstraint.

References position.


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