Subject: CGAL users discussion list
List archive
- From: Yvan Maillot <>
- To:
- Subject: [cgal-discuss] Problem with QPainter
- Date: Thu, 22 Jul 2010 22:06:56 +0200 (CEST)
Hi EveryBody,
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] Problem with QPainter, Yvan Maillot, 07/22/2010
Archive powered by MHonArc 2.6.16.