Inverted polygon renderer: add a merging option

This adds an option to merge using a spatial union polygons before rendering them. This way, overlapping polygons can be merged.
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