
    h                     N    S r SSKJrJr  SSKJr   " S S\5      r " S S5      rg)	a  
The GDAL/OGR library uses an Envelope structure to hold the bounding
box information for a geometry.  The envelope (bounding box) contains
two pairs of coordinates, one for the lower left coordinate and one
for the upper right coordinate:

                          +----------o Upper right; (max_x, max_y)
                          |          |
                          |          |
                          |          |
Lower left (min_x, min_y) o----------+
    )	Structurec_double)GDALExceptionc                   4    \ rS rSrSrS\4S\4S\4S\4/rSrg)	OGREnvelope   z&Represent the OGREnvelope C Structure.MinXMaxXMinYMaxY N)__name__
__module____qualname____firstlineno____doc__r   _fields___static_attributes__r       R/var/www/html/env/lib/python3.13/site-packages/django/contrib/gis/gdal/envelope.pyr   r      s,    ,					Hr   r   c                       \ rS rSrSrS rS rS rS rS r	\
S 5       r\
S	 5       r\
S
 5       r\
S 5       r\
S 5       r\
S 5       r\
S 5       r\
S 5       rSrg)Envelope    z
The Envelope object is a C structure that contains the minimum and
maximum X, Y coordinates for a rectangle bounding box.  The naming
of the variables is compatible with the OGR Envelope structure.
c                    [        U5      S:X  a  [        US   [        5      (       a  US   U l        O[        US   [        [
        45      (       aA  [        US   5      S:w  a  [        S[        US   5      -  5      eU R                  US   5        Ol[        S[        US   5      -  5      e[        U5      S:X  a,  U R                  U Vs/ s H  n[        U5      PM     sn5        O[        S[        U5      -  5      eU R                  U R                  :  a  [        S5      eU R                  U R                  :  a  [        S5      eg	s  snf )
zt
The initialization function may take an OGREnvelope structure, 4-element
tuple or list, or 4 individual arguments.
   r      (Incorrect number of tuple elements (%d).Incorrect type of argument: %s#Incorrect number (%d) of arguments.zEnvelope minimum X > maximum X.zEnvelope minimum Y > maximum Y.N)len
isinstancer   	_envelopetuplelistr   _from_sequence	TypeErrortypefloatmin_xmax_xmin_ymax_y)selfargsas      r   __init__Envelope.__init__'   s!    t9>$q';//!%aDGeT]33tAw<1$'BSa\Q  ''Q0 @4Q= PQQY!^ 4 84aq4 89 ED	 QRR ::

" ABB::

" ABB # !9s   
E	c                 6   [        U[        5      (       ay  U R                  UR                  :H  =(       aY    U R                  UR                  :H  =(       a9    U R                  UR                  :H  =(       a    U R
                  UR
                  :H  $ [        U[        5      (       al  [        U5      S:X  a]  U R                  US   :H  =(       aD    U R                  US   :H  =(       a+    U R                  US   :H  =(       a    U R
                  US   :H  $ [        S5      e)z`
Return True if the envelopes are equivalent; can compare against
other Envelopes and 4-tuples.
r   r   r         z4Equivalence testing only works with other Envelopes.)	r!   r   r)   r+   r*   r,   r#   r    r   )r-   others     r   __eq__Envelope.__eq__H   s    
 eX&&u{{* 0ZZ5;;.0ZZ5;;.0 ZZ5;;.	 u%%#e*/uQx' -ZZ58+-ZZ58+- ZZ58+	   VWWr   c                 ,    [        U R                  5      $ )z,Return a string representation of the tuple.)strr#   r-   s    r   __str__Envelope.__str__^   s    4::r   c                     [        5       U l        US   U R                  l        US   U R                  l        US   U R                  l        US   U R                  l        g)z@Initialize the C OGR Envelope structure from the given sequence.r   r   r3   r4   N)r   r"   r	   r   r
   r   )r-   seqs     r   r%   Envelope._from_sequenceb   sK    $!!f!!f!!f!!fr   c                    [        U5      S:X  Ga  [        US   [        5      (       a  U R                  US   R                  5      $ [        US   S5      (       a\  [        US   S5      (       aH  U R                  US   R                  US   R                  US   R                  US   R                  5      $ [        US   [        [        45      (       Ga  [        US   5      S:X  a-  U R                  US   S   US   S   US   S   US   S   45      $ [        US   5      S:X  a  US   u  p#pEX R                  R                  :  a  X R                  l
        X0R                  R                  :  a  X0R                  l        X@R                  R                  :  a  X@R                  l        XPR                  R                  :  a  XPR                  l        g
g
[        S[        US   5      -  5      e[        S[!        US   5      -  5      e[        U5      S:X  a!  U R                  US   US   US   US   45      $ [        U5      S:X  a  U R                  U5      $ [        S	[        US   5      -  5      e)z~
Modify the envelope to expand to include the boundaries of
the passed-in 2-tuple (a point), 4-tuple (an extent) or
envelope.
r   r   xyr3   r   r   r   r   N)r    r!   r   expand_to_includer#   hasattrrA   rB   r$   r"   r	   r   r
   r   r   r&   r'   )r-   r.   minxminymaxxmaxys         r   rC   Envelope.expand_to_includej   s.    t9>$q'8,,--d1gmm<<a#&&747C+@+@--GIItAwyy$q'))T!WYY  DGeT]33tAw<1$11aT!WQZaT!WQZH  a\Q&/3Aw,Tnn111.2+nn111.2+nn111.2+nn111.2+ 2 (BSa\Q    @4Q= PQQY!^))47DGT!Wd1g*NOOY!^))$// EDQRG TUUr   c                 .    U R                   R                  $ )z-Return the value of the minimum X coordinate.)r"   r	   r:   s    r   r)   Envelope.min_x        ~~"""r   c                 .    U R                   R                  $ )z-Return the value of the minimum Y coordinate.)r"   r   r:   s    r   r+   Envelope.min_y   rL   r   c                 .    U R                   R                  $ )z-Return the value of the maximum X coordinate.)r"   r
   r:   s    r   r*   Envelope.max_x   rL   r   c                 .    U R                   R                  $ )z-Return the value of the maximum Y coordinate.)r"   r   r:   s    r   r,   Envelope.max_y   rL   r   c                 2    U R                   U R                  4$ )z"Return the upper-right coordinate.)r*   r,   r:   s    r   urEnvelope.ur        

DJJ''r   c                 2    U R                   U R                  4$ )z!Return the lower-left coordinate.)r)   r+   r:   s    r   llEnvelope.ll   rV   r   c                 ^    U R                   U R                  U R                  U R                  4$ )z)Return a tuple representing the envelope.)r)   r+   r*   r,   r:   s    r   r#   Envelope.tuple   s#     

DJJ

DJJ??r   c                     SU R                   < SU R                  < SU R                   < SU R                  < SU R                  < SU R                  < SU R                  < SU R                  < SU R                   < SU R                  < S3$ )z4Return WKT representing a Polygon for this envelope.z	POLYGON(( ,z)))r)   r+   r,   r*   r:   s    r   wktEnvelope.wkt   sT    
 JJJJJJJJJJJJJJJJJJJJ
 	
r   )r"   N)r   r   r   r   r   r0   r6   r;   r%   rC   propertyr)   r+   r*   r,   rT   rX   r#   r_   r   r   r   r   r   r       s    CBX,%.V` # # # # # # # # ( ( ( ( @ @ 
 
r   r   N)r   ctypesr   r   django.contrib.gis.gdal.errorr   r   r   r   r   r   <module>rd      s*    ' 7) l
 l
r   