 | CLAYOUTiAddConstraint Method |
Add a constraint between any two rectangles or to one with absolute positioning
Namespace:
GeoEngine.Core.GXNetX
Assembly:
geoengine.core.gxnetx (in geoengine.core.gxnetx.dll) Version: 2024.2.0.25
Syntaxpublic int iAddConstraint(
int rect_from,
int constr_from,
int rect_to,
int constr_to,
double o_mod,
double m_mod
)
public int iAddConstraint(
int rect_from,
int constr_from,
int rect_to,
int constr_to,
double o_mod,
double m_mod
)
Public Function iAddConstraint (
rect_from As Integer,
constr_from As Integer,
rect_to As Integer,
constr_to As Integer,
o_mod As Double,
m_mod As Double
) As Integer
Public Function iAddConstraint (
rect_from As Integer,
constr_from As Integer,
rect_to As Integer,
constr_to As Integer,
o_mod As Double,
m_mod As Double
) As Integer
public:
int iAddConstraint(
int rect_from,
int constr_from,
int rect_to,
int constr_to,
double o_mod,
double m_mod
)
public:
int iAddConstraint(
int rect_from,
int constr_from,
int rect_to,
int constr_to,
double o_mod,
double m_mod
)
member iAddConstraint :
rect_from : int *
constr_from : int *
rect_to : int *
constr_to : int *
o_mod : float *
m_mod : float -> int
member iAddConstraint :
rect_from : int *
constr_from : int *
rect_to : int *
constr_to : int *
o_mod : float *
m_mod : float -> int
Parameters
- rect_from
- Type: SystemInt32
From rectangle (Or -1 for parent) - constr_from
- Type: SystemInt32
<define>LAYOUT_CONSTR</define> From constraint flag - rect_to
- Type: SystemInt32
To rectangle (Or -1 for parent Or -2 for absolute positioning) - constr_to
- Type: SystemInt32
<define>LAYOUT_CONSTR</define> To constraint flag - o_mod
- Type: SystemDouble
Offset modifier - m_mod
- Type: SystemDouble
Multiplicative modifier
Return Value
Type:
Int32
0 - OK
1 - Error
Remarks
Constraints can be applied between 2 rectangles in the layout, or to 1 rectangle with
absolute positioning. Use the constraints to control left, right, bottom, top,
width, height, or centering configurations. Examples:
(ordered as rectangle from, constraint from, rectangle to, constraint to, offset modifier, multiplicative modifier)
A, <define>LAYOUT_CONSTR_LEFT</define>, B, <define>LAYOUT_CONSTR_LEFT</define>, 0, 0, 1.0 Set left position of A equal to left pos of B
A, <define>LAYOUT_CONSTR_LEFT</define>, B, <define>LAYOUT_CONSTR_RIGHT</define>, 0, 0, 1.0 Set left pos of A equal to right of B
The offset modifier is used for additive manipulation of constraints
A, <define>LAYOUT_CONSTR_LEFT</define>, B, <define>LAYOUT_CONSTR_LEFT</define>, 10, 0, 1.0 Set left pos of A equal to left of B, plus 10
A, <define>LAYOUT_CONSTR_BOTTOM</define>, B, <define>LAYOUT_CONSTR_TOP</define>, -20, 0, 1.0 Set bottom of A equal to top of B, minus 20
Multiplicative manipulation of constraints
A, <define>LAYOUT_CONSTR_WIDTH</define>, B, <define>LAYOUT_CONSTR_WIDTH</define>, 0, 0.5 Set the width of A equal to 0.5 times the width of B
A, <define>LAYOUT_CONSTR_HEIGHT</define>, B, <define>LAYOUT_CONSTR_WIDTH</define>, 0, 1.2 Set the height of A equal to 1.2 times the width of B
You can use BOTH the multiplicative and offset modifiers in conjunction (multiplicative gets precedence)
A, <define>LAYOUT_CONSTR_WIDTH</define>, B, <define>LAYOUT_CONSTR_WIDTH</define>, 10, 0.5 A(width) = (0.5 * B(width)) + 10
A, <define>LAYOUT_CONSTR_LEFT</define>, B, <define>LAYOUT_CONSTR_WIDTH</define>, -20, 0.1 A(left) = (0.1 * B(width)) + (-20)
If second node is -2, use absolute positioning
A,<define>LAYOUT_CONSTR_LEFT</define>,-2,<ignored>,25,<ignored>,<ignored> Position left of A at position 25
A,<define>LAYOUT_CONSTR_WIDTH</define>,-2,<ignored>,30,<ignored>,<ignored> Set width of A to 30
Use the MOVE constraints to move an entire window without resizing
A, <define>LAYOUT_CONSTR_MOVEL</define>, B, <define>LAYOUT_CONSTR_LEFT</define>, 0, 0, 1.0 Move node A, align left with left side of B
A, <define>LAYOUT_CONSTR_MOVEL</define>, B, <define>LAYOUT_CONSTR_RIGHT</define>, 0, 0, 1.0 Move node A, align left with right side of B
A, <define>LAYOUT_CONSTR_MOVET</define>, B, <define>LAYOUT_CONSTR_WIDTH</define>, 0, 0, 1.0 Move node A, align bottom to position equal to width of B
A, <define>LAYOUT_CONSTR_MOVER</define>, B, <define>LAYOUT_CONSTR_RIGHT</define>, 10, 1.1 Move node A, align right to 1.1*right of B, plus 10
A, <define>LAYOUT_CONSTR_MOVEL</define>, NULL, 10, 0, 1.0 Move node A, align left at position 10
See Also