[Liblas-commits] hg: VLR docs

liblas-commits at liblas.org liblas-commits at liblas.org
Tue Apr 6 15:32:27 EDT 2010


changeset 1156369845c1 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=1156369845c1
summary: VLR docs

diffstat:

 doc/python/classes.txt  |  28 +++++++++++++++-
 python/liblas/format.py |   9 ++--
 python/liblas/guid.py   |  33 ++++++++++++++++++
 python/liblas/point.py  |   2 +-
 python/liblas/vlr.py    |  86 +++++++++++++++++++++++++++++++++++++++++++++---
 python/tests/GUID.txt   |   4 +-
 6 files changed, 149 insertions(+), 13 deletions(-)

diffs (269 lines):

diff -r f7723d9443e7 -r 1156369845c1 doc/python/classes.txt
--- a/doc/python/classes.txt	Tue Apr 06 13:44:15 2010 -0500
+++ b/doc/python/classes.txt	Tue Apr 06 14:26:32 2010 -0500
@@ -68,8 +68,34 @@
 =============================================
 
 .. autoclass:: liblas.format.Format
-    :members:   __init__
+    :members:   __init__,
+                major,
+                minor,
+                color,
+                time,
+                size
 
+=============================================
+liblas.guid.GUID
+=============================================
+
+.. autoclass:: liblas.guid.GUID
+    :members:   __init__,
+                __str__,
+                __eq__
+
+=============================================
+liblas.vlr.VLR
+=============================================
+
+.. autoclass:: liblas.vlr.VLR
+    :members:   __init__,
+                userid,
+                description,
+                recordlength,
+                recordid,
+                reserved,
+                data
 .. _specification: http://liblas.org/raw-attachment/wiki/WikiStart/asprs_las_format_v13.pdf
 
 # .. doxygenclass:: liblas::Color
diff -r f7723d9443e7 -r 1156369845c1 python/liblas/format.py
--- a/python/liblas/format.py	Tue Apr 06 13:44:15 2010 -0500
+++ b/python/liblas/format.py	Tue Apr 06 14:26:32 2010 -0500
@@ -113,15 +113,16 @@
     
     def set_color(self, value):
         return core.las.LASPointFormat_SetColor(self.handle, bool(value))
-        
-    color = property(get_color, set_color)
+    
+    doc = """Does this format have color information"""
+    color = property(get_color, set_color, None, doc)
 
     def get_time(self):
         return bool(core.las.LASPointFormat_HasTime(self.handle))
     
     def set_time(self, value):
         return core.las.LASPointFormat_SetTime(self.handle, bool(value))
-        
-    time = property(get_time, set_time)  
+    doc = """Does this format have time information"""
+    time = property(get_time, set_time, None, doc)  
     
     
\ No newline at end of file
diff -r f7723d9443e7 -r 1156369845c1 python/liblas/guid.py
--- a/python/liblas/guid.py	Tue Apr 06 13:44:15 2010 -0500
+++ b/python/liblas/guid.py	Tue Apr 06 14:26:32 2010 -0500
@@ -44,6 +44,34 @@
 
 class GUID(object):
     def __init__(self, key=None, handle=None):
+        """ 
+        :keyword key: GUID string to create with
+        :type key: string
+        :keyword handle: raw ctypes object
+        
+        >>> from liblas import guid
+        >>> from liblas import header
+
+        >>> g2 = guid.GUID(key='8388f1b8-aa1b-4108-bca3-6bc68e7b062e')
+        >>> g2
+        8388f1b8-aa1b-4108-bca3-6bc68e7b062e
+
+        >>> header = header.Header()
+        >>> header.guid = g2
+        >>> header.guid
+        8388f1b8-aa1b-4108-bca3-6bc68e7b062e
+        >>> header.project_id
+        '8388f1b8-aa1b-4108-bca3-6bc68e7b062e'
+
+        >>> g3 = guid.GUID(key='8388f1b8-aa1b-4108-bca3-6bc68e7b062e')
+        >>> g2 == g3
+        True
+        
+        .. note::
+            In Python 2.5+, you can use the :mod:`uuid` module to control the
+            creation of UUIDs in alternative ways. Otherwise, the GUID() 
+            constructor will create them for you, but rather simply.
+        """
         self.handle = None
         if handle:
             self.handle = handle
@@ -57,9 +85,14 @@
             core.las.LASGuid_Destroy(self.handle)
     
     def __str__(self):
+        """String representation of the GUID"""
         return core.las.LASGuid_AsString(self.handle)
     
     def __eq__(self, other):
+        """Test GUID for equality against another :obj:`liblas.guid.GUID` instance
+        
+        :param other: The :obj:`liblas.guid.GUID` instance to test against
+        """
         if isinstance(other, GUID):
             return bool(core.las.LASGuid_Equals(self.handle, other.handle))
         raise core.LASException("GUID can only be compared to other GUIDs, not %s" % type(other))
diff -r f7723d9443e7 -r 1156369845c1 python/liblas/point.py
--- a/python/liblas/point.py	Tue Apr 06 13:44:15 2010 -0500
+++ b/python/liblas/point.py	Tue Apr 06 14:26:32 2010 -0500
@@ -337,7 +337,7 @@
         t = float(t) + ms * 0.000001
         core.las.LASPoint_SetTime(self.handle,t)
 
-    doc = """Interpeted (datetime.datetime instance) time value for the point.
+    doc = """Interpeted (:class:`datetime.datetime` instance) time value for the point.
     
         Example:
         
diff -r f7723d9443e7 -r 1156369845c1 python/liblas/vlr.py
--- a/python/liblas/vlr.py	Tue Apr 06 13:44:15 2010 -0500
+++ b/python/liblas/vlr.py	Tue Apr 06 14:26:32 2010 -0500
@@ -45,6 +45,44 @@
 
 class VLR(object):
     def __init__(self, owned=True, handle=None):
+        """ 
+        :keyword owned: flag to denote whether or not the VLR owns itself
+        :keyword handle: raw ctypes object
+        
+        From the specification_:
+        
+            The Public Header Block is followed by one or more Variable Length
+            Records (There is one mandatory Variable Length Record,
+            GeoKeyDirectoryTag). The number of Variable Length Records is
+            specified in the "Number of Variable Length Records"
+            (:obj:`liblas.header.Header.records_count`) field in the Public
+            Header Block. The Variable Length Records must be accessed
+            sequentially since the size of each variable length record is
+            contained in the Variable Length Record Header. Each Variable
+            Length Record Header is 60 bytes in length.
+
+        >>> from liblas import vlr
+        >>> v = vlr.VLR()
+        >>> v.reserved
+        0
+        >>> v.recordid
+        0
+        >>> v.recordid = 2
+        >>> v.recordid
+        2
+        >>> v.userid
+        ''
+        >>> v.userid = 'liblas.org'
+        >>> v.userid
+        'liblas.org'
+
+        >>> v.description
+        ''
+        >>> v.description = 'libLAS'
+        >>> v.description
+        'libLAS'
+
+        """
         if handle:
             self.handle = handle
         else:
@@ -59,31 +97,66 @@
         return core.las.LASVLR_GetUserId(self.handle)
     def set_userid(self, value):
         return core.las.LASVLR_SetUserId(self.handle, value)
-    userid = property(get_userid, set_userid)
+    doc = """User ID key for this VLR (clipped to 16 bytes long)
+    
+    From the specification_:
+        The User ID field is ASCII character data that identifies the user
+        which created the variable length record. It is possible to have many
+        Variable Length Records from different sources with different User
+        IDs. If the character data is less than 16 characters, the remaining
+        data must be null. The User ID must be registered with the LAS
+        specification managing body. The management of these User IDs ensures
+        that no two individuals accidentally use the same User ID. The
+        specification will initially use two IDs: one for globally specified
+        records (LASF_Spec), and another for projection types
+        (LASF_Projection). Keys may be requested at
+        http://www.asprs.org/lasform/keyform.html
+    """
+    userid = property(get_userid, set_userid, None, doc)
 
     def get_description(self):
         return core.las.LASVLR_GetDescription(self.handle)
     def set_description(self, value):
         return core.las.LASVLR_SetDescription(self.handle, value)
-    description = property(get_description, set_description)
+    doc = """Description of this VLR instance (clipped to 32 bytes long)
+    
+    From the specification_:
+        Optional, null terminated text description of the data. Any remaining
+        characters not used must be null.
+    """
+    description = property(get_description, set_description, None, doc)
 
     def get_recordlength(self):
         return core.las.LASVLR_GetRecordLength(self.handle)
     def set_recordlength(self, value):
         return core.las.LASVLR_SetRecordLength(self.handle, value)
-    recordlength = property(get_recordlength, set_recordlength)
+    doc = """The number of bytes long the VLR is"""
+    recordlength = property(get_recordlength, set_recordlength, None, doc)
 
     def get_recordid(self):
         return core.las.LASVLR_GetRecordId(self.handle)
     def set_recordid(self, value):
         return core.las.LASVLR_SetRecordId(self.handle, value)
-    recordid = property(get_recordid, set_recordid)
+    doc = """Record ID for the VLR
+    
+    From the specification_:
+        The Record ID is dependent upon the User ID. There can be 0 to 65535
+        Record IDs for every User ID. The LAS specification manages its own
+        Record IDs (User IDs owned by the specification), otherwise Record IDs
+        will be managed by the owner of the given User ID. Thus each User ID
+        is allowed to assign 0 to 65535 Record IDs in any manner they desire.
+        Publicizing the meaning of a given Record ID is left to the owner of
+        the given User ID. Unknown User ID/Record ID combinations should be
+        ignore
+    """
+    recordid = property(get_recordid, set_recordid, None, doc)
 
     def get_reserved(self):
         return core.las.LASVLR_GetReserved(self.handle)
     def set_reserved(self, value):
         return core.las.LASVLR_SetReserved(self.handle, value)
-    reserved = property(get_reserved, set_reserved)
+    doc = """Reserved value for the VLR.  Currently unused."""
+    reserved = property(get_reserved, set_reserved, None, doc)
     
     def get_data(self):
         length = self.recordlength
@@ -94,5 +167,6 @@
     def set_data(self, data):
         pdata = ctypes.cast(data, ctypes.POINTER(ctypes.c_ubyte))
         core.las.LASVLR_SetData(self.handle, pdata, self.recordlength)
-    data = property(get_data, set_data)
+    doc = """Raw data (in the form of :data:`ctypes.c_ubyte`)"""
+    data = property(get_data, set_data, None, doc)
 
diff -r f7723d9443e7 -r 1156369845c1 python/tests/GUID.txt
--- a/python/tests/GUID.txt	Tue Apr 06 13:44:15 2010 -0500
+++ b/python/tests/GUID.txt	Tue Apr 06 14:26:32 2010 -0500
@@ -15,4 +15,6 @@
   >>> g3 = guid.GUID(key='8388f1b8-aa1b-4108-bca3-6bc68e7b062e')
   >>> g2 == g3
   True
-  
\ No newline at end of file
+  
+  >>> import uuid
+  >>> g4 = guid.GUID(key=str(uuid.uuid1()))


More information about the Liblas-commits mailing list