PageRenderTime 29ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/django/contrib/gis/geos/prototypes/prepared.py

https://code.google.com/p/mango-py/
Python | 25 lines | 19 code | 4 blank | 2 comment | 0 complexity | a75728ff39a667de6fe5a1dff592bb73 MD5 | raw file
Possible License(s): BSD-3-Clause
  1. from ctypes import c_char
  2. from django.contrib.gis.geos.libgeos import GEOM_PTR, PREPGEOM_PTR
  3. from django.contrib.gis.geos.prototypes.errcheck import check_predicate
  4. from django.contrib.gis.geos.prototypes.threadsafe import GEOSFunc
  5. # Prepared geometry constructor and destructors.
  6. geos_prepare = GEOSFunc('GEOSPrepare')
  7. geos_prepare.argtypes = [GEOM_PTR]
  8. geos_prepare.restype = PREPGEOM_PTR
  9. prepared_destroy = GEOSFunc('GEOSPreparedGeom_destroy')
  10. prepared_destroy.argtpes = [PREPGEOM_PTR]
  11. prepared_destroy.restype = None
  12. # Prepared geometry binary predicate support.
  13. def prepared_predicate(func):
  14. func.argtypes= [PREPGEOM_PTR, GEOM_PTR]
  15. func.restype = c_char
  16. func.errcheck = check_predicate
  17. return func
  18. prepared_contains = prepared_predicate(GEOSFunc('GEOSPreparedContains'))
  19. prepared_contains_properly = prepared_predicate(GEOSFunc('GEOSPreparedContainsProperly'))
  20. prepared_covers = prepared_predicate(GEOSFunc('GEOSPreparedCovers'))
  21. prepared_intersects = prepared_predicate(GEOSFunc('GEOSPreparedIntersects'))