18#include "../generic/py_capi_utils.hh"
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__()\n"
49 " __init__(brother)\n"
52 " Builds a :class:`ViewShape` using the default constructor,\n"
53 " copy constructor, or from a :class:`SShape`.\n"
55 " :arg brother: A ViewShape object.\n"
56 " :type brother: :class:`ViewShape`\n"
57 " :arg sshape: An SShape object.\n"
58 " :type sshape: :class:`SShape`");
62 static const char *kwlist_1[] = {
"brother",
nullptr};
63 static const char *kwlist_2[] = {
"sshape",
nullptr};
64 PyObject *obj =
nullptr;
66 if (PyArg_ParseTupleAndKeywords(args, kwds,
"|O!", (
char **)kwlist_1, &
ViewShape_Type, &obj)) {
69 self->py_ss =
nullptr;
76 else if ((
void)PyErr_Clear(),
77 PyArg_ParseTupleAndKeywords(args, kwds,
"O!", (
char **)kwlist_2, &
SShape_Type, &obj))
84 PyErr_SetString(PyExc_TypeError,
"invalid argument(s)");
87 self->borrowed =
false;
88 Py_XINCREF(
self->py_ss);
96 Py_DECREF(
self->py_ss);
101 Py_TYPE(
self)->tp_free((PyObject *)
self);
106 return PyUnicode_FromFormat(
"ViewShape - address: %p",
self->vs);
111 ViewShape_add_edge_doc,
112 ".. method:: add_edge(edge)\n"
114 " Adds a ViewEdge to the list of ViewEdge objects.\n"
116 " :arg edge: A ViewEdge object.\n"
117 " :type edge: :class:`ViewEdge`\n");
121 static const char *kwlist[] = {
"edge",
nullptr};
122 PyObject *py_ve =
nullptr;
124 if (PyArg_ParseTupleAndKeywords(args, kwds,
"O!", (
char **)kwlist, &
ViewEdge_Type, &py_ve)) {
133 ViewShape_add_vertex_doc,
134 ".. method:: add_vertex(vertex)\n"
136 " Adds a ViewVertex to the list of the ViewVertex objects.\n"
138 " :arg vertex: A ViewVertex object.\n"
139 " :type vertex: :class:`ViewVertex`");
143 static const char *kwlist[] = {
"vertex",
nullptr};
144 PyObject *py_vv =
nullptr;
146 if (PyArg_ParseTupleAndKeywords(args, kwds,
"O!", (
char **)kwlist, &
ViewVertex_Type, &py_vv)) {
157# pragma clang diagnostic push
158# pragma clang diagnostic ignored "-Wcast-function-type"
160# pragma GCC diagnostic push
161# pragma GCC diagnostic ignored "-Wcast-function-type"
168 METH_VARARGS | METH_KEYWORDS,
169 ViewShape_add_edge_doc},
172 METH_VARARGS | METH_KEYWORDS,
173 ViewShape_add_vertex_doc},
174 {
nullptr,
nullptr, 0,
nullptr},
179# pragma clang diagnostic pop
181# pragma GCC diagnostic pop
189 ViewShape_sshape_doc,
190 "The SShape on top of which this ViewShape is built.\n"
192 ":type: :class:`SShape`");
206 PyErr_SetString(PyExc_TypeError,
"value must be an SShape");
210 self->vs->setSShape(py_ss->
ss);
212 Py_DECREF(
self->py_ss);
216 Py_INCREF(
self->py_ss);
223 ViewShape_vertices_doc,
224 "The list of ViewVertex objects contained in this ViewShape.\n"
226 ":type: List of :class:`ViewVertex`");
232 PyObject *py_vertices = PyList_New(vertices.size());
235 for (it = vertices.begin(); it != vertices.end(); it++) {
246 if (!PyList_Check(value)) {
247 PyErr_SetString(PyExc_TypeError,
"value must be a list of ViewVertex objects");
251 v.reserve(PyList_GET_SIZE(value));
252 for (
uint i = 0;
i < PyList_GET_SIZE(value);
i++) {
253 item = PyList_GET_ITEM(value,
i);
258 PyErr_SetString(PyExc_TypeError,
"value must be a list of ViewVertex objects");
262 self->vs->setVertices(
v);
269 "The list of ViewEdge objects contained in this ViewShape.\n"
271 ":type: List of :class:`ViewEdge`");
277 PyObject *py_edges = PyList_New(edges.size());
280 for (it = edges.begin(); it != edges.end(); it++) {
291 if (!PyList_Check(value)) {
292 PyErr_SetString(PyExc_TypeError,
"value must be a list of ViewEdge objects");
296 v.reserve(PyList_GET_SIZE(value));
297 for (
int i = 0;
i < PyList_GET_SIZE(value);
i++) {
298 item = PyList_GET_ITEM(value,
i);
303 PyErr_SetString(PyExc_TypeError,
"argument must be list of ViewEdge objects");
307 self->vs->setEdges(
v);
314 "The name of the ViewShape.\n"
325 ViewShape_library_path_doc,
326 "The library path of the ViewShape.\n"
328 ":type: str, or None if the ViewShape is not part of a library");
338 "The Id of this ViewShape.\n"
340 ":type: :class:`Id`");
352 ViewShape_sshape_doc,
357 ViewShape_vertices_doc,
368 ViewShape_library_path_doc,
370 {
"id", (getter)
ViewShape_id_get, (setter)
nullptr, ViewShape_id_doc,
nullptr},
371 {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr}
377 PyVarObject_HEAD_INIT(
nullptr, 0)
396 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)
#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 *)
PyDoc_STRVAR(ViewShape_doc, "Class gathering the elements of the ViewMap (i.e., :class:`ViewVertex`\n" "and :class:`ViewEdge`) that are issued from the same input shape.\n" "\n" ".. method:: __init__()\n" " __init__(brother)\n" " __init__(sshape)\n" "\n" " Builds a :class:`ViewShape` using the default constructor,\n" " copy constructor, or from a :class:`SShape`.\n" "\n" " :arg brother: A ViewShape object.\n" " :type brother: :class:`ViewShape`\n" " :arg sshape: An SShape object.\n" " :type sshape: :class:`SShape`")
static PyGetSetDef BPy_ViewShape_getseters[]
static int ViewShape_sshape_set(BPy_ViewShape *self, PyObject *value, void *)
PyTypeObject ViewVertex_Type
#define BPy_ViewVertex_Check(v)
ATTR_WARN_UNUSED_RESULT const BMVert * v
PyObject * PyC_UnicodeFromStdStr(const std::string &str)
static struct PyModuleDef module
PyObject_HEAD Freestyle::SShape * ss