29 "Class hierarchy: :class:`Iterator` > :class:`ViewEdgeIterator` > :class:`ChainingIterator`\n"
31 "Base class for chaining iterators. This class is designed to be\n"
32 "overloaded in order to describe chaining rules. It makes the\n"
33 "description of chaining rules easier. The two main methods that need\n"
34 "to overloaded are traverse() and init(). traverse() tells which\n"
35 ":class:`ViewEdge` to follow, among the adjacent ones. If you specify\n"
36 "restriction rules (such as \"Chain only ViewEdges of the selection\"),\n"
37 "they will be included in the adjacency iterator (i.e, the adjacent\n"
38 "iterator will only stop on \"valid\" edges).\n"
40 ".. method:: __init__(restrict_to_selection=True, restrict_to_unvisited=True,"
41 " begin=None, orientation=True)\n"
42 " __init__(brother)\n"
44 " Builds a Chaining Iterator from the first ViewEdge used for\n"
45 " iteration and its orientation or by using the copy constructor.\n"
47 " :arg restrict_to_selection: Indicates whether to force the chaining\n"
48 " to stay within the set of selected ViewEdges or not.\n"
49 " :type restrict_to_selection: bool\n"
50 " :arg restrict_to_unvisited: Indicates whether a ViewEdge that has\n"
51 " already been chained must be ignored ot not.\n"
52 " :type restrict_to_unvisited: bool\n"
53 " :arg begin: The ViewEdge from which to start the chain.\n"
54 " :type begin: :class:`ViewEdge` | None\n"
55 " :arg orientation: The direction to follow to explore the graph. If\n"
56 " true, the direction indicated by the first ViewEdge is used.\n"
57 " :type orientation: bool\n"
59 " :type brother: ChainingIterator");
66 *((PyObject **)
v) = obj;
72 static const char *kwlist_1[] = {
"brother",
nullptr};
73 static const char *kwlist_2[] = {
74 "restrict_to_selection",
"restrict_to_unvisited",
"begin",
"orientation",
nullptr};
75 PyObject *obj1 =
nullptr, *obj2 =
nullptr, *obj3 =
nullptr, *obj4 =
nullptr;
77 if (PyArg_ParseTupleAndKeywords(
82 else if ((
void)PyErr_Clear(),
83 (
void)(obj1 = obj2 = obj3 = obj4 =
nullptr),
84 PyArg_ParseTupleAndKeywords(args,
102 restrict_to_selection, restrict_to_unvisited, begin, orientation);
105 PyErr_SetString(PyExc_TypeError,
"invalid argument(s)");
109 self->py_ve_it.py_it.it =
self->c_it;
111 self->c_it->py_c_it = (PyObject *)
self;
118 ChainingIterator_init_doc,
119 ".. method:: init()\n"
121 " Initializes the iterator context. This method is called each\n"
122 " time a new chain is started. It can be used to reset some\n"
123 " history information that you might want to keep.");
128 PyErr_SetString(PyExc_TypeError,
"init() method not properly overridden");
137 ChainingIterator_traverse_doc,
138 ".. method:: traverse(it)\n"
140 " This method iterates over the potential next ViewEdges and returns\n"
141 " the one that will be followed next. Returns the next ViewEdge to\n"
142 " follow or None when the end of the chain is reached.\n"
144 " :arg it: The iterator over the ViewEdges adjacent to the end vertex\n"
145 " of the current ViewEdge. The adjacency iterator reflects the\n"
146 " restriction rules by only iterating over the valid ViewEdges.\n"
147 " :type it: :class:`AdjacencyIterator`\n"
148 " :return: Returns the next ViewEdge to follow, or None if chaining ends.\n"
149 " :rtype: :class:`ViewEdge` | None");
155 static const char *kwlist[] = {
"it",
nullptr};
159 PyErr_SetString(PyExc_TypeError,
"traverse() method not properly overridden");
162 if (!PyArg_ParseTupleAndKeywords(
177 METH_VARARGS | METH_KEYWORDS,
178 ChainingIterator_traverse_doc},
179 {
nullptr,
nullptr, 0,
nullptr},
186 ChainingIterator_object_doc,
187 "The ViewEdge object currently pointed by this iterator.\n"
189 ":type: :class:`ViewEdge`");
193 if (
self->c_it->isEnd()) {
194 PyErr_SetString(PyExc_RuntimeError,
"iteration has stopped");
207 ChainingIterator_next_vertex_doc,
208 "The ViewVertex that is the next crossing.\n"
210 ":type: :class:`ViewVertex`");
224 ChainingIterator_is_incrementing_doc,
225 "True if the current iteration is an incrementation.\n"
239 ChainingIterator_object_doc,
244 ChainingIterator_next_vertex_doc,
249 ChainingIterator_is_incrementing_doc,
251 {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr}
257 PyVarObject_HEAD_INIT(
nullptr, 0)
276 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
277 ChainingIterator_doc,
PyTypeObject AdjacencyIterator_Type
static int check_begin(PyObject *obj, void *v)
static int ChainingIterator___init__(BPy_ChainingIterator *self, PyObject *args, PyObject *kwds)
static PyObject * ChainingIterator_init(BPy_ChainingIterator *self)
static PyGetSetDef BPy_ChainingIterator_getseters[]
static PyObject * ChainingIterator_next_vertex_get(BPy_ChainingIterator *self, void *)
static PyObject * ChainingIterator_traverse(BPy_ChainingIterator *self, PyObject *args, PyObject *kwds)
static PyMethodDef BPy_ChainingIterator_methods[]
static PyObject * ChainingIterator_is_incrementing_get(BPy_ChainingIterator *self, void *)
static PyObject * ChainingIterator_object_get(BPy_ChainingIterator *self, void *)
PyDoc_STRVAR(ChainingIterator_doc, "Class hierarchy: :class:`Iterator` > :class:`ViewEdgeIterator` > :class:`ChainingIterator`\n" "\n" "Base class for chaining iterators. This class is designed to be\n" "overloaded in order to describe chaining rules. It makes the\n" "description of chaining rules easier. The two main methods that need\n" "to overloaded are traverse() and init(). traverse() tells which\n" ":class:`ViewEdge` to follow, among the adjacent ones. If you specify\n" "restriction rules (such as \"Chain only ViewEdges of the selection\"),\n" "they will be included in the adjacency iterator (i.e, the adjacent\n" "iterator will only stop on \"valid\" edges).\n" "\n" ".. method:: __init__(restrict_to_selection=True, restrict_to_unvisited=True," " begin=None, orientation=True)\n" " __init__(brother)\n" "\n" " Builds a Chaining Iterator from the first ViewEdge used for\n" " iteration and its orientation or by using the copy constructor.\n" "\n" " :arg restrict_to_selection: Indicates whether to force the chaining\n" " to stay within the set of selected ViewEdges or not.\n" " :type restrict_to_selection: bool\n" " :arg restrict_to_unvisited: Indicates whether a ViewEdge that has\n" " already been chained must be ignored ot not.\n" " :type restrict_to_unvisited: bool\n" " :arg begin: The ViewEdge from which to start the chain.\n" " :type begin: :class:`ViewEdge` | None\n" " :arg orientation: The direction to follow to explore the graph. If\n" " true, the direction indicated by the first ViewEdge is used.\n" " :type orientation: bool\n" " :arg brother: \n" " :type brother: ChainingIterator")
PyTypeObject ChainingIterator_Type
bool bool_from_PyBool(PyObject *b)
PyObject * Any_BPy_ViewVertex_from_ViewVertex(ViewVertex &vv)
PyObject * BPy_ViewEdge_from_ViewEdge(ViewEdge &ve)
PyObject * PyBool_from_bool(bool b)
PyTypeObject ViewEdgeIterator_Type
#define BPy_ViewEdge_Check(v)
ATTR_WARN_UNUSED_RESULT const BMVert * v