
    Ogb	                     6    d Z ddlmZ ddlZ G d d      Zd Zy)z0
Support for GEOS prepared geometry operations.
    PicklingErrorNc                   R    e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zy)PreparedGeometrya-  
    A geometry prepared for efficient comparison to a set of other geometries.

    Example:

      >>> 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                     t        |t              r|j                  | _        d| _        y t        j                  |       || _        d| _        y )NT)
isinstancer   contextshapelyprepareprepared)selfr	   s     U/var/www/html/public_html/myphp/venv/lib/python3.12/site-packages/shapely/prepared.py__init__zPreparedGeometry.__init__   s=    g/0"??DL  OOG$"DL    c                 8    | j                   j                  |      S )z;Returns True if the geometry contains the other, else False)r	   containsr   others     r   r   zPreparedGeometry.contains       ||$$U++r   c                     ddl m}  ||g      }|j                  | j                  d      }t	        t        |            S )zDReturns True if the geometry properly contains the other, else Falser   )STRtreecontains_properly)	predicate)r
   r   queryr	   boollen)r   r   r   treeidxs        r   r   z"PreparedGeometry.contains_properly"   s8     	$wjj1DjECH~r   c                 8    | j                   j                  |      S )z9Returns True if the geometry covers the other, else False)r	   coversr   s     r   r    zPreparedGeometry.covers+       ||""5))r   c                 8    | j                   j                  |      S )z0Returns True if the geometries cross, else False)r	   crossesr   s     r   r#   zPreparedGeometry.crosses/       ||##E**r   c                 8    | j                   j                  |      S )z3Returns True if geometries are disjoint, else False)r	   disjointr   s     r   r&   zPreparedGeometry.disjoint3   r   r   c                 8    | j                   j                  |      S )z0Returns True if geometries intersect, else False)r	   
intersectsr   s     r   r(   zPreparedGeometry.intersects7   s    ||&&u--r   c                 8    | j                   j                  |      S )z.Returns True if geometries overlap, else False)r	   overlapsr   s     r   r*   zPreparedGeometry.overlaps;   r   r   c                 8    | j                   j                  |      S )z,Returns True if geometries touch, else False)r	   touchesr   s     r   r,   zPreparedGeometry.touches?   r$   r   c                 8    | j                   j                  |      S )z8Returns True if geometry is within the other, else False)r	   withinr   s     r   r.   zPreparedGeometry.withinC   r!   r   c                     t        d      )Nz&Prepared geometries cannot be pickled.r   )r   s    r   
__reduce__zPreparedGeometry.__reduce__G   s    DEEr   N)__name__
__module____qualname____doc__r   r   r   r    r#   r&   r(   r*   r,   r.   r0    r   r   r   r   	   s?    
,*+,.,+*Fr   r   c                     t        |       S )z0Creates and returns a prepared geometric object.)r   )obs    r   prepr8   K   s    Br   )r4   pickler   r
   r   r8   r5   r   r   <module>r:      s$    ! ?F ?FD r   