
    pj|3                         d dl Z ddlmZ ddlmZ ddlmZmZmZ ddlm	Z	m
Z
  e j                  e      Zd Zd Zd	 Zd
 Zy)    N   )
class_name)	serialize)reference_idrgb_float_to_hexwrap_id)cache_propertiesget_cached_propertyc                    |j                         }d }d }g }g }	i }
|rd }t        |d      st        j                  d       n|j	                         }|rMt        |      }t        |||||dz         }|r.|	j                  |       |j                  dt        |      gg       d }t        |d      r|j                         }nt        j                  d       |rMt        |      }t        |||||dz         }|r.|	j                  |       |j                  dt        |      gg       d }t        |d      r|j                         }nt        j                  d	       |rMt        |      }t        |||||dz         }|r.|	j                  |       |j                  d
t        |      gg       |j                         rXdgdz  }|j                         }t        d      D ]/  }t        d      D ]  }|d|z  z   }|j                  ||      ||<   ! 1 ||
d<   |xr |}t        |d      r|sd}|rt        |       |t        |      t!        ||||j#                         |j%                         |j'                         |j)                         |j+                         |j-                         |j/                         |j1                         |j3                         d
|
      ||	dS y )N	GetMapperz+This actor does not have a GetMapper methodr   	setMapperGetPropertyz-This actor does not have a GetProperty methodsetProperty
GetTexturez,This actor does not have a GetTexture method
addTexturer         
userMatrix
visibilityT)
r   pickabledragable	useBoundsoriginpositionscaleorientationforceOpaqueforceTranslucentparentidtype
propertiescallsdependencies)GetVisibilityhasattrloggerdebugr   r   r   appendr   r   r   GetUserMatrixrange
GetElementr
   r   r	   GetPickableGetDragableGetUseBounds	GetOriginGetPositionGetScaleGetOrientationGetForceOpaqueGetForceTranslucent)r    actoractor_idcontextdepthactor_visibilitymapper_instanceproperty_instancer$   r%   add_onmapper	mapper_idpropprop_idtexture
texture_idtexture_instanceuser_matrixmatrixijidxshould_serializes                           U/DATA/.local/lib/python3.12/site-packages/trame_vtk/modules/vtk/serializers/actors.pygeneric_actor_serializerrM      s    **,OELFuk*LLFG__&F$V,I'vy'5ST9UO##O4kGI,>+?@A5-($$&DLLHI"4(G )%wQR S ##$56mgg.>-?@A 5,'&&(GLLGH%g.J(WeVWiX##$45lWZ-@,ABC cBh$$&qA1X!a%i#)#4#4Q#:C     +|&<+<8\2;K"6*u%* #3 % 1 1 3 % 1 1 3!&!3!3!5#oo/ % 1 1 3"^^-#(#7#7#9#(#7#7#9(-(A(A(C * (5
 	
:     c                 F   g d}|j                         r|j                         |d<   |j                         r|j                         |d<   |j	                         r|j                         |d<   t        |j                         j                          }g }dt        t        |j                                     ggg}d}	t        |d      r|j                         }	nt        j                  d       |	rMt        |	      }
t!        ||	|
||dz         }|r.|j#                  |       |j#                  d	t        |
      gg       t        |       |d
t%        ||i d|j'                         d|j)                         d|j+                         d|j-                         d|j/                         d|j1                         d|j3                         d|j5                         d|j7                         d|j9                         ddddd|ddd|dddd d!d"d#|dd$dd       ||d%S )&a  
    Possible add-on properties for vtk.js:
        gridLines: True,
        axisLabels: None,
        axisTitlePixelOffset: 35.0,
        axisTextStyle: {
            fontColor: 'white',
            fontStyle: 'normal',
            fontSize: 18,
            fontFamily: 'serif',
        },
        tickLabelPixelOffset: 12.0,
        tickTextStyle: {
            fontColor: 'white',
            fontStyle: 'normal',
            fontSize: 14,
            fontFamily: 'serif',
        },
    ) rP   rP   r   r      	setCameraNGetXAxesLinesPropertyz7This actor does not have a GetXAxesLinesProperty methodr   vtkCubeAxesActorr   r   r   r   r   r   r   r   r   
dataBoundsfaceVisibilityAngle   	gridLinesT
axisLabelsaxisTitlePixelOffsetg     A@axisTextStylenormal   serif	fontColor	fontStylefontSize
fontFamilytickLabelPixelOffsetg      (@tickTextStyle   r   )GetXAxisLabelVisibility	GetXTitleGetYAxisLabelVisibility	GetYTitleGetZAxisLabelVisibility	GetZTitler   GetXAxesGridlinesPropertyGetColorr   r   	GetCamerar'   rS   r(   r)   r   r*   r	   r&   r.   r/   r0   r1   r2   r3   r5   r6   	GetBounds)r    r7   r8   r9   r:   axis_labels
text_colorr%   r$   rA   rB   r=   s               rL   cube_axes_serializerrs   p   s   ( K$$&*A$$&*A$$&*A!5#B#B#D#M#M#OPJL \%//"3456	
E Du-.**,NOt$%eT7GUQYO 12LL-''*:);<= v&"& e113  E--/  E--/	 
 U//1  %//+  E--/  )  u335  #E$=$=$?  eoo/  &q   T! " k# $ '% &  !+!) "")	"' 2 '3 4  !+!) "")	"5 $
J $U+ +rN   c                    g }g }|j                         }|sy t        |      }t        |||||dz         }	|	sy |j                  |	       |j                  dt	        |      gg       d }
t        |d      r|j                         }
nf|j                  rt        d       |
rMt        |
      }t        ||
|||dz         }|r.|j                  |       |j                  dt	        |      gg       |j                         }|j                         }|j                         }t        |       |dt        |||j                         |j                         |j                         |j!                         d|dd	g||gd
t#        |j%                         j'                          dddddt#        |j%                         j'                          dddd|j)                         |j+                         |j-                         d      ||dS )Nr   setScalarsToColorsr   z8This scalar_bar_actor does not have a GetProperty methodr   vtkScalarBarActorTg)\(?gq=
ףpg      B@r\   r]   r^   r_   g      ,@rf   )r   r   r   r   	automated	axisLabelboxPositionboxSizerZ   r[   rd   re   drawNanAnnotationdrawBelowRangeSwatchdrawAboveRangeSwatchr   )GetLookupTabler   r   r*   r   r'   r   	debug_allprintGetTitleGetWidth	GetHeightr	   r&   r.   r/   r0   r   GetTitleTextPropertyrn   GetDrawNanAnnotationGetDrawBelowRangeSwatchGetDrawAboveRangeSwatch)r    r7   r8   r9   r:   r%   r$   lutlut_idlut_instancerA   rB   r=   
axis_labelwidthheights                   rL   scalar_bar_actor_serializerr      s   LE



 C#FUC%!)DL%	LL&(9:;Dum$  "LM"4(G )%wQR S ##$56mgg.>-?@A!JNNE__F v&#& $113!--/!--/"//1 "' !%e}!6?(,!1335>>@" "* "")" )-!1335>>@" "* "")" &+%?%?%A(-(E(E(G(-(E(E(GM'+
X $c2 2rN   c                    |j                         }|sy |j                         }|j                         }|j                         }|j	                         }	|j                         }
|j                         }|j                         }g d}|j                         r]|j                         }|j                          t        d      D ]/  }t        d      D ]  }|d|z  z   }|j                  ||      ||<   ! 1 t        |       |dt        ||||j                         |j                         |j!                         |j#                         |j%                         |j'                         |||j)                         |j+                         |j-                         dd|	d|
z  |d   ||rdn|ddt/        t1        d	 |j3                         j5                                     t/        t1        d
 |j7                         j5                                     t/        t1        d |j9                         j5                                     d      dS )N)r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   vtkAxesActor)showxyzr   g?g{Gz?)recentertipResolution	tipRadius	tipLengthshaftResolutionshaftRadiusinvertc                     t        | dz        S N   intr   s    rL   <lambda>z'axes_actor_serializer.<locals>.<lambda>y      #a#g,rN   c                     t        | dz        S r   r   r   s    rL   r   z'axes_actor_serializer.<locals>.<lambda>|  r   rN   c                     t        | dz        S r   r   r   s    rL   r   z'axes_actor_serializer.<locals>.<lambda>  r   rN   )r   r   r   r   r   r   r   r   labelsconfig
xAxisColor
yAxisColor
zAxisColor)r    r!   r"   r#   )r&   GetAxisLabelsGetShaftTypeGetNormalizedTipLengthGetConeResolutionGetConeRadiusGetCylinderResolutionGetCylinderRadiusr+   	Transposer,   r-   r   r	   r.   r/   r0   r1   r2   r3   GetXAxisLabelTextGetYAxisLabelTextGetZAxisLabelTextlistmapGetXAxisTipPropertyrn   GetYAxisTipPropertyGetZAxisTipProperty)r    r7   r8   r9   r:   r;   
label_show
shaft_type
tip_lengthcone_resolutioncone_radiuscylinder_resolutioncylinder_radiusrF   rG   rH   rI   rJ   s                     rL   axes_actor_serializerr   -  s4   **, $$&J ##%J--/J --/O%%'K557--/O CK$$&qA1X!a%i#)#4#4Q#:C    v&& /!--/!--/"//1//+!--/)) '002002002	 !"%4!${!2!+A':+54? #.0I0I0K0T0T0VW #.0I0I0K0T0T0VW #.0I0I0K0T0T0VWC$(
	- -rN   )loggingregistryr   r   utilsr   r   r   cacher	   r
   	getLogger__name__r(   rM   rs   r   r    rN   rL   <module>r      sD         : : 8			8	$_J^HSrVrN   