57 "Class to define a feature shape. It is the gathering of feature\n"
58 "elements from an identified input shape.\n"
60 ".. method:: __init__()\n"
61 " __init__(brother)\n"
63 " Creates a :class:`SShape` class using either a default constructor or copy constructor.\n"
65 " :arg brother: An SShape object.\n"
66 " :type brother: :class:`SShape`");
70 static const char *kwlist[] = {
"brother",
nullptr};
71 PyObject *brother =
nullptr;
73 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"|O!", (
char **)kwlist, &
SShape_Type, &brother)) {
82 self->borrowed =
false;
91 Py_TYPE(
self)->tp_free((PyObject *)
self);
96 return PyUnicode_FromFormat(
"SShape - address: %p",
self->ss);
100 ".. method:: add_edge(edge)\n"
102 " Adds an FEdge to the list of FEdges.\n"
104 " :arg edge: An FEdge object.\n"
105 " :type edge: :class:`FEdge`\n";
109 static const char *kwlist[] = {
"edge",
nullptr};
110 PyObject *py_fe =
nullptr;
112 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"O!", (
char **)kwlist, &
FEdge_Type, &py_fe)) {
115 self->ss->AddEdge(((
BPy_FEdge *)py_fe)->fe);
120 ".. method:: add_vertex(vertex)\n"
122 " Adds an SVertex to the list of SVertex of this Shape. The SShape\n"
123 " attribute of the SVertex is also set to this SShape.\n"
125 " :arg vertex: An SVertex object.\n"
126 " :type vertex: :class:`SVertex`");
130 static const char *kwlist[] = {
"edge",
nullptr};
131 PyObject *py_sv =
nullptr;
133 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"O!", (
char **)kwlist, &
SVertex_Type, &py_sv)) {
136 self->ss->AddNewVertex(((
BPy_SVertex *)py_sv)->sv);
141 ".. method:: compute_bbox()\n"
143 " Compute the bbox of the SShape.");
147 self->ss->ComputeBBox();
159 METH_VARARGS | METH_KEYWORDS,
160 SShape_add_vertex_doc},
162 {
nullptr,
nullptr, 0,
nullptr},
168 "The Id of this SShape.\n"
170 ":type: :class:`Id`");
181 PyErr_SetString(PyExc_TypeError,
"value must be an Id");
184 self->ss->setId(*(((
BPy_Id *)value)->
id));
189 "The name of the SShape.\n"
195 return PyUnicode_FromString(
self->ss->getName().c_str());
200 if (!PyUnicode_Check(value)) {
201 PyErr_SetString(PyExc_TypeError,
"value must be a string");
204 const char *name = PyUnicode_AsUTF8(value);
205 self->ss->setName(name);
210 "The bounding box of the SShape.\n"
212 ":type: :class:`BBox`");
223 PyErr_SetString(PyExc_TypeError,
"value must be a BBox");
226 self->ss->setBBox(*(((
BPy_BBox *)value)->bb));
231 "The list of vertices constituting this SShape.\n"
233 ":type: List of :class:`SVertex` objects");
238 vector<SVertex *> vertices =
self->ss->getVertexList();
239 vector<SVertex *>::iterator it;
240 PyObject *py_vertices = PyList_New(vertices.size());
243 for (it = vertices.begin(); it != vertices.end(); it++) {
251 "The list of edges constituting this SShape.\n"
253 ":type: List of :class:`FEdge` objects");
258 vector<FEdge *> edges =
self->ss->getEdgeList();
259 vector<FEdge *>::iterator it;
260 PyObject *py_edges = PyList_New(edges.size());
263 for (it = edges.begin(); it != edges.end(); it++) {
274 {
"edges", (getter)
SShape_edges_get, (setter)
nullptr, SShape_edges_doc,
nullptr},
276 {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr}
282 PyVarObject_HEAD_INIT(
nullptr, 0)
"SShape",
300 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