Ë
    £èh…N  ã                  ó  — U d dl mZ d dlmZmZmZmZmZmZm	Z	m
Z
 d dlmZmZ d dlZd dlZd dlmZmZ d dlmZmZ d dlmZmZ dd	lmZ dd
lmZmZmZmZ ddl m!Z! ddl"m#Z# ddgZ$dZ% G d„ de«      Z&dZ'dZ(dZ)dZ*dZ+ G d„ de&«      Z,ed%d&d„«       Z-ee.e/e.gee.ef   f   Z0de1d<   eege
e/e/f   f   Z2de1d<   e	e
e/e/f      Z3de1d<   e	e3   Z4de1d<   d'd„Z5d(d„Z6d)d*d „Z7 G d!„ de&«      Z8d+d"„Z9	 	 	 	 	 	 	 	 	 	 d,d#„Z:	 	 	 	 	 	 	 	 d-d$„Z;y).é    )Úannotations)ÚIterableÚSequenceÚno_type_checkÚAnyÚCallableÚDictÚListÚTuple)Ú	TypeAliasÚoverrideN)ÚVec2Úworld_mercator_to_gps)ÚCommandÚnesting)Úorient_pathsÚsingle_pathsé   )ÚColor)ÚBackendInterfaceÚBkPath2dÚ
BkPoints2dÚ	ImageData)ÚConfiguration)ÚBackendPropertiesÚCustomJSONBackendÚGeoJSONBackenda~  
JSON content = [entity, entity, ...]

entity = {
    "type": point | lines | path | filled-paths | filled-polygon,
    "properties": {
        "color": "#RRGGBBAA",
        "stroke-width": 0.25, # in mm
        "layer": "name"
    },
    "geometry": depends on "type"
}
DXF linetypes (DASH, DOT, ...) are resolved into solid lines.

A single point:
point = {
    "type": "point",
    "properties": {...},
    "geometry": [x, y]
}

Multiple lines with common properties:
lines = {
    "type": "lines",
    "properties": {...},
    "geometry": [
        (x0, y0, x1, y1),  # 1. line
        (x0, y0, x1, y1),  # 2. line
        ....
    ]
}
Lines can contain points where x0 == x1 and y0 == y1!

A single linear path without filling:
path = {
    "type": "path",
    "properties": {...},
    "geometry": [path-command, ...]
}

SVG-like path structure:
- The first path-command is always an absolute move to "M"
- The "M" command does not appear inside a path, each path is a continuouse geometry 
  (no multi-paths).

path-command = 
    ("M", x, y) = absolute move to
    ("L", x, y) = absolute line to
    ("Q", x0, y0, x1, y1) = absolute quadratice Bezier curve to
    - (x0, y0) = control point
    - (x1, y1) = end point
    ("C", x0, y0, x1, y1, x2, y2) = absolute cubic Bezier curve to
    - (x0, y0) = control point 1
    - (x1, y1) = control point 2
    - (x2, y2) = end point
    ("Z",) = close path

Multiple filled paths:

Exterior paths and holes are mixed and NOT oriented by default (clockwise or 
counter-clockwise) - PyQt and SVG have no problem with that structure but matplotlib 
requires oriented paths.  When oriented paths are required the CustomJSONBackend can 
orient the paths on demand.

filled-paths = {
    "type": "filled-paths",
    "properties": {...},
    "geometry": [
        [path-command, ...],  # 1. path
        [path-command, ...],  # 2. path  
        ...
    ]
}

A single filled polygon:
A polygon is explicitly closed, so first vertex == last vertex is guaranteed.
filled-polygon = {
    "type": "filled-polygon",
    "properties": {...},
    "geometry": [
        (x0, y0),
        (x1, y1),
        (x2, y2),
        ...
    ]
}

c                  óÆ   — e Zd Zdd„Zej
                  dd„«       Zddœdd„Zedd„«       Z	edd„«       Z
edd„«       Zedd	„«       Zedd
„«       Zedd„«       Zedd„«       Zy)Ú_JSONBackendc                óJ   — g | _         d| _        d| _        d| _        d| _        y )Ng{®Gáz„?çš™™™™™©?g      ð?ç        )Ú	_entitiesÚmax_sagittaÚmin_lineweightÚlineweight_scalingÚfixed_lineweight©Úselfs    ú9lib/python3.12/site-packages/ezdxf/addons/drawing/json.pyÚ__init__z_JSONBackend.__init__p   s+   € Ø/1ˆŒØˆÔØ"ˆÔØ"%ˆÔð !$ˆÕó    c                 ó   — y ©N© r(   s    r*   Úget_json_dataz_JSONBackend.get_json_dataz   s   € Ø$'r,   é   ©Úindentc               óL   — t        j                  | j                  «       |¬«      S )z$Returns the result as a JSON string.r2   )ÚjsonÚdumpsr0   )r)   r3   s     r*   Ú
get_stringz_JSONBackend.get_string|   s   € ä�z‰z˜$×,Ñ,Ó.°vÔ>Ð>r,   c                óæ   — |j                   r#|j                   dz  dz  }t        d|«      | _         |j                  | _        | j                  dk(  r| j                   | _        |j                  | _        y )Ngffffff9@i,  r!   r"   )r%   Úmaxr&   r'   Úmax_flattening_distancer$   )r)   ÚconfigÚmin_lineweight_mms      r*   Ú	configurez_JSONBackend.configure€   si   € à× Ò à &× 5Ñ 5¸Ñ <¸sÑ BÐÜ"% dÐ,=Ó">ˆDÔØ"(×";Ñ";ˆÔØ×"Ñ" cÒ)à$(×$7Ñ$7ˆDÔ!Ø!×9Ñ9ˆÕr,   c                ó8   — | j                   j                  «        y r.   )r#   Úclearr(   s    r*   r?   z_JSONBackend.clearŒ   s   € à�‰×ÑÕr,   c                 ó   — y r.   r/   )r)   Ú
image_dataÚ
propertiess      r*   Ú
draw_imagez_JSONBackend.draw_image�   ó   € àr,   c                 ó   — y r.   r/   )r)   Úcolors     r*   Úset_backgroundz_JSONBackend.set_background”   rD   r,   c                 ó   — y r.   r/   r(   s    r*   Úfinalizez_JSONBackend.finalize˜   rD   r,   c                 ó   — y r.   r/   )r)   ÚentityrB   s      r*   Úenter_entityz_JSONBackend.enter_entityœ   rD   r,   c                 ó   — y r.   r/   )r)   rK   s     r*   Úexit_entityz_JSONBackend.exit_entity    rD   r,   N©ÚreturnÚNone)rP   r   )r3   z	int | strrP   Ústr)r;   r   rP   rQ   )rA   r   rB   r   rP   rQ   )rF   r   rP   rQ   )Ú__name__Ú
__module__Ú__qualname__r+   ÚabcÚabstractmethodr0   r7   r   r=   r?   rC   rG   rI   rL   rN   r/   r,   r*   r   r   o   s±   „ ó$ð 	×ÑÚ'ó Ø'Ø01õ ?ð ò	:ó ð	:ð òó ðð òó ðð òó ðð òó ðð òó ðð òó ñr,   r   ÚMÚLÚQÚCÚZc                  óä   ‡ — e Zd ZdZddˆ fd„Zedd„«       Z	 	 	 	 	 	 dd„Zdd„Zedd„«       Z	edd„«       Z
e	 	 	 	 	 	 dd„«       Zedd	„«       Ze	 	 	 	 	 	 dd
„«       Ze	 	 	 	 	 	 dd„«       Zˆ xZS )r   a²  Creates a JSON-like output with a custom JSON scheme.  This scheme supports
    curved shapes by a SVG-path like structure and coordinates are not limited in
    any way.  This backend can be used to send geometries from a web-backend to a
    frontend.

    The JSON scheme is documented in the source code:

    https://github.com/mozman/ezdxf/blob/master/src/ezdxf/addons/drawing/json.py

    Args:
        orient_paths: orient exterior and hole paths on demand, exterior paths have
            counter-clockwise orientation and holes have clockwise orientation.

    **Class Methods**

    .. automethod:: get_json_data

    .. automethod:: get_string

    .. versionadded:: 1.3.0

    c                ó0   •— t         ‰| �  «        || _        y r.   )Úsuperr+   r   )r)   r   Ú	__class__s     €r*   r+   zCustomJSONBackend.__init__Ä   s   ø€ Ü‰ÑÔØ(ˆÕr,   c                ó   — | j                   S )z1Returns the result as a JSON-like data structure.)r#   r(   s    r*   r0   zCustomJSONBackend.get_json_dataÈ   s   € ð �~‰~Ðr,   c                óf   — |sy | j                   j                  || j                  |«      |dœ«       y )N©ÚtyperB   Úgeometry)r#   ÚappendÚmake_properties_dict)r)   Úentity_typere   rB   s       r*   Ú
add_entityzCustomJSONBackend.add_entityÍ   s5   € ñ ØØ�‰×Ñà#Ø"×7Ñ7¸
ÓCØ$ñõ	
r,   c                óÖ   — | j                   r| j                   }n-t        | j                  |j                  | j                  z  «      }|j
                  t        |d«      |j                  dœS )Nr1   ©rF   zstroke-widthÚlayer©r'   r9   r%   Ú
lineweightr&   rF   Úroundrl   ©r)   rB   Ústroke_widths      r*   rg   z&CustomJSONBackend.make_properties_dictÚ   sd   € Ø× Ò Ø×0Ñ0‰LäØ×#Ñ# Z×%:Ñ%:¸T×=TÑ=TÑ%TóˆLð  ×%Ñ%Ü! ,°Ó2Ø×%Ñ%ñ
ð 	
r,   c                óV   — | j                  d|j                  |j                  g|«       y )NÚpoint©ri   ÚxÚy©r)   ÚposrB   s      r*   Ú
draw_pointzCustomJSONBackend.draw_pointç   s   € à�‰˜ #§%¡%¨¯© °Õ<r,   c                ó„   — | j                  d|j                  |j                  |j                  |j                  fg|«       y )NÚlinesrt   )r)   ÚstartÚendrB   s       r*   Ú	draw_linezCustomJSONBackend.draw_lineë   s.   € à�‰˜ 5§7¡7¨E¯G©G°S·U±U¸C¿E¹EÐ"BÐ!CÀZÕPr,   c                óè   — t        |«      }t        |«      dk(  ry | j                  d|D ��cg c]3  \  }}|j                  |j                  |j                  |j                  f‘Œ5 c}}|«       y c c}}w )Nr   r{   )ÚlistÚlenri   ru   rv   )r)   r{   rB   ÚsÚes        r*   Údraw_solid_linesz"CustomJSONBackend.draw_solid_linesï   sZ   € ô �U“ˆÜˆu‹:˜Š?ØØ�‰˜Á5Ô!IÁ5¹4¸1¸a 1§3¡3¨¯©¨Q¯S©S°!·#±#Ò"6À5Ò!IÈ:ÕVùÓ!Is   ¬8A.c                ó<   — | j                  dt        |«      |«       y )NÚpath)ri   Úmake_json_path)r)   r†   rB   s      r*   Ú	draw_pathzCustomJSONBackend.draw_pathø   s   € à�‰˜¤¨tÓ 4°jÕAr,   c                ó  — t        |«      }t        |«      dk(  ry | j                  rt        |«      }nt        |«      }g }|D ]*  }t        |«      sŒ|j	                  t        |d¬«      «       Œ, |r| j                  d||«       y y )Nr   T)Úclosezfilled-paths)r€   r�   r   r   rf   r‡   ri   )r)   ÚpathsrB   Ú
json_pathsr†   s        r*   Údraw_filled_pathsz#CustomJSONBackend.draw_filled_pathsü   s   € ô �U“ˆÜˆu‹:˜Š?ØØ×ÒÜ  Ó'‰Eô ! Ó'ˆEØ "ˆ
ÛˆDÜ�4�yØ×!Ñ!¤.°¸TÔ"BÕCð ñ Ø�O‰O˜N¨J¸
ÕCð r,   c                ó  — |j                  «       }t        |«      dk  ry |d   j                  |d   «      s|j                  |d   «       | j	                  d|D �cg c]  }|j
                  |j                  f‘Œ c}|«       y c c}w )Né   r   éÿÿÿÿzfilled-polygon)Úverticesr�   Úiscloserf   ri   ru   rv   )r)   ÚpointsrB   r‘   Úvs        r*   Údraw_filled_polygonz%CustomJSONBackend.draw_filled_polygon  st   € ð  &Ÿ™Ó0ˆÜˆx‹=˜1ÒØØ˜‰{×"Ñ" 8¨B¡<Ô0Ø�O‰O˜H Q™KÔ(Ø�‰Ð(¹xÓ*H¹x¸!¨A¯C©C°·±ª:¸xÑ*HÈ*ÕUùÒ*Hs   ÁB
©FrO   )rP   zlist[dict[str, Any]])rh   rR   re   zSequence[Any]rB   r   )rB   r   rP   údict[str, Any]©rx   r   rB   r   rP   rQ   ©r|   r   r}   r   rB   r   rP   rQ   ©r{   zIterable[tuple[Vec2, Vec2]]rB   r   rP   rQ   ©r†   r   rB   r   rP   rQ   ©r‹   zIterable[BkPath2d]rB   r   rP   rQ   ©r“   r   rB   r   rP   rQ   )rS   rT   rU   Ú__doc__r+   r   r0   ri   rg   ry   r~   r„   rˆ   r�   r•   Ú__classcell__©r`   s   @r*   r   r   ¬   s  ø„ ñö.)ð òó ðð
Øð
Ø*7ð
ØEVó
ó
ð ò=ó ð=ð òQó ðQð ðWØ0ðWØ>OðWà	òWó ðWð òBó ðBð ðDØ'ðDØ5FðDà	òDó ðDð$ ðVØ ðVØ.?ðVà	òVó ôVr,   c           
     ó  — t        | «      dk(  rg S | j                  }t        |j                  |j                  fg}| j                  «       D �]Ÿ  }|j                  }|j                  t        j                  k(  r-|j                  t        |j                  |j                  f«       ŒZ|j                  t        j                  k(  r-|j                  t        |j                  |j                  f«       Œ¤|j                  t        j                  k(  rP|j                  }|j                  t        |j                  |j                  |j                  |j                  f«       �Œ|j                  t        j                   k(  s�Œ0|j"                  }|j$                  }|j                  t&        |j                  |j                  |j                  |j                  |j                  |j                  f«       �Œ¢ |r|j                  t(        «       |S )Nr   )r�   r|   ÚMOVE_TO_ABSru   rv   Úcommandsr}   rd   r   ÚMOVE_TOrf   ÚLINE_TOÚLINE_TO_ABSÚ	CURVE3_TOÚctrlÚQUAD_TO_ABSÚ	CURVE4_TOÚctrl1Úctrl2ÚCUBIC_TO_ABSÚ
CLOSE_PATH)r†   rŠ   r}   r£   ÚcmdÚc1Úc2s          r*   r‡   r‡     sP  € ä
ˆ4ƒy�A‚~Øˆ	Ø—
‘
€CÜ" C§E¡E¨3¯5©5Ð1Ð2€HØ�}‰}�ˆØ�g‰gˆØ�8‰8”w—‘Ò&Ø�O‰Oœ[¨#¯%©%°·±Ð7Õ8Ø�X‰XœŸ™Ò(Ø�O‰Oœ[¨#¯%©%°·±Ð7Õ8Ø�X‰Xœ×*Ñ*Ò*Ø—‘ˆBØ�O‰Oœ[¨"¯$©$°·±°c·e±e¸S¿U¹UÐCÖDØ�X‰Xœ×*Ñ*Ô*Ø—‘ˆBØ—‘ˆBØ�O‰Oœ\¨2¯4©4°·±°r·t±t¸R¿T¹TÀ3Ç5Á5È#Ï%É%ÐPÖQð ñ Ø�‰œ
Ô#Ø€Or,   r   ÚPropertiesMakerÚTransformFuncÚRingÚGeoJsonPolygonc                ó"   — | t        |d«      |dœS )a  Returns the property dict::

        {
            "color": color,
            "stroke-width": stroke_width,
            "layer": layer,
        }

    Returning an empty dict prevents properties in the GeoJSON output and also avoids
    wraping entities into "Feature" objects.
    r1   rk   )ro   )rF   rq   rl   s      r*   Úproperties_makerr·   >  s   € ð Ü˜l¨AÓ.Øñð r,   c                ó2   — | j                   | j                  fS )zsDummy transformation function.  Does not apply any transformations and
    just returns the input coordinates.
    )ru   rv   )Úlocations    r*   Úno_transformrº   Q  s   € ð �J‰J˜Ÿ
™
Ð#Ð#r,   c                ó   ‡ — dˆ fd„}|S )aG  Returns a function to transform WGS84 World Mercator `EPSG:3395 <https://epsg.io/3395>`_
    location given as cartesian 2D coordinates x, y in meters into WGS84 decimal
    degrees as longitude and latitude `EPSG:4326 <https://epsg.io/4326>`_ as
    used by GPS.

    Args:
        tol: accuracy for latitude calculation

    c                óF   •— t        | j                  | j                  ‰«      S )zITransforms WGS84 World Mercator EPSG:3395 coordinates to WGS84 EPSG:4326.)r   ru   rv   )r¹   Útols    €r*   Ú
_transformz7make_world_mercator_to_gps_function.<locals>._transformc  s   ø€ ä$ X§Z¡Z°·±¸SÓAÐAr,   ©r¹   r   rP   ztuple[float, float]r/   )r½   r¾   s   ` r*   Ú#make_world_mercator_to_gps_functionrÀ   X  s   ø€ õBð Ðr,   c                  óæ   ‡ — e Zd ZdZeef	 	 	 	 	 dˆ fd„Zedd„«       Zdd„Z	dd„Z
edd„«       Zedd„«       Ze	 	 	 	 	 	 dd„«       Zedd	„«       Ze	 	 	 	 	 	 dd
„«       Ze	 	 	 	 	 	 dd„«       Zˆ xZS )r   a1  Creates a JSON-like output according the `GeoJSON`_ scheme.
    GeoJSON uses a geographic coordinate reference system, World Geodetic
    System 1984 `EPSG:4326 <https://epsg.io/4326>`_, and units of decimal degrees.

    - Latitude: -90 to +90 (South/North)
    - Longitude: -180 to +180 (East/West)

    So most DXF files will produce invalid coordinates and it is the job of the
    **package-user** to provide a function to transfrom the input coordinates to
    EPSG:4326!  The :class:`~ezdxf.addons.drawing.recorder.Recorder` and
    :class:`~ezdxf.addons.drawing.recorder.Player` classes can help to detect the
    extents of the DXF content.

    Default implementation:

    .. autofunction:: no_transform

    Factory function to make a transform function from WGS84 World Mercator
    `EPSG:3395 <https://epsg.io/3395>`_  coordinates to WGS84 (GPS) 
    `EPSG:4326 <https://epsg.io/4326>`_.

    .. autofunction:: make_world_mercator_to_gps_function

    The GeoJSON format supports only straight lines so curved shapes are flattened to
    polylines and polygons.

    The properties are handled as a foreign member feature and is therefore not defined
    in the GeoJSON specs.  It is possible to provide a custom function to create these
    property objects.

    Default implementation:

    .. autofunction:: properties_maker


    Args:
        properties_maker: function to create a properties dict.

    **Class Methods**

    .. automethod:: get_json_data

    .. automethod:: get_string

    .. versionadded:: 1.3.0
    
    .. _GeoJSON: https://geojson.org/
    c                ó>   •— t         ‰| �  «        || _        || _        y r.   )r_   r+   Ú_properties_dict_makerÚ_transform_function)r)   r·   Útransform_funcr`   s      €r*   r+   zGeoJSONBackend.__init__›  s    ø€ ô
 	‰ÑÔØ&6ˆÔ#Ø#1ˆÕ r,   c                ó    — t        | j                  «      dk(  ri S | j                  d   d   dk(  }|rd| j                  dœS d| j                  dœS )zMReturns the result as a JSON-like data structure according the GeoJSON specs.r   rd   ÚFeatureÚFeatureCollection)rd   ÚfeaturesÚGeometryCollection)rd   Ú
geometries)r�   r#   )r)   Úusing_featuress     r*   r0   zGeoJSONBackend.get_json_data¤  sS   € ô ˆt�~‰~Ó !Ò#ØˆIØŸ™¨Ñ*¨6Ñ2°iÑ?ˆÙØ/¸T¿^¹^ÑLÐLà0ÀÇÁÑOÐOr,   c                óÀ   — |sy  | j                   | j                  |«      Ž }|r | j                  j                  d||dœ«       y | j                  j                  |«       y )NrÇ   rc   )rÃ   Úmake_propertiesr#   rf   )r)   rK   rB   Úproperties_dicts       r*   ri   zGeoJSONBackend.add_entity¯  sa   € ÙØØ*E¨$×*EÑ*EØ×!Ñ! *Ó-ð+
ˆñ Ø�N‰N×!Ñ!à%Ø"1Ø &ñõð �N‰N×!Ñ! &Õ)r,   c                óÔ   — | j                   r| j                   }n-t        | j                  |j                  | j                  z  «      }|j
                  t        |d«      |j                  fS )Nr1   rm   rp   s      r*   rÎ   zGeoJSONBackend.make_propertiesÀ  s^   € Ø× Ò Ø×0Ñ0‰LäØ×#Ñ# Z×%:Ñ%:¸T×=TÑ=TÑ%TóˆLð × Ñ ¤%¨°aÓ"8¸*×:JÑ:JÐKÐKr,   c           
     ól   — | j                  t        dt        | j                  |«      «      «      |«       y )NÚPoint)ri   Úgeojson_objectr€   rÄ   rw   s      r*   ry   zGeoJSONBackend.draw_pointÉ  s*   € à�‰Ü˜7¤D¨×)AÑ)AÀ#Ó)FÓ$GÓHÈ*õ	
r,   c           	     óp   — | j                   }| j                  t        d ||«       ||«      g«      |«       y )NÚ
LineString)rÄ   ri   rÓ   )r)   r|   r}   rB   Útfs        r*   r~   zGeoJSONBackend.draw_lineÏ  s3   € à×%Ñ%ˆØ�‰Ü˜<©"¨U«)±R¸³WÐ)=Ó>Øõ	
r,   c                óØ   — t        |«      }t        |«      dk(  ry | j                  }|D ��cg c]  \  }} ||«       ||«      f‘Œ }}}| j                  t	        d|«      |«       y c c}}w )Nr   ÚMultiLineString)r€   r�   rÄ   ri   rÓ   )r)   r{   rB   rÖ   r‚   rƒ   Ú
json_liness          r*   r„   zGeoJSONBackend.draw_solid_lines×  se   € ô �U“ˆÜˆu‹:˜Š?ØØ×%Ñ%ˆÙ16Ô7±©¨¨A‘r˜!“u™b ›e’n°ˆ
Ñ7Ø�‰œÐ'8¸*ÓEÀzÕRùó 8s   ¬A&c                óÚ   — t        |«      dk(  ry | j                  }|j                  | j                  ¬«      D �cg c]
  } ||«      ‘Œ }}| j	                  t        d|«      |«       y c c}w )Nr   )ÚdistancerÕ   )r�   rÄ   Ú
flatteningr$   ri   rÓ   )r)   r†   rB   rÖ   r”   r‘   s         r*   rˆ   zGeoJSONBackend.draw_pathâ  sa   € äˆt‹9˜Š>ØØ×%Ñ%ˆØ#'§?¡?¸D×<LÑ<L ?Ô#MÓNÑ#M˜a‘B�q•EÐ#MˆÐNØ�‰œ |°XÓ>À
ÕKùò Os   ºA(c                ó  — t        |«      }t        |«      dk(  ry g }|D ]?  }t        |«      sŒ|j                  t        || j                  | j
                  ¬«      «       ŒA |r| j                  t        d|«      |«       y y )Nr   )r$   rÖ   ÚMultiPolygon)r€   r�   ÚextendÚgeojson_polygonsr$   rÄ   ri   rÓ   )r)   r‹   rB   Úpolygonsr†   s        r*   r�   z GeoJSONBackend.draw_filled_pathsê  sw   € ô �U“ˆÜˆu‹:˜Š?Øà)+ˆÛˆDÜ�4�yØ—‘Ü$Ø¨$×*:Ñ*:¸t×?WÑ?Wôõð ñ Ø�O‰OœN¨>¸8ÓDÀjÕQð r,   c                ó  — |j                  «       }t        |«      dk  ry |d   j                  |d   «      s|j                  |d   «       | j                  }| j                  t        d|D �cg c]
  } ||«      ‘Œ c}g«      |«       y c c}w )Nr�   r   r�   ÚPolygon)r‘   r�   r’   rf   rÄ   ri   rÓ   )r)   r“   rB   r‘   rÖ   r”   s         r*   r•   z"GeoJSONBackend.draw_filled_polygoný  s�   € ð  &Ÿ™Ó0ˆÜˆx‹=˜1ÒØØ˜‰{×"Ñ" 8¨B¡<Ô0Ø�O‰O˜H Q™KÔ(à×%Ñ%ˆØ�‰Ü˜9±xÓ'@±x°!©¨1­°xÑ'@Ð&AÓBÀJõ	
ùÚ'@s   Á,B	)r·   r²   rÅ   r³   rP   rQ   )rP   r—   )rK   r—   rB   r   )rB   r   rP   ztuple[str, float, str]r˜   r™   rš   r›   rœ   r�   )rS   rT   rU   rž   r·   rº   r+   r   r0   ri   rÎ   ry   r~   r„   rˆ   r�   r•   rŸ   r    s   @r*   r   r   i  s  ø„ ñ/ðf -=Ø(4ð2à)ð2ð &ð2ð 
õ	2ð òPó ðPó*ó"Lð ò
ó ð
ð
 ò
ó ð
ð ðSØ0ðSØ>OðSà	òSó ðSð òLó ðLð ðRØ'ðRØ5FðRà	òRó ðRð$ ð
Ø ð
Ø.?ð
à	ò
ó ô
r,   c                ó   — | |dœS )N)rd   Úcoordinatesr/   )Únamerå   s     r*   rÓ   rÓ     s   € Ø¨Ñ5Ð5r,   c                ó4  — | j                   rt        d«      ‚| j                  |«      D �cg c]
  } ||«      ‘Œ }}| j                  s#| j                  }|j                   ||«      «       | j                  «       }|r|r|s|r|j                  «        |S c c}w )a#  Returns a linear ring according to the GeoJSON specs.

    -  A linear ring is a closed LineString with four or more positions.
    -  The first and last positions are equivalent, and they MUST contain
       identical values; their representation SHOULD also be identical.
    -  A linear ring is the boundary of a surface or the boundary of a
       hole in a surface.
    -  A linear ring MUST follow the right-hand rule with respect to the
       area it bounds, i.e., exterior rings are counterclockwise, and
       holes are clockwise.

    zmulti-paths not allowed)Úhas_sub_pathsÚ	TypeErrorrÜ   Ú	is_closedr|   rf   Úhas_clockwise_orientationÚreverse)r†   Úis_holer$   rÖ   r”   r‘   r|   Ú	clockwises           r*   Úgeojson_ringrï     sŠ   € ð ×ÒÜÐ1Ó2Ð2Ø%)§_¡_°[Ô%AÓBÑ%A ‘b˜•eÐ%A€HÐBØ�>Š>Ø—
‘
ˆØ�‰™˜5›	Ô"Ø×.Ñ.Ó0€IÙ™	©7±yØ×ÑÔØ€Oùò Cs   «Bc           
     ó6  — | j                  «       }t        |«      dk(  rg S t        |«      dk(  rt        |d   d||«      ggS t        j                  |«      }g }|D ]»  }t        |d   d||«      g}t        |«      dkD  rˆ|d   }t        |t        «      r|j                  t        |d||«      «       ŒVt        |t        t        f«      r?|D ]:  }	t        |	t        t        f«      r|	d   }	|j                  t        |	d||«      «       Œ< |j                  |«       Œ½ |S )z¢Returns a list of polygons, where each polygon is a list of an exterior path and
    optional holes e.g. [[ext0, hole0, hole1], [ext1], [ext2, hole0], ...].

    r   r   FT)
Ú	sub_pathsr�   rï   r   Úmake_polygon_structureÚ
isinstancer   rf   Útupler€   )
r†   r$   rÖ   rñ   rá   rà   ÚpolygonÚgeojson_polygonÚholesÚholes
             r*   rà   rà   ,  s!  € ð !%§¡Ó 0€IÜ
ˆ9ƒ~˜ÒØˆ	Ü
ˆ9ƒ~˜ÒÜ˜i¨™l¨E°;ÀÓCÐDÐEÐEä×-Ñ-¨iÓ8€HØ-/ÐÛˆä˜ ™ U¨K¸Ó<ð+
ˆô ˆw‹<˜!Òð ˜A‘JˆEÜ˜%¤Ô*Ø×&Ñ&¤|°E¸4ÀÈbÓ'QÔRØÜ˜%¤%¬ Ô/Û!�DÜ! $¬´¨Ô6à# A™w˜Ø#×*Ñ*¬<¸¸dÀKÐQSÓ+TÕUð	 "ð 	×Ñ Õ0ð% ð& Ðr,   r–   )r†   r   rP   z	list[Any])rF   rR   rq   Úfloatrl   rR   rP   r—   r¿   )g�íµ ÷Æ°>)r½   rù   rP   r³   )ræ   rR   rå   r   rP   r—   )
r†   r   rí   Úboolr$   rù   rÖ   r³   rP   r´   )r†   r   r$   rù   rÖ   r³   rP   zlist[GeoJsonPolygon])<Ú
__future__r   Útypingr   r   r   r   r   r	   r
   r   Útyping_extensionsr   r   rV   r5   Ú
ezdxf.mathr   r   Ú
ezdxf.pathr   r   Úezdxf.npshapesr   r   Ú
type_hintsr   Úbackendr   r   r   r   r;   r   rB   r   Ú__all__ÚCUSTOM_JSON_SPECSr   r¢   r¦   r©   r­   r®   r   r‡   rR   rù   r²   Ú__annotations__r³   r´   rµ   r·   rº   rÀ   r   rÓ   rï   rà   r/   r,   r*   Ú<module>r     sz  ðö #ß V× VÓ Vß 1Û 
Û ç 2ß 'ß 5å ß FÓ FÝ !Ý )ð Ð 0Ð
1€ðWÐ ôt3Ð#ô 3ðl €Ø€Ø€Ø€Ø€
ôlV˜ô lVð^ óó ðð0 & s¨E°3Ð&7¸¸cÀ3¸h¹Ð&GÑH€�Ó HØ# T F¨E°%¸°,Ñ,?Ð$?Ñ@€ˆyÓ @à�u˜U E˜\Ñ*Ñ+€€iÓ +ð ! ™J€�	Ó &óó&$ôô"a
�\ô a
óH6ðØ
ðØ!ðØ05ðØ;Hðà	óð6"Ø
ð"Ø!&ð"Ø,9ð"àô"r,   