[Liblas-commits] hg: 7 new changesets

liblas-commits at liblas.org liblas-commits at liblas.org
Fri Jun 25 13:29:31 EDT 2010


changeset a0c8707bd336 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=a0c8707bd336
summary: add_vlr returns an int

changeset 88ae036f7317 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=88ae036f7317
summary: add VLR entry to python example

changeset 968cbe281fd4 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=968cbe281fd4
summary: add required libxml2 detection, remove zlib

changeset e857403e00b7 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=e857403e00b7
summary: some convenience for vlrs

changeset 0a4b0e42d226 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=0a4b0e42d226
summary: support setting header size

changeset 489610038d99 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=489610038d99
summary: support 1.3 as a max minor version, add point formats 4 and 5 (don't do anything with them yet though)

changeset 6bdf6773f8de in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=6bdf6773f8de
summary: support 1.3 as a max minor version, add point formats 4 and 5 (don't do anything with them yet though)

diffstat:

 CMakeLists.txt               |  33 +++++++++++++++++++++------------
 apps/CMakeLists.txt          |   4 ++--
 doc/tutorial/python.txt      |  44 +++++++++++++++++++++++++++++++++++++++++++-
 include/liblas/lasheader.hpp |   6 +++++-
 include/liblas/liblas.hpp    |   4 +++-
 python/liblas/core.py        |   2 +-
 python/liblas/vlr.py         |  10 +++++++---
 src/CMakeLists.txt           |   4 ++--
 src/lasheader.cpp            |   8 +++++++-
 9 files changed, 91 insertions(+), 24 deletions(-)

diffs (255 lines):

diff -r 898f0d6119ad -r 6bdf6773f8de CMakeLists.txt
--- a/CMakeLists.txt	Tue Jun 22 11:21:34 2010 -0500
+++ b/CMakeLists.txt	Fri Jun 25 12:27:30 2010 -0500
@@ -132,6 +132,23 @@
 ###############################################################################
 # Search for dependencies
 
+# libxml2 support - required, default=ON
+set(WITH_LIBXML2 TRUE CACHE BOOL "Choose if libxml2 support should be built (required)")
+
+if(WITH_LIBXML2)
+    find_package(LibXml2 REQUIRED)
+    mark_as_advanced(CLEAR LIBXML2_FOUND)
+    mark_as_advanced(CLEAR LIBXML2_INCLUDE_DIR)
+    mark_as_advanced(CLEAR LIBXML2_LIBRARIES) 
+    mark_as_advanced(CLEAR LIBXML2_DEFINITIONS)
+    if(LIBXML2_FOUND)
+        include_directories(${LIBXML2_INCLUDE_DIR})
+        add_definitions(-DHAVE_LIBXML2=1)
+    endif()
+endif()
+
+
+
 # Boost C++ Libraries support - optional, default=OFF
 set(WITH_BOOST FALSE CACHE BOOL "Choose if Boost C++ Libraries support should be built")
 
@@ -144,17 +161,7 @@
     endif()
 endif()
 
-# zlib support - optional, default=OFF
-set(WITH_ZLIB FALSE CACHE BOOL "Choose if zlib support should be built")
 
-if(WITH_ZLIB)
-    find_package(ZLIB)
-
-    if(ZLIB_FOUND)
-        include_directories(${ZLIB_INCLUDE_DIR})
-        add_definitions(-DHAVE_ZLIB=1)
-    endif()
-endif()
 
 # GeoTIFF support - optional, default=OFF
 set(WITH_GEOTIFF FALSE CACHE BOOL "Choose if GeoTIFF support should be built")
@@ -180,8 +187,10 @@
 
     # Determine libTIFF availability, required
     if (GEOTIFF_FOUND)
-        mark_as_advanced(CLEAR TIFF)
-        find_package(TIFF)
+
+        find_package(TIFF) 
+        mark_as_advanced(CLEAR TIFF_INCLUDE_DIR) 
+        mark_as_advanced(CLEAR TIFF_LIBRARIES) 
         if (TIFF_FOUND)
             include_directories(${TIFF_INCLUDE_DIR})
         endif()
diff -r 898f0d6119ad -r 6bdf6773f8de apps/CMakeLists.txt
--- a/apps/CMakeLists.txt	Tue Jun 22 11:21:34 2010 -0500
+++ b/apps/CMakeLists.txt	Fri Jun 25 12:27:30 2010 -0500
@@ -62,12 +62,12 @@
 
 set(APPS_CPP_DEPENDENCIES
     ${LIBLAS_LIB_NAME}
-    ${ZLIB_LIBRARY}
     ${TIFF_LIBRARY}
     ${GEOTIFF_LIBRARY}
     ${GDAL_LIBRARY}
     ${SPATIALINDEX_LIBRARY}
-    ${ORACLE_LIBRARY})
+    ${ORACLE_LIBRARY}
+    ${LIBXML2_LIBRARIES})
 
 # Build lasinfo
 if(LASINFO)
diff -r 898f0d6119ad -r 6bdf6773f8de doc/tutorial/python.txt
--- a/doc/tutorial/python.txt	Tue Jun 22 11:21:34 2010 -0500
+++ b/doc/tutorial/python.txt	Fri Jun 25 12:27:30 2010 -0500
@@ -169,7 +169,49 @@
     255
     >>> c.green
     255
-    
+
+=============================================
+VLRs
+=============================================
+
+Variable Length Records (VLR) are frequently used by applications to store 
+anything they wish in the file as a "blob" written into the header of the 
+file.  libLAS supports writing and creating your own VLRs in addition to 
+taking on the work of interpreting and using VLR records related to 
+spatial reference systems if GDAL and proj.4 are linked into the library.  
+
+The following code demonstrates how to write your own VLR by opening an 
+XML file and inserting it into a new file.
+
+.. code-block:: python
+
+    from liblas import file as lasfile
+    from liblas import vlr
+    from liblas import header as lasheader
+
+    f = lasfile.File('test/data/srs_utm17.las',None,'rb')
+    h = f.header
+
+    v = vlr.VLR()
+
+    text =  open('schemas/las.xml','rb').read()
+
+    import ctypes
+
+    data = ctypes.create_string_buffer(text)
+
+    v.userid='hobu'
+    v.recordid = 12345
+    v.recordlength = len(text)
+    v.data = data
+
+    h.add_vlr(v)
+
+    f2 = lasfile.File('junk.las',header=h,mode='w')
+    for p in f:
+        f2.write(p)
+    f2.close()
+
     
 =============================================
 Writing
diff -r 898f0d6119ad -r 6bdf6773f8de include/liblas/lasheader.hpp
--- a/include/liblas/lasheader.hpp	Tue Jun 22 11:21:34 2010 -0500
+++ b/include/liblas/lasheader.hpp	Fri Jun 25 12:27:30 2010 -0500
@@ -206,6 +206,10 @@
     /// Get number of bytes of generic verion of public header block storage.
     /// Standard version of the public header block is 227 bytes long.
     uint16_t GetHeaderSize() const;
+
+    /// Sets the header size.  Note that this is not the same as the offset to 
+    /// point data. 
+    void SetHeaderSize(uint16_t v);
     
     /// Get number of bytes from the beginning to the first point record.
     uint32_t GetDataOffset() const;
@@ -336,7 +340,7 @@
         eProjectId4Size = 8,
         eSystemIdSize = 32,
         eSoftwareIdSize = 32,
-        eHeaderSize = 227,
+        eHeaderSize = 227, 
         eFileSourceIdMax = 65535
     };
 
diff -r 898f0d6119ad -r 6bdf6773f8de include/liblas/liblas.hpp
--- a/include/liblas/liblas.hpp	Tue Jun 22 11:21:34 2010 -0500
+++ b/include/liblas/liblas.hpp	Fri Jun 25 12:27:30 2010 -0500
@@ -124,7 +124,7 @@
     eVersionMajorMin = 1, ///< Minimum of major component
     eVersionMajorMax = 1, ///< Maximum of major component
     eVersionMinorMin = 0, ///< Minimum of minor component
-    eVersionMinorMax = 2 ///< Maximum of minor component
+    eVersionMinorMax = 3 ///< Maximum of minor component
 };
 
 /// Versions of point record format.
@@ -134,6 +134,8 @@
     ePointFormat1 = 1, ///< Point Data Format \e 1
     ePointFormat2 = 2, ///< Point Data Format \e 2
     ePointFormat3 = 3,  ///< Point Data Format \e 3
+    ePointFormat4 = 4,  ///< Point Data Format \e 3
+    ePointFormat5 = 5,  ///< Point Data Format \e 3
     ePointFormatUnknown = -99 ///< Point Data Format is unknown
 };
 
diff -r 898f0d6119ad -r 6bdf6773f8de python/liblas/core.py
--- a/python/liblas/core.py	Tue Jun 22 11:21:34 2010 -0500
+++ b/python/liblas/core.py	Fri Jun 25 12:27:30 2010 -0500
@@ -530,7 +530,7 @@
 
 las.LASHeader_AddVLR.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
 las.LASHeader_AddVLR.errcheck = check_return
-las.LASHeader_AddVLR.restype = None
+las.LASHeader_AddVLR.restype = ctypes.c_int
 
 las.LASWriter_Create.restype = ctypes.c_void_p
 las.LASWriter_Create.argtypes = [ctypes.c_char_p,
diff -r 898f0d6119ad -r 6bdf6773f8de python/liblas/vlr.py
--- a/python/liblas/vlr.py	Tue Jun 22 11:21:34 2010 -0500
+++ b/python/liblas/vlr.py	Fri Jun 25 12:27:30 2010 -0500
@@ -105,8 +105,8 @@
         return core.las.LASVLR_SetUserId(self.handle, value)
     doc = """User ID key for this VLR (clipped to 16 bytes long)
     
-    The User ID key for libLAS is ``1209``, and that number will be used 
-    for all extra VLRs that libLAS can interpret itself.  
+    The User ID for libLAS is ``liblas``, and it will be used 
+    for all extra VLRs that libLAS itself can interpret.  
     
     .. seealso::
         :ref:`liblas_vlr_key` has more detail on the key and name.
@@ -126,6 +126,7 @@
         
     """
     userid = property(get_userid, set_userid, None, doc)
+    user = userid
 
     def get_description(self):
         return core.las.LASVLR_GetDescription(self.handle)
@@ -147,7 +148,10 @@
         return core.las.LASVLR_SetRecordLength(self.handle, value)
     doc = """The number of bytes long the VLR is"""
     recordlength = property(get_recordlength, set_recordlength, None, doc)
-
+    
+    def __len__(self):
+        return self.recordlength
+        
     def get_recordid(self):
         return core.las.LASVLR_GetRecordId(self.handle)
 
diff -r 898f0d6119ad -r 6bdf6773f8de src/CMakeLists.txt
--- a/src/CMakeLists.txt	Tue Jun 22 11:21:34 2010 -0500
+++ b/src/CMakeLists.txt	Fri Jun 25 12:27:30 2010 -0500
@@ -147,11 +147,11 @@
 ########
 target_link_libraries(${LIBLAS_C_LIB_NAME}
   ${LIBLAS_LIB_NAME}
-  ${ZLIB_LIBRARIES}
   ${TIFF_LIBRARY}
   ${GEOTIFF_LIBRARY}
   ${GDAL_LIBRARY}
-  ${SPATIALINDEX_LIBRARY})
+  ${SPATIALINDEX_LIBRARY}
+  ${LIBXML2_LIBRARIES})
 
 ###############################################################################
 # Targets installation
diff -r 898f0d6119ad -r 6bdf6773f8de src/lasheader.cpp
--- a/src/lasheader.cpp	Tue Jun 22 11:21:34 2010 -0500
+++ b/src/lasheader.cpp	Fri Jun 25 12:27:30 2010 -0500
@@ -340,7 +340,13 @@
 
 uint16_t Header::GetHeaderSize() const
 {
-    return eHeaderSize;
+    return m_headerSize;
+}
+
+void Header::SetHeaderSize(uint16_t v)
+{
+
+    m_headerSize = v;
 }
 
 uint32_t Header::GetDataOffset() const


More information about the Liblas-commits mailing list