Adaptagrams
|
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>
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 |
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.
cola::AlignmentConstraint::AlignmentConstraint | ( | const vpsc::Dim | dim, |
double | position = 0.0 |
||
) |
Constructs a new AlignmentConstraint in the specified dimension.
[in] | dim | The dimension the constraints will operate in. |
void cola::AlignmentConstraint::addShape | ( | const unsigned int | index, |
const double | offset | ||
) |
Mark a node as being part of this alignment constraint.
[in] | index | The index of the node in the Rectangles vector. |
[in] | offset | The 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().
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.
[in] | pos | The ideal position value for the alignment. |
|
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.
[in] | dim | The current active dimension. |
[in] | vars | The list of variables for the overall problem instance. |
[in,out] | cs | The list of constraints to which the generated constraints will be added. |
[in] | bbs | The list of bounding boxes for all rectangles in the current problem. It has the same order as vars. |
Implements cola::CompoundConstraint.
|
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.
[in] | dim | The current active dimension. |
[in,out] | vars | The list of variables for the overall problem instance to which any variables generated should be appended. |
Implements cola::CompoundConstraint.
bool cola::AlignmentConstraint::isFixed | ( | void | ) | const |
Indicates if the alignment position is marked as fixed.
|
virtual |
Returns a textual description of the compound constraint.
Implements cola::CompoundConstraint.
void cola::AlignmentConstraint::unfixPos | ( | void | ) |
Mark the alignment as not having a fixed position.
This is the default.
|
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.
[in] | dim | The current active dimension. |
Reimplemented from cola::CompoundConstraint.
void* cola::AlignmentConstraint::indicator |
Generic pointer to an indicator object being used to represent this compound constraint in the GUI.