[Qgis-developer] Custom composer items?

Marco Hugentobler marco at hugis.net
Mon Mar 1 03:09:27 EST 2010


Hi Chris

It is possible to derive new classes from QgsComposerItem (in C++ and Python).
You might look into qgscomposerscaleber.cpp/h as an example how to add scale 
information.

Regards,
Marco


Am Sonntag, 28. Februar 2010 23.36:50 schrieb Chris Crook:
> Hi
> 
> I'm wanting to add scale information for symbols to composer.  These are
>  arrow symbols representing vector fields, so I want to be able to show in
>  the composer generated page what the scale of the arrows is (ie how long
>  an arrow represents a 5cm offset at a point, or whatever).
> 
> Logically this would be a custom composer item, but I cannot see any way to
>  create a custom item, either in C++ or in Python (my preference!), without
>  modifying the base composer classe(s).  Can anyone confirm this?
> 
> A slightly less desirable approach would be to draw the scale information
>  onto the map item in composer.  This would constrain the placement - it
>  would be nicer to be able to place it arbitrarily as other widget items.
> 
> In the main Qgis window I draw this scale information onto the map canvas
>  in response to the renderComplete signal, in the same way as the scale bar
>  or north arrow, but I don't think there is an equivalent event when the
>  composer map item is drawn?  So I can't use that approach to draw onto the
>  canvas...
> 
> I think I may be able to draw the scale information by adding a custom map
>  layer.
> 
> Can anyone suggest better approaches, or point me to something obvious I've
>  missed?
> 
> Many thanks
> 
> Chris
> 
> 
> 
> 
> ___________________________________________________________________________
> ___________________________
> 
> This message contains information, which is confidential and may be subject
>  to legal privilege. If you are not the intended recipient, you must not
>  peruse, use, disseminate, distribute or copy this message. If you have
>  received this message in error, please notify us immediately (Phone 0800
>  665 463 or info at linz.govt.nz) and destroy the original message. LINZ
>  accepts no responsibility for changes to this email, or for any
>  attachments, after its transmission from LINZ.
> 
> Thank you.
> ___________________________________________________________________________
> ___________________________
> 

-- 
Dr. Marco Hugentobler
HUGIS - GIS programming and consulting
Webereistr. 66
CH-8134 Adliswil
marco at hugis.net
http://homepage.hispeed.ch/hugis/
Technical Advisor QGIS Project Steering Committee


More information about the Qgis-developer mailing list