Beispiel #1
0
RectangleSymbol::RectangleSymbol(const QString& def, const Polarity& polarity,
                                 const AttribData& attrib):
    Symbol(def, "rect([0-9.]+)x([0-9.]+)(?:(x[cr])([0-9.]+)(?:x([1-4]+))?)?", polarity, attrib), m_def(def)
{
    QRegExp rx(m_pattern);
    if (!rx.exactMatch(def))
        throw InvalidSymbolException(def.toAscii());

    QStringList caps = rx.capturedTexts();
    m_w = caps[1].toDouble() / 1000.0;
    m_h = caps[2].toDouble() / 1000.0;
    if (caps[3] == "xr") {
        m_rad = caps[4].toDouble() / 1000.0;
        m_type = ROUNDED;
    } else if (caps[3] == "xc") {
        m_rad = caps[4].toDouble() / 1000.0;
        m_type = CHAMFERED;
    } else {
        m_rad = 0;
        m_type = NORMAL;
    }
    if (caps[5].length()) {
        m_corners = 0;
        QByteArray cors = caps[5].toAscii();
        for (int i = 0; i < cors.count(); ++i) {
            m_corners |= (1 << (cors[i] - '1'));
        }
    } else {
        m_corners = 15;
    }

    m_bounding = painterPath().boundingRect();
}
Beispiel #2
0
SquareSymbol::SquareSymbol(const QString& def, const Polarity& polarity,
    const AttribData& attrib):
    Symbol(def, "s([0-9.]+)", polarity, attrib), m_def(def)
{
  QRegExp rx(m_pattern);
  if (!rx.exactMatch(def))
    throw InvalidSymbolException(def.toAscii());

  QStringList caps = rx.capturedTexts();
  m_s = caps[1].toDouble() / 1000.0;

  m_bounding = painterPath().boundingRect();
}
SquareThermalOpenCornersSymbol::SquareThermalOpenCornersSymbol(const QString& def, const Polarity& polarity,
    const AttribData& attrib):
    Symbol(def, "s_tho([0-9.]+)x([0-9.]+)x([0-9.]+)x([0-9.]+)x([0-9.]+)", polarity, attrib), m_def(def)
{
  QRegExp rx(m_pattern);
  if (!rx.exactMatch(def))
    throw InvalidSymbolException(def.toAscii());

  QStringList caps = rx.capturedTexts();
  m_od = caps[1].toDouble() / 1000.0;
  m_id = caps[2].toDouble() / 1000.0;
  m_angle = caps[3].toDouble();
  m_num_spokes = caps[4].toInt();
  m_gap = caps[5].toDouble() / 1000.0;

  m_bounding = painterPath().boundingRect();
}