3
®?d]g  ã               @   sD   d Z ddlmZmZ ddlmZ G dd„ deƒZG dd„ deƒZdS )	z8Proxy for coordinates stored outside Shapely geometries
é    )Údeserialize_wkbÚEMPTY)Úlgeosc               @   sP   e Zd ZdZdZeZdZdd„ Ze	dd„ ƒZ
efdd„Ze	dd	„ ƒZd
d„ ZdS )ÚCachingGeometryProxyNc             C   s
   || _ d S )N)Úcontext)Úselfr   © r   ú9/tmp/pip-build-op5p2y5_/shapely/shapely/geometry/proxy.pyÚ__init__   s    zCachingGeometryProxy.__init__c             C   s   | j td gkS )N)Ú__geom__r   )r   r   r   r	   Ú	_is_empty   s    zCachingGeometryProxy._is_emptyc             C   s$   | j  r| jrtj| jƒ || _d S )N)r   r   r   ZGEOSGeom_destroy)r   Úvalr   r   r	   Úempty   s    zCachingGeometryProxy.emptyc             C   sL   | j ƒ }|| jks| jr@| jƒ  t| jƒdkr@| j| jƒ\| _}|| _| jS )z2Keeps the GEOS geometry in synch with the context.r   )ÚgtagÚ_gtagr   r   Úlenr   Úfactoryr   )r   r   Únr   r   r	   Ú_geom   s    zCachingGeometryProxy._geomc             C   s   t t| jƒƒS )N)ÚhashÚreprr   )r   r   r   r	   r   &   s    zCachingGeometryProxy.gtag)Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r   r
   Úpropertyr   r   r   r   r   r   r   r	   r      s   r   c               @   s   e Zd Zedd„ ƒZdS )ÚPolygonProxyc             C   sJ   | j ƒ }|| jks| jr>| jƒ  | j| jd | jd ƒ\| _}|| _| jS )z2Keeps the GEOS geometry in synch with the context.r   é   )r   r   r   r   r   r   r   )r   r   r   r   r   r	   r   ,   s    zPolygonProxy._geomN)r   r   r   r   r   r   r   r   r	   r   *   s   r   N)	Ú__doc__Zshapely.geometry.baser   r   Zshapely.geosr   Úobjectr   r   r   r   r   r	   Ú<module>   s   "