o
    ×Ëh/	  ã                   @   s2   d Z ddlmZ ddlZG dd„ dƒZdd„ ZdS )z.Support for GEOS prepared geometry operations.é    ©ÚPicklingErrorNc                   @   sh   e Zd Z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d„ ZdS )ÚPreparedGeometryaU  A geometry prepared for efficient comparison to a set of other geometries.

    Examples
    --------
    >>> from shapely.prepared import prep
    >>> from shapely.geometry import Point, Polygon
    >>> triangle = Polygon([(0.0, 0.0), (1.0, 1.0), (1.0, -1.0)])
    >>> p = prep(triangle)
    >>> p.intersects(Point(0.5, 0.5))
    True

    c                 C   s.   t |tƒr
|j| _nt |¡ || _d| _dS )z@Prepare a geometry for efficient comparison to other geometries.TN)Ú
isinstancer   ÚcontextÚshapelyÚprepareÚprepared)Úselfr   © r   úK/var/www/html/scripts/venv/lib/python3.10/site-packages/shapely/prepared.pyÚ__init__   s
   



zPreparedGeometry.__init__c                 C   ó   | j  |¡S )z;Return True if the geometry contains the other, else False.)r   Úcontains©r
   Úotherr   r   r   r      ó   zPreparedGeometry.containsc                 C   r   )zDReturn True if the geometry properly contains the other, else False.)r   Úcontains_properlyr   r   r   r   r   #   r   z"PreparedGeometry.contains_properlyc                 C   r   )z9Return True if the geometry covers the other, else False.)r   Úcoversr   r   r   r   r   '   r   zPreparedGeometry.coversc                 C   r   )z0Return True if the geometries cross, else False.)r   Úcrossesr   r   r   r   r   +   r   zPreparedGeometry.crossesc                 C   r   )z3Return True if geometries are disjoint, else False.)r   Údisjointr   r   r   r   r   /   r   zPreparedGeometry.disjointc                 C   r   )z0Return True if geometries intersect, else False.)r   Ú
intersectsr   r   r   r   r   3   r   zPreparedGeometry.intersectsc                 C   r   )z.Return True if geometries overlap, else False.)r   Úoverlapsr   r   r   r   r   7   r   zPreparedGeometry.overlapsc                 C   r   )z,Return True if geometries touch, else False.)r   Útouchesr   r   r   r   r   ;   r   zPreparedGeometry.touchesc                 C   r   )z8Return True if geometry is within the other, else False.)r   Úwithinr   r   r   r   r   ?   r   zPreparedGeometry.withinc                 C   s   t dƒ‚)zPickling is not supported.z&Prepared geometries cannot be pickled.r   )r
   r   r   r   Ú
__reduce__C   ó   zPreparedGeometry.__reduce__N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r      s    	r   c                 C   s   t | ƒS )z.Create and return a prepared geometric object.)r   )Úobr   r   r   ÚprepH   r   r"   )r    Úpickler   r   r   r"   r   r   r   r   Ú<module>   s
    @