
    (fU/                         d Z ddlmZmZ  G d de      Z G d de      Z G d de      Z G d	 d
e      Z G d de      Z G d de      Z	 G d de      Z
 G d de      Zy)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/>.

    )Kmlablecheckc                        e Zd ZdZd
 fd	Zed        Zej                  d        Zed        Zej                  d        Zed        Z	e	j                  d        Z	d	 Z
 xZS )SimpleFieldz]Custom field, forms part of a schema.

    The arguments are the same as the properties.
    c                     t         t        |           || j                  d<   || j                  d<   || j                  d<   y )NnametypedisplayName)superr   __init___kmlselfr   r	   displayname	__class__s       _/mounts/lovelace/software/anaconda3/envs/py312/lib/python3.12/site-packages/simplekml/schema.pyr   zSimpleField.__init__   s:    k4)+ 		& 		&#.		-     c                      | j                   d   S zName of field, accepts string.r   r   r   s    r   r   zSimpleField.name!        yy  r   c                 "    || j                   d<   y Nr   r   r   r   s     r   r   zSimpleField.name&        		&r   c                      | j                   d   S )zFType of field, accepts string from :class:`simplekml.Types` constants.r	   r   r   s    r   r	   zSimpleField.type*   r   r   c                 "    || j                   d<   y )Nr	   r   )r   r	   s     r   r	   zSimpleField.type/   r   r   c                      | j                   d   S )zCPretty name of field that is shown in google earth, accepts string.r
   r   r   s    r   r   zSimpleField.displayname3        yy''r   c                 "    || j                   d<   y Nr
   r   r   r   s     r   r   zSimpleField.displayname8       #.		- r   c                 L   dj                  | j                  t        j                  | j                              g}| j
                  =|j                  dj                  t        j                  | j
                                     |j                  d       dj                  |      S )Nz#<SimpleField type="{0}" name="{1}"><displayName>{0}</displayName>z</SimpleField> )formatr	   r   _chrconvertr   r   appendjoinr   bufs     r   __str__zSimpleField.__str__<   s~    5<<TYYH[H[\`\e\eHfgh'JJ8??@S@STXTdTd@efg

#$wws|r   NstringN)__name__
__module____qualname____doc__r   propertyr   setterr	   r   r.   __classcell__r   s   @r   r   r      s    
/ ! ! 
[[! ! ! ! 
[[! ! ( ( / /r   r   c                   *     e Zd ZdZd fd	Zd Z xZS )GxSimpleArrayFieldzCustom array field for gx:track, forms part of a schema.

    Args:
      * *same as properties*
      * *all other args same as* :class:`simplekml.SimpleField`
    c                 0    t         t        |   |||       y N)r   r:   r   r   s       r   r   zGxSimpleArrayField.__init__L   s     $0t[Ir   c                     dj                  | j                  | j                        g}| j                  *|j	                  dj                  | j                               |j	                  d       dj                  |      S )Nz+<gx:SimpleArrayField type="{0}" name="{1}">r&   z</gx:SimpleArrayField>r'   )r(   r	   r   r   r*   r+   r,   s     r   r.   zGxSimpleArrayField.__str__O   sk    <CCDIIDHIIO P'JJ7>>t?O?OPQ

+,wws|r   r/   )r1   r2   r3   r4   r   r.   r7   r8   s   @r   r:   r:   D   s    Jr   r:   c                        e Zd ZdZ fdZed        Zej                  d        Zed        Zej                  d        Zd Z	 xZ
S )
SimpleDatazIData of a schema.

    The arguments are the same as the properties.
    c                 f    t         t        |           || j                  d<   || j                  d<   y )Nr   value)r   r?   r   r   )r   r   rA   r   s      r   r   zSimpleData.__init__^   s,    j$(* 		&"		'r   c                      | j                   d   S r   r   r   s    r   r   zSimpleData.namec   r   r   c                 "    || j                   d<   y r   r   r   s     r   r   zSimpleData.nameh   r   r   c                      | j                   d   S )z-Value of field, accepts int, float or string.rA   r   r   s    r   rA   zSimpleData.valuel        yy!!r   c                 "    || j                   d<   y NrA   r   r   rA   s     r   rA   zSimpleData.valueq       "		'r   c                 t    dj                  t        j                  | j                        | j                        S )Nz'<SimpleData name="{0}">{1}</SimpleData>)r(   r   r)   r   rA   r   s    r   r.   zSimpleData.__str__u   s.    9@@ATATUYU^U^A_aeakakllr   )r1   r2   r3   r4   r   r5   r   r6   rA   r.   r7   r8   s   @r   r?   r?   X   sk    
#
 ! ! 
[[! ! " " \\# #mr   r?   c                   d     e Zd ZdZd fd	Zed        Zej                  d        Zd Zd Z	 xZ
S )GxSimpleArrayDatazhData of a :class:`simplekml.GxSimpleArrayField`.

    The arguments are the same as the properties.
    c                     t         t        |           || j                  d<   g | _        || xj                  |z  c_        y y r   )r   rL   r   r   values)r   r   rN   r   s      r   r   zGxSimpleArrayData.__init__   s?    /1 		&KK6!K r   c                      | j                   d   S r   r   r   s    r   r   zGxSimpleArrayData.name   r   r   c                 "    || j                   d<   y r   r   r   s     r   r   zGxSimpleArrayData.name   r   r   c                 :    | j                   j                  |       y)z'Adds a value to the gxsimpledarraydata.N)rN   r*   rH   s     r   newvaluezGxSimpleArrayData.newvalue   s    5!r   c                    dj                  t        j                  | j                              g}| j                  D ]"  }|j                  dj                  |             $ |j                  d       dj                  |      S )Nz<gx:SimpleArrayData name="{0}">z<gx:value>{0}</gx:value>z</gx:SimpleArrayData>r'   )r(   r   r)   r   rN   r*   r+   )r   r-   rA   s      r   r.   zGxSimpleArrayData.__str__   sl    1889L9LTYY9WXY[[ 	AEJJ188?@	A

*+wws|r   r<   )r1   r2   r3   r4   r   r5   r   r6   rR   r.   r7   r8   s   @r   rL   rL   y   sC    
" ! ! 
[[! !"r   rL   c                   ~     e Zd ZdZd	 fd	Zed        Zed        Zej                  d        Zd	dZ	d	dZ
d Z xZS )
SchemazzCustom KML schema that is used to add custom data to KML Features.

    The arguments are the same as the properties.
    c                 d    t         t        |           || j                  d<   g | _        g | _        y r   )r   rU   r   r   simplefieldsgxsimplearrayfields)r   r   r   s     r   r   zSchema.__init__   s.    fd$& 		&#% r   c                     | j                   S )zUnique id of the schema.)_idr   s    r   idz	Schema.id   s     xxr   c                      | j                   d   S )zName of schema, accepts string.r   r   r   s    r   r   zSchema.name   r   r   c                 "    || j                   d<   y r   r   r   s     r   r   zSchema.name   r   r   c                 l    | j                   j                  t        |||             | j                   d   S )aj  Creates a new :class:`simplekml.SimpleField` and attaches it to this schema.

        Returns an instance of :class:`simplekml.SimpleField` class.

        Args:
          * name: string name of simplefield (required)
          * type: string type of field (required)
          * displayname: string for pretty name that will be displayed (default None)
        )rW   r*   r   r   r   r	   r   s       r   newsimplefieldzSchema.newsimplefield   s2     	  T4!EF  $$r   c                 l    | j                   j                  t        |||             | j                   d   S )ax  Creates a new :class:`simplekml.GxSimpleArrayField` and attaches it to this schema.

        Returns an instance of :class:`simplekml.GxSimpleArrayField` class.

        Args:
          * name: string name of simplefield (required)
          * type: string type of field (required)
          * displayname: string for pretty name that will be displayed (default None)
        r_   )rX   r*   r:   r`   s       r   newgxsimplearrayfieldzSchema.newgxsimplearrayfield   s3     	  ''(:4{(ST''++r   c                    g }| j                   I|j                  dj                  t        j                  | j                         | j
                               n*|j                  dj                  | j
                               | j                  D ]!  }|j                  |j                                # | j                  D ]!  }|j                  |j                                # |j                  d       dj                  |      S )Nz<Schema name="{0}" id="{1}">z<Schema id="{0}">z	</Schema>r'   )
r   r*   r(   r   r)   rZ   rW   r.   rX   r+   r   r-   fields      r   r.   zSchema.__str__   s    99 JJ6==g>Q>QRVR[R[>\^b^f^fghJJ*11$((;<&& 	(EJJu}}'	(-- 	(EJJu}}'	(

;wws|r   r<   )r1   r2   r3   r4   r   r5   r[   r   r6   ra   rc   r.   r7   r8   s   @r   rU   rU      s\    
&   ! ! 
[[! !%,r   rU   c                        e Zd ZdZd
 fd	Zed        Zej                  d        Zed        Zej                  d        Zed        Z	e	j                  d        Z	d	 Z
 xZS )DatazvData of extended data used to add custom data to KML Features.

    The arguments are the same as the properties.
    c                     t         t        |           || j                  d<   || j                  d<   || j                  d<   y )Nr   rA   r
   )r   rh   r   r   )r   r   rA   r   r   s       r   r   zData.__init__   s:    dD"$ 		&"		'#.		- r   c                      | j                   d   S )zData name, accepts string.r   r   r   s    r   r   z	Data.name   r   r   c                 "    || j                   d<   y r   r   r   s     r   r   z	Data.name   r   r   c                      | j                   d   S )zData value, accepts string.rA   r   r   s    r   rA   z
Data.value   rE   r   c                 "    || j                   d<   y rG   r   rH   s     r   rA   z
Data.value   rI   r   c                      | j                   d   S )z7The name that is displayed to the user, accepts string.r
   r   r   s    r   r   zData.displayname   r    r   c                 "    || j                   d<   y r"   r   r#   s     r   r   zData.displayname  r$   r   c                    dj                  t        j                  | j                              g}| j                  d   -|j                  dj                  | j                  d                | j                  d   @|j                  dj                  t        j                  | j                  d                      |j                  d       dj                  |      S )Nz<Data name="{0}">rA   z<value>{0}</value>r
   r&   z</Data>r'   )r(   r   r)   r   r   r*   r+   r,   s     r   r.   zData.__str__  s    #**7+>+>tyy+IJK99W)JJ+22499W3EFG99]#/JJ8??@S@STXT]T]^kTl@mno

9wws|r   )NNN)r1   r2   r3   r4   r   r5   r   r6   rA   r   r.   r7   r8   s   @r   rh   rh      s    
/ ! ! 
[[! ! " " \\# # ( ( / /r   rh   c                   j     e Zd ZdZd fd	Zed        Zej                  d        Zd Zd Z	d Z
 xZS )	
SchemaDatayData of a schema that is used to add custom data to KML Features.

    The arguments are the same as the properties.
    c                 d    t         t        |           g | _        g | _        || j
                  d<   y N	schemaUrl)r   rr   r   simpledatasgxsimplearraydatasr   )r   	schemaurlr   s     r   r   zSchemaData.__init__  s.    j$(*"$!*		+r   c                 ^    | j                   d   dj                  | j                   d         S y)zSchema url, accepts string.rv   Nz#{0})r   r(   r   s    r   ry   zSchemaData.schemaurl  s.     99[!-==;!788r   c                 "    || j                   d<   y ru   r   )r   ry   s     r   ry   zSchemaData.schemaurl%  s    !*		+r   c                 j    | j                   j                  t        ||             | j                   d   S )a3  
        Creates a new :class:`simplekml.SimpleData` and attaches it to this schemadata.

        Returns an instance of :class:`simplekml.SimpleData` class.

        Args:
          * name: string name of simplefield (required)
          * value: int, float or string for value of field (required)
        r_   )rw   r*   r?   r   r   rA   s      r   newsimpledatazSchemaData.newsimpledata)  s0     	
4 78##r   c                 j    | j                   j                  t        ||             | j                   d   S )a8  Creates a new :class:`simplekml.GxSimpleArrayData` and attaches it to this schemadata.

        Returns an instance of :class:`simplekml.GxSimpleArrayData` class.

        Args:
          * name: string name of simplefield (required)
          * value: int, float or string for value of field (required)
        r_   )rx   r*   rL   r}   s      r   newgxsimplearraydatazSchemaData.newgxsimplearraydata6  s1     	&&'8u'EF&&r**r   c                 >   dj                  | j                        g}| j                  D ]!  }|j                  |j	                                # | j
                  D ]!  }|j                  |j	                                # |j                  d       dj                  |      S )Nz<SchemaData schemaUrl="{0}">z</SchemaData>r'   )r(   ry   rw   r*   r.   rx   r+   re   s      r   r.   zSchemaData.__str__B  s    -44T^^DE%% 	(EJJu}}'	(,, 	(EJJu}}'	(

?#wws|r   r<   )r1   r2   r3   r4   r   r5   ry   r6   r~   r   r.   r7   r8   s   @r   rr   rr     sJ    
+   + +$
+r   rr   c                   z     e Zd ZdZ fdZed        Zej                   ee	      d               ZddZ
d Z xZS )ExtendedDatars   c                 V    t         t        |           d | j                  d<   g | _        y NschemaData_)r   r   r   r   datas)r   r   s    r   r   zExtendedData.__init__S  s%    lD*,#'		- 
r   c                 l    | j                   d   t               | j                   d<   | j                   d   S )zBExtra data for the feature, accepts :class:`simplekml.SchemaData`.r   )r   rr   r   s    r   
schemadatazExtendedData.schemadataX  s2     99]#+'1|DIIm$yy''r   c                 "    || j                   d<   y r   r   )r   r   s     r   r   zExtendedData.schemadata_  s     $.		- r   c                 l    | j                   j                  t        |||             | j                   d   S )at  Creates a new :class:`simplekml.Data` and attaches it to this schemadata.

        Returns an instance of :class:`simplekml.Data` class.

        Args:
          * name: string name of simplefield (required)
          * value: int, float or string for value of field (required)
          * displayname: string for pretty name that will be displayed (default None)
        r_   )r   r*   rh   )r   r   rA   r   s       r   newdatazExtendedData.newdatad  s-     	

$tUK89zz"~r   c                     g }| j                   D ]!  }|j                  |j                                # | j                  d   ,|j                  | j                  d   j                                dj	                  |      S )Nr   r'   )r   r*   r.   r   r+   )r   r-   datas      r   r.   zExtendedData.__str__q  sg    JJ 	'DJJt||~&	'99]#/JJtyy/779:wws|r   r<   )r1   r2   r3   r4   r   r5   r   r6   r   rr   r   r.   r7   r8   s   @r   r   r   M  sR    

 ( ( 
:.  .r   r   N)r4   simplekml.baser   r   r   r:   r?   rL   rU   rh   rr   r    r   r   <module>r      sw   $ *,' ,^ (m mB F?W ?F.7 .d8 8x*7 *r   