Class Reference elementList

A element of a list of drawing-elements. More...

Member

elementList* nextElement
element* thisElement
elementList* firstOnLayer(int layer)
elementList* nextOnLayer(int layer)

Detailed Description

graph LR ce(cell)--firstElement-->el(elementList) el==thisElement==>e(element) el==nextElement==>el click ce "/layoutscript/api/cell" click el "/layoutscript/api/elementlist" click e "/layoutscript/api/element" classDef thisClas fill:#eaf5fc,stroke:#3c7faa,stroke-width:4px; classDef clas fill:#eaf5fc,stroke:#3c7faa,stroke-width:1px; class el thisClas class ce,e clas

An elementList node is one step in the linked list of shapes and references inside a cell. thisElement is the element at this node; nextElement is the following node, or NULL at the end of the list. The head of the list is cell->firstElement. Always test both the node and thisElement against NULL before you read geometry or change selection. The obsolete firstOnLayer / nextOnLayer pair walks only one layer; prefer a full walk and a layer test on thisElement. The example below selects every shape of the current cell.

Example:

elementList *el=layout->drawing->currentCell->firstElement;
while (el!=NULL) {
 if (el->thisElement!=NULL){
 el->thisElement->selectAll();
 }
 el=el->nextElement;
}

Member Function Documentation


elementList* elementList::nextElement

The next node in the list, or NULL after the last element.

Example: (loop over all shapes of the cell)

elementList *el=layout->drawing->currentCell->firstElement;
while (el!=NULL) {
 if (el->thisElement!=NULL){
 // e.g. el->thisElement->selectAll();
 //...
 }
 el=el->nextElement;
}

element* elementList::thisElement

The element stored at this node.

Obsolete Members


elementList* elementList::firstOnLayer(int layer)

Returns: the first node whose shape is on layer, or NULL if none.


elementList* elementList::nextOnLayer(int layer)

Returns: the next node on layer, or NULL if none remain.

Example: (loop over all shapes on layer 5)

elementList *el=layout->drawing->currentCell->firstElement->firstOnLayer(5);
while (el!=NULL) {
 // e.g. el->thisElement->selectAll();
 //...
 el=el->nextOnLayer(5);
}