Exemplo n.º 1
0
bool IrBox::setSlotIrBoxZ(const Eaagles::Basic::Number* const s)
{
   LCreal value = 0.0;

   const Basic::Distance* d = dynamic_cast<const Basic::Distance*>(s);
   if (d != nullptr) {
      Basic::Meters m;
      value = static_cast<LCreal>(m.convert(*d));
   }
   else if (s != nullptr) {
       value = s->getReal();
   }
   z = value;
   return true;
}
Exemplo n.º 2
0
//------------------------------------------------------------------------------
// setB() -- Set the width
//------------------------------------------------------------------------------
bool SigPlate::setB(Basic::Number* const num)
{
    bool ok = false;
    LCreal v = -1.0f;

    Basic::Distance* d = dynamic_cast<Basic::Distance*>(num);
    if (d != 0) {
        // Has distance units and we need meters
        Basic::Meters meters;
        v = meters.convert(*d);
    }
    else if (num != 0) {
        // Just a Number
        v = num->getReal();
    }

    if (v >= 0.0) { b = v; ok = true; }
    else { std::cerr << "SigPlate::setHeightFromSlot: invalid: must be greater than or equal to zero!" << std::endl; }
    return ok;
}
Exemplo n.º 3
0
//------------------------------------------------------------------------------
// setRadiusFromSlot() -- Set the radius from Slot table
//------------------------------------------------------------------------------
bool SigSphere::setRadiusFromSlot(Basic::Number* const num)
{
    bool ok = false;
    LCreal r = -1.0f;

    Basic::Distance* d = dynamic_cast<Basic::Distance*>(num);
    if (d != 0) {
        // Has distance units and we need meters
        Basic::Meters meters;
        r = meters.convert(*d);
    }
    else if (num != 0) {
        // Just a Number
        r = num->getReal();
    }

    if (r >= 0.0) { setRadius(r); ok = true; }
    else { std::cerr << "SigSphere::setRadius: invalid radius; must be greater than or equal to zero!" << std::endl; }
    return ok;
}