56 "Class gathering the elements of the ViewMap (i.e., :class:`ViewVertex`\n"
57 "and :class:`ViewEdge`) that are issued from the same input shape.\n"
59 ".. method:: __init__()\n"
60 " __init__(brother)\n"
63 " Builds a :class:`ViewShape` using the default constructor,\n"
64 " copy constructor, or from a :class:`SShape`.\n"
66 " :arg brother: A ViewShape object.\n"
67 " :type brother: :class:`ViewShape`\n"
68 " :arg sshape: An SShape object.\n"
69 " :type sshape: :class:`SShape`");
73 static const char *kwlist_1[] = {
"brother",
nullptr};
74 static const char *kwlist_2[] = {
"sshape",
nullptr};
75 PyObject *obj =
nullptr;
77 if (PyArg_ParseTupleAndKeywords(args, kwds,
"|O!", (
char **)kwlist_1, &
ViewShape_Type, &obj)) {
80 self->py_ss =
nullptr;
87 else if ((
void)PyErr_Clear(),
88 PyArg_ParseTupleAndKeywords(args, kwds,
"O!", (
char **)kwlist_2, &
SShape_Type, &obj)) {
91 self->py_ss = (!py_ss->
borrowed) ? py_ss :
nullptr;
94 PyErr_SetString(PyExc_TypeError,
"invalid argument(s)");
97 self->borrowed =
false;
98 Py_XINCREF(
self->py_ss);
105 self->vs->setSShape((
SShape *)
nullptr);
106 Py_DECREF(
self->py_ss);
111 Py_TYPE(
self)->tp_free((PyObject *)
self);
116 return PyUnicode_FromFormat(
"ViewShape - address: %p",
self->vs);
120 ".. method:: add_edge(edge)\n"
122 " Adds a ViewEdge to the list of ViewEdge objects.\n"
124 " :arg edge: A ViewEdge object.\n"
125 " :type edge: :class:`ViewEdge`\n");
129 static const char *kwlist[] = {
"edge",
nullptr};
130 PyObject *py_ve =
nullptr;
132 if (PyArg_ParseTupleAndKeywords(args, kwds,
"O!", (
char **)kwlist, &
ViewEdge_Type, &py_ve)) {
140 ".. method:: add_vertex(vertex)\n"
142 " Adds a ViewVertex to the list of the ViewVertex objects.\n"
144 " :arg vertex: A ViewVertex object.\n"
145 " :type vertex: :class:`ViewVertex`");
149 static const char *kwlist[] = {
"vertex",
nullptr};
150 PyObject *py_vv =
nullptr;
152 if (PyArg_ParseTupleAndKeywords(args, kwds,
"O!", (
char **)kwlist, &
ViewVertex_Type, &py_vv)) {
164 METH_VARARGS | METH_KEYWORDS,
165 ViewShape_add_edge_doc},
168 METH_VARARGS | METH_KEYWORDS,
169 ViewShape_add_vertex_doc},
170 {
nullptr,
nullptr, 0,
nullptr},
176 "The SShape on top of which this ViewShape is built.\n"
178 ":type: :class:`SShape`");
182 SShape *ss =
self->vs->sshape();
192 PyErr_SetString(PyExc_TypeError,
"value must be an SShape");
196 self->vs->setSShape(py_ss->
ss);
198 Py_DECREF(
self->py_ss);
202 Py_INCREF(
self->py_ss);
208 "The list of ViewVertex objects contained in this ViewShape.\n"
210 ":type: List of :class:`ViewVertex` objects");
214 vector<ViewVertex *> vertices =
self->vs->vertices();
215 vector<ViewVertex *>::iterator it;
216 PyObject *py_vertices = PyList_New(vertices.size());
219 for (it = vertices.begin(); it != vertices.end(); it++) {
228 vector<ViewVertex *>
v;
230 if (!PyList_Check(value)) {
231 PyErr_SetString(PyExc_TypeError,
"value must be a list of ViewVertex objects");
235 v.reserve(PyList_GET_SIZE(value));
236 for (
unsigned int i = 0; i < PyList_GET_SIZE(value); i++) {
237 item = PyList_GET_ITEM(value, i);
242 PyErr_SetString(PyExc_TypeError,
"value must be a list of ViewVertex objects");
246 self->vs->setVertices(
v);
251 "The list of ViewEdge objects contained in this ViewShape.\n"
253 ":type: List of :class:`ViewEdge` objects");
257 vector<ViewEdge *> edges =
self->vs->edges();
258 vector<ViewEdge *>::iterator it;
259 PyObject *py_edges = PyList_New(edges.size());
262 for (it = edges.begin(); it != edges.end(); it++) {
271 vector<ViewEdge *>
v;
273 if (!PyList_Check(value)) {
274 PyErr_SetString(PyExc_TypeError,
"value must be a list of ViewEdge objects");
278 v.reserve(PyList_GET_SIZE(value));
279 for (
int i = 0; i < PyList_GET_SIZE(value); i++) {
280 item = PyList_GET_ITEM(value, i);
285 PyErr_SetString(PyExc_TypeError,
"argument must be list of ViewEdge objects");
289 self->vs->setEdges(
v);
294 "The name of the ViewShape.\n"
300 return PyUnicode_FromString(
self->vs->getName().c_str());
304 "The library path of the ViewShape.\n"
306 ":type: str, or None if the ViewShape is not part of a library");
310 return PyUnicode_FromString(
self->vs->getLibraryPath().c_str());
314 "The Id of this ViewShape.\n"
316 ":type: :class:`Id`");
328 ViewShape_sshape_doc,
333 ViewShape_vertices_doc,
344 ViewShape_library_path_doc,
346 {
"id", (getter)
ViewShape_id_get, (setter)
nullptr, ViewShape_id_doc,
nullptr},
347 {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr}
353 PyVarObject_HEAD_INIT(
nullptr, 0)
"ViewShape",
371 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
PyObject * BPy_SShape_from_SShape(SShape &ss)
PyObject * BPy_ViewEdge_from_ViewEdge(ViewEdge &ve)
PyObject * BPy_Id_from_Id(Id &id)
PyObject * Any_BPy_ViewVertex_from_ViewVertex(ViewVertex &vv)
#define BPy_SShape_Check(v)
PyTypeObject ViewEdge_Type
#define BPy_ViewEdge_Check(v)
PyTypeObject ViewShape_Type
static int ViewShape_edges_set(BPy_ViewShape *self, PyObject *value, void *UNUSED(closure))
static int ViewShape_sshape_set(BPy_ViewShape *self, PyObject *value, void *UNUSED(closure))
static int ViewShape_init(BPy_ViewShape *self, PyObject *args, PyObject *kwds)
static void ViewShape_dealloc(BPy_ViewShape *self)
static PyObject * ViewShape_edges_get(BPy_ViewShape *self, void *UNUSED(closure))
static PyObject * ViewShape_name_get(BPy_ViewShape *self, void *UNUSED(closure))
static PyMethodDef BPy_ViewShape_methods[]
int ViewShape_Init(PyObject *module)
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 PyObject * ViewShape_sshape_get(BPy_ViewShape *self, void *UNUSED(closure))
static PyObject * ViewShape_library_path_get(BPy_ViewShape *self, void *UNUSED(closure))
static PyGetSetDef BPy_ViewShape_getseters[]
static PyObject * ViewShape_id_get(BPy_ViewShape *self, void *UNUSED(closure))
static PyObject * ViewShape_repr(BPy_ViewShape *self)
static PyObject * ViewShape_add_edge(BPy_ViewShape *self, PyObject *args, PyObject *kwds)
static PyObject * ViewShape_vertices_get(BPy_ViewShape *self, void *UNUSED(closure))
static PyObject * ViewShape_add_vertex(BPy_ViewShape *self, PyObject *args, PyObject *kwds)
static int ViewShape_vertices_set(BPy_ViewShape *self, PyObject *value, void *UNUSED(closure))
PyTypeObject ViewVertex_Type
#define BPy_ViewVertex_Check(v)
static struct PyModuleDef module
ATTR_WARN_UNUSED_RESULT const BMVert * v
PyObject_HEAD Freestyle::SShape * ss