
    _ hs                     v    d Z ddlZddlmZ ddlmZ dgZ G d de      Zeej                  j                  d<   y)z.Collections of polygons and related utilities.    N)polygon)BaseMultipartGeometryMultiPolygonc                   4    e Zd ZdZg ZddZed        ZddZy)r   a  A collection of one or more Polygons.

    If component polygons overlap the collection is invalid and some
    operations on it may fail.

    Parameters
    ----------
    polygons : sequence
        A sequence of Polygons, or a sequence of (shell, holes) tuples
        where shell is the sequence representation of a linear ring
        (see LinearRing) and holes is a sequence of such linear rings.

    Attributes
    ----------
    geoms : sequence
        A sequence of `Polygon` instances

    Examples
    --------
    Construct a MultiPolygon from a sequence of coordinate tuples

    >>> from shapely import MultiPolygon, Polygon
    >>> ob = MultiPolygon([
    ...     (
    ...     ((0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (1.0, 0.0)),
    ...     [((0.1,0.1), (0.1,0.2), (0.2,0.2), (0.2,0.1))]
    ...     )
    ... ])
    >>> len(ob.geoms)
    1
    >>> type(ob.geoms[0]) == Polygon
    True

    Nc                 \   |t        j                  d      S t        |t              r|S t	        |d|      }|D cg c]  }|s|	 }}t        |      }|dk(  rt        j                  d      S t        d |D              rt        d      g }t        |      D ]y  }||   }t        |t        j                        s2|d   }t        |      dkD  r|d   }nd}t        j                  ||      }nt        j                  |      }|j                  |       { t        j                  |      S c c}w )z#Create a new MultiPolygon geometry.NzMULTIPOLYGON EMPTYgeomsr   c              3   <   K   | ]  }t        |t                y wN)
isinstancer   ).0ps     y/home/developers/rajanand/mypropertyqr-fmb-refixing-v2/venv/lib/python3.12/site-packages/shapely/geometry/multipolygon.py	<genexpr>z'MultiPolygon.__new__.<locals>.<genexpr>E   s     =qz!\*=s   z3Sequences of multi-polygons are not valid arguments   )shapelyfrom_wktr   r   getattrlenany
ValueErrorranger   Polygonappendmultipolygons)	selfpolygonsr   Lsubsiobshellholess	            r   __new__zMultiPolygon.__new__0   s     ##$899,/O8Wh7'-!1A--M 6##$899 =H==RSSq 	A!Bb'//21r7Q;qEE EOOE51OOB'KKN	 $$T**7 .s   D)D)c                 0   g }| j                   D ]  }g }|j                  t        |j                  j                               |j
                  D ]&  }|j                  t        |j                               ( |j                  t        |              d|dS )z;Return a GeoJSON-like mapping of the MultiPolygon geometry.r   )typecoordinates)r   r   tupleexteriorcoords	interiors)r   	allcoordsgeomr)   holes        r   __geo_interface__zMultiPolygon.__geo_interface__X   s     	JJ 	,DFMM% 4 456 2eDKK012U6]+	, 'yAA    c                     | j                   ry| j                  rdndddj                  fd| j                  D              z   dz   S )a  Return group of SVG path elements for the MultiPolygon geometry.

        Parameters
        ----------
        scale_factor : float
            Multiplication factor for the SVG stroke-width.  Default is 1.
        fill_color : str, optional
            Hex string for fill color. Default is to use "#66cc99" if
            geometry is valid, and "#ff3333" if invalid.
        opacity : float
            Float number between 0 and 1 for color opacity. Default value is 0.6

        z<g />z#66cc99z#ff3333z<g> c              3   D   K   | ]  }|j                          y wr
   )svg)r   r   
fill_coloropacityscale_factors     r   r   z#MultiPolygon.svg.<locals>.<genexpr>x   s     S1aeeL*g>Ss    z</g>)is_emptyis_validjoinr   )r   r6   r4   r5   s    ```r   r3   zMultiPolygon.svgd   sN     ==&*mmJggS

SST	
r/   r
   )g      ?NN)	__name__
__module____qualname____doc__	__slots__r#   propertyr.   r3    r/   r   r   r   
   s0    !F I&+P 	B 	B
r/      )
r=   r   shapely.geometryr   shapely.geometry.baser   __all__r   libregistryr@   r/   r   <module>rG      s?    4  $ 7
p
( p
f '  Q r/   