Checking for obviously bad geometries in the GDAL driver.

Fixes issues with shapefiles that have obviously bad data.
Changed ModelLayerNodeMap to use a ref_ptr to avoid issues if the node gets moved around.