Changeset 1082
- Timestamp:
- 04/26/08 14:51:02
- Files:
-
- Shapely/trunk/CHANGES.txt (modified) (1 diff)
- Shapely/trunk/shapely/geometry/base.py (modified) (2 diffs)
- Shapely/trunk/shapely/geometry/point.py (modified) (2 diffs)
- Shapely/trunk/shapely/predicates.py (modified) (2 diffs)
- Shapely/trunk/tests/Predicates.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
Shapely/trunk/CHANGES.txt
r1080 r1082 1 1 All tickets are children of http://trac.gispython.org/projects/PCL/ticket/ 2 3 1.0.4 (2008-04-26) 4 ------------------ 5 - Disentangle Python and topological equality (#163). 6 - Implement safe predicate shortcuts for objects identical in the Python sense 7 (#163). 2 8 3 9 1.0.3 (2008-04-09) Shapely/trunk/shapely/geometry/base.py
r1066 r1082 249 249 return self.to_wkt() 250 250 251 def __eq__(self, other):252 return self.equals(other)253 254 def __ne__(self, other):255 return not self.equals(other)256 257 251 # To support pickling 258 252 … … 420 414 421 415 # TODO: Relate Pattern? 422 disjoint = BinaryPredicate(lgeos.GEOSDisjoint )423 touches = BinaryPredicate(lgeos.GEOSTouches )424 intersects = BinaryPredicate(lgeos.GEOSIntersects )425 crosses = BinaryPredicate(lgeos.GEOSCrosses )426 within = BinaryPredicate(lgeos.GEOSWithin )427 contains = BinaryPredicate(lgeos.GEOSContains )428 overlaps = BinaryPredicate(lgeos.GEOSOverlaps )429 equals = BinaryPredicate(lgeos.GEOSEquals )416 disjoint = BinaryPredicate(lgeos.GEOSDisjoint, False) 417 touches = BinaryPredicate(lgeos.GEOSTouches, False) 418 intersects = BinaryPredicate(lgeos.GEOSIntersects, True) 419 crosses = BinaryPredicate(lgeos.GEOSCrosses, False) 420 within = BinaryPredicate(lgeos.GEOSWithin, True) 421 contains = BinaryPredicate(lgeos.GEOSContains, True) 422 overlaps = BinaryPredicate(lgeos.GEOSOverlaps, False) 423 equals = BinaryPredicate(lgeos.GEOSEquals, True) 430 424 431 425 # Unary predicates Shapely/trunk/shapely/geometry/point.py
r1043 r1082 206 206 207 207 context = None 208 __geom = None208 __geom__ = None 209 209 _owned = False 210 210 … … 227 227 def _geom(self): 228 228 """Keeps the GEOS geometry in synch with the context.""" 229 if self.__geom is not None:230 lgeos.GEOSGeom_destroy(self.__geom )231 self.__geom , n = geos_point_from_py(self.context)232 return self.__geom 229 if self.__geom__ is not None: 230 lgeos.GEOSGeom_destroy(self.__geom__) 231 self.__geom__, n = geos_point_from_py(self.context) 232 return self.__geom__ 233 233 234 234 # TODO: reimplement x, y, z properties without calling invoking _geom Shapely/trunk/shapely/predicates.py
r1005 r1082 15 15 context = None 16 16 17 def __init__(self, fn ):17 def __init__(self, fn, self_predicate_value): 18 18 self.fn = fn 19 self.self_predicate_value = self_predicate_value 19 20 def errcheck(result, func, argtuple): 20 21 if result == 2: … … 30 31 if self.context._geom is None or other._geom is None: 31 32 raise ValueError, "Null geometry supports no operations" 33 elif self.context == other: 34 return self.self_predicate_value 32 35 return bool(self.fn(self.context._geom, other._geom)) 33 36 Shapely/trunk/tests/Predicates.txt
r1005 r1082 29 29 False 30 30 31 >>> point == Point(0.0, 0.0) 32 True 33 34 >>> point == Point(-1.0, -1.0) 35 False 36 37 >>> point != Point(-1.0, -1.0) 31 >>> point.equals(Point(0.0, 0.0)) 38 32 True 39 33
