23 StrokeVertexIterator_doc,
24 "Class hierarchy: :class:`Iterator` > :class:`StrokeVertexIterator`\n"
26 "Class defining an iterator designed to iterate over the\n"
27 ":class:`StrokeVertex` of a :class:`Stroke`. An instance of a\n"
28 "StrokeVertexIterator can be obtained from a Stroke by calling\n"
29 "iter(), stroke_vertices_begin() or stroke_vertices_begin(). It is iterating\n"
30 "over the same vertices as an :class:`Interface0DIterator`. The difference\n"
31 "resides in the object access: an Interface0DIterator only allows\n"
32 "access to an Interface0D while one might need to access the\n"
33 "specialized StrokeVertex type. In this case, one should use a\n"
34 "StrokeVertexIterator. To call functions of the UnaryFuntion0D type,\n"
35 "a StrokeVertexIterator can be converted to an Interface0DIterator by\n"
36 "by calling Interface0DIterator(it).\n"
38 ".. method:: __init__()\n"
39 " __init__(brother)\n"
41 " Creates a :class:`StrokeVertexIterator` using either the\n"
42 " default constructor or the copy constructor.\n"
44 " :arg brother: A StrokeVertexIterator object.\n"
45 " :type brother: :class:`StrokeVertexIterator`\n");
50 static const char *kwlist_1[] = {
"brother",
nullptr};
51 static const char *kwlist_2[] = {
"stroke",
nullptr};
52 PyObject *brother =
nullptr, *stroke =
nullptr;
54 if (PyArg_ParseTupleAndKeywords(
63 else if ((
void)PyErr_Clear(),
64 PyArg_ParseTupleAndKeywords(
65 args, kwds,
"|O!", (
char **)kwlist_2, &
Stroke_Type, &stroke))
72 ((
BPy_Stroke *)stroke)->s->strokeVerticesBegin());
74 self->reversed =
false;
75 self->at_start =
true;
78 PyErr_SetString(PyExc_TypeError,
"argument 1 must be StrokeVertexIterator or Stroke");
88 self->at_start =
true;
89 return (PyObject *)
self;
100 if (
self->reversed) {
101 if (
self->sv_it->isBegin()) {
102 PyErr_SetNone(PyExc_StopIteration);
105 self->sv_it->decrement();
109 if (
self->sv_it->isEnd()) {
110 PyErr_SetNone(PyExc_StopIteration);
115 if (
self->at_start) {
116 self->at_start =
false;
120 else if (
self->sv_it->atLast()) {
121 PyErr_SetNone(PyExc_StopIteration);
125 self->sv_it->increment();
136 StrokeVertexIterator_incremented_doc,
137 ".. method:: incremented()\n"
139 " Returns a copy of an incremented StrokeVertexIterator.\n"
141 " :return: A StrokeVertexIterator pointing the next StrokeVertex.\n"
142 " :rtype: :class:`StrokeVertexIterator`\n");
145 if (
self->sv_it->isEnd()) {
146 PyErr_SetString(PyExc_RuntimeError,
"cannot increment any more");
156 StrokeVertexIterator_decremented_doc,
157 ".. method:: decremented()\n"
159 " Returns a copy of a decremented StrokeVertexIterator.\n"
161 " :return: A StrokeVertexIterator pointing the previous StrokeVertex.\n"
162 " :rtype: :class:`StrokeVertexIterator`\n");
165 if (
self->sv_it->isBegin()) {
166 PyErr_SetString(PyExc_RuntimeError,
"cannot decrement any more");
176 StrokeVertexIterator_reversed_doc,
177 ".. method:: reversed()\n"
179 " Returns a StrokeVertexIterator that traverses stroke vertices in the\n"
182 " :return: A StrokeVertexIterator traversing stroke vertices backward.\n"
183 " :rtype: :class:`StrokeVertexIterator`\n");
191# pragma clang diagnostic push
192# pragma clang diagnostic ignored "-Wcast-function-type"
194# pragma GCC diagnostic push
195# pragma GCC diagnostic ignored "-Wcast-function-type"
203 StrokeVertexIterator_incremented_doc},
207 StrokeVertexIterator_decremented_doc},
211 StrokeVertexIterator_reversed_doc},
212 {
nullptr,
nullptr, 0,
nullptr},
217# pragma clang diagnostic pop
219# pragma GCC diagnostic pop
227 StrokeVertexIterator_object_doc,
228 "The StrokeVertex object currently pointed to by this iterator.\n"
230 ":type: :class:`StrokeVertex`\n");
234 if (
self->sv_it->isEnd()) {
235 PyErr_SetString(PyExc_RuntimeError,
"iteration has stopped");
247 StrokeVertexIterator_t_doc,
248 "The curvilinear abscissa of the current point.\n"
253 return PyFloat_FromDouble(
self->sv_it->t());
258 StrokeVertexIterator_u_doc,
259 "The point parameter at the current point in the stroke (0 <= u <= 1).\n"
264 return PyFloat_FromDouble(
self->sv_it->u());
269 StrokeVertexIterator_at_last_doc,
270 "True if the iterator points to the last valid element.\n"
271 "For its counterpart (pointing to the first valid element), use it.is_begin.\n"
281# pragma clang diagnostic push
282# pragma clang diagnostic ignored "-Wcast-function-type"
284# pragma GCC diagnostic push
285# pragma GCC diagnostic ignored "-Wcast-function-type"
293 StrokeVertexIterator_object_doc,
298 StrokeVertexIterator_t_doc,
303 StrokeVertexIterator_u_doc,
308 StrokeVertexIterator_at_last_doc,
310 {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr}
315# pragma clang diagnostic pop
317# pragma GCC diagnostic pop
324 PyVarObject_HEAD_INIT(
nullptr, 0)
325 "StrokeVertexIterator",
343 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
344 StrokeVertexIterator_doc,
PyObject * BPy_StrokeVertexIterator_from_StrokeVertexIterator(StrokeInternal::StrokeVertexIterator &sv_it, bool reversed)
PyObject * BPy_StrokeVertex_from_StrokeVertex(StrokeVertex &sv)
PyObject * PyBool_from_bool(bool b)
PyTypeObject Iterator_Type
static int StrokeVertexIterator_init(BPy_StrokeVertexIterator *self, PyObject *args, PyObject *kwds)
static PyObject * StrokeVertexIterator_at_last_get(BPy_StrokeVertexIterator *self)
static PyObject * StrokeVertexIterator_reversed(BPy_StrokeVertexIterator *self)
static PyObject * StrokeVertexIterator_t_get(BPy_StrokeVertexIterator *self, void *)
static PyObject * StrokeVertexIterator_decremented(BPy_StrokeVertexIterator *self)
static PyObject * StrokeVertexIterator_object_get(BPy_StrokeVertexIterator *self, void *)
static PyObject * StrokeVertexIterator_u_get(BPy_StrokeVertexIterator *self, void *)
PyTypeObject StrokeVertexIterator_Type
static PyObject * StrokeVertexIterator_iternext(BPy_StrokeVertexIterator *self)
static PyGetSetDef BPy_StrokeVertexIterator_getseters[]
static PyObject * StrokeVertexIterator_incremented(BPy_StrokeVertexIterator *self)
static PyMethodDef BPy_StrokeVertexIterator_methods[]
PyDoc_STRVAR(StrokeVertexIterator_doc, "Class hierarchy: :class:`Iterator` > :class:`StrokeVertexIterator`\n" "\n" "Class defining an iterator designed to iterate over the\n" ":class:`StrokeVertex` of a :class:`Stroke`. An instance of a\n" "StrokeVertexIterator can be obtained from a Stroke by calling\n" "iter(), stroke_vertices_begin() or stroke_vertices_begin(). It is iterating\n" "over the same vertices as an :class:`Interface0DIterator`. The difference\n" "resides in the object access: an Interface0DIterator only allows\n" "access to an Interface0D while one might need to access the\n" "specialized StrokeVertex type. In this case, one should use a\n" "StrokeVertexIterator. To call functions of the UnaryFuntion0D type,\n" "a StrokeVertexIterator can be converted to an Interface0DIterator by\n" "by calling Interface0DIterator(it).\n" "\n" ".. method:: __init__()\n" " __init__(brother)\n" "\n" " Creates a :class:`StrokeVertexIterator` using either the\n" " default constructor or the copy constructor.\n" "\n" " :arg brother: A StrokeVertexIterator object.\n" " :type brother: :class:`StrokeVertexIterator`\n")
static PyObject * StrokeVertexIterator_iter(BPy_StrokeVertexIterator *self)
static void copy(bNodeTree *dest_ntree, bNode *dest_node, const bNode *src_node)