18#include "../generic/py_capi_utils.hh"
28 if (module ==
nullptr) {
35 PyModule_AddObjectRef(module,
"ViewShape", (PyObject *)&
ViewShape_Type);
45 "Class gathering the elements of the ViewMap (i.e., :class:`ViewVertex`\n"
46 "and :class:`ViewEdge`) that are issued from the same input shape.\n"
48 ".. method:: __init__(*args)\n"
50 " Accepted call signatures:\n"
53 " - ``__init__(brother)``\n"
54 " - ``__init__(sshape)``\n"
56 " Builds a :class:`ViewShape` using the default constructor,\n"
57 " copy constructor, or from a :class:`SShape`.\n"
59 " :param brother: A ViewShape object.\n"
60 " :type brother: :class:`ViewShape`\n"
61 " :param sshape: An SShape object.\n"
62 " :type sshape: :class:`SShape`\n");
65 static const char *kwlist_1[] = {
"brother",
nullptr};
66 static const char *kwlist_2[] = {
"sshape",
nullptr};
67 PyObject *obj =
nullptr;
69 if (PyArg_ParseTupleAndKeywords(args,
80 self->
py_ss =
nullptr;
87 else if ((
void)PyErr_Clear(),
88 PyArg_ParseTupleAndKeywords(args,
101 PyErr_SetString(PyExc_TypeError,
"invalid argument(s)");
105 Py_XINCREF(self->
py_ss);
113 Py_DECREF(self->
py_ss);
118 Py_TYPE(self)->tp_free((PyObject *)self);
123 return PyUnicode_FromFormat(
"ViewShape - address: %p", self->
vs);
128 ViewShape_add_edge_doc,
129 ".. method:: add_edge(edge)\n"
131 " Adds a ViewEdge to the list of ViewEdge objects.\n"
133 " :param edge: A ViewEdge object.\n"
134 " :type edge: :class:`ViewEdge`\n");
137 static const char *kwlist[] = {
"edge",
nullptr};
138 PyObject *py_ve =
nullptr;
140 if (PyArg_ParseTupleAndKeywords(args,
156 ViewShape_add_vertex_doc,
157 ".. method:: add_vertex(vertex)\n"
159 " Adds a ViewVertex to the list of the ViewVertex objects.\n"
161 " :param vertex: A ViewVertex object.\n"
162 " :type vertex: :class:`ViewVertex`\n");
165 static const char *kwlist[] = {
"vertex",
nullptr};
166 PyObject *py_vv =
nullptr;
168 if (PyArg_ParseTupleAndKeywords(args,
186# pragma clang diagnostic push
187# pragma clang diagnostic ignored "-Wcast-function-type"
189# pragma GCC diagnostic push
190# pragma GCC diagnostic ignored "-Wcast-function-type"
197 METH_VARARGS | METH_KEYWORDS,
198 ViewShape_add_edge_doc},
201 METH_VARARGS | METH_KEYWORDS,
202 ViewShape_add_vertex_doc},
203 {
nullptr,
nullptr, 0,
nullptr},
208# pragma clang diagnostic pop
210# pragma GCC diagnostic pop
218 ViewShape_sshape_doc,
219 "The SShape on top of which this ViewShape is built.\n"
221 ":type: :class:`SShape`\n");
234 PyErr_SetString(PyExc_TypeError,
"value must be an SShape");
240 Py_DECREF(self->
py_ss);
244 Py_INCREF(self->
py_ss);
251 ViewShape_vertices_doc,
252 "The list of ViewVertex objects contained in this ViewShape.\n"
254 ":type: list[:class:`ViewVertex`]\n");
259 PyObject *py_vertices = PyList_New(vertices.size());
262 for (it = vertices.begin(); it != vertices.end(); it++) {
273 if (!PyList_Check(value)) {
274 PyErr_SetString(PyExc_TypeError,
"value must be a list of ViewVertex objects");
278 v.reserve(PyList_GET_SIZE(value));
279 for (uint i = 0; i < PyList_GET_SIZE(value); i++) {
280 item = PyList_GET_ITEM(value, i);
285 PyErr_SetString(PyExc_TypeError,
"value must be a list of ViewVertex objects");
296 "The list of ViewEdge objects contained in this ViewShape.\n"
298 ":type: list[:class:`ViewEdge`]\n");
303 PyObject *py_edges = PyList_New(edges.size());
306 for (it = edges.begin(); it != edges.end(); it++) {
317 if (!PyList_Check(value)) {
318 PyErr_SetString(PyExc_TypeError,
"value must be a list of ViewEdge objects");
322 v.reserve(PyList_GET_SIZE(value));
323 for (
int i = 0; i < PyList_GET_SIZE(value); i++) {
324 item = PyList_GET_ITEM(value, i);
329 PyErr_SetString(PyExc_TypeError,
"argument must be list of ViewEdge objects");
340 "The name of the ViewShape.\n"
350 ViewShape_library_path_doc,
351 "The library path of the ViewShape, or None if the ViewShape is not part of\n"
354 ":type: str | None\n");
363 "The Id of this ViewShape.\n"
365 ":type: :class:`Id`\n");
376 ViewShape_sshape_doc,
381 ViewShape_vertices_doc,
392 ViewShape_library_path_doc,
394 {
"id", (getter)
ViewShape_id_get, (setter)
nullptr, ViewShape_id_doc,
nullptr},
395 {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr}
401 PyVarObject_HEAD_INIT(
nullptr, 0)
420 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
PyObject * BPy_Id_from_Id(Id &id)
PyObject * BPy_SShape_from_SShape(SShape &ss)
PyObject * Any_BPy_ViewVertex_from_ViewVertex(ViewVertex &vv)
PyObject * BPy_ViewEdge_from_ViewEdge(ViewEdge &ve)
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")
#define BPy_SShape_Check(v)
PyTypeObject ViewEdge_Type
#define BPy_ViewEdge_Check(v)
static PyObject * ViewShape_add_edge(BPy_ViewShape *self, PyObject *args, PyObject *kwds)
PyTypeObject ViewShape_Type
static PyObject * ViewShape_add_vertex(BPy_ViewShape *self, PyObject *args, PyObject *kwds)
static PyObject * ViewShape_repr(BPy_ViewShape *self)
static PyObject * ViewShape_sshape_get(BPy_ViewShape *self, void *)
static PyObject * ViewShape_edges_get(BPy_ViewShape *self, void *)
static int ViewShape_init(BPy_ViewShape *self, PyObject *args, PyObject *kwds)
static PyObject * ViewShape_id_get(BPy_ViewShape *self, void *)
static PyObject * ViewShape_library_path_get(BPy_ViewShape *self, void *)
static int ViewShape_vertices_set(BPy_ViewShape *self, PyObject *value, void *)
static void ViewShape_dealloc(BPy_ViewShape *self)
static PyMethodDef BPy_ViewShape_methods[]
int ViewShape_Init(PyObject *module)
static PyObject * ViewShape_vertices_get(BPy_ViewShape *self, void *)
static int ViewShape_edges_set(BPy_ViewShape *self, PyObject *value, void *)
static PyObject * ViewShape_name_get(BPy_ViewShape *self, void *)
static PyGetSetDef BPy_ViewShape_getseters[]
static int ViewShape_sshape_set(BPy_ViewShape *self, PyObject *value, void *)
PyTypeObject ViewVertex_Type
#define BPy_ViewVertex_Check(v)
const string & getName() const
void setVertices(const vector< ViewVertex * > &iVertices)
void AddVertex(ViewVertex *iVertex)
vector< ViewEdge * > & edges()
void setSShape(SShape *iSShape)
vector< ViewVertex * > & vertices()
void setEdges(const vector< ViewEdge * > &iEdges)
void AddEdge(ViewEdge *iEdge)
const string & getLibraryPath() const
PyObject * PyC_UnicodeFromStdStr(const std::string &str)
PyObject_HEAD Freestyle::SShape * ss
PyObject_HEAD Freestyle::ViewShape * vs