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

A page boundary contraint specifies constraints that attempt to keep the given nodes within a defined rectangular region. More...

#include <compound_constraints.h>

Inheritance diagram for cola::PageBoundaryConstraints:
Inheritance graph
Collaboration diagram for cola::PageBoundaryConstraints:
Collaboration graph

Public Member Functions

 PageBoundaryConstraints (double xLow, double xHigh, double yLow, double yHigh, double weight=100.0)
 Constructs a new PageBoundaryConstraints object with given page boundary positions and weight. More...
 
void addShape (unsigned index, double halfW, double halfH)
 Mark a node as being contained within this page boundary. 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 &gcs, 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...
 

Detailed Description

A page boundary contraint specifies constraints that attempt to keep the given nodes within a defined rectangular region.

This compound constraint creates dummy variables for each of the four edges of the page and constraints between all nodes and these dummy vars such that nodes are contained between the edges. The variables for the page edges have a high weight but will "balloon out" if other constraints force nodes to stick out past the ideal edge positions.

Constructor & Destructor Documentation

◆ PageBoundaryConstraints()

cola::PageBoundaryConstraints::PageBoundaryConstraints ( double  xLow,
double  xHigh,
double  yLow,
double  yHigh,
double  weight = 100.0 
)

Constructs a new PageBoundaryConstraints object with given page boundary positions and weight.

Parameters
[in]xLowThe position of the left edge of the page.
[in]xHighThe position of the right edge of the page.
[in]yLowThe position of the bottom edge of the page.
[in]yHighThe position of the top edge of the page.
[in]weightThe weight to give the positions variables for the page edges. The default is 100.0.

References vpsc::XDIM, and vpsc::YDIM.

Member Function Documentation

◆ addShape()

void cola::PageBoundaryConstraints::addShape ( unsigned  index,
double  halfW,
double  halfH 
)

Mark a node as being contained within this page boundary.

Parameters
[in]indexThe index of the node in the Rectangles vector.
[in]halfWHalf of the width of the node. Needed because node position variables represent their centre.
[in]halfHHalf of the height of the node.

◆ generateSeparationConstraints()

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

◆ toString()

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

Returns a textual description of the compound constraint.

Returns
A string describing the compound constraint.

Implements cola::CompoundConstraint.

References vpsc::XDIM, and vpsc::YDIM.

◆ updatePosition()

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


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