Handle the mix of single and multi lines and polygons in shapefiles.

Use some of the code provided by olt in #18, add several tests, see the
LineWritingTest in test_collection.py.