3
®?d]€  ã               @   s¸   d dl Z d dlmZmZ d dlmZ d dlZddlmZ yd dl	m
Z
 dZdZW n, ek
r|   d dlZdZejƒ d	 ZY nX d
d„ ZddddgZi Zdadd„ Zdd„ Zer´eƒ  dS )é    N)Ú
linestringÚpolygon)Úcoordsé   )Úwraps)Ú	_speedupsTFé   c                s   ‡ fdd„}t ˆ ƒ|ƒS )Nc                 s
   ˆ | |ŽS )N© )ÚargsÚkwargs)Úfr	   ú</tmp/pip-build-op5p2y5_/shapely/shapely/speedups/__init__.pyÚwrapper   s    zmethod_wrapper.<locals>.wrapper)r   )r   r   r	   )r   r   Úmethod_wrapper   s    r   Ú	availableÚenableÚdisableÚenabledc              C   s¤   t stjdtƒ dS trdS tjjtd< tt	j
ƒtj_tjjtd< tt	jƒtj_tjtd< t	jt_tjtd< t	jt_tjjtd< dd	„ } tjjj| _| tj_d
adS )a   Enable Cython speedups

    The shapely.speedups module contains performance enhancements written in C.
    They are automaticaly installed when Python has access to a compiler and
    GEOS development headers during installation, and are enabled by default.

    You can check if speedups are installed with the `available` attribute, and
    check if they have been enabled with the `enabled` attribute.

    >>> from shapely import speedups
    >>> speedups.available
    True
    >>> speedups.enable()
    >>> speedups.enabled
    True
    zshapely.speedups not availableNzCoordinateSequence.ctypeszCoordinateSequence.__iter__Úgeos_linestring_from_pyÚgeos_linearring_from_pyÚaffine_transformc             S   s   t j| |ƒS )N)r   r   )ZgeomZmatrixr	   r	   r   r   I   s    z enable.<locals>.affine_transformT)r   ÚwarningsÚwarnÚRuntimeWarningÚ_origr   ÚCoordinateSequenceÚctypesÚpropertyr   Zcoordseq_ctypesÚ__iter__r   Zcoordseq_iterr   r   r   r   ÚshapelyÚaffinityr   Ú__doc__r   )r   r	   r	   r   r   !   s&    

c               C   sP   t sdS t d tj_t d tj_t d t_t d t_t d t	j
_t jƒ  dadS )zDisable Cython speedups
    NzCoordinateSequence.ctypeszCoordinateSequence.__iter__r   r   r   F)r   r   r   r   r   r   r   r   r   r   r    r   Úclearr   r	   r	   r	   r   r   R   s    

)r   Zshapely.geometryr   r   r   r   Zshapely.affinityZftoolsr   Zshapely.speedupsr   r   Zimport_error_msgÚImportErrorÚsysÚexc_infor   Ú__all__r   r   r   r   r	   r	   r	   r   Ú<module>   s(   1