~ubuntu-branches/ubuntu/quantal/python-django/quantal-security

« back to all changes in this revision

Viewing changes to django/contrib/gis/geos/prototypes/predicates.py

  • Committer: Bazaar Package Importer
  • Author(s): Chris Lamb
  • Date: 2010-05-21 07:52:55 UTC
  • mfrom: (1.3.6 upstream)
  • mto: This revision was merged to the branch mainline in revision 28.
  • Revision ID: james.westby@ubuntu.com-20100521075255-ii78v1dyfmyu3uzx
Tags: upstream-1.2
ImportĀ upstreamĀ versionĀ 1.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 unary and binary predicate operations on geometries.
4
4
"""
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
8
9
 
9
10
## Binary & unary predicate functions ##
10
11
def binary_predicate(func, *args):
24
25
    return func
25
26
 
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'))
32
33
 
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'))