3
3
unary and binary predicate operations on geometries.
5
5
from ctypes import c_char, c_char_p, c_double
6
from django.contrib.gis.geos.libgeos import lgeos, GEOM_PTR
6
from django.contrib.gis.geos.libgeos import GEOM_PTR
7
7
from django.contrib.gis.geos.prototypes.errcheck import check_predicate
8
from django.contrib.gis.geos.prototypes.threadsafe import GEOSFunc
9
10
## Binary & unary predicate functions ##
10
11
def binary_predicate(func, *args):
26
27
## Unary Predicates ##
27
geos_hasz = unary_predicate(lgeos.GEOSHasZ)
28
geos_isempty = unary_predicate(lgeos.GEOSisEmpty)
29
geos_isring = unary_predicate(lgeos.GEOSisRing)
30
geos_issimple = unary_predicate(lgeos.GEOSisSimple)
31
geos_isvalid = unary_predicate(lgeos.GEOSisValid)
28
geos_hasz = unary_predicate(GEOSFunc('GEOSHasZ'))
29
geos_isempty = unary_predicate(GEOSFunc('GEOSisEmpty'))
30
geos_isring = unary_predicate(GEOSFunc('GEOSisRing'))
31
geos_issimple = unary_predicate(GEOSFunc('GEOSisSimple'))
32
geos_isvalid = unary_predicate(GEOSFunc('GEOSisValid'))
33
34
## Binary Predicates ##
34
geos_contains = binary_predicate(lgeos.GEOSContains)
35
geos_crosses = binary_predicate(lgeos.GEOSCrosses)
36
geos_disjoint = binary_predicate(lgeos.GEOSDisjoint)
37
geos_equals = binary_predicate(lgeos.GEOSEquals)
38
geos_equalsexact = binary_predicate(lgeos.GEOSEqualsExact, c_double)
39
geos_intersects = binary_predicate(lgeos.GEOSIntersects)
40
geos_overlaps = binary_predicate(lgeos.GEOSOverlaps)
41
geos_relatepattern = binary_predicate(lgeos.GEOSRelatePattern, c_char_p)
42
geos_touches = binary_predicate(lgeos.GEOSTouches)
43
geos_within = binary_predicate(lgeos.GEOSWithin)
35
geos_contains = binary_predicate(GEOSFunc('GEOSContains'))
36
geos_crosses = binary_predicate(GEOSFunc('GEOSCrosses'))
37
geos_disjoint = binary_predicate(GEOSFunc('GEOSDisjoint'))
38
geos_equals = binary_predicate(GEOSFunc('GEOSEquals'))
39
geos_equalsexact = binary_predicate(GEOSFunc('GEOSEqualsExact'), c_double)
40
geos_intersects = binary_predicate(GEOSFunc('GEOSIntersects'))
41
geos_overlaps = binary_predicate(GEOSFunc('GEOSOverlaps'))
42
geos_relatepattern = binary_predicate(GEOSFunc('GEOSRelatePattern'), c_char_p)
43
geos_touches = binary_predicate(GEOSFunc('GEOSTouches'))
44
geos_within = binary_predicate(GEOSFunc('GEOSWithin'))