| 1 |
class WKTAdapter: |
| 2 |
""" |
| 3 |
An adaptor for Geometries sent to the MySQL and Oracle database backends. |
| 4 |
""" |
| 5 |
|
| 6 |
def __init__(self, geom): |
| 7 |
self.wkt = geom.wkt |
| 8 |
self.srid = geom.srid |
| 9 |
|
| 10 |
def __eq__(self, other): |
| 11 |
return ( |
| 12 |
isinstance(other, WKTAdapter) |
| 13 |
and self.wkt == other.wkt |
| 14 |
and self.srid == other.srid |
| 15 |
) |
| 16 |
|
| 17 |
def __hash__(self): |
| 18 |
return hash((self.wkt, self.srid)) |
| 19 |
|
| 20 |
def __str__(self): |
| 21 |
return self.wkt |
| 22 |
|
| 23 |
@classmethod |
| 24 |
def _fix_polygon(cls, poly): |
| 25 |
# Hook for Oracle. |
| 26 |
return poly |