a
    «ˆcÿ  ã                   @   sh   d Z ddlmZ ddlmZmZmZ ddlmZ ddl	m
Z
 ddlmZ ddlmZ G dd	„ d	eƒZd
S )zkDisplays different types of glyphs oriented and colored as per scalar or vector data at the input points.

é    )ÚInstance)ÚViewÚGroupÚItem)ÚModule)Úglyph)ÚActor)ÚPipelineInfoc                   @   s¢   e Zd ZdZeejddd�Zeeddd�Ze	dgdgdgd�Z
eeedddd	�d dd
�eeddd�ddd
�ƒZdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ ZdS )ÚGlyphr   FT)Ú
allow_noneÚrecordÚany)ZdatasetsZattribute_typesÚ
attributesr   Zcustom)ÚnameÚstyleZ	resizable)ÚlabelZshow_labelsÚactor)r   r   r   c                 C   s<   t jdddd�| _ tƒ  }| _d|j_|jjdddd� d	S )
a  Override this method so that it *creates* the tvtk
        pipeline.

        This method is invoked when the object is initialized via
        `__init__`.  Note that at the time this method is called, the
        tvtk data pipeline will *not* yet be setup.  So upstream data
        will not be available.  The idea is that you simply create the
        basic objects and setup those parts of the pipeline not
        dependent on upstream sources and filters.  You should also
        set the `actors` attribute up at this point.
        Zscale_by_scalarÚcolor_by_scalarT)Z
scale_modeÚ
color_modeZshow_scale_modeé   é   F)Ú
line_widthZbackface_cullingZfrontface_cullingN)r   r
   r   r   ÚmapperÚscalar_visibilityÚpropertyZ	trait_set)Úselfr   © r   úW/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/mayavi/modules/glyph.pyÚsetup_pipeline5   s    þþzGlyph.setup_pipelinec                 C   s6   | j }|du rdS |jg| j_|  | jj¡ d| _dS )zêOverride this method so that it *updates* the tvtk pipeline
        when data upstream is known to have changed.

        This method is invoked (automatically) when any of the inputs
        sends a `pipeline_changed` event.
        NT)Úmodule_managerÚsourcer   ÚinputsÚ_color_mode_changedr   Zpipeline_changed)r   Úmmr   r   r   Úupdate_pipelineM   s    zGlyph.update_pipelinec                 C   s
   d| _ dS )zÌOverride this method so that it flushes the vtk pipeline if
        that is necessary.

        This method is invoked (automatically) when any of the inputs
        sends a `data_changed` event.
        TN)Zdata_changed)r   r   r   r   Úupdate_data_   s    zGlyph.update_datac                 C   sl   | j d u rd S | j}|dkr:d|j_| j j}| |j¡ n&|dkrX| j j}| |j¡ nd|j_|  ¡  d S )Nr   r   Zcolor_by_vectorr   )	r   r   r   r   Zscalar_lut_managerZset_lutZlutZvector_lut_managerÚrender)r   Úvaluer   Zlut_mgrr   r   r   r"   l   s    
zGlyph._color_mode_changedc                 C   sT   |d ur|j | jddd� |  | jd¡ | |_| j}|d urD|g|_|  ||¡ d S )Nr   T)Úremove)Zon_trait_changer"   Úmoduler   r!   Ú_change_components)r   ÚoldÚnewr   r   r   r   Ú_glyph_changed   s    þzGlyph._glyph_changedc                 C   s.   | j |_ | j}|d ur|g|_|  ||¡ d S )N)Zscener   r!   r*   )r   r+   r,   Úgr   r   r   Ú_actor_changed�   s
    zGlyph._actor_changedN)Ú__name__Ú
__module__Ú__qualname__Ú__version__r   r   r
   r   r   r	   Z
input_infor   r   r   Úviewr   r$   r%   r"   r-   r/   r   r   r   r   r
      s0   þ
ÿýþür
   N)Ú__doc__Z
traits.apir   Ztraitsui.apir   r   r   Zmayavi.core.moduler   Zmayavi.componentsr   Zmayavi.components.actorr   Zmayavi.core.pipeline_infor	   r
   r   r   r   r   Ú<module>   s   	