o
    Jfb	                     @   s2   d Z ddlmZ ddlZG dd dZdd ZdS )z0
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 )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                 C   s.   t |tr
|j| _nt| || _d| _d S )NT)
isinstancer   contextshapelyprepareprepared)selfr    r   \/home/deployuser/azure_apps/autowriter/venv/lib/python3.10/site-packages/shapely/prepared.py__init__   s
   



zPreparedGeometry.__init__c                 C      | j |S )z;Returns True if the geometry contains the other, else False)r   containsr
   otherr   r   r   r         zPreparedGeometry.containsc                 C   s2   ddl m} ||g}|j| jd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idxr   r   r   r   "   s   
z"PreparedGeometry.contains_properlyc                 C   r   )z9Returns True if the geometry covers the other, else False)r   coversr   r   r   r   r   +   r   zPreparedGeometry.coversc                 C   r   )z0Returns True if the geometries cross, else False)r   crossesr   r   r   r   r   /   r   zPreparedGeometry.crossesc                 C   r   )z3Returns True if geometries are disjoint, else False)r   disjointr   r   r   r   r   3   r   zPreparedGeometry.disjointc                 C   r   )z0Returns True if geometries intersect, else False)r   
intersectsr   r   r   r   r   7   r   zPreparedGeometry.intersectsc                 C   r   )z.Returns True if geometries overlap, else False)r   overlapsr   r   r   r   r   ;   r   zPreparedGeometry.overlapsc                 C   r   )z,Returns True if geometries touch, else False)r   touchesr   r   r   r   r    ?   r   zPreparedGeometry.touchesc                 C   r   )z8Returns True if geometry is within the other, else False)r   withinr   r   r   r   r!   C   r   zPreparedGeometry.withinc                 C   s   t d)Nz&Prepared geometries cannot be pickled.r   )r
   r   r   r   
__reduce__G   s   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 )z0Creates and returns a prepared geometric object.)r   )obr   r   r   prepK   s   r(   )r&   pickler   r   r   r(   r   r   r   r   <module>   s
    B