Toblerity/Shapely — pull request #165 by jwass (2014-08-31 22:54:09+00:00)
Title: Geom clone

This is ready to go and hopefully closes out #143 and #164.

I made sure all geometry types test instantiating from an object of the same type. It's hard to test that clone is called without adding mocks or something like that so I haven't done anything there.

It's ready for @snorfalorpagus's work on cloning the coordinate sequences too. @snorfalorpagus (I really like typing that :smile:), you can also add it to the ctypes and add the functionality in the Python implementation for `geos_linestring_from_py` when creating a `LineString` from a `LinearRing`. That way we should also see sizable performance improvements even without speedups for that case too.

@sgillies, can you also take a look at the third commit (5186f18b4302745b6f9e0585fee9c97f2ecbf3dd)? `geos_multilinestring_from_py` calls `lgeos.GEOSGeom_getDimensions(...)`. `getDimensions` returns the dimensionality of the geometry type: Points are 0, LineStrings are 1, etc... not the degrees of freedom in the coordinates. `getCoordinateDimension()` is the function that returns 2 or 3 and appears to be the intent there, so I just made the fix. I tried to test that part of the code and can't get there without any of the asserts triggering or other calling code failing... the current tests never get there. Hopefully I'm missing something... let me know if you want me to remove that commit. Either way I'm pretty sure that commit is safe.