ó
®â0_c           @   s¦   d  d l  Z  d  d l m Z d  d l m Z d  d l m Z d  d l m	 Z	 d  d l
 m Z d  d l m Z d  d l m Z d  d	 l m Z d
 e f d „  ƒ  YZ d S(   iÿÿÿÿN(   t   c_uint(   t   gdal(   t
   prototypes(   t   GEOSException(   t   GEOSGeometry(   t   six(   t   RemovedInDjango20Warning(   t   ranget   Pointc           B   s[  e  Z d  Z d Z e Z d d d d d „ Z d „  Z e	 d „  ƒ Z
 e	 d „  ƒ Z d „  Z d „  Z d „  Z d	 „  Z d
 „  Z e Z e d „  ƒ Z e j d „  ƒ Z e d „  ƒ Z e j d „  ƒ Z e d „  ƒ Z e j d „  ƒ Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z e d „  ƒ Z e j d „  ƒ Z d „  Z d „  Z e Z  RS(   i   i   c         C   sã   | d k r g  } n– t | t t f ƒ r3 | } nx t | t j t f ƒ rŸ t | t j t f ƒ rŸ t | t j t f ƒ r | | | g } q« | | g } n t d ƒ ‚ |  j t	 | ƒ | ƒ } t
 t |  ƒ j | d | ƒd S(   s  
        The Point object may be initialized with either a tuple, or individual
        parameters.

        For Example:
        >>> p = Point((5, 23)) # 2D point, passed in as a tuple
        >>> p = Point(5, 23, 8) # 3D point, passed in with individual parameters
        s2   Invalid parameters given for Point initialization.t   sridN(   t   Nonet
   isinstancet   tuplet   listR   t   integer_typest   floatt	   TypeErrort   _create_pointt   lent   superR   t   __init__(   t   selft   xt   yt   zR	   t   coordst   point(    (    s?   /tmp/pip-unpacked-wheel-BAJOf3/django/contrib/gis/geos/point.pyR      s    			2c         C   s,   |  j  r t j j j ƒ  St t |  ƒ j ƒ  S(   N(   t   emptyR   t
   geometriesR   t   _create_emptyR   t   _ogr_ptr(   R   (    (    s?   /tmp/pip-unpacked-wheel-BAJOf3/django/contrib/gis/geos/point.pyR   /   s    c         C   s   |  j  d  d  ƒ S(   N(   R   R
   (   t   cls(    (    s?   /tmp/pip-unpacked-wheel-BAJOf3/django/contrib/gis/geos/point.pyR   2   s    c         C   sÕ   | s t  j d ƒ S| d k  s+ | d k rD t d t | ƒ ƒ ‚ n  t  j t d ƒ t | ƒ ƒ } t | ƒ } t  j | d t	 | ƒ ƒ t  j
 | d t	 | ƒ ƒ | d k rÈ t  j | d t	 | ƒ ƒ n  t  j | ƒ S(   sO   
        Create a coordinate sequence, set X, Y, [Z], and create point
        i   i   s   Invalid point dimension: %si   i    N(   t   capit   create_pointR
   R   t   strt	   create_csR    t   itert   cs_setxt   nextt   cs_setyt   cs_setz(   R   t   ndimR   t   cst   i(    (    s?   /tmp/pip-unpacked-wheel-BAJOf3/django/contrib/gis/geos/point.pyR   6   s    c         C   sN   |  j  | | ƒ } | r> t j |  j ƒ | |  _ |  j ƒ  n t d ƒ ‚ d  S(   Ns3   Geometry resulting from slice deletion was invalid.(   R   R    t   destroy_geomt   ptrt   _ptrt   _set_csR   (   R   t   lengtht   itemsR-   (    (    s?   /tmp/pip-unpacked-wheel-BAJOf3/django/contrib/gis/geos/point.pyt	   _set_listJ   s    	c         C   s   |  j  j | d | ƒ d  S(   Ni    (   t   _cst   setOrdinate(   R   t   indext   value(    (    s?   /tmp/pip-unpacked-wheel-BAJOf3/django/contrib/gis/geos/point.pyt   _set_singleT   s    c         c   s*   x# t  t |  ƒ ƒ D] } |  | Vq Wd S(   s0   Allows iteration over coordinates of this Point.N(   R   R   (   R   R+   (    (    s?   /tmp/pip-unpacked-wheel-BAJOf3/django/contrib/gis/geos/point.pyt   __iter__W   s    c         C   s"   |  j  r d S|  j r d Sd Sd S(   sC   Returns the number of dimensions for this Point (either 0, 2 or 3).i    i   i   N(   R   t   hasz(   R   (    (    s?   /tmp/pip-unpacked-wheel-BAJOf3/django/contrib/gis/geos/point.pyt   __len__\   s
    		c         C   s=   | d k r |  j  S| d k r& |  j S| d k r9 |  j Sd  S(   Ni    i   i   (   R   R   R   (   R   R5   (    (    s?   /tmp/pip-unpacked-wheel-BAJOf3/django/contrib/gis/geos/point.pyt   _get_single_externale   s    c         C   s   |  j  j d d ƒ S(   s%   Returns the X component of the Point.i    (   R3   t   getOrdinate(   R   (    (    s?   /tmp/pip-unpacked-wheel-BAJOf3/django/contrib/gis/geos/point.pyR   o   s    c         C   s   |  j  j d d | ƒ d S(   s"   Sets the X component of the Point.i    N(   R3   R4   (   R   R6   (    (    s?   /tmp/pip-unpacked-wheel-BAJOf3/django/contrib/gis/geos/point.pyR   t   s    c         C   s   |  j  j d d ƒ S(   s%   Returns the Y component of the Point.i   i    (   R3   R<   (   R   (    (    s?   /tmp/pip-unpacked-wheel-BAJOf3/django/contrib/gis/geos/point.pyR   y   s    c         C   s   |  j  j d d | ƒ d S(   s"   Sets the Y component of the Point.i   i    N(   R3   R4   (   R   R6   (    (    s?   /tmp/pip-unpacked-wheel-BAJOf3/django/contrib/gis/geos/point.pyR   ~   s    c         C   s    |  j  r |  j j d d ƒ Sd S(   s%   Returns the Z component of the Point.i   i    N(   R9   R3   R<   R
   (   R   (    (    s?   /tmp/pip-unpacked-wheel-BAJOf3/django/contrib/gis/geos/point.pyR   ƒ   s    c         C   s2   |  j  s t d ƒ ‚ n  |  j j d d | ƒ d S(   s"   Sets the Z component of the Point.s   Cannot set Z on 2D Point.i   i    N(   R9   R   R3   R4   (   R   R6   (    (    s?   /tmp/pip-unpacked-wheel-BAJOf3/django/contrib/gis/geos/point.pyR   ˆ   s    	c         C   s   t  j d t d ƒ |  j S(   Ns6   `get_x()` is deprecated, use the `x` property instead.i   (   t   warningst   warnR   R   (   R   (    (    s?   /tmp/pip-unpacked-wheel-BAJOf3/django/contrib/gis/geos/point.pyt   get_x   s    
c         C   s    t  j d t d ƒ | |  _ d  S(   Ns6   `set_x()` is deprecated, use the `x` property instead.i   (   R=   R>   R   R   (   R   R6   (    (    s?   /tmp/pip-unpacked-wheel-BAJOf3/django/contrib/gis/geos/point.pyt   set_x–   s    
c         C   s   t  j d t d ƒ |  j S(   Ns6   `get_y()` is deprecated, use the `y` property instead.i   (   R=   R>   R   R   (   R   (    (    s?   /tmp/pip-unpacked-wheel-BAJOf3/django/contrib/gis/geos/point.pyt   get_y   s    
c         C   s    t  j d t d ƒ | |  _ d  S(   Ns6   `set_y()` is deprecated, use the `y` property instead.i   (   R=   R>   R   R   (   R   R6   (    (    s?   /tmp/pip-unpacked-wheel-BAJOf3/django/contrib/gis/geos/point.pyt   set_y¤   s    
c         C   s   t  j d t d ƒ |  j S(   Ns6   `get_z()` is deprecated, use the `z` property instead.i   (   R=   R>   R   R   (   R   (    (    s?   /tmp/pip-unpacked-wheel-BAJOf3/django/contrib/gis/geos/point.pyt   get_z«   s    
c         C   s    t  j d t d ƒ | |  _ d  S(   Ns6   `set_z()` is deprecated, use the `z` property instead.i   (   R=   R>   R   R   (   R   R6   (    (    s?   /tmp/pip-unpacked-wheel-BAJOf3/django/contrib/gis/geos/point.pyt   set_z²   s    
c         C   s
   |  j  j S(   s   Returns a tuple of the point.(   R3   R   (   R   (    (    s?   /tmp/pip-unpacked-wheel-BAJOf3/django/contrib/gis/geos/point.pyR   º   s    c         C   s   | |  j  d <d S(   s7   Sets the coordinates of the point with the given tuple.i    N(   R3   (   R   t   tup(    (    s?   /tmp/pip-unpacked-wheel-BAJOf3/django/contrib/gis/geos/point.pyR   ¿   s    c         C   s   t  j d t d ƒ |  j S(   Ns?   `get_coords()` is deprecated, use the `tuple` property instead.i   (   R=   R>   R   R   (   R   (    (    s?   /tmp/pip-unpacked-wheel-BAJOf3/django/contrib/gis/geos/point.pyt
   get_coordsÄ   s    
c         C   s    t  j d t d ƒ | |  _ d  S(   Ns?   `set_coords()` is deprecated, use the `tuple` property instead.i   (   R=   R>   R   R   (   R   RE   (    (    s?   /tmp/pip-unpacked-wheel-BAJOf3/django/contrib/gis/geos/point.pyt
   set_coordsË   s    
N(!   t   __name__t
   __module__t
   _minlengtht
   _maxlengtht   Truet   has_csR
   R   R   t   classmethodR   R   R2   R7   R8   R:   R;   t   _get_single_internalt   propertyR   t   setterR   R   R?   R@   RA   RB   RC   RD   R   RF   RG   R   (    (    (    s?   /tmp/pip-unpacked-wheel-BAJOf3/django/contrib/gis/geos/point.pyR      s<   		
													(   R=   t   ctypesR    t   django.contrib.gisR   t   django.contrib.gis.geosR   R    t   django.contrib.gis.geos.errorR   t    django.contrib.gis.geos.geometryR   t   django.utilsR   t   django.utils.deprecationR   t   django.utils.six.movesR   R   (    (    (    s?   /tmp/pip-unpacked-wheel-BAJOf3/django/contrib/gis/geos/point.pyt   <module>   s   