Glade Reference


rectangle class

The rectangle class is derived from a shape. This class is normally created in a cellView using the dbCreateRect() function.

 

int32_t rectangle::left()

int32_t rectangle::bottom()

int32_t rectangle::right()

int32_t rectangle::top()

Get the coordinates of the rectangle.

 

rectangle::setLeft(int32_t x)

rectangle::setBottom(int32_t y)

rectangle::setRight(int32_t x)

rectangle::setTop(int32_t y)

Set the coordinates of the rectangle.

 

Point rectangle::origin()

Get the origin (lower left) of this rectangle.

 

int32_t rectangle::width()

Get the width of this rectangle.

 

rectangle::width(int32_t w)

Set the width of this rectangle. The origin is maintained.

 

int32_t rectangle::height()

Get the height of this rectangle.

 

rectangle::height(int32_t h)

Set the height of this rectangle. The origin is maintained.

 

Point p = rectangle::centre()

Get the centre of a rectangle.

 

Rect rectangle::bBox()

Get the bounding box of this rectangle.

 

rectangle::bBox(Rect b)

Set the bounding box of this rectangle. This will change the size of the rectangle.

 

db_Type rectangle::objType()

Returns the object type of this rectangle as RECTANGLE.

 

const char * rectangle::objName()

Returns the object name of this rectangle as "RECTANGLE".

 

int32_t rectangle::nPoints()

Returns the number of points of the rectangle's boundary as 4.

 

Point * rectangle::ptlist()

Returns the point list of this rectangle as an array of 4 points.

 

polygon * rectangle::shapeToPoly()

Returns a polygon with a pointlist identical to this rectangle.

 

rectangle::bias(int32_t bias, double grid)

Bias this rectangle by bias, snapping to the grid grid.

 

rectangle::scale(double scale, double grid);

Scale this rectangle by scale, snapping to the grid grid.

 

int32_t rectangle::getNearestEdge(const Point &p, segment &s)

Get the distance of the nearest segment s of this rectangle to the point p;

 

int32_t d = rectangle::getNearestVertex(Point p, vertex s)

Get the distance of the nearest vertex s of this rectangle to the point p.

 

double a = rectangle::area()

Get the area of this rectangle.

 

int32_t p = rectangle::perimeter()

Get the perimeter of this rectangle.

 

rectangle::transform(transform trans)

Transform this rectangle using trans.

 

bool ptInPoly(const Point &p)

Returns true if the point is contained in or on the edge of the rectangle.

 

rectangle::Move(cellView *cv, Point delta, bool opt = true)

Move this rectangle by distance delta.  If opt is true then the database is re-optimised for the new rectangle position. If there are a lot of objects to move it makes sense to turn this off and instead use the cellView update() function after moving them all.

 

dbObj *obj = rectangle::Copy(cellView *cv, Point delta, int32_t layerNum = -1)

Copy this rectangle to cellView cv, with offset delta. If layerNum is non negative the rectangle will be copied to the that layer.

 

dbObj *obj = rectangle::Flatten(cellView *cv, transform trans)

Flatten this rectangle into cellView cv with transformation trans.

 

rectangle::Stretch(Point delta, segment * seg, bool lock45 = true, bool lockEnds = true)

Stretch segment seg of this rectangle by delta. If lock45 is true, diagonal edges will be locked diagonal; if lockEnds is true, the endpoints of the segment will remain fixed.

 

rectangle::Stretch(Point delta, vertex v)

Stretch vertex v of this rectangle by delta.

 

 

Contents|Index

Copyright © Peardrop Design 2024.