0,
       0,
       0,
       0,
       0,
       0,
       0,
       0,
       0,

 // enums: name, flags, count, data
     702, 0x0,    7,  202,
     728, 0x0,    4,  216,

 // enum data: key, value
     900, uint(QComboBox::NoInsert),
     909, uint(QComboBox::InsertAtTop),
     921, uint(QComboBox::InsertAtCurrent),
     937, uint(QComboBox::InsertAtBottom),
     952, uint(QComboBox::InsertAfterCurrent),
     971, uint(QComboBox::InsertBeforeCurrent),
     991, uint(QComboBox::InsertAlphabetically),
    1012, uint(QComboBox::AdjustToContents),
    1029, uint(QComboBox::AdjustToContentsOnFirstShow),
    1057, uint(QComboBox::AdjustToMinimumContentsLength),
    1087, uint(QComboBox::AdjustToMinimumContentsLengthWithIcon),

       0        // eod
};

static const char qt_meta_stringdata_QComboBox[] = {
Example #2
0
       2,       // signalCount

 // signals: signature, parameters, type, tag, flags
       8,    7,    7,    7, 0x05,
      19,    7,    7,    7, 0x05,

 // properties: name, type, flags
      56,   40, 0x0009510b,
      69,   40, 0x0009510b,
      90,   80, 0x0009510b,

 // enums: name, flags, count, data
      80, 0x0,    2,   37,

 // enum data: key, value
     100, uint(QState::ExclusiveStates),
     116, uint(QState::ParallelStates),

       0        // eod
};

static const char qt_meta_stringdata_QState[] = {
    "QState\0\0finished()\0propertiesAssigned()\0"
    "QAbstractState*\0initialState\0errorState\0"
    "ChildMode\0childMode\0ExclusiveStates\0"
    "ParallelStates\0"
};

void QState::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
    if (_c == QMetaObject::InvokeMetaMethod) {
Example #3
0
bool QAhiScreen::connect(const QString &displaySpec)
{
    Q_UNUSED(displaySpec);

    AhiSts_t status;

    status = AhiInit(0);
    if (status != AhiStsOk) {
        qCritical("QAhiScreen::connect(): AhiInit failed: %x", status);
        return false;
    }

    AhiDev_t device;
    AhiDevInfo_t info;

    status = AhiDevEnum(&device, &info, 0);
    if (status != AhiStsOk) {
        qCritical("QAhiScreen::connect(): AhiDevEnum failed: %x", status);
        return false;
    }
#ifdef QAHISCREEN_DEBUG
    {
        int displayNo = 0;
        AhiDevInfo_t dispInfo = info;
        qDebug("AHI supported devices:");
        do {
            qDebug("  %2i: %s, sw version: %s (rev %u)\n"
                   "       chip: 0x%x (rev %u), mem: %i (%i/%i), bus: 0x%x",
                   displayNo, dispInfo.name,
                   dispInfo.swVersion, uint(dispInfo.swRevision),
                   uint(dispInfo.chipId), uint(dispInfo.revisionId),
                   uint(dispInfo.totalMemory),
                   uint(dispInfo.internalMemSize),
                   uint(dispInfo.externalMemSize),
                   uint(dispInfo.cpuBusInterfaceMode));
            status = AhiDevEnum(&device, &info, ++displayNo);
        } while (status == AhiStsOk);
    }
#endif

    status = AhiDevOpen(&d_ptr->context, device, "qscreenahi",
                        AHIFLAG_USERLEVEL);
    if (status != AhiStsOk) {
        qCritical("QAhiScreen::connect(): AhiDevOpen failed: %x", status);
        return false;
    }

    AhiDispMode_t mode;

    status = AhiDispModeEnum(d_ptr->context, &mode, 0);
    if (status != AhiStsOk) {
        qCritical("QAhiScreen::connect(): AhiDispModeEnum failed: %x", status);
        return false;
    }

#ifdef QAHISCREEN_DEBUG
    {
        int modeNo = 0;
        AhiDispMode_t modeInfo = mode;
        qDebug("AHI supported modes:");
        do {
            qDebug("  %2i: %ux%u, fmt: %i, %u Hz, rot: %i, mirror: %i",
                   modeNo, uint(modeInfo.size.cx), uint(modeInfo.size.cy),
                   modeInfo.pixFmt, uint(modeInfo.frequency),
                   modeInfo.rotation, modeInfo.mirror);
            status = AhiDispModeEnum(d_ptr->context, &modeInfo, ++modeNo);
        } while (status == AhiStsOk);
    }
#endif

    if (QApplication::type() == QApplication::GuiServer) {
        if (!d_ptr->setMode(mode))
            return false;
    } else {
        status = AhiDispSurfGet(d_ptr->context, &d_ptr->surface);
        if (status != AhiStsOk) {
            qCritical("QAhiScreen::connect(): AhiDispSurfGet failed: %x",
                      status);
            return false;
        }

        status = AhiDispModeGet(d_ptr->context, &mode);
        if (status != AhiStsOk) {
            qCritical("QAhiScreen::context(): AhiDispModeGet failed: %x",
                      status);
            return false;
        }
    }

    return configure();
}
      61,   55, ((uint)QMetaType::QReal << 24) | 0x00095103,
      78,   55, ((uint)QMetaType::QReal << 24) | 0x00095103,
      94,   55, ((uint)QMetaType::QReal << 24) | 0x00095103,
     106,   55, ((uint)QMetaType::QReal << 24) | 0x00095103,
     125,   55, ((uint)QMetaType::QReal << 24) | 0x00095103,
     143,   55, ((uint)QMetaType::QReal << 24) | 0x00095103,
     165,  157, 0x1a095103,
     182,  157, 0x1a095103,
     198,  157, 0x1a095103,

 // enums: name, flags, count, data
     210, 0x1,    3,   55,
      14, 0x1,    3,   61,

 // enum data: key, value
     221, uint(QPinchGesture::ScaleFactorChanged),
     240, uint(QPinchGesture::RotationAngleChanged),
     261, uint(QPinchGesture::CenterPointChanged),
     221, uint(QPinchGesture::ScaleFactorChanged),
     240, uint(QPinchGesture::RotationAngleChanged),
     261, uint(QPinchGesture::CenterPointChanged),

       0        // eod
};

static const char qt_meta_stringdata_QPinchGesture[] = {
    "QPinchGesture\0ChangeFlags\0totalChangeFlags\0"
    "changeFlags\0qreal\0totalScaleFactor\0"
    "lastScaleFactor\0scaleFactor\0"
    "totalRotationAngle\0lastRotationAngle\0"
    "rotationAngle\0QPointF\0startCenterPoint\0"
Example #5
0
unsigned RunControlContext::threadIdFromTcdfId(const QByteArray &id)
{
    const int tPos = id.indexOf(".t");
    return tPos != -1 ? id.mid(tPos + 2).toUInt() : uint(0);
}
Example #6
0
void TypeSystem::callDestructor(AbstractTypeData* data) const {
  if(uint(m_factories.size()) <= data->typeClassId || m_fastFactories[data->typeClassId] == 0)
    return;
  return m_fastFactories[data->typeClassId]->callDestructor(data);
}
Example #7
0
uint TypeSystem::dataClassSize(const AbstractTypeData& data) const {
  if(uint(m_dataClassSizes.size()) <= data.typeClassId || m_fastFactories[data.typeClassId] == 0)
    return 0;
  return m_fastDataClassSizes[data.typeClassId];
}
Example #8
0
QRgb QColorDialogOptions::standardColor(int index)
{
    if (uint(index) >= uint(QColorDialogStaticData::StandardColorCount))
        return qRgb(255, 255, 255);
    return qColorDialogStaticData()->standardRgb[index];
}
Example #9
0
void QColorDialogOptions::setStandardColor(int index, QRgb color)
{
    if (uint(index) >= uint(QColorDialogStaticData::StandardColorCount))
        return;
    qColorDialogStaticData()->standardRgb[index] = color;
}
Example #10
0
void QgsRangeWidgetWrapper::initWidget( QWidget *editor )
{
  mDoubleSpinBox = qobject_cast<QDoubleSpinBox *>( editor );
  mIntSpinBox = qobject_cast<QSpinBox *>( editor );

  mDial = qobject_cast<QDial *>( editor );
  mSlider = qobject_cast<QSlider *>( editor );
  mQgsDial = qobject_cast<QgsDial *>( editor );
  mQgsSlider = qobject_cast<QgsSlider *>( editor );

  bool allowNull = config( QStringLiteral( "AllowNull" ), true ).toBool();

  QVariant min( config( QStringLiteral( "Min" ) ) );
  QVariant max( config( QStringLiteral( "Max" ) ) );
  QVariant step( config( QStringLiteral( "Step" ) ) );
  QVariant precision( config( QStringLiteral( "Precision" ) ) );

  if ( mDoubleSpinBox )
  {
    double stepval = step.isValid() ? step.toDouble() : 1.0;
    double minval = min.isValid() ? min.toDouble() : std::numeric_limits<double>::lowest();
    double maxval  = max.isValid() ? max.toDouble() : std::numeric_limits<double>::max();
    int precisionval = precision.isValid() ? precision.toInt() : layer()->fields().at( fieldIdx() ).precision();

    mDoubleSpinBox->setDecimals( precisionval );

    QgsDoubleSpinBox *qgsWidget = qobject_cast<QgsDoubleSpinBox *>( mDoubleSpinBox );


    if ( qgsWidget )
      qgsWidget->setShowClearButton( allowNull );
    // Make room for null value: lower the minimum to allow for NULL special values
    if ( allowNull )
    {
      double decr;
      if ( precisionval > 0 )
      {
        decr = std::pow( 10, -precisionval );
      }
      else
      {
        decr = stepval;
      }
      minval -= decr;
      // Note: call setMinimum here or setValue won't work
      mDoubleSpinBox->setMinimum( minval );
      mDoubleSpinBox->setValue( minval );
      QgsDoubleSpinBox *doubleSpinBox( qobject_cast<QgsDoubleSpinBox *>( mDoubleSpinBox ) );
      if ( doubleSpinBox )
        doubleSpinBox->setSpecialValueText( QgsApplication::nullRepresentation() );
      else
        mDoubleSpinBox->setSpecialValueText( QgsApplication::nullRepresentation() );
    }
    mDoubleSpinBox->setMinimum( minval );
    mDoubleSpinBox->setMaximum( maxval );
    mDoubleSpinBox->setSingleStep( stepval );
    if ( config( QStringLiteral( "Suffix" ) ).isValid() )
      mDoubleSpinBox->setSuffix( config( QStringLiteral( "Suffix" ) ).toString() );

    connect( mDoubleSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ),
    this, [ = ]( double ) { emitValueChanged(); } );
  }
  else if ( mIntSpinBox )
  {
    QgsSpinBox *qgsWidget = qobject_cast<QgsSpinBox *>( mIntSpinBox );
    if ( qgsWidget )
      qgsWidget->setShowClearButton( allowNull );
    int minval = min.toInt();
    if ( allowNull )
    {
      uint stepval = step.isValid() ? step.toUInt() : 1;
      // make sure there is room for a new value (i.e. signed integer does not overflow)
      int minvalOverflow = uint( minval ) - stepval;
      if ( minvalOverflow < minval )
      {
        minval = minvalOverflow;
      }
      mIntSpinBox->setValue( minval );
      QgsSpinBox *intSpinBox( qobject_cast<QgsSpinBox *>( mIntSpinBox ) );
      if ( intSpinBox )
        intSpinBox->setSpecialValueText( QgsApplication::nullRepresentation() );
      else
        mIntSpinBox->setSpecialValueText( QgsApplication::nullRepresentation() );
    }
    setupIntEditor( minval, max, step, mIntSpinBox, this );
    if ( config( QStringLiteral( "Suffix" ) ).isValid() )
      mIntSpinBox->setSuffix( config( QStringLiteral( "Suffix" ) ).toString() );
  }
  else
  {
    ( void )field().convertCompatible( min );
    ( void )field().convertCompatible( max );
    ( void )field().convertCompatible( step );
    if ( mQgsDial )
      setupIntEditor( min, max, step, mQgsDial, this );
    else if ( mQgsSlider )
      setupIntEditor( min, max, step, mQgsSlider, this );
    else if ( mDial )
      setupIntEditor( min, max, step, mDial, this );
    else if ( mSlider )
      setupIntEditor( min, max, step, mSlider, this );
  }
}
Example #11
0
QRgb QColorDialogOptions::customColor(int index)
{
    if (uint(index) >= uint(QColorDialogStaticData::CustomColorCount))
        return qRgb(255, 255, 255);
    return qColorDialogStaticData()->customRgb[index];
}
Example #12
0
void BTreeBuilder::buildBalanced(
    ByteInputStream &sortedInputStream,
    uint iInputLevel,
    RecordNum nEntriesTotal,
    double fillFactor)
{
    // First, determine node capacities based on fixed-width entry sizes.  This
    // gives us the maximum fanout.

    uint nEntriesPerNonLeaf =
        getSegment()->getUsablePageSize() - sizeof(BTreeNode);
    nEntriesPerNonLeaf /=
        pNonLeafNodeAccessor->getEntryByteCount(
            pNonLeafNodeAccessor->tupleAccessor.getMaxByteCount());

    uint nEntriesPerLeaf =
        getSegment()->getUsablePageSize() - sizeof(BTreeNode);
    nEntriesPerLeaf /=
        pLeafNodeAccessor->getEntryByteCount(
            pLeafNodeAccessor->tupleAccessor.getMaxByteCount());

    nEntriesPerNonLeaf = uint(nEntriesPerNonLeaf*fillFactor);
    nEntriesPerLeaf = uint(nEntriesPerLeaf*fillFactor);

    if (!nEntriesPerNonLeaf) {
        nEntriesPerNonLeaf = 1;
    }
    if (!nEntriesPerLeaf) {
        nEntriesPerLeaf = 1;
    }

    // Next, calculate how high a "full" tree with this fanout would have to be
    // in order to accommodate the expected number of entries.  In most cases
    // the tree won't actually be full, but the height can't be any lower than
    // this.

    RecordNum nEntriesFull = iInputLevel ? nEntriesPerNonLeaf : nEntriesPerLeaf;
    uint nLevels = iInputLevel + 1;
    while (nEntriesFull < nEntriesTotal) {
        ++nLevels;
        nEntriesFull *= nEntriesPerNonLeaf;
    }
    levels.resize(nLevels);

    // Now, calculate how many entries to expect on each level.  We could do
    // the per-level balancing here as well, but then we'd have to keep around
    // an in-memory structure proportional to the number of nodes in the tree.
    // Instead, we calculate the balancing on the fly later.
    RecordNum nEntriesInLevel = nEntriesTotal;
    for (uint i = iInputLevel; i < levels.size(); i++) {
        BTreeNodeAccessor &nodeAccessor =
            i ? *pNonLeafNodeAccessor : *pLeafNodeAccessor;

        assert(nodeAccessor.hasFixedWidthEntries());
        levels[i].reset(new FixedBuildLevel(*this,nodeAccessor));

        BTreeBuildLevel &level = getLevel(i);
        level.iLevel = i;
        level.nEntriesTotal = nEntriesInLevel;

        // number of parent entries is same as number of child nodes
        nEntriesInLevel = calculateNodesOnLevel(
            nEntriesInLevel,
            i ? nEntriesPerNonLeaf : nEntriesPerLeaf);

        if (i == getRootHeight()) {
            // Set up the root info, which can be fully determined ahead of
            // time.
            level.nEntriesPerNode = level.nEntriesTotal;
            if (getRootPageId() == NULL_PAGE_ID) {
                level.allocatePage();
                treeDescriptor.rootPageId = level.pageId;
            } else {
                // We're from Berkeley, so we reuse the existing root rather
                // than allocating a new one.
                level.pageId = getRootPageId();
                level.pageLock.lockExclusive(level.pageId);
                BTreeNode &node = level.pageLock.getNodeForWrite();
                assert(!node.nEntries);
                level.nodeAccessor.clearNode(
                    node, getSegment()->getUsablePageSize());
                node.height = i;
            }
        } else {
            // Allocate the first empty page of a non-root level.
            level.allocatePage();
        }
        if (i) {
            // Prepare the first page of a non-leaf level.
            // Calculate balancing for first child node.
            BTreeBuildLevel &childLevel = getLevel(i - 1);
            childLevel.nEntriesPerNode = calculateChildEntriesPerNode(
                level.nEntriesTotal,
                childLevel.nEntriesTotal,
                0);
        }
    }

    // should end up with exactly one node at the root level, which corresponds
    // to one entry in an imaginary parent of the root
    assert(nEntriesInLevel == 1);

    // feed data into the correct level
    getLevel(iInputLevel).processInput(sortedInputStream);

    // finalize rightist fringe
    for (uint i = iInputLevel; i < levels.size(); ++i) {
        BTreeBuildLevel &level = getLevel(i);
        level.indexLastKey(true);
        assert(level.isFinished());
    }
}
Example #13
0
void CommandSubscriber::commandCallback(const kinfu_msgs::KinfuCommand & cmd)
  {
  boost::mutex::scoped_lock shared_lock(m_shared_mutex);

  if (cmd.command_type == cmd.COMMAND_TYPE_NOOP)
    {
    // does nothing
    ack(cmd.command_id,true);
    }
  else if (cmd.command_type == cmd.COMMAND_TYPE_RESUME)
    {
    m_is_running = true;
    ack(cmd.command_id,true);
    }
  else if (cmd.command_type == cmd.COMMAND_TYPE_SUSPEND)
    {
    m_is_running = false;
    ack(cmd.command_id,true);
    }
  else if (cmd.command_type == cmd.COMMAND_TYPE_RESET)
    {
    if (m_request_reset)
      ack(m_request_reset_command_id,false);
    m_request_reset = true;
    m_request_reset_command_id = cmd.command_id;
    }
  else if (cmd.command_type == cmd.COMMAND_TYPE_SET_ENABLED_MIN_MOVEMENT)
    {
    if (cmd.boolean_data.size() < 1)
      {
      ROS_ERROR("kinfu: command: set enabled min movement: one boolean required in boolean_data.");
      ack(cmd.command_id,false);
      }
    else
      {
      m_enable_minimum_movement = cmd.boolean_data[0];
      ROS_INFO("kinfu: command: set enable min movement: %u.",uint(m_enable_minimum_movement));
      ack(cmd.command_id,true);
      }
    }
  else if (cmd.command_type == cmd.COMMAND_TYPE_SET_FORCED_TF_FRAMES)
    {
    if (cmd.boolean_data.size() < 1)
      {
      ROS_ERROR("kinfu: command: set forced tf frame: one boolean required in boolean_data.");
      ack(cmd.command_id,false);
      }
    else
      {
      m_forced_tf_frames = cmd.boolean_data[0];
      ROS_INFO("kinfu: command: set forced tf frame: %u.",uint(m_forced_tf_frames));
      if (m_forced_tf_frames)
        m_hint_expiration = ros::Time(0); // clear the hint: now forced from tf
      ack(cmd.command_id,true);
      }
    }
  else if (cmd.command_type == cmd.COMMAND_TYPE_CLEAR_SPHERE)
    {
    ROS_INFO("kinfu: command: clear sphere.");
    if (cmd.float_data.size() < 4)
      ROS_ERROR("kinfu: command: a sphere requires 4 float_data params.");
    else
      {
      Eigen::Vector3f center,kinfu_center;
      float radius;
      for (uint i = 0; i < 3; i++)
        center[i] = cmd.float_data[i];
      radius = cmd.float_data[3];

      kinfu_center = m_initial_transformation * center;

      m_clear_sphere = Sphere::Ptr(new Sphere(kinfu_center,radius,cmd.command_id));
      }
    }
  else if (cmd.command_type == cmd.COMMAND_TYPE_CLEAR_BOUNDING_BOX)
    {
    ROS_INFO("kinfu: command: clear bbox.");
    if (cmd.float_data.size() < 6)
      ROS_ERROR("kinfu: command: a sphere requires 6 float_data params.");
    else
      {
      Eigen::Vector3f min,max;
      Eigen::Vector3f kinfu_min,kinfu_max;
      for (uint i = 0; i < 3; i++)
        min[i] = cmd.float_data[i];
      for (uint i = 0; i < 3; i++)
        max[i] = cmd.float_data[i + 3];

      kinfu_min = m_initial_transformation * min;
      kinfu_max = m_initial_transformation * max;

      m_clear_bbox = BBox::Ptr(new BBox(kinfu_min,kinfu_max,cmd.command_id));
      }

    }
  else if (cmd.command_type == cmd.COMMAND_TYPE_TRIGGER)
    {
    if (m_is_running || m_is_triggered)
      ROS_WARN("kinfu: trigger request ignored: kinfu is already running.");
    else
      {
      m_is_triggered = true;
      m_is_triggered_command_id = cmd.command_id;
      }
    }
  else
    {
    ROS_ERROR("kinfu: command: unknown command type: %u",uint(cmd.command_type));
    ack(cmd.command_id,false);
    }

  // if the hint comes from tf frames, do not force hint otherwise
  if (!m_forced_tf_frames)
    {
    if (cmd.hint_expiration_time >= ros::Time::now())
      {
      m_hint_expiration = cmd.hint_expiration_time;

      for (uint r = 0; r < 3; r++)
        for (uint c = 0; c < 3; c++)
          m_hint.linear()(r,c) = cmd.pose_hint_rotation[r * 3 + c];
      for (uint i = 0; i < 3; i++)
        m_hint.translation()[i] = cmd.pose_hint_translation[i];

      m_hint = m_initial_transformation * m_hint;

      m_hint_forced = cmd.hint_forced;
      }
    }
  }
 // slots: signature, parameters, type, tag, flags
      53,   46,   16,   16, 0x0a,
      70,   16,   16,   16, 0x0a,

 // properties: name, type, flags
      17,   79, 0x01495103,

 // properties: notify_signal_id
       0,

 // enums: name, flags, count, data
      84, 0x1,    4,   37,

 // enum data: key, value
      96, uint(QGraphicsEffect::SourceAttached),
     111, uint(QGraphicsEffect::SourceDetached),
     126, uint(QGraphicsEffect::SourceBoundingRectChanged),
     152, uint(QGraphicsEffect::SourceInvalidated),

       0        // eod
};

static const char qt_meta_stringdata_QGraphicsEffect[] = {
    "QGraphicsEffect\0\0enabled\0enabledChanged(bool)\0"
    "enable\0setEnabled(bool)\0update()\0bool\0"
    "ChangeFlags\0SourceAttached\0SourceDetached\0"
    "SourceBoundingRectChanged\0SourceInvalidated\0"
};

void QGraphicsEffect::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
// ######################################################################
void Beobot2_GistSalLocalizerWorkerI::compute(GSlocJobData cjob)
{
  LDEBUG("T[%4d] match object[%d] itsLandmarkDB[%d][%d]: [ %d, %d ]",
         itsWorkerIndex, cjob.objNum, cjob.segNum, cjob.lmkNum,
         cjob.voStartNum, cjob.voEndNum);

  its_input_info_mutex.lock();
  uint nvo = itsInputVO.size();
  its_input_info_mutex.unlock();

  if(nvo <= uint(cjob.objNum) ||
     itsLandmarkDB->getNumSegment() <= uint(cjob.segNum) ||
     itsLandmarkDB->getNumSegLandmark(cjob.segNum) <= uint(cjob.lmkNum) ||
     cjob.voStartNum < 0 ||
     itsLandmarkDB->getLandmark(cjob.segNum, cjob.lmkNum)->numObjects()
     <= uint(cjob.voStartNum) ||
     cjob.voEndNum < 0 ||
     itsLandmarkDB->getLandmark(cjob.segNum, cjob.lmkNum)->numObjects()
     <= uint(cjob.voEndNum))
    {
      LINFO("Invalid job[%4d] object[%d] itsLandmarkDB[%d][%d]: [ %d, %d ]",
             itsWorkerIndex, cjob.objNum, cjob.segNum, cjob.lmkNum,
             cjob.voStartNum, cjob.voEndNum);
      return;
    }

  // make sure the VO keypoints are computed
  its_input_info_mutex.lock();
  if(!itsVOKeypointsComputed[cjob.objNum])
    {
      itsInputVO[cjob.objNum]->computeKeypoints();
      itsVOKeypointsComputed[cjob.objNum] = true;
    }
  its_input_info_mutex.unlock();

  // match the object with the range of database
  // we limit the maxScale range to [2/3 ... 3/2] by entering 1.5
  // Now (2/10/2010):
  // we limit the maxScale range to [3/4 ... 4/3] by entering 1.33
  its_input_info_mutex.lock();
  rutz::shared_ptr<VisualObjectMatch> cmatch;
  int ind = itsLandmarkDB->getLandmark(cjob.segNum, cjob.lmkNum)->
    match(itsInputVO[cjob.objNum],
          cmatch, cjob.voStartNum, cjob.voEndNum,
          15.0F, 0.5F, 2.5F, 4, M_PI/4, 1.33F, .25F);
  its_input_info_mutex.unlock();

  // if match is found
  uint nObjSearch = 0;
  if(ind != -1)
    {
      LINFO("-> found match[%d]: %s with itsLandmarkDB[%d][%d]\n %s : %s",
            cjob.objNum, itsInputVO[cjob.objNum]->getName().c_str(),
            cjob.segNum, cjob.lmkNum,
            cmatch->getVoRef()->getName().c_str(),
            cmatch->getVoTest()->getName().c_str());
      nObjSearch = (ind - cjob.voStartNum + 1);

      // store the match information
      // since there is a possibility that there are concurrent threads
      // that also just found it we will choose the first match
      its_results_mutex.lock();
      itsVOmatch[cjob.objNum] = cmatch;
      itsLmkMatch[cjob.objNum] =
        GSlocJobData(cjob.objNum, cjob.segNum, cjob.lmkNum, ind, ind);
      itsSegNumMatch[cjob.objNum] = cjob.segNum;
      itsLenTravMatch[cjob.objNum] =
        itsLandmarkDB->getLenTrav(cjob.segNum, cjob.lmkNum, ind);
      itsMatchFound[cjob.objNum] = true;
      its_results_mutex.unlock();

      // send the result back to GSLoc_master
      BeobotEvents::LandmarkMatchResultMessagePtr msg =
        new BeobotEvents::LandmarkMatchResultMessage;

      msg->RequestID = itsInputFnum;
      msg->voMatchImage =
        Image2Ice(getMatchImage(cjob.objNum, itsInputImage.getDims()));
      BeobotEvents::LandmarkSearchJob tempJob;
      tempJob.inputSalRegID  = cjob.objNum;
      tempJob.dbSegNum       = cjob.segNum;
      tempJob.dbLmkNum       = cjob.lmkNum;
      tempJob.dbVOStart      = ind;
      tempJob.dbVOEnd        = ind;
      msg->matchInfo = tempJob;

      // location of the matched database salient region
      msg->segNumMatch = cjob.segNum;
      msg->lenTravMatch = itsLenTravMatch[cjob.objNum];

      LINFO("Publishing lmrMessage with ID: %d[%4d,%10.7f]",
            itsInputFnum, msg->segNumMatch, msg->lenTravMatch);
      publish("LandmarkMatchResultMessageTopic", msg);
    }
  else
    {
      nObjSearch = cjob.voEndNum - cjob.voStartNum + 1;
    }

    BeobotEvents::LandmarkSearchStatMessagePtr msg =
      new BeobotEvents::LandmarkSearchStatMessage;

    msg->RequestID     = itsInputFnum;
    msg->inputSalRegID = cjob.objNum;
    msg->numObjSearch  = nObjSearch;
    msg->found         = (ind != -1);

    LDEBUG("Publishing LandmarkSearchStatMessage");
    publish("LandmarkSearchStatMessageTopic", msg);

    its_results_mutex.lock();
    itsNumJobsProcessed++;
    its_results_mutex.unlock();
}
const QRegion QWSSharedMemSurface::directRegion() const
{
    if (mem.address() && *(uint *)mem.address() == uint(directRegionId()))
        return QWSMemorySurface::directRegion();
    return QRegion();
}
Example #17
0
AbstractType* TypeSystem::create(AbstractTypeData* data) const {
  if(uint(m_factories.size()) <= data->typeClassId || m_fastFactories[data->typeClassId] == 0)
    return 0;
  return m_fastFactories[data->typeClassId]->create(data);
}
Example #18
0
	uint TextEditor::YToLine(float y) const
	{
		if (y - pVertMargin <= 0)
			return pScrollPos.y;
		return uint((y - pVertMargin) / pLineHeight(pConversion)) + pScrollPos.y;
	}
Example #19
0
uint TypeSystem::dynamicSize(const AbstractTypeData& data) const {
  if(uint(m_factories.size()) <= data.typeClassId || m_fastFactories[data.typeClassId] == 0)
    return 0;
  return m_fastFactories[data.typeClassId]->dynamicSize(data);
}
Example #20
0
bool dataconfigs::loadLevelBackground(obj_BG &sbg, QString section, obj_BG *merge_with, QString iniFile, QSettings *setup)
{
    bool valid=true;
    bool internal=!setup;
    QString errStr, tmpstr, imgFile;
    if(internal)
    {
        setup=new QSettings(iniFile, QSettings::IniFormat);
        setup->setIniCodec("UTF-8");
    }

    if(!openSection(setup, section))
        return false;

        sbg.name = setup->value("name", (merge_with? merge_with->name : "") ).toString();
        if(sbg.name.isEmpty())
        {
            addError(QString("%1 Item name isn't defined").arg(section.toUpper()));
            valid=false;
            goto abort;
        }
        tmpstr = setup->value("type", "-1").toString();
            if(tmpstr=="single-row")
               sbg.type = 0;
            else if(tmpstr=="double-row")
               sbg.type = 1;
            else if(tmpstr=="tiled")
               sbg.type = 2;
            else if(tmpstr=="-1")
               sbg.type = (merge_with ? merge_with->type : 0);
            else sbg.type = 0;


        sbg.repeat_h = float(qFabs(setup->value("repeat-h", (merge_with ? merge_with->repeat_h : 2.0f)).toFloat()));

        tmpstr = setup->value("repeat-v", "-1").toString();
            if(tmpstr=="NR")
                sbg.repead_v = 0;
            else if(tmpstr=="ZR")
                sbg.repead_v = 1;
            else if(tmpstr=="RP")
                sbg.repead_v = 2;
            else if(tmpstr=="RZ")
                sbg.repead_v = 3;
            else if(tmpstr=="-1")
                sbg.repead_v = (merge_with ? merge_with->repead_v : 0);
            else sbg.repead_v = 0;

        sbg.image_n = setup->value("image", (merge_with ? merge_with->image_n : "") ).toString();
        if(!merge_with)
        {
            if( (sbg.image_n !="") )
            {
                GraphicsHelps::loadMaskedImage(BGPath,
                    sbg.image_n, imgFile,
                    sbg.image,
                    errStr);
                if(!errStr.isEmpty())
                {
                    addError(QString("%1 %2").arg(section).arg(errStr));
                    valid=false;
                    //goto abort;
                }
            } else {
                addError(QString("%1 Image filename isn't defined").arg(section));
                valid=false;
                //goto abort;
            }
        }

        sbg.attached =     uint(setup->value("attached",
                                             (merge_with?(merge_with->attached==1?"top":"bottom"):"bottom") ).toString()=="top");

        sbg.editing_tiled =    setup->value("tiled-in-editor", merge_with?merge_with->editing_tiled:false ).toBool();

        sbg.magic =             setup->value("magic", (merge_with?merge_with->magic:false)).toBool();
        sbg.magic_strips =      setup->value("magic-strips", (merge_with? merge_with->magic_strips: 1 )).toUInt();
        sbg.magic_splits =      setup->value("magic-splits", (merge_with? merge_with->magic_splits:"0")).toString();
        sbg.magic_speeds =      setup->value("magic-speeds", (merge_with? merge_with->magic_speeds:"0")).toString();

        sbg.animated =          setup->value("animated", (merge_with?merge_with->animated:false)).toBool();//animated
        sbg.frames =            setup->value("frames", (merge_with?merge_with->frames:1)).toUInt();
        sbg.framespeed =        setup->value("framespeed", (merge_with?merge_with->framespeed : 128)).toUInt();
        sbg.display_frame =     setup->value("display-frame", (merge_with?merge_with->display_frame : 0)).toUInt();
        //frames

        if(sbg.type==1)
        {
            sbg.second_image_n = setup->value("second-image", (merge_with ? merge_with->second_image_n : "")).toString();
            if(!merge_with)
            {
                if( (sbg.second_image_n !="") )
                {
                    GraphicsHelps::loadMaskedImage(BGPath,
                       sbg.second_image_n, imgFile,
                       sbg.second_image,
                       errStr);
                } else {
                    sbg.second_image = Themes::Image(Themes::dummy_bg);
                }
            }

            sbg.second_repeat_h = float(qFabs(setup->value("second-repeat-h", (merge_with ? merge_with->second_repeat_h : 2.0f)).toFloat()));

            tmpstr = setup->value("second-repeat-v", "-1").toString();
                if(tmpstr=="NR")
                    sbg.second_repeat_v = 0;
                else if(tmpstr=="ZR")
                    sbg.second_repeat_v = 1;
                else if(tmpstr=="RP")
                    sbg.second_repeat_v = 2;
                else if(tmpstr=="RZ")
                    sbg.second_repeat_v = 3;
                else if(tmpstr=="-1")
                    sbg.second_repeat_v = (merge_with ? merge_with->second_repeat_v : 0);
                else sbg.second_repeat_v = 0;

            tmpstr = setup->value("second-attached", "-1").toString();
                if(tmpstr=="overfirst")
                    sbg.second_attached = 0;
                else if(tmpstr=="bottom")
                    sbg.second_attached = 1;
                else if(tmpstr=="top")
                    sbg.second_attached = 2;
                else if(tmpstr=="-1")
                    sbg.second_attached = (merge_with ? merge_with->second_attached : 0);
                else sbg.second_repeat_v = 0;
        }

        if(sbg.animated)
        {
            int fHeight = sbg.image.height() / int(sbg.frames);
            sbg.image = sbg.image.copy(0, 0, sbg.image.width(), fHeight );
        }

        sbg.isValid = true;

    abort:
        closeSection(setup);
        if(internal) delete setup;
    return valid;
}
Example #21
0
bool TypeSystem::isFactoryLoaded(const AbstractTypeData& data) const {
  if(uint(m_factories.size()) <= data.typeClassId || m_fastFactories[data.typeClassId] == 0)
    return false;
  else
    return true;
}
Example #22
0
     241,  237,   15,   15, 0x0a,
     254,   15,   15,   15, 0x2a,
     263,  237,   15,   15, 0x0a,
     276,   15,   15,   15, 0x2a,
     285,   15,   15,   15, 0x08,
     307,   15,   15,   15, 0x08,

 // properties: name, type, flags
     328,  320, 0x0a095103,
     347,  337, 0x0009510b,

 // enums: name, flags, count, data
     337, 0x0,    2,   99,

 // enum data: key, value
     357, uint(QextSerialPort::Polling),
     365, uint(QextSerialPort::EventDriven),

       0        // eod
};

static const char qt_meta_stringdata_QextSerialPort[] = {
    "QextSerialPort\0\0status\0dsrChanged(bool)\0"
    "name\0setPortName(QString)\0mode\0"
    "setQueryMode(QueryMode)\0"
    "setBaudRate(BaudRateType)\0"
    "setDataBits(DataBitsType)\0"
    "setParity(ParityType)\0setStopBits(StopBitsType)\0"
    "setFlowControl(FlowType)\0setTimeout(long)\0"
    "set\0setDtr(bool)\0setDtr()\0setRts(bool)\0"
    "setRts()\0_q_onWinEvent(HANDLE)\0"
Example #23
0
    0x80000000 | 4, QMetaType::QRect,    2,

 // properties: name, type, flags
       5, 0x80000000 | 6, 0x0009510b,
       7, 0x80000000 | 8, 0x0009510b,
       9, QMetaType::Int, 0x00095103,
      10, QMetaType::Int, 0x00095103,
      11, QMetaType::Int, 0x00095001,
      12, QMetaType::QRect, 0x00094001,

 // enums: name, flags, count, data
       6, 0x0,    3,   54,
       8, 0x0,    3,   60,

 // enum data: key, value
      13, uint(QwtPlotGLCanvas::Plain),
      14, uint(QwtPlotGLCanvas::Raised),
      15, uint(QwtPlotGLCanvas::Sunken),
      16, uint(QwtPlotGLCanvas::NoFrame),
      17, uint(QwtPlotGLCanvas::Box),
      18, uint(QwtPlotGLCanvas::Panel),

       0        // eod
};

void QwtPlotGLCanvas::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
    if (_c == QMetaObject::InvokeMetaMethod) {
        QwtPlotGLCanvas *_t = static_cast<QwtPlotGLCanvas *>(_o);
        switch (_id) {
        case 0: _t->replot(); break;
Example #24
0
/*!
    \reimp
*/
QAbstractFileEngine::FileFlags QFSFileEngine::fileFlags(FileFlags type) const
{
    Q_D(const QFSFileEngine);

    if (type & Refresh)
        d->metaData.clear();

    QAbstractFileEngine::FileFlags ret = 0;

    if (type & FlagsMask)
        ret |= LocalDiskFlag;

    bool exists;
    {
        QFileSystemMetaData::MetaDataFlags queryFlags = 0;

        queryFlags |= QFileSystemMetaData::MetaDataFlags(uint(type))
                & QFileSystemMetaData::Permissions;

        if (type & TypesMask)
            queryFlags |= QFileSystemMetaData::AliasType
                    | QFileSystemMetaData::LinkType
                    | QFileSystemMetaData::FileType
                    | QFileSystemMetaData::DirectoryType
                    | QFileSystemMetaData::BundleType;

        if (type & FlagsMask)
            queryFlags |= QFileSystemMetaData::HiddenAttribute
                    | QFileSystemMetaData::ExistsAttribute;

        queryFlags |= QFileSystemMetaData::LinkType;

        exists = d->doStat(queryFlags);
    }

    if (!exists && !d->metaData.isLink())
        return ret;

    if (exists && (type & PermsMask))
        ret |= FileFlags(uint(d->metaData.permissions()));

    if (type & TypesMask) {
        if (d->metaData.isAlias()) {
            ret |= LinkType;
        } else {
            if ((type & LinkType) && d->metaData.isLink())
                ret |= LinkType;
            if (exists) {
                if (d->metaData.isFile()) {
                    ret |= FileType;
                } else if (d->metaData.isDirectory()) {
                    ret |= DirectoryType;
                    if ((type & BundleType) && d->metaData.isBundle())
                        ret |= BundleType;
                }
            }
        }
    }

    if (type & FlagsMask) {
        if (exists)
            ret |= ExistsFlag;
        if (d->fileEntry.isRoot())
            ret |= RootFlag;
        else if (d->metaData.isHidden())
            ret |= HiddenFlag;
    }

    return ret;
}
Example #25
0
static bool qIsAlnum(QChar ch)
{
    uint u = uint(ch.unicode());
    // matches [a-zA-Z0-9_]
    return u - 'a' < 26 || u - 'A' < 26 || u - '0' < 10 || u == '_';
}
 // content:
       5,       // revision
       0,       // classname
       0,    0, // classinfo
       0,    0, // methods
       0,    0, // properties
       1,   14, // enums/sets
       0,    0, // constructors
       0,       // flags
       0,       // signalCount

 // enums: name, flags, count, data
      21, 0x0,    5,   18,

 // enum data: key, value
      25, uint(iSip::ForwardingType::None),
      30, uint(iSip::ForwardingType::Unconditional),
      44, uint(iSip::ForwardingType::OnBusy),
      51, uint(iSip::ForwardingType::OnFailure),
      61, uint(iSip::ForwardingType::OnNoAnswer),

       0        // eod
};

static const char qt_meta_stringdata_iSip__ForwardingType[] = {
    "iSip::ForwardingType\0Val\0None\0"
    "Unconditional\0OnBusy\0OnFailure\0"
    "OnNoAnswer\0"
};

const QMetaObject iSip::ForwardingType::staticMetaObject = {
Example #27
0
/*
 * This implementation is from QWindowsStyle (Qt 7.2)
 *
 * It is licensed under the GPL 3:
 * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 * Contact: Nokia Corporation ([email protected])
 */
void StyleHelper::drawArrow( QStyle::PrimitiveElement element, QPainter* p, const QStyleOption* opt )
{
    if ( opt->rect.width() <= 1 || opt->rect.height() <= 1 )
        return;

    QRect r = opt->rect;
    int size = qMin( r.height(), r.width() );
    QPixmap pixmap;
    QString pixmapName;

    pixmapName.sprintf( "arrow-%s-%d-%d-%d-%lld", "$qt_ia", uint(opt->state), element, size, opt->palette.cacheKey() );
    if ( !QPixmapCache::find( pixmapName, pixmap) )
    {
        int border = size / 5;
        int sqsize = 2 * ( size / 2 );

        QImage image( sqsize, sqsize, QImage::Format_ARGB32 );
        image.fill( 0 );
        QPainter imagePainter( &image );
        imagePainter.setRenderHint( QPainter::Antialiasing, true );
        QPolygon a;

        switch ( element )
        {
            case QStyle::PE_IndicatorArrowUp:
                a.setPoints( 3, border, sqsize / 2, sqsize / 2, border, sqsize - border, sqsize / 2 );
                break;

            case QStyle::PE_IndicatorArrowDown:
                a.setPoints( 3, border, sqsize / 2, sqsize / 2, sqsize - border,  sqsize - border, sqsize / 2 );
                break;

            case QStyle::PE_IndicatorArrowRight:
                a.setPoints( 3, sqsize - border, sqsize / 2, sqsize / 2, border, sqsize / 2, sqsize - border );
                break;

            case QStyle::PE_IndicatorArrowLeft:
                a.setPoints( 3, border, sqsize / 2, sqsize / 2, border, sqsize / 2, sqsize - border );
                break;

            default:
                break;
        }

        int bsx = 0;
        int bsy = 0;

        if ( opt->state & QStyle::State_Sunken )
        {
            bsx = qApp->style()->pixelMetric( QStyle::PM_ButtonShiftHorizontal );
            bsy = qApp->style()->pixelMetric( QStyle::PM_ButtonShiftVertical );
        }

        QRect bounds = a.boundingRect();
        int sx = sqsize / 2 - bounds.center().x() - 1;
        int sy = sqsize / 2 - bounds.center().y() - 1;
        imagePainter.translate( sx + bsx, sy + bsy );
        imagePainter.setPen( opt->palette.buttonText().color() );
        imagePainter.setBrush( opt->palette.buttonText() );

        if ( !( opt->state & QStyle::State_Enabled ) )
        {
            QColor foreGround( 150, 150, 150, 150 );
            imagePainter.setBrush( opt->palette.mid().color() );
            imagePainter.setPen( opt->palette.mid().color() );
        }
        else
        {
            QColor shadow( 0, 0, 0, 100 );
            imagePainter.translate( 0, 1 );
            imagePainter.setPen( shadow );
            imagePainter.setBrush( shadow );
            QColor foreGround( 255, 255, 255, 210 );
            imagePainter.drawPolygon( a );
            imagePainter.translate( 0, -1 );
            imagePainter.setPen( foreGround );
            imagePainter.setBrush( foreGround );
        }

        imagePainter.drawPolygon( a );
        imagePainter.end();

        pixmap = QPixmap::fromImage( image );
        QPixmapCache::insert( pixmapName, pixmap );
    }

    int xOffset = r.x() + ( r.width() - size ) / 2;
    int yOffset = r.y() + ( r.height() - size ) / 2;
    p->drawPixmap( xOffset, yOffset, pixmap );
}
     873,  821, 0x02094103,
     895,  881, 0x0009510b,
     914,  909, 0x01094103,
     940,  929, 0x0009510b,
     951,  929, 0x0009510b,
     959,  821, 0x02095001,
     970,  821, 0x02095001,
     978,  909, 0x01095103,
     992,  909, 0x01095103,

 // enums: name, flags, count, data
     881, 0x0,    4,  212,
     929, 0x0,    4,  220,

 // enum data: key, value
    1007, uint(Q3ListBox::Single),
    1014, uint(Q3ListBox::Multi),
    1020, uint(Q3ListBox::Extended),
    1029, uint(Q3ListBox::NoSelection),
    1041, uint(Q3ListBox::FixedNumber),
    1053, uint(Q3ListBox::FitToWidth),
    1064, uint(Q3ListBox::FitToHeight),
    1076, uint(Q3ListBox::Variable),

       0        // eod
};

static const char qt_meta_stringdata_Q3ListBox[] = {
    "Q3ListBox\0\0index\0highlighted(int)\0"
    "selected(int)\0highlighted(QString)\0"
    "selected(QString)\0highlighted(Q3ListBoxItem*)\0"
Example #29
0
static const uint qt_meta_data_PBGameOptions[] = {

 // content:
       2,       // revision
       0,       // classname
       0,    0, // classinfo
       0,    0, // methods
       0,    0, // properties
       1,   12, // enums/sets
       0,    0, // constructors

 // enums: name, flags, count, data
      14, 0x0,    6,   16,

 // enum data: key, value
      27, uint(PBGameOptions::FullRing),
      36, uint(PBGameOptions::NoLimit),
      44, uint(PBGameOptions::Limit),
      50, uint(PBGameOptions::SNG),
      54, uint(PBGameOptions::MTT),
      58, uint(PBGameOptions::Cash),

       0        // eod
};

static const char qt_meta_stringdata_PBGameOptions[] = {
    "PBGameOptions\0EGameOptions\0FullRing\0"
    "NoLimit\0Limit\0SNG\0MTT\0Cash\0"
};

const QMetaObject PBGameOptions::staticMetaObject = {
Example #30
0
HRESULT Update(double deltaTime)
{
	HRESULT hr = S_OK;

	if (g_endgame)
		return EndgameUpdate(deltaTime);

	// TODO: Optimize for cache coherency
	//		 We could attempt to store chains of nodes linearly in memory. That would make the update loop for nodes in those chains
	//		 super fast (since the most chains could probably fit in one cache line). But it would involve a lot of mem moves and 
	//		 could introduce some complexity. Since we're already under 1ms average, I'd say let's not do it.

	// Sort into buckets
	BeginCounter(&binningCounter);
	{
		float pixelsPerVert = float((g_width * g_height) / g_numActiveNodes);
		float binDiameterPixels = sqrt(pixelsPerVert); // conservative
	
		g_binNHeight = binDiameterPixels / g_height;
		g_binNWidth  = binDiameterPixels / g_width;

		g_binCountX  = uint(ceilf(1.0f / g_binNWidth) )+2;  // Add a boundary around the outside
		g_binCountY  = uint(ceilf(1.0f / g_binNHeight))+2;

		uint xiter = g_binUpdateIter % g_numBinSplits;
		uint yiter = g_binUpdateIter / g_numBinSplits;
		g_binRangeX[0] = (g_binCountX * xiter/g_numBinSplits)		  - 1;	// Subtract/Add 1 to each of these ranges for a buffer layer
		g_binRangeX[1] = (g_binCountX * (xiter+1)/g_numBinSplits - 1) + 1;	// This buffer layer will be overlap for each quadrant
		g_binRangeY[0] = (g_binCountY * yiter/g_numBinSplits)		  - 1;	// But without it verts would only target verts in their quadrant
		g_binRangeY[1] = (g_binCountY * (yiter+1)/g_numBinSplits - 1) + 1;
		g_binStride  = g_numSlots / ((g_binRangeX[1] - g_binRangeX[0] + 1) * (g_binRangeY[1] - g_binRangeY[0] + 1));

		int bin;
		memset(g_slots, EMPTY_SLOT, sizeof(g_slots));
		for (uint i = 0; i < g_numNodes; i++)
		{
			if (g_nodes[i].attribs.hasChild == true) continue; // Only bin the chompable tails
			hr = Bin(g_nodes[i].position.getX(), g_nodes[i].position.getY(), &bin);
			if (FAILED(hr)) // If this bin isn't backed by memory, we can't be a target this frame
				continue;

			// Find first empty bin slot
			for (uint slot = 0; slot < g_binStride; slot++) 
			{
				if (g_slots[bin*g_binStride + slot] == EMPTY_SLOT)
				{
					g_slots[bin*g_binStride + slot] = i;
					break;
				}
			}
			// If we overflow the bins, the vertex cannot be targeted. Haven't seen any cases yet...
		}
		g_binUpdateIter = (g_binUpdateIter+1) % (g_numBinSplits*g_numBinSplits);
	}
	EndCounter(&binningCounter);

	// Determine nearest neighbors
	BeginCounter(&nearestNeighborCounter);
	for (uint i = 0; i < g_numNodes; i++)
	{
		IFC( FindNearestNeighbor(i) );
	}
	EndCounter(&nearestNeighborCounter);

	BeginCounter(&positionUpdate);
	for (uint i = 0; i < g_numNodes; i++)
	{
		// Do our memory reads here so we can optimize our access patterns
		Node& current = g_nodes[i];
		Node& target = g_nodes[current.attribs.targetID];

		// Get target vector
		// For optimal precision, pull our shorts into floats and do all math at full precision...
		float2 targetVec;
		targetVec.x = target.position.getX() - current.position.getX(); 
		targetVec.y = target.position.getY() - current.position.getY();

		float dist = targetVec.getLength();
		float2 dir = targetVec;
		if (dist != 0)
			dir = dir / dist;
		
		// Calculate change in position
		float2 offset;
		if (current.attribs.hasParent)
		{
			// This controls wigglyness. Perhaps it should be a function of velocity? (static is more wiggly)
			float parentPaddingRadius = g_tailDist;// + (rand() * 2 - 1)*g_tailDist*0.3f;
			offset = targetVec - dir * parentPaddingRadius;
		}
		else
			offset = min(targetVec, dir * float(g_speed * deltaTime));
		
		// ... then finally, at the verrrry end, stuff our FP floats into 16-bit shorts
		current.position.setX(current.position.getX() + offset.x);
		current.position.setY(current.position.getY() + offset.y);
		
		// Check for chomps
		if (current.attribs.hasParent == false && dist <= g_tailDist)
			Chomp(i);
	}
	EndCounter(&positionUpdate);

Cleanup:
	if (g_numActiveNodes == 1)
		return EndgameInit();

	return hr;
}