[Qgis-developer] 回复: Questions about labels and animation in QGIS

Hugo Mercier hugo.mercier at oslandia.com
Mon Nov 9 04:54:51 PST 2015


On a layer you can call layer.triggerRepaint() and it will force a
repaint of this layer.
Usually it will refresh only this layer, except if there are labels. In
which case all layers with labels will be redrawn.

On 09/11/2015 12:07, 151612463 wrote:
> I thought my needs can be satisfied by pretty basic funcition of QGIS,
> so I didn't build QGIS of higher version.  But I can do this if needed.
> What I want is like a Vehicle Navigatin System, when the plane moves I
> can draw its track in real time. And I want to provide interoperation
> for users such as drag a point by mouse move. If I refresh all the
> layers every time I change the position of labels, considering the
> raster map could be big, the system would be rather  inefficient.
> The number of labels will not exceed 1000.
> If one layer can draw all the labels I need, 3 layers are enough. One
> for the map, one for the labels(planned positions of plane) and one for
> tracks(real time position of plane).
> 
> 
> ------------------ 原始邮件 ------------------
> *发件人:* "Hugo Mercier";<hugo.mercier at oslandia.com>;
> *发送时间:* 2015年11月9日(星期一) 下午5:31
> *收件人:* "qgis-developer"<qgis-developer at lists.osgeo.org>;
> *主题:* Re: [Qgis-developer] Questions about labels and animation in QGIS
> 
> Hi,
> 
> On 09/11/2015 07:20, 151612463 wrote:
>> Hi,
>> I'm new to QGIS, and I want to use QGIS to develop a software to show
>> and editing flight tracks. My development environment is as follow:
>> 1 Windows 7
>> 2 Qt4.8.6
>> 3 QGIS2.4(Build from sourcecode).
> 
> Why not a more recent version ?
> 
>> I have displayed vector and raster in a canvas(QgsMapCanvas)
>> successfully, but I don't know how to show labels in QGIS and how to
>> animate them.
>> I used to do the same job in MapX. In MapX, a user drawing layer is
>> provided to decrease CPU usage when some elements must be refreshed
>> frequently. However, it seems like that QGIS doesn't provide such layer,
>> so how to animate a moving track without refreshing the whole map?
>> A colleage use a QWidget window to draw the labels and the QWidget
>> window overlays on the canvas(QgsMapCanvas). By this method, he can draw
>> anything he want in the QWidget window and refresh the elements. But I
>> feel that this is not the recommended way in QGIS. Is there any better
>> way to achieve the requirements?
>>
>> Can anyone tell me how or provide development documents to refer to?
> Thanks.
> 
> If I understand correctly your needs: you need to animate a layer with
> labels and you don't want all the layers to be refreshed at each frame ?
> For performance reasons ?
> How many layers have labels ?
> 
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer


More information about the Qgis-developer mailing list