î
ªÍ XÆ  ã               @   s:   d  d l  m Z d  d l m Z Gd d „  d e ƒ Z d S)é   )ÚGEOSBase)Úpreparedc               @   s£   e  Z d  Z d Z e j Z d d „  Z d d „  Z d d „  Z	 d d	 „  Z
 d
 d „  Z d d „  Z d d „  Z d d „  Z d d „  Z d d „  Z d d „  Z d S)ÚPreparedGeometryzœ
    A geometry that is prepared for performing certain operations.
    At the moment this includes the contains covers, and intersects
    operations.
    c             C   sJ   | |  _  d d l m } t | | ƒ s1 t ‚ n  t j | j ƒ |  _ d  S)Nr   )ÚGEOSGeometry)Z
_base_geomZgeometryr   Ú
isinstanceÚ	TypeErrorÚcapiZgeos_prepareÚptr)ÚselfZgeomr   © r   úN/home/ubuntu/projects/ifolica/build/django/django/contrib/gis/geos/prepared.pyÚ__init__   s
    		zPreparedGeometry.__init__c             C   s3   y t  j |  j ƒ Wn t t f k
 r. Yn Xd  S)N)r   Zprepared_destroyZ_ptrÚAttributeErrorr   )r
   r   r   r   Ú__del__   s    zPreparedGeometry.__del__c             C   s   t  j |  j | j ƒ S)N)r   Zprepared_containsr	   )r
   Úotherr   r   r   Úcontains   s    zPreparedGeometry.containsc             C   s   t  j |  j | j ƒ S)N)r   Zprepared_contains_properlyr	   )r
   r   r   r   r   Úcontains_properly    s    z"PreparedGeometry.contains_properlyc             C   s   t  j |  j | j ƒ S)N)r   Zprepared_coversr	   )r
   r   r   r   r   Úcovers#   s    zPreparedGeometry.coversc             C   s   t  j |  j | j ƒ S)N)r   Zprepared_intersectsr	   )r
   r   r   r   r   Ú
intersects&   s    zPreparedGeometry.intersectsc             C   s   t  j |  j | j ƒ S)N)r   Zprepared_crossesr	   )r
   r   r   r   r   Úcrosses)   s    zPreparedGeometry.crossesc             C   s   t  j |  j | j ƒ S)N)r   Zprepared_disjointr	   )r
   r   r   r   r   Údisjoint,   s    zPreparedGeometry.disjointc             C   s   t  j |  j | j ƒ S)N)r   Zprepared_overlapsr	   )r
   r   r   r   r   Úoverlaps/   s    zPreparedGeometry.overlapsc             C   s   t  j |  j | j ƒ S)N)r   Zprepared_touchesr	   )r
   r   r   r   r   Útouches2   s    zPreparedGeometry.touchesc             C   s   t  j |  j | j ƒ S)N)r   Zprepared_withinr	   )r
   r   r   r   r   Úwithin5   s    zPreparedGeometry.withinN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   ZPREPGEOM_PTRZptr_typer   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r      s   	
r   N)Úbaser   Z
prototypesr   r   r   r   r   r   r   Ú<module>   s   