[Qgis-developer] QgsVertexMarker modified class: Plot moving points over a map at fixed rate

Luca Pascale pascale.luca.it at gmail.com
Thu Jul 2 08:59:39 EDT 2009


Hi Martin,

I solve the problem of pixmap visualization using the correct icon dimension
(setIconSize () )
but I don' t understand how to use boundingRect() and... which
boundingRect() method----


Luca

2009/7/2 Martin Dobias <wonder.sk at gmail.com>

> On Thu, Jul 2, 2009 at 11:43 AM, Luca Pascale<pascale.luca.it at gmail.com>
> wrote:
> > [...]
> >     case ICON_CUSTOM:
> >
> >       QPixmap pixmap(QSize(22,22));
> >       pixmap.load(mFileName);
> >       p->drawPixmap(0,0,pixmap);
> >       break;
>
> It would be wiser to load the pixmap just once and keep the QPixmap,
> it will save some time when doing updates. Additionally, you don't
> have to set pixmap's size before the load() method - the pixmap will
> be resized to the required size during the load.
>
> > The problem now is that the icon (png file) is not plotted correctly
> until I
> > refresh the map canvas.
> > See the attached images.
> > notcorrectvisualization.png is what I obtain on the screen
> > and
> > correctvisualization.png is waht I obtain after pushed the refresh
> button.
> >
> > Any suggestion to solve ??
>
> Yes: you have to update boundingRect() function to return correct
> rectangle of the marker. Currently for markers it's something like
> (-5,-5)..(5,5) while you probably want a bounding rect e.g.
> (0,0)..(22,22). But think also where dou you actually want to put the
> pixmap - currently you draw it in a way that the position is at the
> upper left corner of the pixmap. Maybe you want it to be in the
> center...?
>
> Martin
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/qgis-developer/attachments/20090702/7dcb504c/attachment.html


More information about the Qgis-developer mailing list