a
    «ˆc.  ã                   @   sx   d Z ddlmZmZmZmZ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 )zq A module that displays the outline for the given data, either as a
    box, or the corners of the bounding box.
é    )ÚInstanceÚEnumÚPropertyÚBoolÚDelegatesTo)ÚViewÚGroupÚItem)Útvtk)ÚModule)ÚActor)ÚPipelineInfoc                       s>  e Zd ZdZeeejdd�dd�Ze	dddd	�Z
eeddd
�Zedgdgdgd�ZeejdƒZeddd	�Zedd	�Zeeeedd�eddddddd�d dd�ededdd�dd�eddd�ddd �dd!�Zeejddd"�Zeejddd"�Zd#d$„ Zd%d&„ Zd'd(„ Z‡ fd)d*„Z d+d,„ Z!d-d.„ Z"d/d0„ Z#d1d2„ Z$d3d4„ Z%‡  Z&S )5ÚOutliner   F)Ú
allow_noneT)ÚrecordÚfullZcorneredz'if outline mode is "full" or "cornered")Údesc)r   r   Úany)ZdatasetsZattribute_typesÚ
attributes© Úoutline_sourcez1the bounds of the outline: xmin, xmax, ymin, ymaxzBwhether the bounds are automatically inferred from the data sourceÚoutline_mode)ÚnameÚoutline_filterZcustomzoutline_mode == "cornered")r   ÚstyleÚenabled_whenZvisible_whenÚ	resizableZ
show_label)ÚlabelÚshow_labelsÚmanual_boundsÚbounds)r   ZBounds)r   Úactor)r   r   Ztabbed)Zlayoutr   )r   )Úargsr   c                 C   s8   | j  | j¡ | j | j¡ |  | j| j¡ tƒ | _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.
        N)	Ú_full_outlineZon_trait_changeÚrenderÚ_cornered_outlineÚconfigure_connectionr   r   r   r!   ©Úselfr   r   úY/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/mayavi/modules/outline.pyÚsetup_pipeline`   s    zOutline.setup_pipelinec                 C   s(   | j }|du rdS |  | 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Ú_outline_mode_changedr   Úpipeline_changed©r(   Úmmr   r   r)   Úupdate_pipelinew   s
    zOutline.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_changedr'   r   r   r)   Úupdate_data…   s    zOutline.update_datac                    s   | j  ¡  tt| ƒ ¡  d S ©N)r   ÚupdateÚsuperr   r$   r'   ©Ú	__class__r   r)   r$   �   s    
zOutline.renderc                 C   sR   | j }| j}|| ju r| j}|  d||¡ | j}|du r<dS |  ¡  | j g| _dS )zeThis method is invoked (automatically) when the 'outline_mode'
        attribute is changed.
        r   N)r   r%   r#   Ztrait_property_changedr+   Ú_manual_bounds_changedÚoutputs)r(   ÚvalueÚnewÚoldr/   r   r   r)   r,   –   s    
zOutline._outline_mode_changedc                 C   s   | j dkr| jS | jS d S )Nr   )r   r#   r%   r'   r   r   r)   Ú_get_outline_filter­   s    
zOutline._get_outline_filterc                 C   s    | j |_ | g|_|  ||¡ d S r2   )ZsceneÚinputsZ_change_components)r(   r;   r:   r   r   r)   Ú_actor_changed³   s    zOutline._actor_changedc                 C   s6   | j r| jj| j_n| j}|  | j|j¡ |  ¡  d S r2   )	r   r   Zoutput_portr   Zinput_connectionr+   r&   Úsourcer$   r.   r   r   r)   r7   ¸   s
    zOutline._manual_bounds_changedc                 C   s   | j  ¡  d| _d S )NT)r   r3   r-   r'   r   r   r)   Ú_bounds_changedÁ   s    
zOutline._bounds_changed)'Ú__name__Ú
__module__Ú__qualname__Ú__version__r   r   r
   Z
ObjectBaser   r   r   r   r!   r   Z
input_infoZOutlineSourcer   r   r    r   r   r   r   r	   ÚviewZOutlineFilterr#   ZOutlineCornerFilterr%   r*   r0   r1   r$   r,   r<   r>   r7   r@   Ú__classcell__r   r   r5   r)   r      sv   ÿÿÿþÿÿû÷

þ
ïîÿÿ
	r   N)Ú__doc__Z
traits.apir   r   r   r   r   Ztraitsui.apir   r   r	   Ztvtk.apir
   Zmayavi.core.moduler   Zmayavi.components.actorr   Zmayavi.core.pipeline_infor   r   r   r   r   r)   Ú<module>   s   