Added Index as attribute of all voronoi objects for easier debugging

This commit is contained in:
Markus Lampert
2020-09-08 23:27:19 -07:00
committed by sliptonic
parent e3adbc0bf9
commit 3a50f84ba4
6 changed files with 48 additions and 6 deletions

View File

@@ -16,6 +16,12 @@
<Author Licence="LGPL" Name="sliptonic" EMail="shopinthewoods@gmail.com" />
<UserDocu>Cell of a Voronoi diagram</UserDocu>
</Documentation>
<Attribute Name="Index" ReadOnly="true">
<Documentation>
<UserDocu>Internal id of the element.</UserDocu>
</Documentation>
<Parameter Name="Index" Type="Int"/>
</Attribute>
<Attribute Name="Color" ReadOnly="false">
<Documentation>
<UserDocu>Assigned color of the receiver.</UserDocu>

View File

@@ -111,6 +111,14 @@ VoronoiCell* getVoronoiCellFromPy(const VoronoiCellPy *c, PyObject *args = 0) {
return self;
}
Py::Int VoronoiCellPy::getIndex(void) const {
VoronoiCell *c = getVoronoiCellPtr();
if (c->isBound()) {
return Py::Int(c->dia->index(c->ptr));
}
return Py::Int(-1);
}
Py::Long VoronoiCellPy::getColor(void) const {
VoronoiCell *c = getVoronoiCellPtr();
if (c->isBound()) {

View File

@@ -16,6 +16,12 @@
<Author Licence="LGPL" Name="sliptonic" EMail="shopinthewoods@gmail.com" />
<UserDocu>Edge of a Voronoi diagram</UserDocu>
</Documentation>
<Attribute Name="Index" ReadOnly="true">
<Documentation>
<UserDocu>Internal id of the element.</UserDocu>
</Documentation>
<Parameter Name="Index" Type="Int"/>
</Attribute>
<Attribute Name="Color" ReadOnly="false">
<Documentation>
<UserDocu>Assigned color of the receiver.</UserDocu>
@@ -46,17 +52,17 @@
</Documentation>
<Parameter Name="Prev" Type="Object"/>
</Attribute>
<Attribute Name="RotatedNext" ReadOnly="true">
<Attribute Name="RotNext" ReadOnly="true">
<Documentation>
<UserDocu>Rotated CCW next edge whithin voronoi cell</UserDocu>
</Documentation>
<Parameter Name="RotatedNext" Type="Object"/>
<Parameter Name="RotNext" Type="Object"/>
</Attribute>
<Attribute Name="RotatedPrev" ReadOnly="true">
<Attribute Name="RotPrev" ReadOnly="true">
<Documentation>
<UserDocu>Rotated CCW previous edge whithin voronoi cell</UserDocu>
</Documentation>
<Parameter Name="RotatedPrev" Type="Object"/>
<Parameter Name="RotPrev" Type="Object"/>
</Attribute>
<Attribute Name="Twin" ReadOnly="true">
<Documentation>

View File

@@ -130,6 +130,14 @@ VoronoiEdge* getVoronoiEdgeFromPy(const VoronoiEdgePy *e, PyObject *args = 0) {
return self;
}
Py::Int VoronoiEdgePy::getIndex(void) const {
VoronoiEdge *e = getVoronoiEdgePtr();
if (e->isBound()) {
return Py::Int(e->dia->index(e->ptr));
}
return Py::Int(-1);
}
Py::Long VoronoiEdgePy::getColor(void) const {
VoronoiEdge *e = getVoronoiEdgePtr();
if (e->isBound()) {
@@ -183,13 +191,13 @@ Py::Object VoronoiEdgePy::getPrev(void) const
return Py::asObject(new VoronoiEdgePy(new VoronoiEdge(e->dia, e->ptr->prev())));
}
Py::Object VoronoiEdgePy::getRotatedNext(void) const
Py::Object VoronoiEdgePy::getRotNext(void) const
{
VoronoiEdge *e = getVoronoiEdgeFromPy(this);
return Py::asObject(new VoronoiEdgePy(new VoronoiEdge(e->dia, e->ptr->rot_next())));
}
Py::Object VoronoiEdgePy::getRotatedPrev(void) const
Py::Object VoronoiEdgePy::getRotPrev(void) const
{
VoronoiEdge *e = getVoronoiEdgeFromPy(this);
return Py::asObject(new VoronoiEdgePy(new VoronoiEdge(e->dia, e->ptr->rot_prev())));

View File

@@ -16,6 +16,12 @@
<Author Licence="LGPL" Name="sliptonic" EMail="shopinthewoods@gmail.com" />
<UserDocu>Vertex of a Voronoi diagram</UserDocu>
</Documentation>
<Attribute Name="Index" ReadOnly="true">
<Documentation>
<UserDocu>Internal id of the element.</UserDocu>
</Documentation>
<Parameter Name="Index" Type="Int"/>
</Attribute>
<Attribute Name="Color" ReadOnly="false">
<Documentation>
<UserDocu>Assigned color of the receiver.</UserDocu>

View File

@@ -113,6 +113,14 @@ VoronoiVertex* getVoronoiVertexFromPy(const VoronoiVertexPy *v, PyObject *args =
}
Py::Int VoronoiVertexPy::getIndex(void) const {
VoronoiVertex *v = getVoronoiVertexPtr();
if (v->isBound()) {
return Py::Int(v->dia->index(v->ptr));
}
return Py::Int(-1);
}
Py::Long VoronoiVertexPy::getColor(void) const {
VoronoiVertex *v = getVoronoiVertexPtr();
if (v->isBound()) {