U
    td<                     @   s(   d Z ddlmZ dZG dd deZdS )zGThis module provides implementation for a Cairo-specific palette drawer    )AbstractCairoDrawer)CairoPaletteDrawerc                       s(   e Zd ZdZ fddZdd Z  ZS )r   z(Default Cairo drawer object for palettesc                    s   t  j|dd dS )zConstructs the vertex drawer and associates it to the given
        palette.

        @param context: the context on which we will draw
        N)bbox)super__init__)selfcontext	__class__ U/home/sam/Atlas/atlas_env/lib/python3.8/site-packages/igraph/drawing/cairo/palette.pyr      s    zCairoPaletteDrawer.__init__c              
   K   s   ddl m} ddlm} | j}||dd}ttt| }|dkrN|	  |dkrb||g}n|dd	 |D }|
d
d }	| _|	dkrtdt|dd}
t|dd}|jd||	| dd||
dS )TODOr   )Matrix)str_to_orientationorientationlr)rlZbt)r   r   c                 S   s   g | ]
}|gqS r   r   ).0ir   r   r   
<listcomp>"   s     z+CairoPaletteDrawer.draw.<locals>.<listcomp>r   Nz bbox is required for Cairo plotsborder_widthg      ?
grid_widthg        ZcairopaletteF)r   r   styleZsquarer   r   )Zigraph.datatypesr   Zigraph.drawing.utilsr   r   getlistrangelenreversepopr   
ValueErrorfloatZ__plot__)r   r   kwdsr   r   r   r   indicesmatrixr   r   r   r   r   r   draw   s2    zCairoPaletteDrawer.draw)__name__
__module____qualname____doc__r   r%   __classcell__r   r   r	   r   r      s   r   N)r)   Zigraph.drawing.cairo.baser   __all__r   r   r   r   r   <module>   s   