Class Reference strans

A transformation including angle and scale among others used for placing components. More...

Member

strans( )
strans(strans trans )
strans(string transString )
void clearMirror_x()
double getAngle()
bool getMirror_x()
double getScale()
void reset()
void rotate(double angle)
void scale(double value)
void setMirror_x()
void toggleMirror_x()

Detailed Description

graph LR ce(cell)--addCellref-->e(element) e--getTrans-->st(strans) click ce "/layoutscript/api/cell" click e "/layoutscript/api/element" click st "/layoutscript/api/strans" classDef thisClas fill:#eaf5fc,stroke:#3c7faa,stroke-width:4px; classDef clas fill:#eaf5fc,stroke:#3c7faa,stroke-width:1px; class st thisClas class ce,e clas

A strans is the placement transform used on cell references, text, and schematic components: rotation in degrees, a scale factor, and an optional mirror about the x axis. After cell addCellref, getTrans and setTrans on element read and write that transform. sheet addPlacement takes the same type when dropping a component. You can construct identity, copy another strans, or parse a short string such as R180 or MR90 (R is rotation, M means mirror about x). rotate and scale accumulate on the current values; reset returns identity (no rotation, scale 1, no mirror). It is a value type: build it, then pass it into the element or placement.

Example:

cell *myCell = layout->drawing->findCell("noname");
if (myCell == NULL)
 return 0;
point p;
p.set(100, 200);
element *e = layout->drawing->currentCell->addCellref(myCell, p);
strans trans;
trans.rotate(180);
e->setTrans(trans);

Member Function Documentation


strans::strans( )

Creates an identity transformation (no rotation, scale 1, no mirror).


strans::strans(strans trans )

Creates a transformation with copied data from trans.


strans::strans(string transString )

Creates a transformation from a string. Examples: MR90, R180, or R0. An empty string also creates a R0 transformation. R is the rotation in degrees; if M is present, the transform mirrors about the x axis.


void strans::clearMirror_x()

Clears the mirror about the x axis.


double strans::getAngle()

Returns: the rotation angle of the transformation, in degrees.


bool strans::getMirror_x()

Returns: true if the transformation includes mirroring about the x axis, otherwise false.


double strans::getScale()

Returns: the scale factor of the transformation.


void strans::reset()

Resets the transformation to identity.


void strans::rotate(double angle)

Adds angle degrees of rotation to the transformation.


void strans::scale(double value)

Multiplies the current scale by value.


void strans::setMirror_x()

Sets the mirror about the x axis.


void strans::toggleMirror_x()

Toggles the mirror about the x axis.