Changeset 3292


Ignore:
Timestamp:
01/02/08 16:00:27 (12 years ago)
Author:
mkochan
Message:

Added basic comments in KMLDocument.py

Location:
DPPP/kml/csml2kml/python
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • DPPP/kml/csml2kml/python/notes.txt

    r3291 r3292  
    11[x] long term task 
     2[+] curious about 
    23[.] minor issue 
    34[o] important but can wait 
     
    56 
    67---------------------------------------------------------------------------------------------------------------------------- 
     8|| KMLDocument.py 
    79 
    810[O] Add comments: KMLDocument.py 
     11[O] Add KMLDocument.build(), make KMLDocument descended from KMLElement, de-ambiguize to KMLWholeDocument. 
     12 
     13---------------------------------------------------------------------------------------------------------------------------- 
     14 
     15[+] Assertion and type checking in Python 
    916[o] Resolve outstanding issues in pylons controllers 
    1017[O] Make quadrize_stations.py work with the KMLDocument module -- by wrapping the functionality for creating 
  • DPPP/kml/csml2kml/python/prototypes/KMLDocument.py

    r3291 r3292  
    22 
    33class KMLDocument: 
     4    ''' 
     5    Wraps around a whole KML document and makes it possible to save it to a file directly. 
     6    Does *not* represent merely the <kml:Document> tag, but also the wrapping <kml:kml> tag. 
     7    ''' 
    48 
    59    def __init__(self, name, styles): 
     
    1014 
    1115    def save(self, outputFilename): 
     16        ''' 
     17        Save the document to file <code>outputFilename</code>. 
     18        ''' 
    1219 
    1320        # Auxiliary function, indents XML 
     
    5158        kmlFile.close() 
    5259 
    53 # Abstract class 
    5460class KMLElement: 
    55     def build(self): 
     61    ''' 
     62    Abstract class, representing any element of a KML document -- i.e. anything contained *within* 
     63    the <kml:Document> element. 
     64    ''' 
     65 
     66    def build(self): 
     67        ''' 
     68        It is required that each KMLElement instance is able to build() itself into an ElementTree.Element 
     69        instance of KML, which it represents. 
     70        ''' 
    5671        raise NotImplementedError("Abstract method, to be overriden by child classes") 
    5772 
    5873class KMLStyle(KMLElement): 
     74    ''' 
     75    Represents the <kml:Style> tag. 
     76    ''' 
    5977 
    6078    def __init__(self, id, iconURL = None, balloonTemplate = None, listItemType = None): 
     
    93111        return styleElement 
    94112 
    95 # Defined for convenience 
    96113def createDefaultPlacemarKMLStyle(id = 'default_placemark_style', 
    97114                                  iconURL = 'http://maps.google.com/mapfiles/kml/shapes/target.png', 
    98115                                  balloonTemplate = ''): 
     116    ''' 
     117    A factory method defined for convenience. Creates a style readily usable for adding styles to KML placemarks. 
     118    ''' 
    99119    return KMLStyle(id, iconURL, balloonTemplate) 
    100120 
    101121class KMLPlacemark(KMLElement): 
     122    ''' 
     123    Represents the <kml:Placemark> tag. 
     124    ''' 
    102125     
    103126    def __init__(self, id, name, lon, lat, styleID = None, data=None): 
     
    141164 
    142165class KMLFolder(KMLElement): 
     166    ''' 
     167    Represents the <kml:Folder> tag. 
     168    ''' 
    143169 
    144170    def __init__(self, name, children, styleID = None, region = None): 
     
    164190 
    165191class KMLRegion(KMLElement): 
     192    ''' 
     193    Represents the <kml:Region> tag. 
     194    ''' 
    166195     
    167196    def __init__(self, west, south, east, north, minLodPixels = 64, maxLodPixels = -1): 
Note: See TracChangeset for help on using the changeset viewer.