[Liblas-commits] r1058 - in trunk: include/liblas
include/liblas/capi python/liblas python/tests src
liblas-commits at liblas.org
liblas-commits at liblas.org
Fri Feb 20 16:49:27 EST 2009
Author: hobu
Date: Fri Feb 20 16:49:27 2009
New Revision: 1058
URL: http://liblas.org/changeset/1058
Log:
add the ability to check for HAVE_GDAL and HAVE_LIBGEOTIFF at runtime
Modified:
trunk/include/liblas/capi/liblas.h
trunk/include/liblas/liblas.hpp
trunk/python/liblas/__init__.py
trunk/python/liblas/core.py
trunk/python/tests/VLR.txt
trunk/src/las_c_api.cpp
Modified: trunk/include/liblas/capi/liblas.h
==============================================================================
--- trunk/include/liblas/capi/liblas.h (original)
+++ trunk/include/liblas/capi/liblas.h Fri Feb 20 16:49:27 2009
@@ -124,7 +124,11 @@
/** Returns the version string for this library.
* @return the version string for this library.
*/
-LAS_DLL char* LAS_GetVersion();
+LAS_DLL char* LAS_GetVersion(void);
+
+LAS_DLL int LAS_IsLibGeoTIFFEnabled(void);
+
+LAS_DLL int LAS_IsGDALEnabled(void);
/****************************************************************************/
/* Error handling */
Modified: trunk/include/liblas/liblas.hpp
==============================================================================
--- trunk/include/liblas/liblas.hpp (original)
+++ trunk/include/liblas/liblas.hpp Fri Feb 20 16:49:27 2009
@@ -98,6 +98,24 @@
return ofs.is_open();
}
+inline bool IsGDALEnabled()
+{
+#ifdef HAVE_GDAL
+ return true;
+#else
+ return false;
+#endif
+}
+
+inline bool IsLibGeoTIFFEnabled()
+{
+#ifdef HAVE_LIBGEOTIFF
+ return true;
+#else
+ return false;
+#endif
+}
+
} // namespace liblas
#endif // LIBLAS_HPP_INCLUDED
Modified: trunk/python/liblas/__init__.py
==============================================================================
--- trunk/python/liblas/__init__.py (original)
+++ trunk/python/liblas/__init__.py Fri Feb 20 16:49:27 2009
@@ -1,5 +1,8 @@
from core import *
version = get_version()
+HAVE_GDAL = bool(las.LAS_IsGDALEnabled())
+HAVE_LIBGEOTIFF = bool(las.LAS_IsLibGeoTIFFEnabled())
+
import file
import point
import header
Modified: trunk/python/liblas/core.py
==============================================================================
--- trunk/python/liblas/core.py (original)
+++ trunk/python/liblas/core.py Fri Feb 20 16:49:27 2009
@@ -147,6 +147,9 @@
version = get_version()
+las.LAS_IsGDALEnabled.restype = ctypes.c_int
+las.LAS_IsLibGeoTIFFEnabled.restype = ctypes.c_int
+
las.LAS_GetVersion.restype = ctypes.POINTER(ctypes.c_char)
las.LAS_GetVersion.errcheck = free_returned_char_p
Modified: trunk/python/tests/VLR.txt
==============================================================================
--- trunk/python/tests/VLR.txt (original)
+++ trunk/python/tests/VLR.txt Fri Feb 20 16:49:27 2009
@@ -53,14 +53,20 @@
>>> [v.data[i] for i in range(10)]
[2, 32, 4, 5, 6, 7, 8, 9, 10, 11]
-
+ >>> import liblas
+
+# >>> liblas.HAVE_GDAL
+# >>> liblas.HAVE_LIBGEOTIFF
+
>>> from liblas import file
>>> f = file.File('../test/data/srs.las')
>>> h = f.header
>>> h.records_count
3L
- >>> h.proj4
- '+proj=utm +zone=17 +ellps=WGS84 +datum=WGS84 +units=m +no_defs '
+ >>> if not liblas.HAVE_GDAL:
+ ... h.proj4
+ '+proj=utm +zone=17 +ellps=WGS84 +units=m '
+
>>> v = h.GetVLR(0)
>>> v.recordid
34735
Modified: trunk/src/las_c_api.cpp
==============================================================================
--- trunk/src/las_c_api.cpp (original)
+++ trunk/src/las_c_api.cpp Fri Feb 20 16:49:27 2009
@@ -41,7 +41,7 @@
* OF SUCH DAMAGE.
****************************************************************************/
-
+#include <liblas/liblas.hpp>
#include <liblas/lasreader.hpp>
#include <liblas/laserror.hpp>
#include <liblas/laswriter.hpp>
@@ -126,6 +126,14 @@
return (rc); \
}} while(0)
+LAS_DLL int LAS_IsGDALEnabled(void) {
+ return IsGDALEnabled();
+}
+
+LAS_DLL int LAS_IsLibGeoTIFFEnabled(void) {
+ return IsLibGeoTIFFEnabled();
+}
+
LAS_DLL void LASError_Reset(void) {
if (errors.empty()) return;
for (std::size_t i=0;i<errors.size();i++) errors.pop();
More information about the Liblas-commits
mailing list