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

A distribution constraint specifies an ordered set of alignment constraints and a fixed separation required between them. More...

#include <compound_constraints.h>

Inheritance diagram for cola::DistributionConstraint:
Inheritance graph
Collaboration diagram for cola::DistributionConstraint:
Collaboration graph

Public Member Functions

 DistributionConstraint (const vpsc::Dim dim)
 Constructs a new empty DistributionConstraint with a minimum or exact spacing. More...
 
void addAlignmentPair (AlignmentConstraint *ac1, AlignmentConstraint *ac2)
 Mark a pair of alignment constraints as being part of this distribution constraint. More...
 
void setSeparation (double sep)
 Alter the exact spacing between each pair of alignment constraints. 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...
 
- Public Member Functions inherited from cola::CompoundConstraint
virtual 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

A distribution constraint specifies an ordered set of alignment constraints and a fixed separation required between them.

This compound constraint it used to keep a set of alignment constraints equally distributed.

If no separation distance is set, then it is detemined from the distance between the two outer alignments, divided by the number of alignments - 1.

Constructor & Destructor Documentation

◆ DistributionConstraint()

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

Constructs a new empty DistributionConstraint with a minimum or exact spacing.

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

Member Function Documentation

◆ addAlignmentPair()

void cola::DistributionConstraint::addAlignmentPair ( AlignmentConstraint ac1,
AlignmentConstraint ac2 
)

Mark a pair of alignment constraints as being part of this distribution constraint.

You should specify spacing beteen a set of alignments (e.g., {1, 2, 3, 4}) by calling this method with each neighbouring pair (e.g., {(1, 2), (2, 3), (3, 4)}).

Parameters
[in]ac1A pointer to the left AlignmentConstraint object of the pair.
[in]ac2A pointer to the right AlignmentConstraint object of the pair.

◆ generateSeparationConstraints()

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

◆ setSeparation()

void cola::DistributionConstraint::setSeparation ( double  sep)

Alter the exact spacing between each pair of alignment constraints.

Parameters
[in]sepThe exact distance to separate the alignment constraints.

◆ toString()

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

Returns a textual description of the compound constraint.

Returns
A string describing the compound constraint.

Implements cola::CompoundConstraint.

Member Data Documentation

◆ indicator

void* cola::DistributionConstraint::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: