PageRenderTime 95ms CodeModel.GetById 40ms app.highlight 3ms RepoModel.GetById 37ms 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
 1from ctypes import c_char
 2from django.contrib.gis.geos.libgeos import GEOM_PTR, PREPGEOM_PTR
 3from django.contrib.gis.geos.prototypes.errcheck import check_predicate
 4from django.contrib.gis.geos.prototypes.threadsafe import GEOSFunc
 5
 6# Prepared geometry constructor and destructors.
 7geos_prepare = GEOSFunc('GEOSPrepare')
 8geos_prepare.argtypes = [GEOM_PTR]
 9geos_prepare.restype = PREPGEOM_PTR
10
11prepared_destroy = GEOSFunc('GEOSPreparedGeom_destroy')
12prepared_destroy.argtpes = [PREPGEOM_PTR]
13prepared_destroy.restype = None
14
15# Prepared geometry binary predicate support.
16def prepared_predicate(func):
17    func.argtypes= [PREPGEOM_PTR, GEOM_PTR]
18    func.restype = c_char
19    func.errcheck = check_predicate
20    return func
21
22prepared_contains = prepared_predicate(GEOSFunc('GEOSPreparedContains'))
23prepared_contains_properly = prepared_predicate(GEOSFunc('GEOSPreparedContainsProperly'))
24prepared_covers = prepared_predicate(GEOSFunc('GEOSPreparedCovers'))
25prepared_intersects = prepared_predicate(GEOSFunc('GEOSPreparedIntersects'))