3
ybW-                 @   s\   d Z ddlmZmZ ddlmZ ddlmZmZm	Z	m
Z
mZ ddlmZ dZdZdd ZdS )z
Paths manager.

    )piradians   )draw_marker)	normalizepointpoint_anglequadratic_pointsrotate)sizeZachlmqstvzACHLMQSTVZcircleellipselinepathpolygonpolylinerectc       %      C   s  |j dd}|j sdS xtD ]}|j|d| }qW d}t|}x8|r||j }|jddd tkr~|d jdd\}}n|dkrd	}n|d
krd}|dkr| jj \}}t| |\}}}|jdd\}	}t	t
|	}	|d |dd j  }
}x0|
d) j s&|
|d  |dd j  }
}qW |d |dd j  }}x2|d* j st||d  |dd j  }}qDW tt|
tt| }
}t| |\}}}|dkr||8 }||8 }| s| rd|||f }qF|| }t|||	 \}}|| }tdd||}|d |d  d }d}t||d }|d }|d |d  d }|
|A s\| }|rj| jjn| jj}t|d|\}}t|||\}}t||dd}t||||}|jj| | f | jj  | jj|| | jj|	 | jjd| |||||| | jj  n.|dkr| jj \}}t| |\}}}t| |\}}}t| |\}}}|jjt||||t||||f | jj|||||| ||7 }||7 }||7 }||7 }||7 }||7 }nx|dkr@t| |\}}}t| |\}}}t| |\}}}|jjt||||t||||f | jj|||||| n |dkr|d jdd\}}| jj \}}t| |ddkrdnt}|jj| |f | jjt| |dd n|dkr$|d jdd\}}| jj \}}t| |d|krdnt}|jj| |f | jjt| |d| n|dkrpt| |\}}}tdd||}|jj| |f | jj|| n|d	krt| |\}}}| jj \}}t||||}|jj| |f | jj|| nv|d
krt| |\}}}| jj r | jj || n| jj!|| n.|dkr>t| |\}}}| jj!|| n|dkrd+\}}t| |\}}}t| |\}}}t"||||||\}}}} }!}"| jj|||| |!|" |jjd, n|dkr0| jj \}}t| |\}}}t| |\}}}t"||||||\}}}} }!}"| jj|||| |!|" |jjd- n|dkr| jj \}}|dkrZ|| nd}|dkrp|| nd}t| |\}}}t| |\}}}|jjt||||t||||f | jj|||||| ||7 }||7 }||7 }||7 }||7 }||7 }n>|dkr| jj \}}|dkr0|||  n|}|dkrJ|||  n|}t| |\}}}t| |\}}}|jjt||||t||||f | jj|||||| n|dk	rd|dkrd.\}}}}n*|dkr||8 }||8 }||8 }||8 }|| }|| }d/\}}t| |\}}}t"||||||\}}}} }!}"|jjd0 | jj|||| |!|" n|dk
r,| jj \}#}$|dk	r|#|$|#|$f\}}}}n|dk	r||7 }||7 }d|# | }d|$ | }|#|$ }}t| |\}}}t"||||||\}}}} }!}"|jjd1 | jj|||| |!|" n|d k
r|d jdd\}}| jj \}}t| |d!dk
rrtd nt d }|jj| |f | jjdt| |d! n|d"kr |d jdd\}}| jj \}}t| |d!dk
rtd nt d }|jj| |f | jj|t| |d! n |d#kr@|jjd2 | jj#  |sRt$| |d$ |j }|rv|d%krvt$| |d& |}qFW |jdgkr|jj%|jd3  |d'krt$| |d( dS )4zDraw a path ``node``.d Nz %s  r   r   MLmlZaAAz
l %f %f %s   g      ?cChxHqQsZcsCSStZQqTtZQTTZqtvyVZzZstartZmMzZZmidZmMendr,   )r   r   )r   r   )r   r   )r   r   r   r   )r   r   )r   r   )r   r   )r   r   r,   )&getstripPATH_LETTERSreplacer   splitcontextZget_current_pointr   r   floatisdigitboolintr
   r   maxarcZarc_negativeZtangentsextendsave	translateZscaleZrestoreZrel_curve_toZcurve_tor   r   Zrel_line_toZline_toZhas_current_pointZrel_move_toZmove_tor	   Z
close_pathr   append)%ZsurfacenodestringletterZlast_letterx1y1ZrxZryZrotationZlargeZsweepZx3Zy3Zradii_ratioZxeZyeZangleZxcZycr8   Zangle1Zangle2r   r(   Zx2y2Zold_xZold_yZxq1Zyq1Zxq2Zyq2Zxq3Zyq3Zabs_xZabs_y rC   U/var/www/html/enquirykeeper_venv/lib/python3.6/site-packages/cairosvg/surface/path.pyr   #   s   


"$






















$
$


N)r   r   r   r   r   r   r   )__doc__mathr   r   Zdefsr   Zhelpersr   r   r   r	   r
   unitsr   r/   Z	PATH_TAGSr   rC   rC   rC   rD   <module>   s   