Use OGR api tests spatial index availability before build it. The spatial index is built only if it doesn't exist or if force_rebuild option is ON

I often get messages from OGR like this one in the console : "Failed to delete file xxxyyyzzz.qix. Permission denied"

This happen when an OGR dataset (or more specifically a shapefile) is already opened.

I added a test to build the spatial index only if necessary :
- spatial index is asked but doesn't exists
- spatial index "force_rebuild" is ON

This can also give a little more performances on large shape files, since the spatial index was rebuilt at every  "shapefile first open"