
    ,hO'                     j    d Z ddlmZ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mZ  G d de      Zy	)
zConnector (line) shape and related objects.

A connector is a line shape having end-points that can be connected to other
objects (but not to other connectors). A connector can be straight, have
elbows, or can be curved.
    )absolute_importdivisionprint_functionunicode_literals
LineFormat)MSO_SHAPE_TYPE)	BaseShape)Emulazypropertyc                   :   e Zd ZdZd Zed        Zej                  d        Zed        Zej                  d        Zd Z	ed        Z
e
j                  d	        Z
ed
        Zej                  d        Zd Zed        Zed        Zed        Zd Zd Zd Zd Zy)	ConnectorzConnector (line) shape.

    A connector is a linear shape having end-points that can be connected to
    other objects (but not to other connectors). A connector can be straight,
    have elbows, or can be curved.
    c                 L    | j                  ||       | j                  ||       y)a  
        **EXPERIMENTAL** - *The current implementation only works properly
        with rectangular shapes, such as pictures and rectangles. Use with
        other shape types may cause unexpected visual alignment of the
        connected end-point and could lead to a load error if cxn_pt_idx
        exceeds the connection point count available on the connected shape.
        That said, a quick test should reveal what to expect when using this
        method with other shape types.*

        Connect the beginning of this connector to *shape* at the connection
        point specified by *cxn_pt_idx*. Each shape has zero or more
        connection points and they are identified by index, starting with 0.
        Generally, the first connection point of a shape is at the top center
        of its bounding box and numbering proceeds counter-clockwise from
        there. However this is only a convention and may vary, especially
        with non built-in shapes.
        N)_connect_begin_to_move_begin_to_cxnselfshape
cxn_pt_idxs      W/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/pptx/shapes/connector.pybegin_connectzConnector.begin_connect   s$    $ 	uj1z2    c                     | j                   }|j                  |j                  |j                  }}}|r||z   n|}t	        |      S )z
        Return the X-position of the begin point of this connector, in
        English Metric Units (as a |Length| object).
        _elementxcxflipHr   )r   cxnSpr   r   r   begin_xs         r   r    zConnector.begin_x/   =     ww%++u2!!b&q7|r   c                    | j                   }|j                  |j                  |j                  t	        |      f\  }}}}|rL||z   }t        ||z
        }||k\  r||z   |_        y ||k  r||z
  |_        y d|_        ||_        ||z
  |_        y t        ||z
        }||k  r||_        ||z   |_        y ||k  r||_        ||z
  |_        y d|_        ||z   |_        ||z
  |_        y NFTr   r   r   r   intabs)	r   valuer   r   r   r   new_xold_xdxs	            r   r    zConnector.begin_x:       #gguxxc%jH2ueFEUU]#B~7r7#7UQYBz7r7"b&7r   c                     | j                   }|j                  |j                  |j                  }}}|r||z   n|}t	        |      S )z
        Return the Y-position of the begin point of this connector, in
        English Metric Units (as a |Length| object).
        r   ycyflipVr   )r   r   r.   r/   r0   begin_ys         r   r1   zConnector.begin_yW   r!   r   c                    | j                   }|j                  |j                  |j                  t	        |      f\  }}}}|rL||z   }t        ||z
        }||k\  r||z   |_        y ||k  r||z
  |_        y d|_        ||_        ||z
  |_        y t        ||z
        }||k  r||_        ||z   |_        y ||k  r||_        ||z
  |_        y d|_        ||z   |_        ||z
  |_        y r#   r   r.   r/   r0   r%   r&   )	r   r'   r   r.   r/   r0   new_yold_ydys	            r   r1   zConnector.begin_yb   r+   r   c                 L    | j                  ||       | j                  ||       y)ae  
        **EXPERIMENTAL** - *The current implementation only works properly
        with rectangular shapes, such as pictures and rectangles. Use with
        other shape types may cause unexpected visual alignment of the
        connected end-point and could lead to a load error if cxn_pt_idx
        exceeds the connection point count available on the connected shape.
        That said, a quick test should reveal what to expect when using this
        method with other shape types.*

        Connect the ending of this connector to *shape* at the connection
        point specified by *cxn_pt_idx*.
        N)_connect_end_to_move_end_to_cxnr   s      r   end_connectzConnector.end_connect   s$     	UJ/eZ0r   c                     | j                   }|j                  |j                  |j                  }}}|r|n||z   }t	        |      S )z
        Return the X-position of the end point of this connector, in English
        Metric Units (as a |Length| object).
        r   )r   r   r   r   r   end_xs         r   r<   zConnector.end_x   =     ww%++u2B5zr   c                    | j                   }|j                  |j                  |j                  t	        |      f\  }}}}|rXt        ||z
        }||k  r||_        ||z   |_        y ||k  r||_        ||z
  |_        y d|_        ||z   |_        ||z
  |_        y ||z   }t        ||z
        }||k\  r||z   |_        y ||k  r||z
  |_        y d|_        ||_        ||z
  |_        y r#   r$   )	r   r'   r   r   r   r   r(   r*   r)   s	            r   r<   zConnector.end_x       #gguxxc%jH2ueUQYBz7r7#b&7FEUU]#B~7r7"7r   c                     | j                   }|j                  |j                  |j                  }}}|r|n||z   }t	        |      S )z
        Return the Y-position of the end point of this connector, in English
        Metric Units (as a |Length| object).
        r-   )r   r   r.   r/   r0   end_ys         r   rA   zConnector.end_y   r=   r   c                    | j                   }|j                  |j                  |j                  t	        |      f\  }}}}|rXt        ||z
        }||k  r||_        ||z   |_        y ||k  r||_        ||z
  |_        y d|_        ||z   |_        ||z
  |_        y ||z   }t        ||z
        }||k\  r||z   |_        y ||k  r||z
  |_        y d|_        ||_        ||z
  |_        y r#   r3   )	r   r'   r   r.   r/   r0   r4   r6   r5   s	            r   rA   zConnector.end_y   r?   r   c                 J    | j                   j                  j                         S )z'Helper method required by |LineFormat|.)r   spPrget_or_add_lnr   s    r   rE   zConnector.get_or_add_ln   s    }}!!//11r   c                     t        |       S )z|LineFormat| instance for this connector.

        Provides access to line properties such as line color, width, and
        line style.
        r   rF   s    r   linezConnector.line   s     $r   c                 B    | j                   j                  j                  S )zHelper method required by |LineFormat|.

        The ``<a:ln>`` element containing the line format properties such as
        line color and width. |None| if no `<a:ln>` element is present.
        )r   rD   lnrF   s    r   rJ   zConnector.ln   s     }}!!$$$r   c                 "    t         j                  S )zMember of `MSO_SHAPE_TYPE` identifying the type of this shape.

        Unconditionally `MSO_SHAPE_TYPE.LINE` for a `Connector` object.
        )r	   LINErF   s    r   
shape_typezConnector.shape_type   s     """r   c                     | j                   j                  j                  }|j                         }|j                  |_        ||_        y)z
        Add or update a stCxn element for this connector that connects its
        begin point to the connection point of *shape* specified by
        *cxn_pt_idx*.
        N)r   	nvCxnSpPr
cNvCxnSpPrget_or_add_stCxnshape_idididx)r   r   r   rP   stCxns        r   r   zConnector._connect_begin_to   s9     ]],,77
++->>	r   c                     | j                   j                  j                  }|j                         }|j                  |_        ||_        y)z
        Add or update an endCxn element for this connector that connects its
        end point to the connection point of *shape* specified by
        *cxn_pt_idx*.
        N)r   rO   rP   get_or_add_endCxnrR   rS   rT   )r   r   r   rP   endCxns        r   r8   zConnector._connect_end_to  s9     ]],,77
--/NN	
r   c           	      ,   |j                   |j                  |j                  |j                  f\  }}}}t	        ||dz  z         |f|t	        ||dz  z         ft	        ||dz  z         ||z   f||z   t	        ||dz  z         fd|   \  | _        | _        y)z
        Move the begin point of this connector to coordinates of the
        connection point of *shape* specified by *cxn_pt_idx*.
           r      rZ      N)lefttopwidthheightr%   r    r1   r   r   r   r   r.   r   r/   s          r   r   zConnector._move_begin_to_cxn  s    
 zz599ekk5<<G1b"AQJ#3q26z?#AQJR(BAQJ(	&

 &"dlr   c           	      ,   |j                   |j                  |j                  |j                  f\  }}}}t	        ||dz  z         |f|t	        ||dz  z         ft	        ||dz  z         ||z   f||z   t	        ||dz  z         fd|   \  | _        | _        y)z
        Move the end point of this connector to the coordinates of the
        connection point of *shape* specified by *cxn_pt_idx*.
        rZ   r[   N)r^   r_   r`   ra   r%   r<   rA   rb   s          r   r9   zConnector._move_end_to_cxn   s    
 zz599ekk5<<G1b"AQJ#3q26z?#AQJR(BAQJ(	"

 "
DJr   N)__name__
__module____qualname____doc__r   propertyr    setterr1   r:   r<   rA   rE   r   rH   rJ   rM   r   r8   r   r9    r   r   r   r      s   3*   ^^# #8   ^^# #81    \\# #8   \\# #82     % % # #		 r   r   N)rg   
__future__r   r   r   r   pptx.dml.liner   pptx.enum.shapesr	   pptx.shapes.baser
   	pptx.utilr   r   r   rj   r   r   <module>rp      s-    S R $ + & 'Y	 Yr   