A symbol of a component use for the schematic. More...
A symbol is the drawing of a component: ports, bus ports and the non-functional shapes that make the icon. You get it from component->getSymbol(); you do not construct a symbol yourself. The graphics live in firstElement, the same linked sElementList as on a sheet. The add… methods append shapes and ports; deleteElement removes one. Colour of drawing shapes is set on each sElement with setColor. A typical edit loop walks thisElement / nextElement and then adds a polygon or a port.
Example:
component *comp = schematic->drawing->currentSheet->getSheetComponent();
if (comp == NULL)
return 1;
symbol *sym = comp->getSymbol();
if (sym == NULL)
return 1;
sElementList *sl = sym->firstElement;
while (sl != NULL) {
if (sl->thisElement != NULL)
sl->thisElement->setColor(255, 0, 50);
sl = sl->nextElement;
}
pointArray pa;
pa.attach(0, 0);
pa.attach(30, 0);
pa.attach(0, 30);
sym->addPolygon(pa, 0, 155, 255);
Adds an arc on this symbol. p holds the points of the arc. red, green and blue are the colour channels from 0 to 255.
| Parameter: | |
|---|---|
| p | points of the arc |
| red | red colour channel |
| green | green colour channel |
| blue | blue colour channel |
Returns: a pointer to the new sElement.
Adds a bus port at p. text is the port name.
Returns: a pointer to the new sElement.
| Parameter: | |
|---|---|
| p | p |
| text | text |
Adds a circle whose bounding box runs from p1 to p2. red, green and blue set the colour.
| Parameter: | |
|---|---|
| p1 | first corner of the bounding box |
| p2 | opposite corner of the bounding box |
| red | red colour channel |
| green | green colour channel |
| blue | blue colour channel |
Returns: a pointer to the new sElement.
Adds a port at p. text is the port name shown on the symbol.
Returns: a pointer to the new sElement.
| Parameter: | |
|---|---|
| p | p |
| text | text |
Adds a polyline along p. red, green and blue set the colour.
| Parameter: | |
|---|---|
| p | vertices of the polyline |
| red | red colour channel |
| green | green colour channel |
| blue | blue colour channel |
Returns: a pointer to the new sElement.
Adds a polygon with vertices p. red, green and blue set the colour.
| Parameter: | |
|---|---|
| p | vertices of the polygon |
| red | red colour channel |
| green | green colour channel |
| blue | blue colour channel |
Returns: a pointer to the new sElement.
Adds a rectangle with opposite corners p1 and p2. red, green and blue set the colour.
| Parameter: | |
|---|---|
| p1 | first corner |
| p2 | opposite corner |
| red | red colour channel |
| green | green colour channel |
| blue | blue colour channel |
Returns: a pointer to the new sElement.
Adds a text textt at p. red, green and blue set the colour.
| Parameter: | |
|---|---|
| p | origin of the text |
| red | red colour channel |
| green | green colour channel |
| blue | blue colour channel |
| textt | the text string |
Returns: a pointer to the new sElement.
Deletes element from this symbol. The pointer is then invalid.
Head of the linked list of all elements in this symbol. See sElementList.