43 "Class to define a feature shape. It is the gathering of feature\n"
44 "elements from an identified input shape.\n"
46 ".. method:: __init__()\n"
47 " __init__(brother)\n"
49 " Creates a :class:`SShape` class using either a default constructor or copy constructor.\n"
51 " :arg brother: An SShape object.\n"
52 " :type brother: :class:`SShape`");
56 static const char *kwlist[] = {
"brother",
nullptr};
57 PyObject *brother =
nullptr;
59 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"|O!", (
char **)kwlist, &
SShape_Type, &brother)) {
68 self->borrowed =
false;
77 Py_TYPE(
self)->tp_free((PyObject *)
self);
82 return PyUnicode_FromFormat(
"SShape - address: %p",
self->ss);
86 ".. method:: add_edge(edge)\n"
88 " Adds an FEdge to the list of FEdges.\n"
90 " :arg edge: An FEdge object.\n"
91 " :type edge: :class:`FEdge`\n";
95 static const char *kwlist[] = {
"edge",
nullptr};
96 PyObject *py_fe =
nullptr;
98 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"O!", (
char **)kwlist, &
FEdge_Type, &py_fe)) {
101 self->ss->AddEdge(((
BPy_FEdge *)py_fe)->fe);
106 ".. method:: add_vertex(vertex)\n"
108 " Adds an SVertex to the list of SVertex of this Shape. The SShape\n"
109 " attribute of the SVertex is also set to this SShape.\n"
111 " :arg vertex: An SVertex object.\n"
112 " :type vertex: :class:`SVertex`");
116 static const char *kwlist[] = {
"edge",
nullptr};
117 PyObject *py_sv =
nullptr;
119 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"O!", (
char **)kwlist, &
SVertex_Type, &py_sv)) {
122 self->ss->AddNewVertex(((
BPy_SVertex *)py_sv)->sv);
127 ".. method:: compute_bbox()\n"
129 " Compute the bbox of the SShape.");
133 self->ss->ComputeBBox();
145 METH_VARARGS | METH_KEYWORDS,
146 SShape_add_vertex_doc},
148 {
nullptr,
nullptr, 0,
nullptr},
154 "The Id of this SShape.\n"
156 ":type: :class:`Id`");
167 PyErr_SetString(PyExc_TypeError,
"value must be an Id");
170 self->ss->setId(*(((
BPy_Id *)value)->
id));
175 "The name of the SShape.\n"
181 return PyUnicode_FromString(
self->ss->getName().c_str());
186 if (!PyUnicode_Check(value)) {
187 PyErr_SetString(PyExc_TypeError,
"value must be a string");
190 const char *name = PyUnicode_AsUTF8(value);
191 self->ss->setName(name);
196 "The bounding box of the SShape.\n"
198 ":type: :class:`BBox`");
209 PyErr_SetString(PyExc_TypeError,
"value must be a BBox");
212 self->ss->setBBox(*(((
BPy_BBox *)value)->bb));
217 "The list of vertices constituting this SShape.\n"
219 ":type: List of :class:`SVertex` objects");
224 vector<SVertex *> vertices =
self->ss->getVertexList();
225 vector<SVertex *>::iterator it;
226 PyObject *py_vertices = PyList_New(vertices.size());
229 for (it = vertices.begin(); it != vertices.end(); it++) {
237 "The list of edges constituting this SShape.\n"
239 ":type: List of :class:`FEdge` objects");
244 vector<FEdge *> edges =
self->ss->getEdgeList();
245 vector<FEdge *>::iterator it;
246 PyObject *py_edges = PyList_New(edges.size());
249 for (it = edges.begin(); it != edges.end(); it++) {
260 {
"edges", (getter)
SShape_edges_get, (setter)
nullptr, SShape_edges_doc,
nullptr},
262 {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr}
268 PyVarObject_HEAD_INIT(
nullptr, 0)
"SShape",
286 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
#define BPy_BBox_Check(v)
PyObject * BPy_SVertex_from_SVertex(SVertex &sv)
PyObject * Any_BPy_FEdge_from_FEdge(FEdge &fe)
PyObject * BPy_Id_from_Id(Id &id)
PyObject * BPy_BBox_from_BBox(const BBox< Vec3r > &bb)
static PyObject * SShape_id_get(BPy_SShape *self, void *UNUSED(closure))
static int SShape_name_set(BPy_SShape *self, PyObject *value, void *UNUSED(closure))
static char SShape_add_edge_doc[]
static void SShape_dealloc(BPy_SShape *self)
static int SShape_init(BPy_SShape *self, PyObject *args, PyObject *kwds)
static PyObject * SShape_bbox_get(BPy_SShape *self, void *UNUSED(closure))
static int SShape_bbox_set(BPy_SShape *self, PyObject *value, void *UNUSED(closure))
static PyGetSetDef BPy_SShape_getseters[]
static PyObject * SShape_repr(BPy_SShape *self)
static PyObject * SShape_edges_get(BPy_SShape *self, void *UNUSED(closure))
static int SShape_id_set(BPy_SShape *self, PyObject *value, void *UNUSED(closure))
int SShape_Init(PyObject *module)
static PyMethodDef BPy_SShape_methods[]
static PyObject * SShape_compute_bbox(BPy_SShape *self)
static PyObject * SShape_add_edge(BPy_SShape *self, PyObject *args, PyObject *kwds)
PyDoc_STRVAR(SShape_doc, "Class to define a feature shape. It is the gathering of feature\n" "elements from an identified input shape.\n" "\n" ".. method:: __init__()\n" " __init__(brother)\n" "\n" " Creates a :class:`SShape` class using either a default constructor or copy constructor.\n" "\n" " :arg brother: An SShape object.\n" " :type brother: :class:`SShape`")
static PyObject * SShape_vertices_get(BPy_SShape *self, void *UNUSED(closure))
static PyObject * SShape_add_vertex(BPy_SShape *self, PyObject *args, PyObject *kwds)
static PyObject * SShape_name_get(BPy_SShape *self, void *UNUSED(closure))
PyTypeObject SVertex_Type
static struct PyModuleDef module