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`\n");
61 static const char *kwlist_1[] = {
"brother",
nullptr};
62 static const char *kwlist_2[] = {
"sshape",
nullptr};
63 PyObject *obj =
nullptr;
65 if (PyArg_ParseTupleAndKeywords(args, kwds,
"|O!", (
char **)kwlist_1, &
ViewShape_Type, &obj)) {
68 self->py_ss =
nullptr;
75 else if ((
void)PyErr_Clear(),
76 PyArg_ParseTupleAndKeywords(args, kwds,
"O!", (
char **)kwlist_2, &
SShape_Type, &obj))
83 PyErr_SetString(PyExc_TypeError,
"invalid argument(s)");
86 self->borrowed =
false;
87 Py_XINCREF(
self->py_ss);
100 Py_TYPE(
self)->tp_free((PyObject *)
self);
105 return PyUnicode_FromFormat(
"ViewShape - address: %p",
self->vs);
110 ViewShape_add_edge_doc,
111 ".. method:: add_edge(edge)\n"
113 " Adds a ViewEdge to the list of ViewEdge objects.\n"
115 " :arg edge: A ViewEdge object.\n"
116 " :type edge: :class:`ViewEdge`\n");
119 static const char *kwlist[] = {
"edge",
nullptr};
120 PyObject *py_ve =
nullptr;
122 if (PyArg_ParseTupleAndKeywords(args, kwds,
"O!", (
char **)kwlist, &
ViewEdge_Type, &py_ve)) {
131 ViewShape_add_vertex_doc,
132 ".. method:: add_vertex(vertex)\n"
134 " Adds a ViewVertex to the list of the ViewVertex objects.\n"
136 " :arg vertex: A ViewVertex object.\n"
137 " :type vertex: :class:`ViewVertex`\n");
140 static const char *kwlist[] = {
"vertex",
nullptr};
141 PyObject *py_vv =
nullptr;
143 if (PyArg_ParseTupleAndKeywords(args, kwds,
"O!", (
char **)kwlist, &
ViewVertex_Type, &py_vv)) {
154# pragma clang diagnostic push
155# pragma clang diagnostic ignored "-Wcast-function-type"
157# pragma GCC diagnostic push
158# pragma GCC diagnostic ignored "-Wcast-function-type"
165 METH_VARARGS | METH_KEYWORDS,
166 ViewShape_add_edge_doc},
169 METH_VARARGS | METH_KEYWORDS,
170 ViewShape_add_vertex_doc},
171 {
nullptr,
nullptr, 0,
nullptr},
176# pragma clang diagnostic pop
178# pragma GCC diagnostic pop
186 ViewShape_sshape_doc,
187 "The SShape on top of which this ViewShape is built.\n"
189 ":type: :class:`SShape`\n");
202 PyErr_SetString(PyExc_TypeError,
"value must be an SShape");
206 self->vs->setSShape(py_ss->
ss);
212 Py_INCREF(
self->py_ss);
219 ViewShape_vertices_doc,
220 "The list of ViewVertex objects contained in this ViewShape.\n"
222 ":type: List of :class:`ViewVertex`\n");
227 PyObject *py_vertices = PyList_New(vertices.size());
230 for (it = vertices.begin(); it != vertices.end(); it++) {
241 if (!PyList_Check(value)) {
242 PyErr_SetString(PyExc_TypeError,
"value must be a list of ViewVertex objects");
246 v.reserve(PyList_GET_SIZE(value));
247 for (
uint i = 0;
i < PyList_GET_SIZE(value);
i++) {
248 item = PyList_GET_ITEM(value,
i);
253 PyErr_SetString(PyExc_TypeError,
"value must be a list of ViewVertex objects");
257 self->vs->setVertices(
v);
264 "The list of ViewEdge objects contained in this ViewShape.\n"
266 ":type: List of :class:`ViewEdge`\n");
271 PyObject *py_edges = PyList_New(edges.size());
274 for (it = edges.begin(); it != edges.end(); it++) {
285 if (!PyList_Check(value)) {
286 PyErr_SetString(PyExc_TypeError,
"value must be a list of ViewEdge objects");
290 v.reserve(PyList_GET_SIZE(value));
291 for (
int i = 0;
i < PyList_GET_SIZE(value);
i++) {
292 item = PyList_GET_ITEM(value,
i);
297 PyErr_SetString(PyExc_TypeError,
"argument must be list of ViewEdge objects");
301 self->vs->setEdges(
v);
308 "The name of the ViewShape.\n"
318 ViewShape_library_path_doc,
319 "The library path of the ViewShape.\n"
321 ":type: str, or None if the ViewShape is not part of a library.\n");
330 "The Id of this ViewShape.\n"
332 ":type: :class:`Id`\n");
343 ViewShape_sshape_doc,
348 ViewShape_vertices_doc,
359 ViewShape_library_path_doc,
361 {
"id", (getter)
ViewShape_id_get, (setter)
nullptr, ViewShape_id_doc,
nullptr},
362 {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr}
368 PyVarObject_HEAD_INIT(
nullptr, 0)
387 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)
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`\n")
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)
ATTR_WARN_UNUSED_RESULT const BMVert * v
PyObject * PyC_UnicodeFromStdStr(const std::string &str)
static struct PyModuleDef module
PyObject_HEAD Freestyle::SShape * ss