The rect class defines a rectangle. More...
| rect( ) | |
| rect( rect r ) | |
| int | bottom() |
| int | left() |
| int | height() |
| int | right() |
| void | set(int left,int bottom, int right, int top) |
| void | set(point p1, point p2) |
| void | setBottom(int bottom) |
| void | setLeft(int left) |
| void | setRight(int right) |
| void | setTop(int top) |
| int | top() |
| int | width() |
A rect is an axis-aligned rectangle stored as four 32-bit integers left, bottom, right, and top in database units. Multiply by databaseunits on drawingField to get metres. getBoundingBox on element returns the outline of a shape; cSelect and fSelect on cell take a rect as the rubber-band used to pick cellrefs or full shapes. width and height are the differences of those sides. You construct a rect with set, copy another rect, or fill the four sides one by one. It is a value type, not a box element in the cell: passing it to addBox creates the actual geometry.
Example:
element *e = layout->drawing->currentCell->firstElement->thisElement;
if (e == NULL)
return 1;
rect r = e->getBoundingBox();
layout->drawing->currentCell->fSelect(r);
rect box;
box.set(0, 0, 1000, 500);
layout->drawing->currentCell->addBox(box, layout->drawing->activeLayer);
Creates a rectangle with all sides at zero.
Creates a rectangle with copied data from r.
Returns: the bottom coordinate.
Returns: the left coordinate.
Returns: the height (top minus bottom).
Returns: the right coordinate.
Sets all four sides of the rectangle.
| Parameter: | |
|---|---|
| left | left coordinate |
| bottom | bottom coordinate |
| right | right coordinate |
| top | top coordinate |
Sets the rectangle to the axis-aligned box that has p1 and p2 as opposite corners. The smaller x becomes left, the larger x becomes right, and the same for y versus bottom and top.
| Parameter: | |
|---|---|
| p1 | p1 |
| p2 | p2 |
Sets the bottom side to bottom.
Sets the left side to left.
Sets the right side to right.
Sets the top side to top.
Returns: the top coordinate.
Returns: the width (right minus left).