MCPcopy Create free account
hub / github.com/Qucs/qucs / createSymbol

Method createSymbol

qucs/components/component.cpp:1504–1588  ·  view source on GitHub ↗

-------------------------------------------------------

Source from the content-addressed store, hash-verified

1502
1503// -------------------------------------------------------
1504void GateComponent::createSymbol()
1505{
1506 int Num = Props.getFirst()->Value.toInt();
1507 if(Num < 2) Num = 2;
1508 else if(Num > 8) Num = 8;
1509 Props.getFirst()->Value = QString::number(Num);
1510
1511 int xl, xr, y = 10*Num, z;
1512 x1 = -30; y1 = -y-3;
1513 x2 = 30; y2 = y+3;
1514
1515 tx = x1+4;
1516 ty = y2+4;
1517
1518 z = 0;
1519 if(Model.at(0) == 'N') z = 1;
1520
1521 if(Props.getLast()->Value.at(0) == 'D') { // DIN symbol
1522 xl = -15;
1523 xr = 15;
1524 Lines.append(new Line( 15,-y, 15, y,QPen(Qt::darkBlue,2)));
1525 Lines.append(new Line(-15,-y, 15,-y,QPen(Qt::darkBlue,2)));
1526 Lines.append(new Line(-15, y, 15, y,QPen(Qt::darkBlue,2)));
1527 Lines.append(new Line(-15,-y,-15, y,QPen(Qt::darkBlue,2)));
1528 Lines.append(new Line( 15, 0, 30, 0,QPen(Qt::darkBlue,2)));
1529
1530 if(Model.at(z) == 'O') {
1531 Lines.append(new Line(-11, 6-y,-6, 9-y,QPen(Qt::darkBlue,0)));
1532 Lines.append(new Line(-11,12-y,-6, 9-y,QPen(Qt::darkBlue,0)));
1533 Lines.append(new Line(-11,14-y,-6,14-y,QPen(Qt::darkBlue,0)));
1534 Lines.append(new Line(-11,16-y,-6,16-y,QPen(Qt::darkBlue,0)));
1535 Texts.append(new Text( -4, 3-y, "1", Qt::darkBlue, 15.0));
1536 }
1537 else if(Model.at(z) == 'A')
1538 Texts.append(new Text( -10, 3-y, "&", Qt::darkBlue, 15.0));
1539 else if(Model.at(0) == 'X') {
1540 if(Model.at(1) == 'N') {
1541 Ellips.append(new Area(xr,-4, 8, 8,
1542 QPen(Qt::darkBlue,0), QBrush(Qt::darkBlue)));
1543 Texts.append(new Text( -11, 3-y, "=1", Qt::darkBlue, 15.0));
1544 }
1545 else
1546 Texts.append(new Text( -11, 3-y, "=1", Qt::darkBlue, 15.0));
1547 }
1548 }
1549 else { // old symbol
1550
1551 if(Model.at(z) == 'O') xl = 10;
1552 else xl = -10;
1553 xr = 10;
1554 Lines.append(new Line(-10,-y,-10, y,QPen(Qt::darkBlue,2)));
1555 Lines.append(new Line( 10, 0, 30, 0,QPen(Qt::darkBlue,2)));
1556 Arcs.append(new Arc(-30,-y, 40, 30, 0, 16*90,QPen(Qt::darkBlue,2)));
1557 Arcs.append(new Arc(-30,y-30, 40, 30, 0,-16*90,QPen(Qt::darkBlue,2)));
1558 Lines.append(new Line( 10,15-y, 10, y-15,QPen(Qt::darkBlue,2)));
1559
1560 if(Model.at(0) == 'X') {
1561 Lines.append(new Line(-5, 0, 5, 0,QPen(Qt::darkBlue,1)));

Callers

nothing calls this directly

Calls 1

QPenClass · 0.85

Tested by

no test coverage detected