Envision
A visual programming IDE for object-oriented languages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
Visualization::AnchorLayoutConstraintSolver Class Reference

This class can solve the linear program given by a list of elements and anchors. More...

Public Member Functions

 AnchorLayoutConstraintSolver ()
 
virtual ~AnchorLayoutConstraintSolver ()
 
void placeElements (const QVector< FormElement * > &elements, QList< AnchorLayoutAnchor * > &anchors, AnchorLayoutAnchor::Orientation orientation, Item *item)
 Taking a list of elements and a list of anchors, computes the positions along the axis given by orientation for all the elements, relative to the item. More...
 

Private Member Functions

void addConstraint (int type, QVector< QPair< int, float >> constraintRow, float result)
 
void cleanUpConstraintSolver ()
 
int endVariable (int elementIndex)
 
void initializeConstraintSolver (int numVariables)
 
void prepareLP (const QVector< FormElement * > &elements, QList< AnchorLayoutAnchor * > &anchors, AnchorLayoutAnchor::Orientation orientation, Item *item)
 
void setMinimizeObjective (QVector< float > objectiveRow)
 
QVector< float > solveConstraints ()
 
int startVariable (int elementIndex)
 
void updateLP (const QVector< FormElement * > &elements, AnchorLayoutAnchor::Orientation orientation, Item *item)
 

Private Attributes

int * columnIndices_ {}
 
_lprec * lp_ {}
 
int numVariables_ {}
 
double * rowValues_ {}
 

Detailed Description

This class can solve the linear program given by a list of elements and anchors.

That is, it can place elements along an axis, even if there are some circular dependencies involved. This solver is only used, if there are such dependencies along the axis to be handled.

The library used to solve the linear programming problem is lp_solve.

Constructor & Destructor Documentation

◆ AnchorLayoutConstraintSolver()

Visualization::AnchorLayoutConstraintSolver::AnchorLayoutConstraintSolver ( )

◆ ~AnchorLayoutConstraintSolver()

Visualization::AnchorLayoutConstraintSolver::~AnchorLayoutConstraintSolver ( )
virtual

Member Function Documentation

◆ addConstraint()

void Visualization::AnchorLayoutConstraintSolver::addConstraint ( int  type,
QVector< QPair< int, float >>  constraintRow,
float  result 
)
private

◆ cleanUpConstraintSolver()

void Visualization::AnchorLayoutConstraintSolver::cleanUpConstraintSolver ( )
private

◆ endVariable()

int Visualization::AnchorLayoutConstraintSolver::endVariable ( int  elementIndex)
inlineprivate

◆ initializeConstraintSolver()

void Visualization::AnchorLayoutConstraintSolver::initializeConstraintSolver ( int  numVariables)
private

◆ placeElements()

void Visualization::AnchorLayoutConstraintSolver::placeElements ( const QVector< FormElement * > &  elements,
QList< AnchorLayoutAnchor * > &  anchors,
AnchorLayoutAnchor::Orientation  orientation,
Item item 
)

Taking a list of elements and a list of anchors, computes the positions along the axis given by orientation for all the elements, relative to the item.

◆ prepareLP()

void Visualization::AnchorLayoutConstraintSolver::prepareLP ( const QVector< FormElement * > &  elements,
QList< AnchorLayoutAnchor * > &  anchors,
AnchorLayoutAnchor::Orientation  orientation,
Item item 
)
private

◆ setMinimizeObjective()

void Visualization::AnchorLayoutConstraintSolver::setMinimizeObjective ( QVector< float >  objectiveRow)
private

◆ solveConstraints()

QVector< float > Visualization::AnchorLayoutConstraintSolver::solveConstraints ( )
private

◆ startVariable()

int Visualization::AnchorLayoutConstraintSolver::startVariable ( int  elementIndex)
inlineprivate

◆ updateLP()

void Visualization::AnchorLayoutConstraintSolver::updateLP ( const QVector< FormElement * > &  elements,
AnchorLayoutAnchor::Orientation  orientation,
Item item 
)
private

Member Data Documentation

◆ columnIndices_

int* Visualization::AnchorLayoutConstraintSolver::columnIndices_ {}
private

◆ lp_

_lprec* Visualization::AnchorLayoutConstraintSolver::lp_ {}
private

◆ numVariables_

int Visualization::AnchorLayoutConstraintSolver::numVariables_ {}
private

◆ rowValues_

double* Visualization::AnchorLayoutConstraintSolver::rowValues_ {}
private