25 "Class hierarchy: :class:`Iterator` > :class:`ViewEdgeIterator` > :class:`ChainingIterator`\n"
27 "Base class for chaining iterators. This class is designed to be\n"
28 "overloaded in order to describe chaining rules. It makes the\n"
29 "description of chaining rules easier. The two main methods that need\n"
30 "to overloaded are traverse() and init(). traverse() tells which\n"
31 ":class:`ViewEdge` to follow, among the adjacent ones. If you specify\n"
32 "restriction rules (such as \"Chain only ViewEdges of the selection\"),\n"
33 "they will be included in the adjacency iterator (i.e, the adjacent\n"
34 "iterator will only stop on \"valid\" edges).\n"
36 ".. method:: __init__(*args)\n"
38 " Accepted call signatures:\n"
40 " - ``__init__(restrict_to_selection=True, restrict_to_unvisited=True, begin=None, "
41 "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 " :param 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 " :param 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 " :param begin: The ViewEdge from which to start the chain.\n"
54 " :type begin: :class:`ViewEdge` | None\n"
55 " :param 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\n");
65 *((PyObject **)v) = obj;
71 static const char *kwlist_1[] = {
"brother",
nullptr};
72 static const char *kwlist_2[] = {
73 "restrict_to_selection",
"restrict_to_unvisited",
"begin",
"orientation",
nullptr};
74 PyObject *obj1 =
nullptr, *obj2 =
nullptr, *obj3 =
nullptr, *obj4 =
nullptr;
76 if (PyArg_ParseTupleAndKeywords(args,
86 else if ((
void)PyErr_Clear(),
87 (
void)(obj1 = obj2 = obj3 = obj4 =
nullptr),
88 PyArg_ParseTupleAndKeywords(args,
111 restrict_to_selection, restrict_to_unvisited, begin, orientation);
114 PyErr_SetString(PyExc_TypeError,
"invalid argument(s)");
127 ChainingIterator_init_doc,
128 ".. method:: init()\n"
130 " Initializes the iterator context. This method is called each\n"
131 " time a new chain is started. It can be used to reset some\n"
132 " history information that you might want to keep.\n");
136 PyErr_SetString(PyExc_TypeError,
"init() method not properly overridden");
145 ChainingIterator_traverse_doc,
146 ".. method:: traverse(it)\n"
148 " This method iterates over the potential next ViewEdges and returns\n"
149 " the one that will be followed next. Returns the next ViewEdge to\n"
150 " follow or None when the end of the chain is reached.\n"
152 " :param it: The iterator over the ViewEdges adjacent to the end vertex\n"
153 " of the current ViewEdge. The adjacency iterator reflects the\n"
154 " restriction rules by only iterating over the valid ViewEdges.\n"
155 " :type it: :class:`AdjacencyIterator`\n"
156 " :return: Returns the next ViewEdge to follow, or None if chaining ends.\n"
157 " :rtype: :class:`ViewEdge` | None\n");
162 static const char *kwlist[] = {
"it",
nullptr};
166 PyErr_SetString(PyExc_TypeError,
"traverse() method not properly overridden");
169 if (!PyArg_ParseTupleAndKeywords(args,
187# pragma clang diagnostic push
188# pragma clang diagnostic ignored "-Wcast-function-type"
190# pragma GCC diagnostic push
191# pragma GCC diagnostic ignored "-Wcast-function-type"
199 METH_VARARGS | METH_KEYWORDS,
200 ChainingIterator_traverse_doc},
201 {
nullptr,
nullptr, 0,
nullptr},
206# pragma clang diagnostic pop
208# pragma GCC diagnostic pop
216 ChainingIterator_object_doc,
217 "The ViewEdge object currently pointed by this iterator.\n"
219 ":type: :class:`ViewEdge`\n");
223 PyErr_SetString(PyExc_RuntimeError,
"iteration has stopped");
236 ChainingIterator_next_vertex_doc,
237 "The ViewVertex that is the next crossing.\n"
239 ":type: :class:`ViewVertex`\n");
252 ChainingIterator_is_incrementing_doc,
253 "True if the current iteration is an incrementation.\n"
266 ChainingIterator_object_doc,
271 ChainingIterator_next_vertex_doc,
276 ChainingIterator_is_incrementing_doc,
278 {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr}
284 PyVarObject_HEAD_INIT(
nullptr, 0)
303 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
304 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 *)
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)
PyDoc_STRVAR(FalseBP1D___doc__, "Class hierarchy: :class:`freestyle.types.BinaryPredicate1D` > :class:`FalseBP1D`\n" "\n" ".. method:: __call__(inter1, inter2)\n" "\n" " Always returns false.\n" "\n" " :param inter1: The first Interface1D object.\n" " :type inter1: :class:`freestyle.types.Interface1D`\n" " :param inter2: The second Interface1D object.\n" " :type inter2: :class:`freestyle.types.Interface1D`\n" " :return: False.\n" " :rtype: bool\n")
PyTypeObject ViewEdgeIterator_Type
#define BPy_ViewEdge_Check(v)
ChainingIterator(bool iRestrictToSelection=true, bool iRestrictToUnvisited=true, ViewEdge *begin=nullptr, bool orientation=true)
bool isIncrementing() const
virtual int traverse(const AdjacencyIterator &it)
virtual bool isEnd() const
Freestyle::ChainingIterator * c_it
BPy_ViewEdgeIterator py_ve_it
PyObject_HEAD Freestyle::Iterator * it
Freestyle::ViewEdgeInternal::ViewEdgeIterator * ve_it