9 #include "../BPy_Convert.h"
10 #include "../BPy_Interface1D.h"
23 "Class hierarchy: :class:`Iterator` > :class:`Interface0DIterator`\n"
25 "Class defining an iterator over Interface0D elements. An instance of\n"
26 "this iterator is always obtained from a 1D element.\n"
28 ".. method:: __init__(brother)\n"
31 " Construct a nested Interface0DIterator using either the copy constructor\n"
32 " or the constructor that takes an he argument of a Function0D.\n"
34 " :arg brother: An Interface0DIterator object.\n"
35 " :type brother: :class:`Interface0DIterator`\n"
36 " :arg it: An iterator object to be nested.\n"
37 " :type it: :class:`SVertexIterator`, :class:`CurvePointIterator`, or\n"
38 " :class:`StrokeVertexIterator`");
56 static const char *kwlist_1[] = {
"it",
nullptr};
57 static const char *kwlist_2[] = {
"inter",
nullptr};
58 static const char *kwlist_3[] = {
"brother",
nullptr};
60 PyObject *brother, *inter;
62 if (PyArg_ParseTupleAndKeywords(
65 self->at_start =
true;
66 self->reversed =
false;
68 else if ((
void)PyErr_Clear(),
69 PyArg_ParseTupleAndKeywords(
72 self->at_start =
true;
73 self->reversed =
false;
75 else if ((
void)PyErr_Clear(),
76 PyArg_ParseTupleAndKeywords(
83 PyErr_SetString(PyExc_TypeError,
"invalid argument(s)");
86 self->py_it.it =
self->if0D_it;
93 self->at_start =
true;
94 return (PyObject *)
self;
100 if (
self->if0D_it->isBegin()) {
101 PyErr_SetNone(PyExc_StopIteration);
104 self->if0D_it->decrement();
107 if (
self->if0D_it->isEnd()) {
108 PyErr_SetNone(PyExc_StopIteration);
111 if (
self->at_start) {
112 self->at_start =
false;
114 else if (
self->if0D_it->atLast()) {
115 PyErr_SetNone(PyExc_StopIteration);
119 self->if0D_it->increment();
129 "The 0D object currently pointed to by this iterator. Note that the object\n"
130 "may be an instance of an Interface0D subclass. For example if the iterator\n"
131 "has been created from the `vertices_begin()` method of the :class:`Stroke`\n"
132 "class, the .object property refers to a :class:`StrokeVertex` object.\n"
134 ":type: :class:`Interface0D` or one of its subclasses.");
139 if (
self->if0D_it->isEnd()) {
140 PyErr_SetString(PyExc_RuntimeError,
"iteration has stopped");
147 "The curvilinear abscissa of the current point.\n"
153 return PyFloat_FromDouble(
self->if0D_it->t());
157 "The point parameter at the current point in the 1D element (0 <= u <= 1).\n"
163 return PyFloat_FromDouble(
self->if0D_it->u());
167 "True if the iterator points to the last valid element.\n"
168 "For its counterpart (pointing to the first valid element), use it.is_begin.\n"
182 Interface0DIterator_object_doc,
189 Interface0DIterator_at_last_doc,
191 {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr}
197 PyVarObject_HEAD_INIT(
nullptr, 0)
"Interface0DIterator",
215 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
216 Interface0DIterator_doc,
PyObject * PyBool_from_bool(bool b)
PyObject * Any_BPy_Interface0D_from_Interface0D(Interface0D &if0D)
static PyObject * Interface0DIterator_iternext(BPy_Interface0DIterator *self)
static int Interface0DIterator_init(BPy_Interface0DIterator *self, PyObject *args, PyObject *kwds)
static PyObject * Interface0DIterator_u_get(BPy_Interface0DIterator *self, void *UNUSED(closure))
static PyObject * Interface0DIterator_object_get(BPy_Interface0DIterator *self, void *UNUSED(closure))
static int convert_nested_it(PyObject *obj, void *v)
static PyObject * Interface0DIterator_iter(BPy_Interface0DIterator *self)
static PyObject * Interface0DIterator_t_get(BPy_Interface0DIterator *self, void *UNUSED(closure))
static PyObject * Interface0DIterator_at_last_get(BPy_Interface0DIterator *self, void *UNUSED(closure))
static PyGetSetDef BPy_Interface0DIterator_getseters[]
PyTypeObject Interface0DIterator_Type
PyDoc_STRVAR(Interface0DIterator_doc, "Class hierarchy: :class:`Iterator` > :class:`Interface0DIterator`\n" "\n" "Class defining an iterator over Interface0D elements. An instance of\n" "this iterator is always obtained from a 1D element.\n" "\n" ".. method:: __init__(brother)\n" " __init__(it)\n" "\n" " Construct a nested Interface0DIterator using either the copy constructor\n" " or the constructor that takes an he argument of a Function0D.\n" "\n" " :arg brother: An Interface0DIterator object.\n" " :type brother: :class:`Interface0DIterator`\n" " :arg it: An iterator object to be nested.\n" " :type it: :class:`SVertexIterator`, :class:`CurvePointIterator`, or\n" " :class:`StrokeVertexIterator`")
PyTypeObject Interface1D_Type
PyTypeObject Iterator_Type
#define BPy_Iterator_Check(v)
ATTR_WARN_UNUSED_RESULT const BMVert * v