
    'j=!                        d dl mZ d dlmZmZmZ d dlZd dlZd dlm	Z	 d dl
mZ d dlmZmZmZ erd dlmZmZmZmZmZmZ  ej        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 )%    )annotations)TYPE_CHECKINGIterableUnionN)factory)VERTEXNAMES)Vec3bulge_to_arcOCS)
LWPolylinePolylineLineArcFace3dPolymeshezdxf
lwpolyliner   returnIterable[Union[Line, Arc]]c              #  ~  K   |                                  dk    sJ |                     d          }t          |          dk     rdS | j        r|                    |d                    t          || j        j        | j                            dd          | 	                                | j
                  E d{V  dS )zYields 'virtual' entities of LWPOLYLINE as LINE or ARC objects.

    These entities are located at the original positions, but are not stored in
    the entity database, have no handle and are not assigned to any layout.

    (internal API)

    
LWPOLYLINExyb   Nr   	extrusionpoints	elevationr   
dxfattribsdoc)dxftype
get_pointslenclosedappend_virtual_polyline_entitiesdxfr   getgraphic_propertiesr   )r   r   s     O/DATA/AppData/hermes/venv/lib/python3.11/site-packages/ezdxf/render/polyline.pyvirtual_lwpolyline_entitiesr*      s       <////""5))F
6{{Q !fQi   ).*.$$[$770022N               polyliner   "Iterable[Union[Line, Arc, Face3d]]c                    |                                  dk    sJ | j        rt          |           S | j        rt	          |           S | j        rt          |           S | j        rt          |           S g S )zYields 'virtual' entities of POLYLINE as LINE, ARC or 3DFACE objects.

    These entities are located at the original positions, but are not stored in
    the entity database, have no handle and are not assigned to any layout.

    (internal API)

    POLYLINE)	r    is_2d_polylinevirtual_polyline2d_entitiesis_3d_polylinevirtual_polyline3d_entitiesis_polygon_meshvirtual_polymesh_entitiesis_poly_face_meshvirtual_polyface_entities)r,   s    r)   virtual_polyline_entitiesr8   /   s     ++++ 3*8444		  3*8444		! 3(222		# 3(222Ir+   c           	   #    K   |                                  dk    sJ | j        sJ t          | j                  dk     rdS d | j        D             }| j        r|                    |d                    t          |t          | j        	                    dd                    j
        | j        	                    dd          |                                 | j        	          E d{V  dS )
zYields 'virtual' entities of 2D POLYLINE as LINE or ARC objects.

    These entities are located at the original positions, but are not stored in
    the entity database, have no handle and are not assigned to any layout.

    (internal API)

    r/   r   Nc                h    g | ]/}|j         j        j        |j         j        j        |j         j        f0S  )r&   locationxybulge.0vs     r)   
<listcomp>z/virtual_polyline2d_entities.<locals>.<listcomp>V   s>       >?	15>+QU[9  r+   r   r   )r   r   r   r   r   )r    r0   r"   vertices	is_closedr$   r%   r	   r&   r'   zr(   r   )r,   r   s     r)   r1   r1   F   s      ++++""""
8!! CKCT  F  !fQi   )x|''Y??@@B,"";55..00L           r+   r   floatr   r	   r   dictc              #  v  K   |rt          |          nt                      }d }d}| D ]\  }}	}
t          ||	|          }||}|
}t          |          }|dk    rt          |||          \  }}}}|dk    rqt          |j        |j        |          |d<   ||d<   t          j        |          |d<   t          j        |          |d<   |r||d<   t          j	        d||	          V  nI|
                    |          |d
<   |
                    |          |d<   t          j	        d||	          V  |}|
}d S )Ng        r   centerradiusstart_angle	end_angler   ARCr    r   r   startendLINE)r   r	   rH   r
   r=   r>   mathdegreesr   newto_wcs)r   r   r   r   r   ocs
prev_point
prev_bulger=   r>   r?   pointattribsrJ   rL   rM   rK   s                    r)   r%   r%   e   s      &
0#i...355C"JJ  1eQ9%%JJz""5AE:6 62FKF zz$(68Y$G$G!$*!)-k)B)B&'+|I'>'>$ 5+4GK(k%GMMMMMM"zz*55GG ZZ..GEN+fcJJJJJJ


3 r+   Iterable[Line]c              #    K   |                                  dk    sJ | j        sJ t          | j                  dk     rdS | j        }| j        }|                                 }| j        rdnd}t          |t          |          dz
            D ]H}||         j        j	        |d<   ||dz            j        j	        |d<   t          j        d	||
          V  IdS )zYields 'virtual' entities of 3D POLYLINE as LINE objects.

    This entities are located at the original positions, but are not stored in
    the entity database, have no handle and are not assigned to any layout.

    (internal API)

    r/   r   Nr      rP   rQ   rR   rO   )r    r2   r"   rD   r   r(   rE   ranger&   r<   r   rU   )r,   r   rD   r   rP   indexs         r)   r3   r3      s       ++++""""
8!!
,C H,,..J$+BB!Euc(mma/00 J J&uo1:
7$UQY/3<
5k&ZSIIIIIIIJ Jr+   Iterable[Face3d]c              #  D  K   | }|                                 dk    sJ |j        sJ |j        }|                                }|                                }|j        j        }|j        j        }|t          |j	                   z
  }|t          |j
                   z
  }t          |          D ]q}	t          |          D ]_}
|	dz   |z  }|
dz   |z  }||	|
f         |d<   |||
f         |d<   |||f         |d<   ||	|f         |d<   t          j        d||          V  `rd	S )
zYields 'virtual' entities of POLYMESH as 3DFACE objects.

    This entities are located at the original positions, but are not stored in
    the entity database, have no handle and are not assigned to any layout.

    (internal API)

    r/   r_   vtx0vtx1vtx2vtx33DFACErO   N)r    r4   r   get_mesh_vertex_cacher(   r&   m_countn_countintis_m_closedis_n_closedr`   r   rU   )r,   polymeshr   meshr   rj   rk   m_rangen_rangemnnext_mnext_ns                r)   r5   r5      sk      $H++++####
,C))++D,,..Jl"Gl"G 44555G 44555G7^^ 	P 	Pw 	P 	PA!ew&F!ew&F!%adJv!%faiJv!%ffn!5Jv!%aiJv+h:3OOOOOOO	P	P 	Pr+   c           
   #    K   |                                  dk    sJ | j        sJ | j        }| j        }|                                 }d |D             }|D ].t
          dd         D ]b}j                            |          sFt          	                    dt                     dt          | j        j                   d           bct          |          }|                                                               d}d	}fd
t
          D             }	|	D ]<\  }
}|
dk     rt          |
          }
||z  }||
d	z
           j        j        ||<   |d	z  }=d|vr|d         |d<   ||d<   t!          j        d||          V  0dS )zYields 'virtual' entities of POLYFACE as 3DFACE objects.

    This entities are located at the original positions, but are not stored in
    the entity database, have no handle and are not assigned to any layout.

    (internal API)

    r/   c              3  (   K   | ]}|j         	|V  d S N)is_face_recordr@   s     r)   	<genexpr>z,virtual_polyface_entities.<locals>.<genexpr>   s*      <<!1+;<A<<<<<<r+   Nr^   zskipped face z+ with less than 3 verticesin PolyFaceMesh(#)r   r_   c              3     K   | ]:}j                             |          j                             |          |fV  ;d S ry   )r&   hasattrr'   )rA   namefaces     r)   r{   z,virtual_polyface_entities.<locals>.<genexpr>   s`       
 
+/$(BRBRSWBXBX
X\\$&
 
 
 
 
 
r+   rg   rf   	invisiblerh   rO   )r    r6   r   rD   r(   r   r&   r~   loggerinfostrhandlerH   updateabsr<   r   rU   )r,   r   rD   base_attribsface_recordsr   face3d_attribsr   posindicesra   r   s              @r)   r7   r7      s      ++++%%%%
,C H..00L<<x<<<L $P $P$ 	 	D8##D)) DCII D D(+HL,?(@(@D D D    l++d5577888	
 
 
 
3>
 
 
 # 	 	KE4qyyE

S 	#+EAI#6#:#CN4 AICC'' &4F%;N6"&/{#k(~3OOOOOOOI$P $Pr+   )r   r   r   r   )r,   r   r   r-   )r,   r   r   r   )r   rG   r   r	   r   rH   r   r   )r,   r   r   r\   )r,   r   r   rb   )
__future__r   typingr   r   r   loggingrS   ezdxf.entitiesr   ezdxf.lldxf.constr   
ezdxf.mathr	   r
   r   r   r   r   r   r   r   	getLoggerr   r*   r8   r1   r%   r3   r5   r7   r;   r+   r)   <module>r      s|   # " " " " " 1 1 1 1 1 1 1 1 1 1   " " " " " " ) ) ) ) ) ) . . . . . . . . . . QPPPPPPPPPPPPPPPP		7	#	#   :   .   >       FJ J J J.P P P PB5P 5P 5P 5P 5P 5Pr+   