[Qgis-developer] Qpainter.rotate() question - qgis

ashjas ashjas at gmail.com
Sat May 9 13:29:38 EDT 2009


Hi,

I am customising QuantumGIS that uses Qt's Qpainter to draw and paint...

I am trying to draw a polyline on the canvas that is coming as a update
through message queues..the draw is very fine...but in the polyline or
polygon objects that i get as an update also include an angle field that is
to be used for rotation of an object. The problem is that when i try to
rotate the line just before the polyline is drawn by the qpainter using
painter.rotate() method,the line is rotated fine but the position of the
line drawn changes..and it changes at every zoom and pan of the Qgis
canvas.. Before setting painter.rotate() i am saving the painter state and
after drawing- again restoring its state which i believe is analogous to
OpenGL's push/popMatrix functions. Does the Qpainter's save restore
functions work similar to push/popMatrix functions of opengl??

Any Ideas how rotation can be achieved??

here is a code snippet:

p->save();
  //p->rotate(45);
  p->scale( 1.0 / rasterScaleFactor, 1.0 / rasterScaleFactor );
  p->drawPolyline( pa );
  p->restore();

Help is appreciated. Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/qgis-developer/attachments/20090509/4e78bf09/attachment-0001.html


More information about the Qgis-developer mailing list