[Qgis-developer] attribute map for renderer
b.rowlingson at lancaster.ac.uk
Tue May 29 09:50:06 EDT 2007
I'm trying to write a renderer for vector data. In python.
I want to colour features according to the percentage that one
attribute is of another attribute. I can do it by making sure there's a
percentage attribute in the layer but that's a bit of a faff.
So I want to colour according to the ratio of two attributes. But in
the renderFeature method of my renderer class the feature attribute map
doesn't have all the attributes. Sometimes it has none, I've also seen
it with just one. Here's the code:
def renderFeature(self, p, f, img, selected, widthScale):
am = f.attributeMap()
print "attribute map",am
Now it may be because I'm subclassing from QgsContinuousColorRenderer,
and so the renderer is only being fed the attribute that that method
would need, but I can't see how that is controlled.
The vector layer draw code does this:
QgsAttributeList attributes = mRenderer->classificationAttributes();
but the classificationAttributes method in my python class isn't getting
called at all! Weird?
This is all on a 0.9 checkout from this morning. Any ideas?
More information about the Qgis-developer