Subject: CGAL users discussion list
List archive
- From: Yvan Maillot <>
- To:
- Subject: [cgal-discuss] Extending TriangulationGraphicsItem<T> problem
- Date: Fri, 23 Jul 2010 21:00:06 +0200 (CEST)
Hi Again,
Sorry to post this again but I am looking for my mistake for a while, in vain.
Any idea ?
I am trying to extend TriangulationGraphicsItem<T> with a class I called
TriangulationGraphicsItemWithFaces<T> in order to also draw faces (triangles)
of a Delaunay triangulation.
To do this I have overridden the drawAll method like as follow. It almost
works: faces are drawn. But they are drawn at a wrong place. Faces are
translated compared with edges and vertices. Indeed, the origin of the faces
seems to be on the left top of the screen instead of being in the middle. I
also tried to use resetMatrix() and so on, and other stuff but nothing works.
I
don't know at all where I'm wrong.
What can I do to fix this problem?
Thanks for your help.
Yvan
// The overridden method
template <typename T>
void
TriangulationGraphicsItemWithFaces<T>::drawAll(QPainter *painter) {
// Calling drawAll method of the TriangulationGraphicsItem<T> super class
TriangulationGraphicsItem<T>::drawAll(painter);
if (visible_faces) {
if (TriangulationGraphicsItem<T>::t->number_of_vertices() > 2) {
QColor color(::Qt::blue);
color.setAlpha(150);
faces_brush.setColor(color);
faces_brush.setStyle(::Qt::SolidPattern);
painter->setBrush(faces_brush);
painter->setPen(::Qt::NoPen);
for (typename T::Finite_faces_iterator fit =
TriangulationGraphicsItem<T>::t->finite_faces_begin();
fit != TriangulationGraphicsItem<T>::t->finite_faces_end();
++fit) {
TriangulationGraphicsItem<T>::painterostream <<
TriangulationGraphicsItem<T>::t->triangle(fit);
}
}
}
}
- [cgal-discuss] Extending TriangulationGraphicsItem<T> problem, Yvan Maillot, 07/23/2010
- Re: [cgal-discuss] Extending TriangulationGraphicsItem<T> problem, Andreas Fabri, 07/24/2010
- Re: [cgal-discuss] Extending TriangulationGraphicsItem<T> problem, Yvan Maillot, 07/26/2010
- Re: [cgal-discuss] Extending TriangulationGraphicsItem<T> problem, Yvan Maillot, 07/26/2010
- Re: [cgal-discuss] Extending TriangulationGraphicsItem<T> problem, Andreas Fabri, 07/24/2010
- Re: [cgal-discuss] Extending TriangulationGraphicsItem<T> problem, Andreas Fabri, 07/24/2010
Archive powered by MHonArc 2.6.16.