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
6 # Prepared geometry constructor and destructors.
7 geos_prepare
= GEOSFunc('GEOSPrepare')
8 geos_prepare
.argtypes
= [GEOM_PTR
]
9 geos_prepare
.restype
= PREPGEOM_PTR
11 prepared_destroy
= GEOSFunc('GEOSPreparedGeom_destroy')
12 prepared_destroy
.argtpes
= [PREPGEOM_PTR
]
13 prepared_destroy
.restype
= None
15 # Prepared geometry binary predicate support.
16 def prepared_predicate(func
):
17 func
.argtypes
= [PREPGEOM_PTR
, GEOM_PTR
]
19 func
.errcheck
= check_predicate
22 prepared_contains
= prepared_predicate(GEOSFunc('GEOSPreparedContains'))
23 prepared_contains_properly
= prepared_predicate(GEOSFunc('GEOSPreparedContainsProperly'))
24 prepared_covers
= prepared_predicate(GEOSFunc('GEOSPreparedCovers'))
25 prepared_intersects
= prepared_predicate(GEOSFunc('GEOSPreparedIntersects'))