Changeset 904
- Timestamp:
- 10/13/07 09:28:11
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
PCL/trunk/PCL-Core/cartography/geometry/geometry.py
r548 r904 280 280 z = property(getZ, setZ) 281 281 282 def _provideGeoInterface(self): 283 return { 284 'type': 'Point', 285 'coordinates': (self.x, self.y, self.z) 286 } 287 __geo_interface__ = property(_provideGeoInterface) 288 282 289 283 290 class LineString(Geometry): … … 340 347 return self.startPoint().equals(self.endPoint()) 341 348 349 def _provideGeoInterface(self): 350 coords = [] 351 for i in range(self.numPoints()): 352 p = self.pointN(i) 353 coords.append((p.x, p.y, p.z)) 354 return { 355 'type': 'LineString', 356 'coordinates': tuple(coords) 357 } 358 __geo_interface__ = property(_provideGeoInterface) 359 342 360 343 361 class LinearRing(LineString): … … 370 388 self._copyFromCoordSeq(s, GEOS_LINEARRING) 371 389 390 def _provideGeoInterface(self): 391 coords = [] 392 for i in range(self.numPoints()): 393 p = self.pointN(i) 394 coords.append((p.x, p.y, p.z)) 395 return { 396 'type': 'LinearRing', 397 'coordinates': tuple(coords) 398 } 399 __geo_interface__ = property(_provideGeoInterface) 400 372 401 373 402 class Polygon(Geometry): … … 409 438 """Return a point on surface.""" 410 439 return self._unary_geometry_operation('getInteriorRingN', N) 411 440 441 #def _provideGeoInterface(self): 442 # coords = [] 443 # for i in range(self.numPoints()): 444 # p = self.pointN(i) 445 # coords.append((p.x, p.y, p.z)) 446 # return { 447 # 'type': 'LineString', 448 # 'coordinates': tuple(coords) 449 # } 450 #__geo_interface__ = property(_provideGeoInterface) 451 412 452 413 453 class GeometryCollection(Geometry):
