Beispiel #1
0
  QPoint PolygonPrivate::getPrevPoint(std::vector<QPoint>::const_iterator current) const
  {
    const int currentY = current->y();
    for (auto prev = current;;)
    {
      if (prev == m_points.begin())
        prev = --m_points.end();
      else
        --prev;

      if (prev->y() != currentY)
        return *prev;
    }
  }
Beispiel #2
0
  QPoint PolygonPrivate::getNextPoint(int& shift, std::vector<QPoint>::const_iterator current) const
  {
    const int currentY = current->y();
    shift = 0;
    for (auto next = current;;)
    {
      ++shift;
      if (next == --m_points.end())
        next = m_points.begin();
      else
        ++next;

      if (next->y() != currentY)
        return *next;
    }
  }