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

An alignment constraint specifies a alignment line that a set of nodes must be constrained to by an exact amount. More...

#include <compound_constraints.h>

Inheritance diagram for cola::AlignmentConstraint:
Inheritance graph
Collaboration diagram for cola::AlignmentConstraint:
Collaboration graph

Public Member Functions

 AlignmentConstraint (const vpsc::Dim dim, double position=0.0)
 Constructs a new AlignmentConstraint in the specified dimension. More...
 
void addShape (const unsigned int index, const double offset)
 Mark a node as being part of this alignment constraint. More...
 
void fixPos (double pos)
 Mark the alignment as ideally having a fixed position. More...
 
void unfixPos (void)
 Mark the alignment as not having a fixed position. More...
 
bool isFixed (void) const
 Indicates if the alignment position is marked as fixed. 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

void * indicator
 

Detailed Description

An alignment constraint specifies a alignment line that a set of nodes must be constrained to by an exact amount.

This is represented as a variable representing the position of a vertical or horizontal and a then group of nodes and offsets for those nodes such that the nodes must be spaced exactly at those offsets from the alignment position.

Optionally, the alignment may be given a suggested position and/or marked as "fixed". When fixed, the position variable will be given a higher weight to attempt to keep it at that position.

Constructor & Destructor Documentation

◆ AlignmentConstraint()

cola::AlignmentConstraint::AlignmentConstraint ( const vpsc::Dim  dim,
double  position = 0.0 
)

Constructs a new AlignmentConstraint in the specified dimension.

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

Member Function Documentation

◆ addShape()

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

Mark a node as being part of this alignment constraint.

Parameters
[in]indexThe index of the node in the Rectangles vector.
[in]offsetThe exact amount to separate the node from the alignment line. Negative if left-of, positive if right-of. Will usually be equal to half a node's size if aligning to the side of a node, or zero if aligning with the centre of a node.

Referenced by dialect::SepCo::generateColaConstraints().

Here is the caller graph for this function:

◆ fixPos()

void cola::AlignmentConstraint::fixPos ( double  pos)

Mark the alignment as ideally having a fixed position.

This causes the position variable for the alignment to be given the ideal position pos and a higher weight.

Parameters
[in]posThe ideal position value for the alignment.

◆ generateSeparationConstraints()

void cola::AlignmentConstraint::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::AlignmentConstraint::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.

◆ isFixed()

bool cola::AlignmentConstraint::isFixed ( void  ) const

Indicates if the alignment position is marked as fixed.

Returns
True if the alignment position is marked as fixed, or false otherwise.

◆ toString()

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

Returns a textual description of the compound constraint.

Returns
A string describing the compound constraint.

Implements cola::CompoundConstraint.

◆ unfixPos()

void cola::AlignmentConstraint::unfixPos ( void  )

Mark the alignment as not having a fixed position.

This is the default.

◆ updatePosition()

void cola::AlignmentConstraint::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.

Member Data Documentation

◆ indicator

void* cola::AlignmentConstraint::indicator

Generic pointer to an indicator object being used to represent this compound constraint in the GUI.


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