QSubpathFlatIterator Class Reference

Collaboration diagram for QSubpathFlatIterator:

Collaboration graph
[legend]
List of all members.

Detailed Description

Definition at line 98 of file qstroker.cpp.

Public Member Functions

 QSubpathFlatIterator (const QDataBuffer< QStrokerOps::Element > *path)
bool hasNext () const
QStrokerOps::Element next ()

Private Attributes

const QDataBuffer< QStrokerOps::Element > * m_path
int m_pos
QPolygonF m_curve
int m_curve_index


Constructor & Destructor Documentation

QSubpathFlatIterator::QSubpathFlatIterator ( const QDataBuffer< QStrokerOps::Element > *  path  )  [inline]

Definition at line 101 of file qstroker.cpp.

00102         : m_path(path), m_pos(0), m_curve_index(-1) { }


Member Function Documentation

bool QSubpathFlatIterator::hasNext (  )  const [inline]

Definition at line 104 of file qstroker.cpp.

References m_curve_index, m_path, m_pos, and QDataBuffer< Type >::size().

Referenced by next(), and QDashStroker::processCurrentSubpath().

00104 { return m_curve_index >= 0 || m_pos < m_path->size(); }

Here is the call graph for this function:

QStrokerOps::Element QSubpathFlatIterator::next (  )  [inline]

Definition at line 106 of file qstroker.cpp.

References QDataBuffer< Type >::at(), QVector< T >::at(), QBezier::fromPoints(), hasNext(), QStrokerOps::Element::isCurveTo(), QStrokerOps::Element::isLineTo(), QStrokerOps::Element::isMoveTo(), QPainterPath::LineToElement, m_curve, m_curve_index, m_path, m_pos, qt_fixed_to_real, qt_real_to_fixed, QVector< T >::size(), size, QStrokerOps::Element::type, QStrokerOps::Element::x, QPointF::x(), QStrokerOps::Element::y, and QPointF::y().

Referenced by QDashStroker::processCurrentSubpath().

00107     {
00108         Q_ASSERT(hasNext());
00109 
00110         if (m_curve_index >= 0) {
00111             QStrokerOps::Element e = { QPainterPath::LineToElement,
00112                                        qt_real_to_fixed(m_curve.at(m_curve_index).x()),
00113                                        qt_real_to_fixed(m_curve.at(m_curve_index).y())
00114                                        };
00115             ++m_curve_index;
00116             if (m_curve_index >= m_curve.size())
00117                 m_curve_index = -1;
00118             return e;
00119         }
00120 
00121         QStrokerOps::Element e = m_path->at(m_pos);
00122         if (e.isCurveTo()) {
00123             Q_ASSERT(m_pos > 0);
00124             Q_ASSERT(m_pos < m_path->size());
00125 
00126             m_curve = QBezier::fromPoints(QPointF(qt_fixed_to_real(m_path->at(m_pos-1).x),
00127                                                   qt_fixed_to_real(m_path->at(m_pos-1).y)),
00128                                           QPointF(qt_fixed_to_real(e.x),
00129                                                   qt_fixed_to_real(e.y)),
00130                                           QPointF(qt_fixed_to_real(m_path->at(m_pos+1).x),
00131                                                   qt_fixed_to_real(m_path->at(m_pos+1).y)),
00132                                           QPointF(qt_fixed_to_real(m_path->at(m_pos+2).x),
00133                                                   qt_fixed_to_real(m_path->at(m_pos+2).y))).toPolygon();
00134             m_curve_index = 1;
00135             e.type = QPainterPath::LineToElement;
00136             e.x = m_curve.at(0).x();
00137             e.y = m_curve.at(0).y();
00138             m_pos += 2;
00139         }
00140         Q_ASSERT(e.isLineTo() || e.isMoveTo());
00141         ++m_pos;
00142         return e;
00143     }

Here is the call graph for this function:


Member Data Documentation

const QDataBuffer<QStrokerOps::Element>* QSubpathFlatIterator::m_path [private]

Definition at line 146 of file qstroker.cpp.

Referenced by hasNext(), and next().

int QSubpathFlatIterator::m_pos [private]

Definition at line 147 of file qstroker.cpp.

Referenced by hasNext(), and next().

QPolygonF QSubpathFlatIterator::m_curve [private]

Definition at line 148 of file qstroker.cpp.

Referenced by next().

int QSubpathFlatIterator::m_curve_index [private]

Definition at line 149 of file qstroker.cpp.

Referenced by hasNext(), and next().


The documentation for this class was generated from the following file:
Generated on Thu Mar 15 19:12:17 2007 for Qt 4.2 User's Guide by  doxygen 1.5.1