Inverted polygon renderer: fix problems with overlapping polygons

This adds an option to merge using a spatial union polygons before rendering them. This way, overlapping polygons can be merged (refs http://hub.qgis.org/issues/10338 )
This patchset also fixes these issues:
* make sure the different symbol categories are always rendered in the same order
* fix the rendering when a reprojection is used
* fix a crash when no painter is assigned (http://hub.qgis.org/issues/10355)
* complete unit tests