Re: [Qgis-developer] Rendering active map symbol as QPixmap

2015-05-07 Thread Andrew McClure
Awesome,

Thanks Nathan!

On 8/05/2015, at 10:34 am, Nathan Woodrow  wrote:

> Hey Andrew,
> 
> This is how I did it with Roam to get all the legend items for the layer:
> 
> items = layer.rendererV2().legendSymbologyItems(ICON_SIZE)
> 
> That will give you a list of:Text - Icon pairs
> 
> if you are using the rule base renderer you get can the symbol for the rule 
> and paint that into a pixmap, however note that one feature can have many 
> symbols so you will have to use the method that returns a list for all the 
> symbols.
> 
> Depending on what you are doing  legendSymbologyItems might give you what you 
> need without extra work.
> 
> - Nathan
> 
> On Fri, 8 May 2015 at 07:00 Andrew McClure  wrote:
> Any takers for this one? I'd like to render the active symbol for a layer as 
> a QPixmap in a dialog.
> 
> I have got this far:
> 
>s =  layer().rendererV2()
>key = s.rootRule().findRuleByKey(s.rootRule().ruleKey())
> 
> This tells me the active rule key to be rendered but how to get the image 
> data?
> 
> Perhaps I am barking up the wrong tree here?
> 
> Thanks
> ___
> Qgis-developer mailing list
> Qgis-developer@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
> 

___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [Qgis-developer] Rendering active map symbol as QPixmap

2015-05-07 Thread Nathan Woodrow
Hey Andrew,

This is how I did it with Roam to get all the legend items for the layer:

items = layer.rendererV2().legendSymbologyItems(ICON_SIZE)

That will give you a list of:Text - Icon pairs

if you are using the rule base renderer you get can the symbol for the rule
and paint that into a pixmap, however note that one feature can have many
symbols so you will have to use the method that returns a list for all the
symbols.

Depending on what you are doing  legendSymbologyItems might give you what
you need without extra work.

- Nathan

On Fri, 8 May 2015 at 07:00 Andrew McClure  wrote:

> Any takers for this one? I'd like to render the active symbol for a layer
> as a QPixmap in a dialog.
>
> I have got this far:
>
>s =  layer().rendererV2()
>key = s.rootRule().findRuleByKey(s.rootRule().ruleKey())
>
> This tells me the active rule key to be rendered but how to get the image
> data?
>
> Perhaps I am barking up the wrong tree here?
>
> Thanks
> ___
> Qgis-developer mailing list
> Qgis-developer@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer

[Qgis-developer] Rendering active map symbol as QPixmap

2015-05-07 Thread Andrew McClure
Any takers for this one? I'd like to render the active symbol for a layer as a 
QPixmap in a dialog.

I have got this far:

   s =  layer().rendererV2()
   key = s.rootRule().findRuleByKey(s.rootRule().ruleKey())

This tells me the active rule key to be rendered but how to get the image data?

Perhaps I am barking up the wrong tree here?

Thanks
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer