
    \iH-                     r   S r SSKrSSKr\R                  S:  a  SSKrOSSKrSSKrSSKrSSK	J
r
   " S S\5      r " S S\5      r " S	 S
\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\R(                  R*                  R,                  5      rSS jrg)a  
Copyright 2011-2018 Kyle Lancaster | 2019 Patrick Eisoldt

Simplekml is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

    N3)uc                   N    \ rS rSrSrSrSrSrSS/rS r	S	 r
\S
 5       rS rSrg)Kmlable   z,Enables a subclass to be converted into KML.r   NFz&xmlns="http://www.opengis.net/kml/2.2"z,xmlns:gx="http://www.google.com/kml/ext/2.2"c                     [        [        R                  5      U l        [        =R                  S-  sl         SSKJn  U" 5       U l        g ! [         a
    0 U l         g f = f)N   r   )OrderedDict)strr   	_globalid_idcollectionsr
   _kmlImportError)selfr
   s     Q/var/www/html/kml_chatgpt/mouzaenv/lib/python3.13/site-packages/simplekml/base.py__init__Kmlable.__init__$   sL    w(()Q	/#DI 	DI	s   A A A c                 6   SnSn[         R                  (       a4  [         R                  R                  n[         R                  R                  n/ nU R
                  R                  5        GH  u  pEUc  M  UR                  S5      (       a"  UR                  SR                  U5      5        MC  US;   a)  U(       a"  [        U5      n[         R                  U5      nGO
US:X  a*  [        R                  R                  U5      (       a  US:X  d0  US:X  a  [        R                  R                  U5      (       a  US:X  a  [         R                  R                  R                  U5        [        R                  R!                  S[        R                  R#                  U5      S	   5      R%                  S
S5      n[         R                  U5      nOUS;   a  [         R                  U5      nUR                  ['        S5      R                  XE5      5        [         R                  (       a  UR)                  S5      (       aJ  S[         R                  R*                  ;  a,  [         R                  R*                  R                  S5        GM  UR)                  S5      (       aM  S[         R                  R*                  ;  a,  [         R                  R*                  R                  S5        GMz  GM}  GM  UR)                  S5      (       a6  S[         R*                  ;  a"  [         R                  R                  S5        GM  UR)                  S5      (       d  GM  S[         R*                  ;  d  GM  [         R                  R                  S5        GM     SR!                  U5      $ )z This is where the magic happens.TF_z{0})
namedescriptiontextlinknamelinkdescriptionmessagechangecreatedeletelinkhref
targetHreffilesr	   \/)r!   r"   z<{0}>{1}</{0}>zatom:z(xmlns:atom="http://www.w3.org/2005/Atom"zxal:z4xmlns:xal="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0" )r   
_compiling_currentroot
_parsetext
_outputkmzr   itemsendswithappendformatr   _chrconvertospathexists_foundimagesjoinsplitreplacer   
startswith_namespaces)r   	parsetext	outputkmzbufvarvals         r   __str__Kmlable.__str__-   s   		,,77I,,77I		)HC<<$$JJv}}S12  N  N  S\!#h%11#6-BGGNN3,?,?IQUDU #| 3s8K8KPY]aPa,,99@@E ggll7BGGMM#4Fq4IJRRSWY\]%11#6!77%11#6JJq!1299#CD))>>'227aipi}i}  jJ  jJ  8J#00<<CCDno ^^F338nv}  wK  wK  wW  wW  9W#00<<CCDz{ 9W3 >>'227aipi|i|7|#00778bc ^^F338nv}  wJ  wJ  9J#00778no5 *8 wws|    c           	      n   SnSnUnSnUR                  U5      nUS:  a  [        U5       H  n[        R                  S:  a,  U[        R
                  " USUR                  U5       5      -  nO+U[        R
                  " USUR                  U5       5      -  nXTUR                  U5      UR                  U5      [        U5      -    -  nXDR                  U5      [        U5      -   S  nM     XT-  nU$ [        R                  S:  a  [        R
                  " U5      nU$ [        R
                  " U5      nU$ )Nz	<![CDATA[z]]>r&   r   r   )	countrangesysversioncgiescapefindhtmllen)clsr   
cdatastartcdataend	starttextendtextrB   is           r   r/   Kmlable._chrconvertU   s    
	

:&195\;;$szz)AinnZ6P*QRRGt{{9Qy~~j7Q+RSSGY^^J%?	x@XY\]eYf@fgg%nnX&>s8}&L&MN	 "  G 	 {{S **T*  ++d+r@   c                     [        S5      e)NzThis method is no longer available for this class. The addfile method may only be called from the Kml class (since version 1.2.8))NotImplementedError)r   r1   s     r   addfileKmlable.addfilel   s    !  #f  g  	gr@   )r   r   )__name__
__module____qualname____firstlineno____doc__r   r(   r'   r8   r   r>   classmethodr/   rT   __static_attributes__ r@   r   r   r      sD    6ILJ;=klK&P  ,gr@   r   c                       \ rS rSrSr    SS jr\S 5       r\R                  S 5       r\S 5       r	\	R                  S 5       r	\S	 5       r
\
R                  S
 5       r
\S 5       r\R                  S 5       rS rSrg)Vector2o   aC  Abstract class representing a vector.

Args:
  * x: int in xunits (default None)
  * y: int in yunits (default None)
  * xunits: string of type of x units. See :class:`simplekml.Units` (default None)
  * yunits: string of type of y units. See :class:`simplekml.Units` (default None)
  
.. note::
  Not to be used directly.
Nc                 B    0 U l         Xl        X l        X0l        X@l        g N)r   xyxunitsyunits)r   rc   rd   re   rf   s        r   r   Vector2.__init__|   s    
 	r@   c                      U R                   S   $ )zNumber in xunits, accepts int.rc   r   r   s    r   rc   	Vector2.x        yy~r@   c                      XR                   S'   g )Nrc   ri   )r   rc   s     r   rc   rk          		#r@   c                      U R                   S   $ )zNumber in yunits, accepts int.rd   ri   rj   s    r   rd   	Vector2.y   rl   r@   c                      XR                   S'   g )Nrd   ri   )r   rd   s     r   rd   rp      rn   r@   c                      U R                   S   $ )z(Type of x units, see [Units] for values.re   ri   rj   s    r   re   Vector2.xunits        yy""r@   c                      XR                   S'   g )Nre   ri   )r   re   s     r   re   rs          $		(r@   c                      U R                   S   $ )z9Type of y units, See :class:`simplekml.Units` for values.rf   ri   rj   s    r   rf   Vector2.yunits   rt   r@   c                      XR                   S'   g )Nrf   ri   )r   rf   s     r   rf   rx      rv   r@   c                    U R                   R                  S   R                  5       U R                   R                  SS  -   nSR                  XR                  S   U R                  S   U R                  S   U R                  S   5      $ )Nr   r	   z1<{0} x="{1}" y="{2}" xunits="{3}" yunits="{4}" />rc   rd   re   rf   )	__class__rV   lowerr.   r   )r   cnames     r   r>   Vector2.__str__   s    ''*002T^^5L5LQR5PPBII%QZQZ[^Q_aeajajknaoJN))T\J]_c_h_hiq_rt 	tr@   )r   rc   re   rd   rf   )NNNN)rV   rW   rX   rY   rZ   r   propertyrc   setterrd   re   rf   r>   r\   r]   r@   r   r_   r_   o   s    
 		   XX    XX  # # ]]% % # # ]]% %tr@   r_   c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )	OverlayXY   zPoint in overlay image that is mapped to screen coordinate :class:`simplekml.ScreenXY`

Arguments are the same as the properties.
c                 .   > [         [        U ]
  " S0 UD6  g Nr]   )superr   r   r   kwargsr{   s     r   r   OverlayXY.__init__   s    i'1&1r@   r]   rV   rW   rX   rY   rZ   r   r\   __classcell__r{   s   @r   r   r      s    
2 2r@   r   c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )ScreenXY   zu
Point relative to the screen origin that the overlay image is mapped to.

Arguments are the same as the properties.
c                 .   > [         [        U ]
  " S0 UD6  g r   )r   r   r   r   s     r   r   ScreenXY.__init__   s    h&00r@   r]   r   r   s   @r   r   r      s    1 1r@   r   c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )
RotationXY   zt
Point relative to the screen about which the screen overlay is rotated.

Arguments are the same as the properties.
c                 .   > [         [        U ]
  " S0 UD6  g r   )r   r   r   r   s     r   r   RotationXY.__init__   s    j$(262r@   r]   r   r   s   @r   r   r      s    3 3r@   r   c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )Size   zd
Specifies the size of the image for the screen overlay.

Arguments are the same as the properties.
c                 .   > [         [        U ]
  " S0 UD6  g r   )r   r   r   r   s     r   r   Size.__init__   s    dD",V,r@   r]   r   r   s   @r   r   r      s    
- -r@   r   c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )HotSpot   zv
Specifies the position inside the [Icon] that is anchored to the [Point].

Arguments are the same as the properties.
c                 .   > [         [        U ]
  " S0 UD6  g r   )r   r   r   r   s     r   r   HotSpot.__init__   s    gt%//r@   r]   r   r   s   @r   r   r      s    0 0r@   r   c                       \ rS rSrSrSS jr\S 5       r\R                  S 5       r\S 5       r	\	R                  S 5       r	S	 r
S
rg)Snippet   zOA short description of the feature.

Arguments are the same as the properties.
Nc                 *    0 U l         Xl        X l        g rb   r   contentmaxlines)r   r   r   s      r   r   Snippet.__init__   s    	 r@   c                      U R                   S   $ )z:The description to be used in the snippet, accepts string.r   ri   rj   s    r   r   Snippet.content   s     yy##r@   c                      XR                   S'   g )Nr   ri   )r   r   s     r   r   r      s    &		)r@   c                      U R                   S   $ )z(Number of lines to display, accepts int.r   ri   rj   s    r   r   Snippet.maxlines   s     yy$$r@   c                      XR                   S'   g )Nr   ri   )r   r   s     r   r   r      s     (		*r@   c                    U R                   S   b?  SR                  U R                   S   [        R                  U R                   S   5      5      $ SR                  [        R                  U R                   S   5      5      $ )Nr   z%<Snippet maxLines="{0}">{1}</Snippet>r   z<Snippet>{0}</Snippet>)r   r.   r   r/   rj   s    r   r>   Snippet.__str__  s~    99Z ,;BB499ZCXY`YlYlmqmvmv  xA  nB  ZC  D  D,33G4G4G		R[H\4]^^r@   r   )r&   N)rV   rW   rX   rY   rZ   r   r   r   r   r   r>   r\   r]   r@   r   r   r      sj    
!
 $ $ ^^' ' % % __) )_r@   r   c                       \ rS rSrSr\R                  R                  R                  r	\
S 5       r\
S 5       rSS jrSrg)	
KmlElementi  zDOverrides the original Element to format the KML to GMaps standards.c                     [         R                  R                  R                  [        :w  aM  [         R                  R                  R                  U l        [        [         R                  R                  l        gg)z8Patch xml.dom.minidom.Element to use KmlElement instead.NxmldomminidomElementr   _original_elementrK   s    r   patchKmlElement.patch  sE     77??""j0$'GGOO$;$;C!&0CGGOO# 1r@   c                     [         R                  R                  R                  [        :X  a*  U R
                  [         R                  R                  l        gg)zCUnpatch xml.dom.minidom.Element to use the Element class used last.Nr   r   s    r   unpatchKmlElement.unpatch  s5     77??""j0&)&;&;CGGOO# 1r@   c                    U R                   (       a  [        U R                   5      S:X  a  U R                   S   R                  [        R                  R
                  R                  R                  :X  aB  UR                  U5        [        R                  R                  X5        UR                  U5        g[        R                  R                  XX#U5        g)zXIf the element only contains a single string value then don't add white space around it.r	   r   N)
childNodesrJ   nodeTyper   r   r   Node	TEXT_NODEwriter   r   writexml)r   writerindent	addindentnewls        r   r   KmlElement.writexml  s    ??s4??3q8??1&&#''//*>*>*H*HHLL ((11$?LL((11$SWXr@   r]   N)r&   r&   r&   )rV   rW   rX   rY   rZ   r   r   r   r   r   r[   r   r   r   r\   r]   r@   r   r   r     sE    N//1 1 < <
Yr@   r   c                    ^ ^ U U4S jnU$ )zType checking.c                    >^  UU U4S jnU$ )Nc                 L  > Ub  T(       aK  [        UT5      (       d9  [        SR                  UR                  R                  TR                  5      5      eOG[        U5      TLa9  [        SR                  UR                  R                  TR                  5      5      eT" X5      $ )NzJ{0} is an invalid type. Accepts an instance of a subclass of simplekml.{1}z<{0} is an invalid type. Accepts an instance of simplekml.{1})
isinstance	TypeErrorr.   r{   rV   type)r   value	classtypefsubclasss     r   _inner&check.<locals>._second.<locals>._inner,  s     %eY77' )88>u?W?WYbYkYk8ln n 8  ;)3' )88>u?W?WYbYkYk8ln nT>!r@   r]   )r   r   r   r   s   ` r   _secondcheck.<locals>._second+  s    
	" r@   r]   )r   r   r   s   `` r   checkr   )  s     Nr@   )F)rZ   r0   rD   rE   rF   rI   xml.dom.minidomr   warningssimplekml.makeunicoder   objectr   r_   r   r   r   r   r   r   r   r   r   r   r   r]   r@   r   <module>r      s   $ 
 
;;   #Pgf Pgd@tf @tF2 21w 13 3-7 -0g 0!_f !_JY(( Y:r@   