polygon editing branch

This branch adds polygon editing capabilities and a whole pile of fixed done by Mark on the spatialite part.