From liblas-commits at hobu.net Sun Mar 2 18:11:20 2008 From: liblas-commits at hobu.net (liblas-commits@hobu.net) Date: Sun Mar 2 18:11:28 2008 Subject: [Liblas-commits] r524 - trunk/apps Message-ID: <20080303001120.1A30B62FB06@mail.hobu.net> Author: mloskot Date: Sun Mar 2 18:11:18 2008 New Revision: 524 URL: http://liblas.org/changeset/524 Log: Added new tool - las2ogr. Currently, it is experimental version of las2shp only but soon it will become more OGR generic tool. Added: trunk/apps/las2ogr.cpp (contents, props changed) Added: trunk/apps/las2ogr.cpp ============================================================================== --- (empty file) +++ trunk/apps/las2ogr.cpp Sun Mar 2 18:11:18 2008 @@ -0,0 +1,249 @@ +// $Id$ +// +// las2ogr translates LAS file to OGR datasource. +// Inspired by pylas.py script developed by Matthew Perry and Carl Anderson, +// available at http://code.google.com/p/pylas/ +// +// (C) Copyright Mateusz Loskot 2008, mateusz@loskot.net +// Distributed under the BSD License +// (See accompanying file LICENSE.txt or copy at +// http://www.opensource.org/licenses/bsd-license.php) +// +#if defined(_MSC_VER) && defined(USE_VLD) +#include +#endif +// liblas +#include +#include +#include +#include +// ogr +#include "ogrsf_frmts.h" +//std +#include +#include +#include +#include +#include + +template +class raii_wrapper +{ + typedef void(*deleter_type)(T* p); + +public: + + explicit raii_wrapper(T* p) + : p_(p), del_(0) + {} + + raii_wrapper(T* p, deleter_type d) + : p_(p), del_(d) + {} + + ~raii_wrapper() + { + do_delete(p_); + } + + void reset(T* p) + { + do_delete(p_); + p_= p; + } + + T* get() const + { + return p_; + } + + T* operator->() const + { + return p_; + } + + T& operator*() const + { + return (*p_); + } + + void swap(raii_wrapper& other) + { + std::swap(p_, other.p_); + } + +private: + + raii_wrapper(raii_wrapper const& other); + raii_wrapper& operator=(raii_wrapper const& rhs); + + void do_delete(T* p) + { + if (del_) + { + del_(p); + } + else + { + delete p; + } + } + + deleter_type del_; + T* p_; +}; + +void create_layer_def(OGRLayer& lyr) +{ + std::string fldname("return_num"); + OGRFieldDefn fld(fldname.c_str(), OFTReal); + fld.SetWidth(1); + fld.SetPrecision(0); + if (OGRERR_NONE != lyr.CreateField(&fld)) + { + throw std::runtime_error(fldname + " field cration failed"); + } + + fldname = "angle"; + fld.Set(fldname.c_str(), OFTReal, 3, 0); + if (OGRERR_NONE != lyr.CreateField(&fld)) + { + throw std::runtime_error(fldname + " field cration failed"); + } + + fldname = "intensity"; + fld.Set(fldname.c_str(), OFTReal, 3, 0); + if (OGRERR_NONE != lyr.CreateField(&fld)) + { + throw std::runtime_error(fldname + " field cration failed"); + } + + fldname = "asprsclass"; + fld.Set(fldname.c_str(), OFTReal, 3, 0); + if (OGRERR_NONE != lyr.CreateField(&fld)) + { + throw std::runtime_error(fldname + " field cration failed"); + } + + fldname = "return_tot"; + fld.Set(fldname.c_str(), OFTReal, 3, 0); + if (OGRERR_NONE != lyr.CreateField(&fld)) + { + throw std::runtime_error(fldname + " field cration failed"); + } + + fldname = "gps_time"; + fld.Set(fldname.c_str(), OFTReal, 13, 6); + if (OGRERR_NONE != lyr.CreateField(&fld)) + { + throw std::runtime_error(fldname + " field cration failed"); + } +} + +int main(char* argv[], int argc) +{ + // TODO: + // - rename las2shp to las2ogr with ESRI Shapefile as default output format + // - input params parsing + // - usage info + // - progress info + + OGRRegisterAll(); + + try + { + // TODO: input params should come from argv + std::string lasname("d:\\data\\lidar\\LDR030828_213450_0.LAS"); + //std::string lasname("D:\\data\\lidar\\gilmer\\000001.las"); + std::string ogrname("cloud.shp"); + + // + // Source + // + std::cout << "Source:" << "\n - dataset: " << lasname << std::endl; + + std::ifstream ifs; + if (!liblas::Open(ifs, lasname.c_str())) + { + throw std::runtime_error(std::string("Can not open ") + lasname); + } + liblas::LASReader reader(ifs); + + // + // Target + // + std::string const drvname("ESRI Shapefile"); + std::string const lyrname(ogrname.substr(0, ogrname.find_last_of('.'))); + + std::cout << "Target:" + << "\n - format: " << drvname + << "\n - dataset: " << ogrname + << "\n - layer: " << lyrname + << std::endl; + + OGRSFDriver* drv = 0; + drv = OGRSFDriverRegistrar::GetRegistrar()->GetDriverByName(drvname.c_str()); + if (0 == drv) + { + throw std::runtime_error(drvname + " driver not available"); + } + + raii_wrapper ds(drv->CreateDataSource(ogrname.c_str()), + OGRDataSource::DestroyDataSource); + if (0 == ds.get()) + { + throw std::runtime_error(ogrname + " datasource cration failed"); + } + + OGRLayer* lyr = 0; + lyr = ds->CreateLayer(lyrname.c_str(), 0, wkbPoint25D, 0); + if (0 == lyr) + { + throw std::runtime_error(ogrname + " layer cration failed"); + } + + // Prepare layer schema + create_layer_def(*lyr); + + // + // Translation of points cloud to features set + // + std::cout << "Translating " << reader.GetHeader().GetPointRecordsCount() << " points..."; + + raii_wrapper feat(OGRFeature::CreateFeature(lyr->GetLayerDefn()), + OGRFeature::DestroyFeature); + + while (reader.ReadNextPoint()) + { + liblas::LASPoint const& p = reader.GetPoint(); + + feat->SetField(0, p.GetReturnNumber()); + feat->SetField(1, p.GetScanAngleRank()); + feat->SetField(2, p.GetIntensity()); + feat->SetField(3, p.GetClassification()); + feat->SetField(4, p.GetNumberOfReturns()); + feat->SetField(5, p.GetTime()); + + OGRPoint gp(p.GetX(), p.GetY(), p.GetZ()); + feat->SetGeometry(&gp); + + if (OGRERR_NONE != lyr->CreateFeature(feat.get())) + { + throw std::runtime_error("feature creation failed"); + } + } + + std::cout << "done!\n"; + } + catch (std::exception const& e) + { + std::cerr << "Error: " << e.what() << std::endl; + } + catch (...) + { + std::cerr << "Unknown error\n"; + } + + return 0; +} + From liblas-commits at hobu.net Sun Mar 2 18:41:29 2008 From: liblas-commits at hobu.net (liblas-commits@hobu.net) Date: Sun Mar 2 18:41:36 2008 Subject: [Liblas-commits] r525 - trunk/src/detail Message-ID: <20080303004129.746F262FD68@mail.hobu.net> Author: mloskot Date: Sun Mar 2 18:41:28 2008 New Revision: 525 URL: http://liblas.org/changeset/525 Log: Added TODO comment to detail::FileImpl about required RAII. Modified: trunk/src/detail/file.cpp Modified: trunk/src/detail/file.cpp ============================================================================== --- trunk/src/detail/file.cpp (original) +++ trunk/src/detail/file.cpp Sun Mar 2 18:41:28 2008 @@ -37,6 +37,7 @@ } } + // TODO: apply RAII assert(0 != m_istrm); m_reader = new LASReader(*m_istrm); m_header = m_reader->GetHeader(); @@ -76,6 +77,7 @@ } } + // TODO: apply RAII assert(0 != m_ostrm); m_writer = new LASWriter(*m_ostrm, m_header); From liblas-commits at hobu.net Sun Mar 2 20:45:46 2008 From: liblas-commits at hobu.net (liblas-commits@hobu.net) Date: Sun Mar 2 20:45:54 2008 Subject: [Liblas-commits] r526 - trunk Message-ID: <20080303024546.BC7EF6311D7@mail.hobu.net> Author: hobu Date: Sun Mar 2 20:45:45 2008 New Revision: 526 URL: http://liblas.org/changeset/526 Log: add GDAL macro Modified: trunk/configure.ac Modified: trunk/configure.ac ============================================================================== --- trunk/configure.ac (original) +++ trunk/configure.ac Sun Mar 2 20:45:45 2008 @@ -66,6 +66,33 @@ rm -f conftest* ]) +dnl ########################################################### +dnl GDAL +dnl ########################################################### +AC_ARG_WITH(gdal,[ --with-gdal=ARG Path to gdal-config],,) +if test "$with_gdal" = "yes" -o "$with_gdal" = "" ; then + AC_PATH_PROG(GDAL_CONFIG, gdal-config, no) +else + if test "`basename xx/$with_gdal`" = "gdal-config" ; then + AC_MSG_RESULT([GDAL enabled with provided gdal-config]) + GDAL_CONFIG="$with_gdal" + else + AC_MSG_ERROR([--with-gdal should have yes or a path to gdal-config]) + fi +fi +if test "$GDAL_CONFIG" != "no" ; then + VERSION=`$GDAL_CONFIG --version` + AC_MSG_RESULT([$GDAL_CONFIG reports version $VERSION]) + LIBS="`$GDAL_CONFIG --libs` $LIBS" + GDAL_INC=`$GDAL_CONFIG --cflags` + GDAL_PREFIX=`$GDAL_CONFIG --prefix` + OGR=`$GDAL_CONFIG --ogr-enabled` + if test "$OGR" != "yes" ; then + AC_MSG_ERROR([$GDAL_CONFIG says OGR is not enabled]) + fi +fi +AC_SUBST(GDAL_INC GDAL_PREFIX) + AC_HAVE_LONG_LONG dnl Checks for library functions. @@ -92,4 +119,5 @@ LOC_MSG([ C compiler...............: ${CC} ${CFLAGS}]) LOC_MSG([ C++ compiler.............: ${CXX} ${CXXFLAGS}]) LOC_MSG([ Debugging support........: ${enable_debug}]) +LOC_MSG([ GDAL support........: ${with_gdal}]) LOC_MSG() From liblas-commits at hobu.net Fri Mar 7 13:22:23 2008 From: liblas-commits at hobu.net (liblas-commits@hobu.net) Date: Fri Mar 7 13:22:33 2008 Subject: [Liblas-commits] r527 - in trunk: . src Message-ID: <20080307192223.4A23A655E41@mail.hobu.net> Author: hobu Date: Fri Mar 7 13:22:20 2008 New Revision: 527 URL: http://liblas.org/changeset/527 Log: default to not using GDAL in the configure line Modified: trunk/configure trunk/configure.ac trunk/libtool trunk/src/Makefile.in Modified: trunk/configure ============================================================================== --- trunk/configure (original) +++ trunk/configure Fri Mar 7 13:22:20 2008 @@ -869,6 +869,7 @@ FFLAGS ac_ct_F77 LIBTOOL +GDAL_INC GDAL_PREFIX LIBOBJS LTLIBOBJS' ac_subst_files='' @@ -1482,6 +1483,7 @@ --with-pic try to use only PIC/non-PIC objects [default=use both] --with-tags[=TAGS] include additional configurations [automatic] + --with-gdal=ARG Path to gdal-config Some influential environment variables: CXX C++ compiler command @@ -5112,7 +5114,7 @@ ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 5115 "configure"' > conftest.$ac_ext + echo '#line 5117 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -7371,11 +7373,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7374: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7376: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7378: \$? = $ac_status" >&5 + echo "$as_me:7380: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7639,11 +7641,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7642: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7644: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7646: \$? = $ac_status" >&5 + echo "$as_me:7648: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7743,11 +7745,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7746: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7748: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:7750: \$? = $ac_status" >&5 + echo "$as_me:7752: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -10051,7 +10053,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:12492: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:12494: \$? = $ac_status" >&5 + echo "$as_me:12496: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -12591,11 +12593,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:12594: $lt_compile\"" >&5) + (eval echo "\"\$as_me:12596: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:12598: \$? = $ac_status" >&5 + echo "$as_me:12600: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -14161,11 +14163,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14164: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14166: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:14168: \$? = $ac_status" >&5 + echo "$as_me:14170: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -14265,11 +14267,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14268: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14270: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:14272: \$? = $ac_status" >&5 + echo "$as_me:14274: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -16463,11 +16465,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16466: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16468: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16470: \$? = $ac_status" >&5 + echo "$as_me:16472: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -16731,11 +16733,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16734: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16736: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16738: \$? = $ac_status" >&5 + echo "$as_me:16740: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -16835,11 +16837,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16838: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16840: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:16842: \$? = $ac_status" >&5 + echo "$as_me:16844: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -19974,6 +19976,41 @@ +# Check whether --with-gdal was given. +if test "${with_gdal+set}" = set; then + withval=$with_gdal; +fi + +if test "$with_gdal" = "no" -o "$with_gdal" = "" ; then + GDAL_CONFIG="$with_gdal" +else + if test "`basename xx/$with_gdal`" = "gdal-config" ; then + { echo "$as_me:$LINENO: result: GDAL enabled with provided gdal-config" >&5 +echo "${ECHO_T}GDAL enabled with provided gdal-config" >&6; } + GDAL_CONFIG="$with_gdal" + else + { { echo "$as_me:$LINENO: error: --with-gdal should have yes or a path to gdal-config" >&5 +echo "$as_me: error: --with-gdal should have yes or a path to gdal-config" >&2;} + { (exit 1); exit 1; }; } + fi +fi +if test "$GDAL_CONFIG" != "no" ; then + VERSION=`$GDAL_CONFIG --version` + { echo "$as_me:$LINENO: result: $GDAL_CONFIG reports version $VERSION" >&5 +echo "${ECHO_T}$GDAL_CONFIG reports version $VERSION" >&6; } + LIBS="`$GDAL_CONFIG --libs` $LIBS" + GDAL_INC=`$GDAL_CONFIG --cflags` + GDAL_PREFIX=`$GDAL_CONFIG --prefix` + OGR=`$GDAL_CONFIG --ogr-enabled` + if test "$OGR" != "yes" ; then + { { echo "$as_me:$LINENO: error: $GDAL_CONFIG says OGR is not enabled" >&5 +echo "$as_me: error: $GDAL_CONFIG says OGR is not enabled" >&2;} + { (exit 1); exit 1; }; } + fi +fi + + + { echo "$as_me:$LINENO: checking for 64bit integer type" >&5 echo $ECHO_N "checking for 64bit integer type... $ECHO_C" >&6; } @@ -20903,11 +20940,13 @@ FFLAGS!$FFLAGS$ac_delim ac_ct_F77!$ac_ct_F77$ac_delim LIBTOOL!$LIBTOOL$ac_delim +GDAL_INC!$GDAL_INC$ac_delim +GDAL_PREFIX!$GDAL_PREFIX$ac_delim LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 6; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 8; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 @@ -21401,5 +21440,8 @@ echo " Debugging support........: ${enable_debug}" +echo " GDAL support........: ${with_gdal}" + + echo "" Modified: trunk/configure.ac ============================================================================== --- trunk/configure.ac (original) +++ trunk/configure.ac Fri Mar 7 13:22:20 2008 @@ -70,8 +70,9 @@ dnl GDAL dnl ########################################################### AC_ARG_WITH(gdal,[ --with-gdal=ARG Path to gdal-config],,) -if test "$with_gdal" = "yes" -o "$with_gdal" = "" ; then - AC_PATH_PROG(GDAL_CONFIG, gdal-config, no) +if test "$with_gdal" = "no" -o "$with_gdal" = "" ; then + GDAL_CONFIG="$with_gdal" +dnl AC_PATH_PROG(GDAL_CONFIG, gdal-config, no) else if test "`basename xx/$with_gdal`" = "gdal-config" ; then AC_MSG_RESULT([GDAL enabled with provided gdal-config]) Modified: trunk/libtool ============================================================================== --- trunk/libtool (original) +++ trunk/libtool Fri Mar 7 13:22:20 2008 @@ -40,11 +40,11 @@ (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # The names of the tagged configurations supported by this script. -available_tags=" CXX F77" +available_tags=" CXX" # ### BEGIN LIBTOOL CONFIG -# Libtool was configured on host fire.hobu.net: +# Libtool was configured on host torch.local: # Shell to use when invoking shell scripts. SHELL="/bin/sh" @@ -7212,7 +7212,7 @@ # End: # ### BEGIN LIBTOOL TAG CONFIG: CXX -# Libtool was configured on host fire.hobu.net: +# Libtool was configured on host torch.local: # Shell to use when invoking shell scripts. SHELL="/bin/sh" @@ -7515,308 +7515,3 @@ # ### END LIBTOOL TAG CONFIG: CXX -# ### BEGIN LIBTOOL TAG CONFIG: F77 - -# Libtool was configured on host fire.hobu.net: - -# Shell to use when invoking shell scripts. -SHELL="/bin/sh" - -# Whether or not to build shared libraries. -build_libtool_libs=yes - -# Whether or not to build static libraries. -build_old_libs=yes - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=no - -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=no - -# Whether or not to optimize for fast installation. -fast_install=needless - -# The host system. -host_alias= -host=i686-apple-darwin9.2.0 -host_os=darwin9.2.0 - -# The build system. -build_alias= -build=i686-apple-darwin9.2.0 -build_os=darwin9.2.0 - -# An echo program that does not interpret backslashes. -echo="/bin/echo" - -# The archiver. -AR="ar" -AR_FLAGS="cru" - -# A C compiler. -LTCC="gcc" - -# LTCC compiler flags. -LTCFLAGS="-Wall -Wno-long-long -pedantic -ansi " - -# A language-specific compiler. -CC="g77" - -# Is the compiler the GNU C compiler? -with_gcc=yes - -# An ERE matcher. -EGREP="/usr/bin/grep -E" - -# The linker used to build libraries. -LD="/usr/libexec/gcc/i686-apple-darwin9/4.0.1/ld" - -# Whether we need hard or soft links. -LN_S="ln -s" - -# A BSD-compatible nm program. -NM="/usr/bin/nm -p" - -# A symbol stripping program -STRIP="strip" - -# Used to examine libraries when file_magic_cmd begins "file" -MAGIC_CMD=file - -# Used on cygwin: DLL creation program. -DLLTOOL="dlltool" - -# Used on cygwin: object dumper. -OBJDUMP="objdump" - -# Used on cygwin: assembler. -AS="as" - -# The name of the directory that contains temporary libtool files. -objdir=.libs - -# How to create reloadable object files. -reload_flag=" -r" -reload_cmds="\$LTCC \$LTCFLAGS -nostdlib \${wl}-r -o \$output\$reload_objs" - -# How to pass a linker flag through the compiler. -wl="-Wl," - -# Object file suffix (normally "o"). -objext="o" - -# Old archive suffix (normally "a"). -libext="a" - -# Shared library suffix (normally ".so"). -shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' - -# Executable file suffix (normally ""). -exeext="" - -# Additional compiler flags for building library objects. -pic_flag=" -fno-common" -pic_mode=default - -# What is the maximum length of a command? -max_cmd_len=196608 - -# Does compiler simultaneously support -c and -o options? -compiler_c_o="yes" - -# Must we lock files when doing compilation? -need_locks="no" - -# Do we need the lib prefix for modules? -need_lib_prefix=no - -# Do we need a version for libraries? -need_version=no - -# Whether dlopen is supported. -dlopen_support=unknown - -# Whether dlopen of programs is supported. -dlopen_self=unknown - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=unknown - -# Compiler flag to prevent dynamic linking. -link_static_flag="" - -# Compiler flag to turn off builtin functions. -no_builtin_flag="" - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec="" - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec="" - -# Compiler flag to generate thread-safe objects. -thread_safe_flag_spec="" - -# Library versioning type. -version_type=darwin - -# Format of library name prefix. -libname_spec="lib\$name" - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME. -library_names_spec="\${libname}\${release}\${major}\$shared_ext \${libname}\$shared_ext \${libname}\${release}\${versuffix}\$shared_ext" - -# The coded name of the library, if different from the real name. -soname_spec="\${libname}\${release}\${major}\$shared_ext" - -# Commands used to build and install an old-style archive. -RANLIB="ranlib" -old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs\$old_deplibs~\$RANLIB \$oldlib" -old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$oldlib" -old_postuninstall_cmds="" - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds="" - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds="" - -# Commands used to build and install a shared archive. -archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring" -archive_expsym_cmds="sed -e \\\"s,#.*,,\\\" -e \\\"s,^[ ]*,,\\\" -e \\\"s,^\\\\(..*\\\\),_&,\\\" < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring~nmedit -s \$output_objdir/\${libname}-symbols.expsym \${lib}" -postinstall_cmds="" -postuninstall_cmds="" - -# Commands used to build a loadable module (assumed same as above if empty) -module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs\$compiler_flags" -module_expsym_cmds="sed -e \\\"s,#.*,,\\\" -e \\\"s,^[ ]*,,\\\" -e \\\"s,^\\\\(..*\\\\),_&,\\\" < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs\$compiler_flags~nmedit -s \$output_objdir/\${libname}-symbols.expsym \${lib}" - -# Commands to strip libraries. -old_striplib="" -striplib="strip -x" - -# Dependencies to place before the objects being linked to create a -# shared library. -predep_objects="" - -# Dependencies to place after the objects being linked to create a -# shared library. -postdep_objects="" - -# Dependencies to place before the objects being linked to create a -# shared library. -predeps="" - -# Dependencies to place after the objects being linked to create a -# shared library. -postdeps="" - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path="" - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method="pass_all" - -# Command to use when deplibs_check_method == file_magic. -file_magic_cmd="\$MAGIC_CMD" - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag="\${wl}-flat_namespace \${wl}-undefined \${wl}suppress" - -# Flag that forces no undefined symbols. -no_undefined_flag="" - -# Commands used to finish a libtool library installation in a directory. -finish_cmds="" - -# Same as above, but a single script fragment to be evaled but not shown. -finish_eval="" - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe="sed -n -e 's/^.*[ ]\\([BCDEGRST][BCDEGRST]*\\)[ ][ ]*_\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 _\\2 \\2/p'" - -# Transform the output of nm in a proper C declaration -global_symbol_to_cdecl="sed -n -e 's/^. .* \\(.*\\)\$/extern int \\1;/p'" - -# Transform the output of nm in a C name address pair -global_symbol_to_c_name_address="sed -n -e 's/^: \\([^ ]*\\) \$/ {\\\"\\1\\\", (lt_ptr) 0},/p' -e 's/^[BCDEGRST] \\([^ ]*\\) \\([^ ]*\\)\$/ {\"\\2\", (lt_ptr) \\&\\2},/p'" - -# This is the shared library runtime path variable. -runpath_var= - -# This is the shared library path variable. -shlibpath_var=DYLD_LIBRARY_PATH - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=yes - -# How to hardcode a shared library path into an executable. -hardcode_action=immediate - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=no - -# Flag to hardcode $libdir into a binary during linking. -# This must work even if $libdir does not exist. -hardcode_libdir_flag_spec="" - -# If ld is used when linking, flag to hardcode $libdir into -# a binary during linking. This must work even if $libdir does -# not exist. -hardcode_libdir_flag_spec_ld="" - -# Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator="" - -# Set to yes if using DIR/libNAME during linking hardcodes DIR into the -# resulting binary. -hardcode_direct=no - -# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -# resulting binary. -hardcode_minus_L=no - -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -# the resulting binary. -hardcode_shlibpath_var=unsupported - -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=yes - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at relink time. -variables_saved_for_relink="PATH DYLD_LIBRARY_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=yes - -# Compile-time system search path for libraries -sys_lib_search_path_spec=" /usr/local/lib/gcc/i686-apple-darwin8.8.1/3.4.0/ /usr/lib/gcc/i686-apple-darwin8.8.1/3.4.0/ /usr/local/lib/gcc/i686-apple-darwin8.8.1/3.4.0/../../../../i686-apple-darwin8.8.1/lib/i686-apple-darwin8.8.1/3.4.0/ /usr/local/lib/gcc/i686-apple-darwin8.8.1/3.4.0/../../../../i686-apple-darwin8.8.1/lib/ /usr/local/lib/gcc/i686-apple-darwin8.8.1/3.4.0/../../../i686-apple-darwin8.8.1/3.4.0/ /usr/local/lib/gcc/i686-apple-darwin8.8.1/3.4.0/../../../ /lib/i686-apple-darwin8.8.1/3.4.0/ /lib/ /usr/lib/i686-apple-darwin8.8.1/3.4.0/ /usr/lib/ /lib /usr/lib /usr/local/lib" - -# Run-time system search path for libraries -sys_lib_dlsearch_path_spec="/usr/local/lib /lib /usr/lib" - -# Fix the shell variable $srcfile for the compiler. -fix_srcfile_path="" - -# Set to yes if exported symbols are required. -always_export_symbols=no - -# The commands to list exported symbols. -export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols" - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds="" - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms="_GLOBAL_OFFSET_TABLE_" - -# Symbols that must always be exported. -include_expsyms="" - -# ### END LIBTOOL TAG CONFIG: F77 - Modified: trunk/src/Makefile.in ============================================================================== --- trunk/src/Makefile.in (original) +++ trunk/src/Makefile.in Fri Mar 7 13:22:20 2008 @@ -50,8 +50,9 @@ libLTLIBRARIES_INSTALL = $(INSTALL) LTLIBRARIES = $(lib_LTLIBRARIES) liblas_la_DEPENDENCIES = detail/liblasdetail.la -am_liblas_la_OBJECTS = lasheader.lo lasreader.lo las_c_api.lo \ - laspoint.lo laserror.lo laswriter.lo lasfile.lo +am_liblas_la_OBJECTS = laserror.lo laspoint.lo lasheader.lo \ + lasrecordheader.lo lasreader.lo laswriter.lo lasfile.lo \ + las_c_api.lo liblas_la_OBJECTS = $(am_liblas_la_OBJECTS) liblas_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ @@ -191,7 +192,16 @@ SUBDIRS = detail . INCLUDES = -I../include -I../include/detail lib_LTLIBRARIES = liblas.la -liblas_la_SOURCES = lasheader.cpp lasreader.cpp las_c_api.cpp laspoint.cpp laserror.cpp laswriter.cpp lasfile.cpp +liblas_la_SOURCES = \ + laserror.cpp \ + laspoint.cpp \ + lasheader.cpp \ + lasrecordheader.cpp \ + lasreader.cpp \ + laswriter.cpp \ + lasfile.cpp \ + las_c_api.cpp + liblas_la_LIBADD = detail/liblasdetail.la liblas_la_LDFLAGS = -version-info 1:0:0 all: all-recursive @@ -269,6 +279,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lasheader.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/laspoint.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lasreader.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lasrecordheader.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/laswriter.Plo@am__quote@ .cpp.o: From liblas-commits at hobu.net Fri Mar 7 13:42:55 2008 From: liblas-commits at hobu.net (liblas-commits@hobu.net) Date: Fri Mar 7 13:43:03 2008 Subject: [Liblas-commits] r528 - trunk/apps Message-ID: <20080307194255.6D45365603F@mail.hobu.net> Author: hobu Date: Fri Mar 7 13:42:54 2008 New Revision: 528 URL: http://liblas.org/changeset/528 Log: fix some dumb stuf in las2las Modified: trunk/apps/las2las.c Modified: trunk/apps/las2las.c ============================================================================== --- trunk/apps/las2las.c (original) +++ trunk/apps/las2las.c Fri Mar 7 13:42:54 2008 @@ -77,8 +77,8 @@ int use_stdout = FALSE; char* file_name_in = 0; char* file_name_out = 0; - int clip_xy_min[2]; - int clip_xy_max[2]; + double *clip_xy_min = NULL; + double *clip_xy_max = NULL; int clip = FALSE; int remove_extra_header = FALSE; int elim_return = 0; @@ -155,14 +155,16 @@ strcmp(argv[i],"-clip_xy") == 0 ) { + clip_xy_min = (double*) malloc (2 * sizeof(double)); + clip_xy_max = (double*) malloc( 2 * sizeof(double)); i++; - clip_xy_min[0] = atoi(argv[i]); + clip_xy_min[0] = atof(argv[i]); i++; - clip_xy_min[1] = atoi(argv[i]); + clip_xy_min[1] = atof(argv[i]); i++; - clip_xy_max[0] = atoi(argv[i]); + clip_xy_max[0] = atof(argv[i]); i++; - clip_xy_max[1] = atoi(argv[i]); + clip_xy_max[1] = atof(argv[i]); clip = TRUE; } else if ( strcmp(argv[i],"--eliminate_return") == 0 || @@ -552,7 +554,7 @@ fprintf(stderr, "second pass reading %d and writing %d points ...\n", LASHeader_GetPointRecordsCount(header), surviving_number_of_point_records); if (use_stdout) file_name_out = "stdout"; - writer = LASWriter_Create(file_name_out, surviving_header, LAS_MODE_APPEND); + writer = LASWriter_Create(file_name_out, surviving_header, LAS_MODE_WRITE); if (!writer) { LASError_Print("Could not open file to write"); exit(1); @@ -569,6 +571,22 @@ } */ + LASReader_Destroy(reader); + reader = NULL; + if (file_name_in) + { + reader = LASReader_Create(file_name_in); + if (!reader) { + LASError_Print("Could not open file to read"); + exit(1); + } + } + else + { + LASError_Print("no input specified"); + usage(); + exit(1); + } p = LASReader_GetNextPoint(reader); if (!p) { @@ -580,44 +598,56 @@ } while (p) { + printf("fetching..."); if (last_only && LASPoint_GetReturnNumber(p) != LASPoint_GetNumberOfReturns(p)) { + printf("last_only..."); p = LASReader_GetNextPoint(reader); continue; } if (first_only && LASPoint_GetReturnNumber(p) != 1) { + printf("first_only..."); p = LASReader_GetNextPoint(reader); continue; } if (clip_xy_min && (LASPoint_GetX(p) < clip_xy_min[0] || LASPoint_GetY(p) < clip_xy_min[1])) { + printf("clip_xy_min..."); p = LASReader_GetNextPoint(reader); continue; } if (clip_xy_max && (LASPoint_GetX(p) > clip_xy_max[0] || LASPoint_GetY(p) > clip_xy_max[1])) { + printf("\nclip_xy_max..."); + printf("LASPoint_GetX(p): %.2f ", LASPoint_GetX(p)); + printf("clip_xy_max[0] %.2f ", clip_xy_max[0]); + printf("clip_xy_max[1] %.2f\n ", clip_xy_max[1]); p = LASReader_GetNextPoint(reader); continue; } if (elim_return && (elim_return & (1 << LASPoint_GetReturnNumber(p)))) { + printf("elim_return..."); p = LASReader_GetNextPoint(reader); continue; } if (elim_scan_angle_above && (LASPoint_GetScanAngleRank(p) > elim_scan_angle_above || LASPoint_GetScanAngleRank(p) < -elim_scan_angle_above)) { + printf("elim_scan_anble..."); p = LASReader_GetNextPoint(reader); continue; } if (elim_intensity_below && LASPoint_GetIntensity(p) < elim_intensity_below) { + printf("elim_intensity..."); p = LASReader_GetNextPoint(reader); continue; } LASWriter_WritePoint(writer,p); + printf("Writing point..."); p = LASReader_GetNextPoint(reader); } From liblas-commits at hobu.net Wed Mar 12 23:36:35 2008 From: liblas-commits at hobu.net (liblas-commits@hobu.net) Date: Wed Mar 12 23:36:44 2008 Subject: [Liblas-commits] r529 - trunk/apps Message-ID: <20080313043635.CB36467F053@mail.hobu.net> Author: hobu Date: Wed Mar 12 23:36:34 2008 New Revision: 529 URL: http://liblas.org/changeset/529 Log: remove debugging lint Modified: trunk/apps/las2las.c Modified: trunk/apps/las2las.c ============================================================================== --- trunk/apps/las2las.c (original) +++ trunk/apps/las2las.c Wed Mar 12 23:36:34 2008 @@ -598,56 +598,44 @@ } while (p) { - printf("fetching..."); if (last_only && LASPoint_GetReturnNumber(p) != LASPoint_GetNumberOfReturns(p)) { - printf("last_only..."); p = LASReader_GetNextPoint(reader); continue; } if (first_only && LASPoint_GetReturnNumber(p) != 1) { - printf("first_only..."); p = LASReader_GetNextPoint(reader); continue; } if (clip_xy_min && (LASPoint_GetX(p) < clip_xy_min[0] || LASPoint_GetY(p) < clip_xy_min[1])) { - printf("clip_xy_min..."); p = LASReader_GetNextPoint(reader); continue; } if (clip_xy_max && (LASPoint_GetX(p) > clip_xy_max[0] || LASPoint_GetY(p) > clip_xy_max[1])) { - printf("\nclip_xy_max..."); - printf("LASPoint_GetX(p): %.2f ", LASPoint_GetX(p)); - printf("clip_xy_max[0] %.2f ", clip_xy_max[0]); - printf("clip_xy_max[1] %.2f\n ", clip_xy_max[1]); p = LASReader_GetNextPoint(reader); continue; } if (elim_return && (elim_return & (1 << LASPoint_GetReturnNumber(p)))) { - printf("elim_return..."); p = LASReader_GetNextPoint(reader); continue; } if (elim_scan_angle_above && (LASPoint_GetScanAngleRank(p) > elim_scan_angle_above || LASPoint_GetScanAngleRank(p) < -elim_scan_angle_above)) { - printf("elim_scan_anble..."); p = LASReader_GetNextPoint(reader); continue; } if (elim_intensity_below && LASPoint_GetIntensity(p) < elim_intensity_below) { - printf("elim_intensity..."); p = LASReader_GetNextPoint(reader); continue; } LASWriter_WritePoint(writer,p); - printf("Writing point..."); p = LASReader_GetNextPoint(reader); } From liblas-commits at hobu.net Sat Mar 15 17:35:19 2008 From: liblas-commits at hobu.net (liblas-commits@hobu.net) Date: Sat Mar 15 17:35:29 2008 Subject: [Liblas-commits] r530 - trunk/apps Message-ID: <20080315223519.2B360696526@mail.hobu.net> Author: hobu Date: Sat Mar 15 17:35:17 2008 New Revision: 530 URL: http://liblas.org/changeset/530 Log: formatting Modified: trunk/apps/txt2las.c Modified: trunk/apps/txt2las.c ============================================================================== --- trunk/apps/txt2las.c (original) +++ trunk/apps/txt2las.c Sat Mar 15 17:35:17 2008 @@ -306,7 +306,6 @@ { int i; int dry = FALSE; - int use_stdin = FALSE; int verbose = FALSE; char* file_name_in = 0; char* file_name_out = 0; @@ -448,21 +447,24 @@ i++; file_creation_year = (unsigned short)atoi(argv[i]); } - else if ( strcmp(argv[i], "--stdin") == 0 || - strcmp(argv[i], "-ilas") == 0 - ) - { - use_stdin = TRUE; - } - else if (i == argc - 2 && file_name_in == NULL && file_name_out == NULL) + else if ( i == argc - 2 + && file_name_in == NULL && + file_name_out == NULL + ) { file_name_in = argv[i]; } - else if (i == argc - 1 && file_name_in == NULL && file_name_out == NULL) + else if ( i == argc - 1 && + file_name_in == NULL && + file_name_out == NULL + ) { file_name_in = argv[i]; } - else if (i == argc - 1 && file_name_in && file_name_out == NULL) + else if ( i == argc - 1 && + file_name_in && + file_name_out == NULL + ) { file_name_out = argv[i]; } @@ -473,13 +475,7 @@ { int len = strlen(file_name_in); file_name_out = strdup(file_name_in); - if (file_name_out[len-3] == '.' || - file_name_out[len-2] == 'g' || - file_name_out[len-1] == 'z' - ) - { - len = len - 4; - } + while (len > 0 && file_name_out[len] != '.') { len--; @@ -496,10 +492,10 @@ if (file_name_in == NULL && file_name_out == NULL) { LASError_Print("both input and output filenames are null!"); + usage(); exit(1); } - file_in = fopen(file_name_in, "r"); if (file_in == NULL) @@ -508,436 +504,305 @@ exit(1); } -/* // create a cheaper parse string that only looks for 'x' 'y' 'z' and 'r' -*/ - parse_less = strdup(parse_string); - for (i = 0; i < (int)strlen(parse_string); i++) - { - if (parse_less[i] != 'x' && parse_less[i] != 'y' && parse_less[i] != 'z' && parse_less[i] != 'r') - { - parse_less[i] = 's'; - } - } - do - { - parse_less[i] = '\0'; - i--; - } while (parse_less[i] == 's'); -/* - // first pass to figure out the bounding box and number of returns -*/ - - fprintf(stderr, "first pass over file '%s' with parse '%s'\n", file_name_in, parse_less); - -/* // read the first line -*/ - while (fgets(line, sizeof(char) * MAX_CHARACTERS_PER_LINE, file_in)) - { - if (parse(parse_less, line, xyz, &point, &gps_time)) - { -/* // init the bounding box -*/ - VecCopy3dv(xyz_min, xyz); - VecCopy3dv(xyz_max, xyz); - -/* // mark that we found the first point -*/ - number_of_point_records = 1; - -/* // create return histogram -*/ - number_of_points_by_return[LASPoint_GetReturnNumber(point)]++; -/* // we can stop this loop -*/ - break; - } - else - { - fprintf(stderr, "WARNING: cannot parse '%s' with '%s'. skipping ...\n", line, parse_less); - } - } - -/* // did we manage to parse a line -*/ - if (number_of_point_records != 1) - { - fprintf(stderr, "ERROR: could not parse any lines with '%s'\n", parse_less); - exit(1); - } - -/* // loop over the remaining lines -*/ - while (fgets(line, sizeof(char) * MAX_CHARACTERS_PER_LINE, file_in)) - { - if (parse(parse_less, line, xyz, &point, &gps_time)) - { -/* // update bounding box -*/ - VecUpdateMinMax3dv(xyz_min, xyz_max, xyz); - -/* // count points -*/ - number_of_point_records++; - -/* // create return histogram -*/ - number_of_points_by_return[LASPoint_GetReturnNumber(point)]++; - } - else - { - fprintf(stderr, "WARNING: cannot parse '%s' with '%s'. skipping ...\n", line, parse_less); - } - } - -/* // output some stats -*/ - if (verbose) - { - fprintf(stderr, "npoints %d min %g %g %g max %g %g %g\n", number_of_point_records, xyz_min[0], xyz_min[1], xyz_min[2], xyz_max[0], xyz_max[1], xyz_max[2]); - fprintf(stderr, "return histogram %d %d %d %d %d %d %d %d\n", number_of_points_by_return[0], number_of_points_by_return[1], number_of_points_by_return[2], number_of_points_by_return[3], number_of_points_by_return[4], number_of_points_by_return[5], number_of_points_by_return[6], number_of_points_by_return[7]); - } + /* create a cheaper parse string that only looks for 'x' 'y' 'z' and 'r' */ + parse_less = strdup(parse_string); + for (i = 0; i < (int)strlen(parse_string); i++) + { + if (parse_less[i] != 'x' && + parse_less[i] != 'y' && + parse_less[i] != 'z' && + parse_less[i] != 'r') + { + parse_less[i] = 's'; + } + } -/* // close the input file -*/ - fclose(file_in); + do + { + parse_less[i] = '\0'; + printf("nuking %d for %c\n", i, parse_less[i]); + i--; + } while (parse_less[i] == 's'); + + + /* first pass to figure out the bounding box and number of returns */ + if (verbose) { + fprintf(stderr, + "first pass over file '%s' with parse '%s'\n", + file_name_in, + parse_less); + } + + /* read the first line */ + while (fgets(line, sizeof(char) * MAX_CHARACTERS_PER_LINE, file_in)) + { + if (parse(parse_less, line, xyz, &point, &gps_time)) + { + /* init the bounding box */ + VecCopy3dv(xyz_min, xyz); + VecCopy3dv(xyz_max, xyz); + + /* mark that we found the first point */ + number_of_point_records = 1; + + /* create return histogram */ + number_of_points_by_return[LASPoint_GetReturnNumber(point)]++; + + /* we can stop this loop */ + break; + } + else + { + fprintf(stderr, "WARNING: cannot parse '%s' with '%s'. skipping ...\n", + line, + parse_less); + } + } -/* // compute bounding box after quantization -*/ + /* did we manage to parse a line? */ + if (number_of_point_records != 1) + { + fprintf(stderr, "ERROR: could not parse any lines with '%s'\n", + parse_less); + exit(1); + } + /* loop over the remaining lines */ + while (fgets(line, sizeof(char) * MAX_CHARACTERS_PER_LINE, file_in)) + { + if (parse(parse_less, line, xyz, &point, &gps_time)) + { + /* update bounding box */ + VecUpdateMinMax3dv(xyz_min, xyz_max, xyz); - for (i = 0; i < 3; i++) - { - xyz_min_quant[i] = (int)(0.5 + (xyz_min[i] - xyz_offset[i]) / xyz_scale[i]); - xyz_max_quant[i] = (int)(0.5 + (xyz_max[i] - xyz_offset[i]) / xyz_scale[i]); - } + /* count points */ + number_of_point_records++; + /* create return histogram */ + number_of_points_by_return[LASPoint_GetReturnNumber(point)]++; + } + else + { + fprintf(stderr, "WARNING: cannot parse '%s' with '%s'. skipping ...\n", + line, + parse_less); + } + } + /* output some stats */ + if (verbose) + { + fprintf(stderr, + "npoints %d min %g %g %g max %g %g %g\n", + number_of_point_records, + xyz_min[0], + xyz_min[1], + xyz_min[2], + xyz_max[0], + xyz_max[1], + xyz_max[2] + ); + fprintf(stderr, + "return histogram %d %d %d %d %d %d %d %d\n", + number_of_points_by_return[0], + number_of_points_by_return[1], + number_of_points_by_return[2], + number_of_points_by_return[3], + number_of_points_by_return[4], + number_of_points_by_return[5], + number_of_points_by_return[6], + number_of_points_by_return[7] + ); + } - for (i = 0; i < 3; i++) - { - xyz_min_dequant[i] = xyz_offset[i] + (xyz_min_quant[i] * xyz_scale[i]); - xyz_max_dequant[i] = xyz_offset[i] + (xyz_max_quant[i] * xyz_scale[i]); - } + /* close the input file */ + fclose(file_in); + + /* compute bounding box after quantization */ + for (i = 0; i < 3; i++) + { + xyz_min_quant[i] = (int)(0.5 + (xyz_min[i] - xyz_offset[i]) / xyz_scale[i]); + xyz_max_quant[i] = (int)(0.5 + (xyz_max[i] - xyz_offset[i]) / xyz_scale[i]); + } + + for (i = 0; i < 3; i++) + { + xyz_min_dequant[i] = xyz_offset[i] + (xyz_min_quant[i] * xyz_scale[i]); + xyz_max_dequant[i] = xyz_offset[i] + (xyz_max_quant[i] * xyz_scale[i]); + } -/* // make sure there is not sign flip -*/ #define log_xor !=0==! - for (i = 0; i < 3; i++) - { - if ((xyz_min[i] > 0) log_xor (xyz_min_dequant[i] > 0)) - { - fprintf(stderr, "WARNING: quantization sign flip for %s min coord %g -> %g. use offset or scale up\n", (i ? (i == 1 ? "y" : "z") : "x"), xyz_min[i], xyz_min_dequant[i]); - } - if ((xyz_max[i] > 0) log_xor (xyz_max_dequant[i] > 0)) - { - fprintf(stderr, "WARNING: quantization sign flip for %s max coord %g -> %g. use offset or scale up\n", (i ? (i == 1 ? "y" : "z") : "x"), xyz_max[i], xyz_max_dequant[i]); - } - } + /* make sure there is not sign flip */ + for (i = 0; i < 3; i++) + { + if ((xyz_min[i] > 0) log_xor (xyz_min_dequant[i] > 0)) + { + fprintf(stderr, + "WARNING: quantization sign flip for %s min coord %g -> %g. use offset or scale up\n", + (i ? (i == 1 ? "y" : "z") : "x"), + xyz_min[i], + xyz_min_dequant[i] + ); + } + if ((xyz_max[i] > 0) log_xor (xyz_max_dequant[i] > 0)) + { + fprintf(stderr, + "WARNING: quantization sign flip for %s max coord %g -> %g. use offset or scale up\n", + (i ? (i == 1 ? "y" : "z") : "x"), + xyz_max[i], + xyz_max_dequant[i] + ); + } + } #undef log_xor -/* // populate the header -*/ + /* populate the header */ - header = LASHeader_Create(); + header = LASHeader_Create(); - if (system_identifier) LASHeader_SetSystemId(header, system_identifier); - if (generating_software) LASHeader_SetSoftwareId(header, generating_software); - LASHeader_SetCreationDOY(header, file_creation_day); - LASHeader_SetCreationYear(header, file_creation_year); + if (system_identifier) LASHeader_SetSystemId(header, system_identifier); + if (generating_software) LASHeader_SetSoftwareId(header, generating_software); + LASHeader_SetCreationDOY(header, file_creation_day); + LASHeader_SetCreationYear(header, file_creation_year); - if (strstr(parse_string,"t")) - { - LASHeader_SetDataFormatId(header, 1); - - } - else - { - LASHeader_SetDataFormatId(header, 0); - } - LASHeader_SetPointRecordsCount(header, number_of_point_records); - LASHeader_SetScale(header, xyz_scale[0], xyz_scale[1], xyz_scale[2]); - LASHeader_SetOffset(header, xyz_offset[0], xyz_offset[1], xyz_offset[2]); - LASHeader_SetMin(header, xyz_min_dequant[0], xyz_min_dequant[1], xyz_min_dequant[2]); - LASHeader_SetMax(header, xyz_max_dequant[0], xyz_max_dequant[1], xyz_max_dequant[2]); - LASHeader_SetPointRecordsByReturnCount(header, 0, number_of_points_by_return[1]); - LASHeader_SetPointRecordsByReturnCount(header, 1, number_of_points_by_return[2]); - LASHeader_SetPointRecordsByReturnCount(header, 2, number_of_points_by_return[3]); - LASHeader_SetPointRecordsByReturnCount(header, 3, number_of_points_by_return[4]); - LASHeader_SetPointRecordsByReturnCount(header, 4, number_of_points_by_return[5]); + if (strstr(parse_string,"t")) + { + LASHeader_SetDataFormatId(header, 1); + } + else + { + LASHeader_SetDataFormatId(header, 0); + } + LASHeader_SetPointRecordsCount(header, number_of_point_records); + LASHeader_SetScale(header, xyz_scale[0], xyz_scale[1], xyz_scale[2]); + LASHeader_SetOffset(header, xyz_offset[0], xyz_offset[1], xyz_offset[2]); + LASHeader_SetMin(header, xyz_min_dequant[0], xyz_min_dequant[1], xyz_min_dequant[2]); + LASHeader_SetMax(header, xyz_max_dequant[0], xyz_max_dequant[1], xyz_max_dequant[2]); + LASHeader_SetPointRecordsByReturnCount(header, 0, number_of_points_by_return[1]); + LASHeader_SetPointRecordsByReturnCount(header, 1, number_of_points_by_return[2]); + LASHeader_SetPointRecordsByReturnCount(header, 2, number_of_points_by_return[3]); + LASHeader_SetPointRecordsByReturnCount(header, 3, number_of_points_by_return[4]); + LASHeader_SetPointRecordsByReturnCount(header, 4, number_of_points_by_return[5]); -/* // reopen input file for the second pass -*/ - file_in = fopen(file_name_in, "r"); - - if (file_in == 0) - { - fprintf(stderr, "ERROR: could not open '%s' for second pass\n",file_name_in); - exit(1); - } + /* reopen input file for the second pass */ + file_in = fopen(file_name_in, "r"); -/* // open the output pipe -*/ + if (file_in == 0) + { + fprintf(stderr, "ERROR: could not open '%s' for second pass\n",file_name_in); + exit(1); + } + /* + because the output goes to a file we can do everything in a + single pass and compute the header information along the way + */ -/* - if (laswriter->open(stdout, &header, olaz ? 1 : 0) == false) - { - fprintf(stderr, "ERROR: could not open laswriter\n"); - exit(1); - } - - fprintf(stderr, "second pass over file '%s' with parse '%s' writing to '%s'\n", file_name_in, parse_string, file_name_out ? file_name_out : "stdout"); - - // loop over points - - while (fgets(line, sizeof(char) * MAX_CHARACTERS_PER_LINE, file_in)) - { - if (parse(parse_string, line, xyz, &point, &gps_time)) - { - point.x = (int)(0.5 + (xyz[0] - xyz_offset[0]) / xyz_scale[0]); - point.y = (int)(0.5 + (xyz[1] - xyz_offset[1]) / xyz_scale[1]); - point.z = (int)(0.5 + (xyz[2] - xyz_offset[2]) / xyz_scale[2]); - laswriter->write_point(&point, gps_time); - number_of_point_records--; - } - else - { - fprintf(stderr, "WARNING: cannot parse '%s' with '%s'. skipping ...\n", line, parse_string); - } - } - - if (number_of_point_records) - { - fprintf(stderr, "WARNING: second pass has different number of points (%d instead of %d)\n", header.number_of_point_records - number_of_point_records, header.number_of_point_records); - } - - LASWriter_Destroy(writer); - - if (verbose) - { - fprintf(stderr, "done.\n"); - } - - fclose(file_in); - } - else - { -*/ -/* - // because the output goes to a file we can do everything in a single pass - // and compute the header information along the way and then set it at the - // end by fopen() the file with "rb+" - - // open input file -*/ - - if (file_name_in) - { - - file_in = fopen(file_name_in, "r"); - - if (file_in == NULL) - { - LASError_Print("Could not open input file"); - exit(1); - } - } - -/* // open output file -*/ - printf("Creating file...\n"); - writer = LASWriter_Create(file_name_out, header, LAS_MODE_WRITE); - if (!writer) { - fprintf(stderr, - "Error! %d, %s, in method %s\n", - LASError_GetLastErrorNum(), - LASError_GetLastErrorMsg(), - LASError_GetLastErrorMethod() - ); - exit(1); - } - - - fprintf(stderr, "scanning %s with parse '%s' writing to %s\n", file_name_in ? file_name_in : "stdin" , parse_string, file_name_out); - -/* // read the first line -*/ - while (fgets(line, sizeof(char) * MAX_CHARACTERS_PER_LINE, file_in)) - { - if (parse(parse_string, line, xyz, &point, &gps_time)) - { -/* // init the bounding box -*/ - VecCopy3dv(xyz_min, xyz); - VecCopy3dv(xyz_max, xyz); - -/* // we found the first point -*/ - number_of_point_records = 1; - -/* // create return histogram -*/ - number_of_points_by_return[LASPoint_GetReturnNumber(point)]++; -/* // compute the quantized x, y, and z values -*/ - LASPoint_SetX(point, 0.5 + (xyz[0] - xyz_offset[0]) / xyz_scale[0]); - LASPoint_SetY(point, 0.5 + (xyz[1] - xyz_offset[1]) / xyz_scale[1]); - LASPoint_SetX(point, 0.5 + (xyz[2] - xyz_offset[2]) / xyz_scale[2]); - -/* // write the first point -*/ - LASWriter_WritePoint(writer, point); - -/* // we can stop this loop -*/ - break; - } - else - { - fprintf(stderr, "WARNING: cannot parse '%s' with '%s'. skipping ...\n", line, parse_string); - } - } - -/* // did we manage to parse a line -*/ - if (number_of_point_records != 1) - { - fprintf(stderr, "ERROR: could not parse any lines with '%s'\n", parse_string); - exit(1); - } - -/* // loop over the remaining lines -*/ - while (fgets(line, sizeof(char) * MAX_CHARACTERS_PER_LINE, file_in)) - { - if (parse(parse_string, line, xyz, &point, &gps_time)) - { - -/* // update bounding box -*/ - VecUpdateMinMax3dv(xyz_min, xyz_max, xyz); - -/* // count points -*/ - number_of_point_records++; - -/* // create return histogram -*/ - number_of_points_by_return[LASPoint_GetReturnNumber(point)]++; -/* // compute the quantized x, y, and z values -*/ - LASPoint_SetX(point, 0.5 + (xyz[0] - xyz_offset[0]) / xyz_scale[0]); - LASPoint_SetY(point, 0.5 + (xyz[1] - xyz_offset[1]) / xyz_scale[1]); - LASPoint_SetX(point, 0.5 + (xyz[2] - xyz_offset[2]) / xyz_scale[2]); - -/* // write the first point - */ - LASWriter_WritePoint(writer, point); - } - else - { - fprintf(stderr, "WARNING: cannot parse '%s' with '%s'. skipping ...\n", line, parse_string); - } - } - -/* // done writing the points -*/ - -/* if (file_in != stdin) fclose(file_in); -*/ - - LASWriter_Destroy(writer); - -/* // output some stats -*/ - - if (verbose) - { - fprintf(stderr, "npoints %d min %g %g %g max %g %g %g\n", number_of_point_records, xyz_min[0], xyz_min[1], xyz_min[2], xyz_max[0], xyz_max[1], xyz_max[2]); - fprintf(stderr, "return histogram %d %d %d %d %d %d %d %d\n", number_of_points_by_return[0], number_of_points_by_return[1], number_of_points_by_return[2], number_of_points_by_return[3], number_of_points_by_return[4], number_of_points_by_return[5], number_of_points_by_return[6], number_of_points_by_return[7]); - } - -/* // compute bounding box after quantization -*/ - - - for (i = 0; i < 3; i++) - { - xyz_min_quant[i] = (int)(0.5 + (xyz_min[i] - xyz_offset[i]) / xyz_scale[i]); - xyz_max_quant[i] = (int)(0.5 + (xyz_max[i] - xyz_offset[i]) / xyz_scale[i]); - } - - - - for (i = 0; i < 3; i++) - { - xyz_min_dequant[i] = xyz_offset[i] + (xyz_min_quant[i] * xyz_scale[i]); - xyz_max_dequant[i] = xyz_offset[i] + (xyz_max_quant[i] * xyz_scale[i]); - } - -/* // make sure there is not sign flip -*/ - -#define log_xor !=0==! - - for (i = 0; i < 3; i++) - { - if ((xyz_min[i] > 0) log_xor (xyz_min_dequant[i] > 0)) - { - fprintf(stderr, "WARNING: quantization sign flip for %s min coord %g -> %g. use offset or scale up\n", (i ? (i == 1 ? "y" : "z") : "x"), xyz_min[i], xyz_min_dequant[i]); - } - if ((xyz_max[i] > 0) log_xor (xyz_max_dequant[i] > 0)) - { - fprintf(stderr, "WARNING: quantization sign flip for %s max coord %g -> %g. use offset or scale up\n", (i ? (i == 1 ? "y" : "z") : "x"), xyz_max[i], xyz_max_dequant[i]); - } - } - -#undef log_xor - -/* // re-open output file to rewrite the missing header information - + /* open output file */ + printf("Creating file...\n"); + writer = LASWriter_Create(file_name_out, header, LAS_MODE_WRITE); + if (!writer) { + LASError_Print("Could not open file for write mode "); + exit(1); + } - file_out = fopen(file_name_out, "rb+"); + if (verbose) { + fprintf(stderr, + "scanning %s with parse '%s' writing to %s\n", + file_name_in , + parse_string, + file_name_out + ); + } - if (file_out == 0) - { - fprintf(stderr, "ERROR: could not open re-output file '%s'\n",file_name_out); - exit(1); - } - // rewrite the information + /* read the first line */ + while (fgets(line, sizeof(char) * MAX_CHARACTERS_PER_LINE, file_in)) + { + if (parse(parse_string, line, xyz, &point, &gps_time)) + { + /* init the bounding box */ + VecCopy3dv(xyz_min, xyz); + VecCopy3dv(xyz_max, xyz); + + /* mark that we found the first point */ + number_of_point_records = 1; + + /* create return histogram */ + number_of_points_by_return[LASPoint_GetReturnNumber(point)]++; + + /* compute the quantized x, y, and z values */ + LASPoint_SetX(point, 0.5 + (xyz[0] - xyz_offset[0]) / xyz_scale[0]); + LASPoint_SetY(point, 0.5 + (xyz[1] - xyz_offset[1]) / xyz_scale[1]); + LASPoint_SetX(point, 0.5 + (xyz[2] - xyz_offset[2]) / xyz_scale[2]); + + /* write the first point */ + LASWriter_WritePoint(writer, point); + printf("Writing point..."); + + /* we can stop this loop */ + break; + } + else + { + fprintf(stderr, "WARNING: cannot parse '%s' with '%s'. skipping ...\n", + line, + parse_string); + } + } + /* did we manage to parse a line? */ + if (number_of_point_records != 1) + { + fprintf(stderr, "ERROR: could not parse any lines with '%s'\n", + parse_less); + exit(1); + } + /* loop over the remaining lines */ + while (fgets(line, sizeof(char) * MAX_CHARACTERS_PER_LINE, file_in)) + { + if (parse(parse_string, line, xyz, &point, &gps_time)) + { + /* update bounding box */ + VecUpdateMinMax3dv(xyz_min, xyz_max, xyz); - fseek(file_out, 107, SEEK_SET); - fwrite(&number_of_point_records, sizeof(unsigned int), 5, file_out); + /* count points */ + number_of_point_records++; - fseek(file_out, 111, SEEK_SET); - fwrite(&(number_of_points_by_return[1]), sizeof(unsigned int), 5, file_out); + /* create return histogram */ + number_of_points_by_return[LASPoint_GetReturnNumber(point)]++; - fseek(file_out, 179, SEEK_SET); - fwrite(&(xyz_max_dequant[0]), sizeof(double), 1, file_out); - fwrite(&(xyz_min_dequant[0]), sizeof(double), 1, file_out); - fwrite(&(xyz_max_dequant[1]), sizeof(double), 1, file_out); - fwrite(&(xyz_min_dequant[1]), sizeof(double), 1, file_out); - fwrite(&(xyz_max_dequant[2]), sizeof(double), 1, file_out); - fwrite(&(xyz_min_dequant[2]), sizeof(double), 1, file_out); + /* compute the quantized x, y, and z values */ + LASPoint_SetX(point, 0.5 + (xyz[0] - xyz_offset[0]) / xyz_scale[0]); + LASPoint_SetY(point, 0.5 + (xyz[1] - xyz_offset[1]) / xyz_scale[1]); + LASPoint_SetX(point, 0.5 + (xyz[2] - xyz_offset[2]) / xyz_scale[2]); - // close the rewritten file + /* write the first point */ + LASWriter_WritePoint(writer, point); + } + else + { + fprintf(stderr, "WARNING: cannot parse '%s' with '%s'. skipping ...\n", + line, + parse_string); + } + } - fclose(file_out); -*/ + /* close up stuff */ + fclose(file_in); + LASWriter_Destroy(writer); if (verbose) - { - fprintf(stderr, "done.\n"); - } + { + fprintf(stderr, "done.\n"); + } return 0; From liblas-commits at hobu.net Sat Mar 15 17:35:53 2008 From: liblas-commits at hobu.net (liblas-commits@hobu.net) Date: Sat Mar 15 17:36:00 2008 Subject: [Liblas-commits] r531 - trunk/include/liblas/capi Message-ID: <20080315223553.26CE26965D3@mail.hobu.net> Author: hobu Date: Sat Mar 15 17:35:52 2008 New Revision: 531 URL: http://liblas.org/changeset/531 Log: SetDataFormatId Modified: trunk/include/liblas/capi/liblas.h Modified: trunk/include/liblas/capi/liblas.h ============================================================================== --- trunk/include/liblas/capi/liblas.h (original) +++ trunk/include/liblas/capi/liblas.h Sat Mar 15 17:35:52 2008 @@ -143,7 +143,7 @@ LAS_DLL uint32_t LASHeader_GetRecordsCount(const LASHeaderH hHeader); LAS_DLL uint8_t LASHeader_GetDataFormatId(const LASHeaderH hHeader); LAS_DLL uint16_t LASHeader_GetDataRecordLength(const LASHeaderH hHeader); -LAS_DLL uint8_t LASHeader_GetDataFormatId(const LASHeaderH hHeader); +LAS_DLL uint8_t LASHeader_SetDataFormatId(const LASHeaderH hHeader, int value); LAS_DLL uint32_t LASHeader_GetPointRecordsCount(const LASHeaderH hHeader); LAS_DLL void LASHeader_SetPointRecordsCount(const LASHeaderH hHeader, uint32_t value); LAS_DLL uint32_t LASHeader_GetPointRecordsByReturnCount(const LASHeaderH hHeader, int index); From liblas-commits at hobu.net Sun Mar 16 16:08:55 2008 From: liblas-commits at hobu.net (liblas-commits@hobu.net) Date: Sun Mar 16 16:09:04 2008 Subject: [Liblas-commits] r532 - trunk/apps Message-ID: <20080316210855.B7D8869CC98@mail.hobu.net> Author: hobu Date: Sun Mar 16 16:08:53 2008 New Revision: 532 URL: http://liblas.org/changeset/532 Log: mostly working txt2las Modified: trunk/apps/txt2las.c Modified: trunk/apps/txt2las.c ============================================================================== --- trunk/apps/txt2las.c (original) +++ trunk/apps/txt2las.c Sun Mar 16 16:08:53 2008 @@ -96,7 +96,7 @@ const char* p = parse_string; const char* l = line; - point = LASPoint_Create(); + while (p[0]) { /* // we expect the x coordinate */ @@ -329,6 +329,7 @@ char* parse_less = NULL; LASHeaderH header = NULL; LASWriterH writer = NULL; + LASError err; int xyz_min_quant[3] = {0, 0, 0}; int xyz_max_quant[3] = {0, 0, 0}; @@ -536,7 +537,8 @@ /* read the first line */ while (fgets(line, sizeof(char) * MAX_CHARACTERS_PER_LINE, file_in)) { - if (parse(parse_less, line, xyz, &point, &gps_time)) + point = LASPoint_Create(); + if (parse(parse_less, line, xyz, point, &gps_time)) { /* init the bounding box */ VecCopy3dv(xyz_min, xyz); @@ -556,7 +558,10 @@ fprintf(stderr, "WARNING: cannot parse '%s' with '%s'. skipping ...\n", line, parse_less); + } + LASPoint_Destroy(point); + point = NULL; } /* did we manage to parse a line? */ @@ -570,7 +575,8 @@ /* loop over the remaining lines */ while (fgets(line, sizeof(char) * MAX_CHARACTERS_PER_LINE, file_in)) { - if (parse(parse_less, line, xyz, &point, &gps_time)) + point = LASPoint_Create(); + if (parse(parse_less, line, xyz, point, &gps_time)) { /* update bounding box */ VecUpdateMinMax3dv(xyz_min, xyz_max, xyz); @@ -586,7 +592,10 @@ fprintf(stderr, "WARNING: cannot parse '%s' with '%s'. skipping ...\n", line, parse_less); + } + LASPoint_Destroy(point); + point = NULL; } /* output some stats */ @@ -671,6 +680,7 @@ if (strstr(parse_string,"t")) { + fprintf(stderr, "Setting to LAS version 1.1!!!\n"); LASHeader_SetDataFormatId(header, 1); } else @@ -725,7 +735,8 @@ /* read the first line */ while (fgets(line, sizeof(char) * MAX_CHARACTERS_PER_LINE, file_in)) { - if (parse(parse_string, line, xyz, &point, &gps_time)) + point = LASPoint_Create(); + if (parse(parse_string, line, xyz, point, &gps_time)) { /* init the bounding box */ VecCopy3dv(xyz_min, xyz); @@ -738,13 +749,16 @@ number_of_points_by_return[LASPoint_GetReturnNumber(point)]++; /* compute the quantized x, y, and z values */ - LASPoint_SetX(point, 0.5 + (xyz[0] - xyz_offset[0]) / xyz_scale[0]); - LASPoint_SetY(point, 0.5 + (xyz[1] - xyz_offset[1]) / xyz_scale[1]); - LASPoint_SetX(point, 0.5 + (xyz[2] - xyz_offset[2]) / xyz_scale[2]); + LASPoint_SetX(point, xyz[0]); + LASPoint_SetY(point, xyz[1]); + LASPoint_SetZ(point, xyz[2]); /* write the first point */ - LASWriter_WritePoint(writer, point); - printf("Writing point..."); + err = LASWriter_WritePoint(writer, point); + if (err) { + LASError_Print("could not write point"); + exit(1); + } /* we can stop this loop */ break; @@ -755,6 +769,8 @@ line, parse_string); } + LASPoint_Destroy(point); + point = NULL; } /* did we manage to parse a line? */ @@ -768,6 +784,7 @@ /* loop over the remaining lines */ while (fgets(line, sizeof(char) * MAX_CHARACTERS_PER_LINE, file_in)) { + point = LASPoint_Create(); if (parse(parse_string, line, xyz, &point, &gps_time)) { /* update bounding box */ @@ -780,12 +797,17 @@ number_of_points_by_return[LASPoint_GetReturnNumber(point)]++; /* compute the quantized x, y, and z values */ - LASPoint_SetX(point, 0.5 + (xyz[0] - xyz_offset[0]) / xyz_scale[0]); - LASPoint_SetY(point, 0.5 + (xyz[1] - xyz_offset[1]) / xyz_scale[1]); - LASPoint_SetX(point, 0.5 + (xyz[2] - xyz_offset[2]) / xyz_scale[2]); + LASPoint_SetX(point, xyz[0]); + LASPoint_SetY(point, xyz[1]); + LASPoint_SetZ(point, xyz[2]); /* write the first point */ - LASWriter_WritePoint(writer, point); + err = LASWriter_WritePoint(writer, point); + if (err) { + LASError_Print("could not write point"); + exit(1); + } + } else { @@ -793,6 +815,8 @@ line, parse_string); } + LASPoint_Destroy(point); + point = NULL; } From liblas-commits at hobu.net Mon Mar 17 10:18:50 2008 From: liblas-commits at hobu.net (liblas-commits@hobu.net) Date: Mon Mar 17 10:19:01 2008 Subject: [Liblas-commits] r533 - in trunk: . apps Message-ID: <20080317151850.C92136A3C22@mail.hobu.net> Author: hobu Date: Mon Mar 17 10:18:48 2008 New Revision: 533 URL: http://liblas.org/changeset/533 Log: update for 0.9.1 Modified: trunk/apps/Makefile.am trunk/apps/Makefile.in trunk/configure trunk/configure.ac trunk/libtool Modified: trunk/apps/Makefile.am ============================================================================== --- trunk/apps/Makefile.am (original) +++ trunk/apps/Makefile.am Mon Mar 17 10:18:48 2008 @@ -6,5 +6,10 @@ las2txt_SOURCES = las2txt.c lascommon.c txt2las_SOURCES = txt2las.c +#if GDAL_IS_CONFIG +#las2ogr_SOURCES = las2ogr.cpp +#else +#las2ogr_SOURCES = +#endif LDADD = ../src/liblas.la bin_PROGRAMS = lasinfo las2las lasmerge las2txt txt2las Modified: trunk/apps/Makefile.in ============================================================================== --- trunk/apps/Makefile.in (original) +++ trunk/apps/Makefile.in Mon Mar 17 10:18:48 2008 @@ -195,6 +195,12 @@ lasmerge_SOURCES = lasmerge.c lascommon.c las2txt_SOURCES = las2txt.c lascommon.c txt2las_SOURCES = txt2las.c + +#if GDAL_IS_CONFIG +#las2ogr_SOURCES = las2ogr.cpp +#else +#las2ogr_SOURCES = +#endif LDADD = ../src/liblas.la all: all-am Modified: trunk/configure ============================================================================== --- trunk/configure (original) +++ trunk/configure Mon Mar 17 10:18:48 2008 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.61 for las 0.9.0. +# Generated by GNU Autoconf 2.61 for las 0.9.1. # # Report bugs to . # @@ -728,8 +728,8 @@ # Identity of this package. PACKAGE_NAME='las' PACKAGE_TARNAME='las' -PACKAGE_VERSION='0.9.0' -PACKAGE_STRING='las 0.9.0' +PACKAGE_VERSION='0.9.1' +PACKAGE_STRING='las 0.9.1' PACKAGE_BUGREPORT='hobu.inc@gmail.com' # Factoring default headers for most tests. @@ -870,6 +870,8 @@ ac_ct_F77 LIBTOOL GDAL_INC GDAL_PREFIX +GDAL_IS_CONFIG_TRUE +GDAL_IS_CONFIG_FALSE LIBOBJS LTLIBOBJS' ac_subst_files='' @@ -1390,7 +1392,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures las 0.9.0 to adapt to many kinds of systems. +\`configure' configures las 0.9.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1460,7 +1462,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of las 0.9.0:";; + short | recursive ) echo "Configuration of las 0.9.1:";; esac cat <<\_ACEOF @@ -1564,7 +1566,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -las configure 0.9.0 +las configure 0.9.1 generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1578,7 +1580,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by las $as_me 0.9.0, which was +It was created by las $as_me 0.9.1, which was generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ @@ -2009,7 +2011,7 @@ -RELEASE_VERSION=0.9.0 +RELEASE_VERSION=0.9.1 debug_default="no" CFLAGS="-Wall -Wno-long-long -pedantic -ansi $CFLAGS" @@ -2321,7 +2323,7 @@ # Define the identity of the package. PACKAGE='las' - VERSION='0.9.0' + VERSION='0.9.1' cat >>confdefs.h <<_ACEOF @@ -5114,7 +5116,7 @@ ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 5117 "configure"' > conftest.$ac_ext + echo '#line 5119 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -7373,11 +7375,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7376: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7378: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7380: \$? = $ac_status" >&5 + echo "$as_me:7382: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7641,11 +7643,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7644: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7646: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7648: \$? = $ac_status" >&5 + echo "$as_me:7650: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7745,11 +7747,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7748: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7750: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:7752: \$? = $ac_status" >&5 + echo "$as_me:7754: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -10053,7 +10055,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:12494: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:12496: \$? = $ac_status" >&5 + echo "$as_me:12498: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -12593,11 +12595,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:12596: $lt_compile\"" >&5) + (eval echo "\"\$as_me:12598: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:12600: \$? = $ac_status" >&5 + echo "$as_me:12602: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -14163,11 +14165,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14166: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14168: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:14170: \$? = $ac_status" >&5 + echo "$as_me:14172: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -14267,11 +14269,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14270: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14272: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:14274: \$? = $ac_status" >&5 + echo "$as_me:14276: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -16465,11 +16467,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16468: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16470: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16472: \$? = $ac_status" >&5 + echo "$as_me:16474: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -16733,11 +16735,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16736: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16738: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16740: \$? = $ac_status" >&5 + echo "$as_me:16742: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -16837,11 +16839,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16840: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16842: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:16844: \$? = $ac_status" >&5 + echo "$as_me:16846: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -19981,8 +19983,13 @@ withval=$with_gdal; fi +{ echo "$as_me:$LINENO: checking for GDAL" >&5 +echo $ECHO_N "checking for GDAL... $ECHO_C" >&6; } + if test "$with_gdal" = "no" -o "$with_gdal" = "" ; then - GDAL_CONFIG="$with_gdal" + GDAL_CONFIG="no" + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } else if test "`basename xx/$with_gdal`" = "gdal-config" ; then { echo "$as_me:$LINENO: result: GDAL enabled with provided gdal-config" >&5 @@ -20009,6 +20016,14 @@ fi fi + if test $GDAL_CONFIG != no; then + GDAL_IS_CONFIG_TRUE= + GDAL_IS_CONFIG_FALSE='#' +else + GDAL_IS_CONFIG_TRUE='#' + GDAL_IS_CONFIG_FALSE= +fi + { echo "$as_me:$LINENO: checking for 64bit integer type" >&5 @@ -20279,6 +20294,13 @@ Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi +if test -z "${GDAL_IS_CONFIG_TRUE}" && test -z "${GDAL_IS_CONFIG_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"GDAL_IS_CONFIG\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"GDAL_IS_CONFIG\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files @@ -20579,7 +20601,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by las $as_me 0.9.0, which was +This file was extended by las $as_me 0.9.1, which was generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -20626,7 +20648,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -las config.status 0.9.0 +las config.status 0.9.1 configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" @@ -20942,11 +20964,13 @@ LIBTOOL!$LIBTOOL$ac_delim GDAL_INC!$GDAL_INC$ac_delim GDAL_PREFIX!$GDAL_PREFIX$ac_delim +GDAL_IS_CONFIG_TRUE!$GDAL_IS_CONFIG_TRUE$ac_delim +GDAL_IS_CONFIG_FALSE!$GDAL_IS_CONFIG_FALSE$ac_delim LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 8; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 10; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 @@ -21440,7 +21464,7 @@ echo " Debugging support........: ${enable_debug}" -echo " GDAL support........: ${with_gdal}" +echo " GDAL support........: ${GDAL_CONFIG}" echo "" Modified: trunk/configure.ac ============================================================================== --- trunk/configure.ac (original) +++ trunk/configure.ac Mon Mar 17 10:18:48 2008 @@ -4,7 +4,7 @@ dnl m4_define([liblas_version_major], [0]) m4_define([liblas_version_minor], [9]) -m4_define([liblas_version_micro], [0]) +m4_define([liblas_version_micro], [1]) m4_define([liblas_version], [liblas_version_major.liblas_version_minor.liblas_version_micro]) @@ -70,9 +70,12 @@ dnl GDAL dnl ########################################################### AC_ARG_WITH(gdal,[ --with-gdal=ARG Path to gdal-config],,) +AC_MSG_CHECKING([for GDAL]) + if test "$with_gdal" = "no" -o "$with_gdal" = "" ; then - GDAL_CONFIG="$with_gdal" -dnl AC_PATH_PROG(GDAL_CONFIG, gdal-config, no) + GDAL_CONFIG="no" + AC_MSG_RESULT([no]) +dnl AC_PATH_PROG(GDAL_CONFIG, gdal-config, no) else if test "`basename xx/$with_gdal`" = "gdal-config" ; then AC_MSG_RESULT([GDAL enabled with provided gdal-config]) @@ -93,6 +96,7 @@ fi fi AC_SUBST(GDAL_INC GDAL_PREFIX) +AM_CONDITIONAL([GDAL_IS_CONFIG], [test $GDAL_CONFIG != no]) AC_HAVE_LONG_LONG @@ -120,5 +124,5 @@ LOC_MSG([ C compiler...............: ${CC} ${CFLAGS}]) LOC_MSG([ C++ compiler.............: ${CXX} ${CXXFLAGS}]) LOC_MSG([ Debugging support........: ${enable_debug}]) -LOC_MSG([ GDAL support........: ${with_gdal}]) +LOC_MSG([ GDAL support........: ${GDAL_CONFIG}]) LOC_MSG() Modified: trunk/libtool ============================================================================== --- trunk/libtool (original) +++ trunk/libtool Mon Mar 17 10:18:48 2008 @@ -1,7 +1,7 @@ #! /bin/sh # libtoolT - Provide generalized library-building support services. -# Generated automatically by (GNU las 0.9.0) +# Generated automatically by (GNU las 0.9.1) # NOTE: Changes made to this file will be lost: look at ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 @@ -40,11 +40,11 @@ (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # The names of the tagged configurations supported by this script. -available_tags=" CXX" +available_tags=" CXX F77" # ### BEGIN LIBTOOL CONFIG -# Libtool was configured on host torch.local: +# Libtool was configured on host fire.hobu.net: # Shell to use when invoking shell scripts. SHELL="/bin/sh" @@ -7212,7 +7212,7 @@ # End: # ### BEGIN LIBTOOL TAG CONFIG: CXX -# Libtool was configured on host torch.local: +# Libtool was configured on host fire.hobu.net: # Shell to use when invoking shell scripts. SHELL="/bin/sh" @@ -7515,3 +7515,308 @@ # ### END LIBTOOL TAG CONFIG: CXX +# ### BEGIN LIBTOOL TAG CONFIG: F77 + +# Libtool was configured on host fire.hobu.net: + +# Shell to use when invoking shell scripts. +SHELL="/bin/sh" + +# Whether or not to build shared libraries. +build_libtool_libs=yes + +# Whether or not to build static libraries. +build_old_libs=yes + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=no + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=no + +# Whether or not to optimize for fast installation. +fast_install=needless + +# The host system. +host_alias= +host=i686-apple-darwin9.2.0 +host_os=darwin9.2.0 + +# The build system. +build_alias= +build=i686-apple-darwin9.2.0 +build_os=darwin9.2.0 + +# An echo program that does not interpret backslashes. +echo="/bin/echo" + +# The archiver. +AR="ar" +AR_FLAGS="cru" + +# A C compiler. +LTCC="gcc" + +# LTCC compiler flags. +LTCFLAGS="-Wall -Wno-long-long -pedantic -ansi " + +# A language-specific compiler. +CC="g77" + +# Is the compiler the GNU C compiler? +with_gcc=yes + +# An ERE matcher. +EGREP="/usr/bin/grep -E" + +# The linker used to build libraries. +LD="/usr/libexec/gcc/i686-apple-darwin9/4.0.1/ld" + +# Whether we need hard or soft links. +LN_S="ln -s" + +# A BSD-compatible nm program. +NM="/usr/bin/nm -p" + +# A symbol stripping program +STRIP="strip" + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=file + +# Used on cygwin: DLL creation program. +DLLTOOL="dlltool" + +# Used on cygwin: object dumper. +OBJDUMP="objdump" + +# Used on cygwin: assembler. +AS="as" + +# The name of the directory that contains temporary libtool files. +objdir=.libs + +# How to create reloadable object files. +reload_flag=" -r" +reload_cmds="\$LTCC \$LTCFLAGS -nostdlib \${wl}-r -o \$output\$reload_objs" + +# How to pass a linker flag through the compiler. +wl="-Wl," + +# Object file suffix (normally "o"). +objext="o" + +# Old archive suffix (normally "a"). +libext="a" + +# Shared library suffix (normally ".so"). +shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' + +# Executable file suffix (normally ""). +exeext="" + +# Additional compiler flags for building library objects. +pic_flag=" -fno-common" +pic_mode=default + +# What is the maximum length of a command? +max_cmd_len=196608 + +# Does compiler simultaneously support -c and -o options? +compiler_c_o="yes" + +# Must we lock files when doing compilation? +need_locks="no" + +# Do we need the lib prefix for modules? +need_lib_prefix=no + +# Do we need a version for libraries? +need_version=no + +# Whether dlopen is supported. +dlopen_support=unknown + +# Whether dlopen of programs is supported. +dlopen_self=unknown + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=unknown + +# Compiler flag to prevent dynamic linking. +link_static_flag="" + +# Compiler flag to turn off builtin functions. +no_builtin_flag="" + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec="" + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec="" + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec="" + +# Library versioning type. +version_type=darwin + +# Format of library name prefix. +libname_spec="lib\$name" + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec="\${libname}\${release}\${major}\$shared_ext \${libname}\$shared_ext \${libname}\${release}\${versuffix}\$shared_ext" + +# The coded name of the library, if different from the real name. +soname_spec="\${libname}\${release}\${major}\$shared_ext" + +# Commands used to build and install an old-style archive. +RANLIB="ranlib" +old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs\$old_deplibs~\$RANLIB \$oldlib" +old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$oldlib" +old_postuninstall_cmds="" + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds="" + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds="" + +# Commands used to build and install a shared archive. +archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring" +archive_expsym_cmds="sed -e \\\"s,#.*,,\\\" -e \\\"s,^[ ]*,,\\\" -e \\\"s,^\\\\(..*\\\\),_&,\\\" < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring~nmedit -s \$output_objdir/\${libname}-symbols.expsym \${lib}" +postinstall_cmds="" +postuninstall_cmds="" + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs\$compiler_flags" +module_expsym_cmds="sed -e \\\"s,#.*,,\\\" -e \\\"s,^[ ]*,,\\\" -e \\\"s,^\\\\(..*\\\\),_&,\\\" < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs\$compiler_flags~nmedit -s \$output_objdir/\${libname}-symbols.expsym \${lib}" + +# Commands to strip libraries. +old_striplib="" +striplib="strip -x" + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects="" + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects="" + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps="" + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps="" + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path="" + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method="pass_all" + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd="\$MAGIC_CMD" + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag="\${wl}-flat_namespace \${wl}-undefined \${wl}suppress" + +# Flag that forces no undefined symbols. +no_undefined_flag="" + +# Commands used to finish a libtool library installation in a directory. +finish_cmds="" + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval="" + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe="sed -n -e 's/^.*[ ]\\([BCDEGRST][BCDEGRST]*\\)[ ][ ]*_\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 _\\2 \\2/p'" + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl="sed -n -e 's/^. .* \\(.*\\)\$/extern int \\1;/p'" + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address="sed -n -e 's/^: \\([^ ]*\\) \$/ {\\\"\\1\\\", (lt_ptr) 0},/p' -e 's/^[BCDEGRST] \\([^ ]*\\) \\([^ ]*\\)\$/ {\"\\2\", (lt_ptr) \\&\\2},/p'" + +# This is the shared library runtime path variable. +runpath_var= + +# This is the shared library path variable. +shlibpath_var=DYLD_LIBRARY_PATH + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=yes + +# How to hardcode a shared library path into an executable. +hardcode_action=immediate + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=no + +# Flag to hardcode $libdir into a binary during linking. +# This must work even if $libdir does not exist. +hardcode_libdir_flag_spec="" + +# If ld is used when linking, flag to hardcode $libdir into +# a binary during linking. This must work even if $libdir does +# not exist. +hardcode_libdir_flag_spec_ld="" + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator="" + +# Set to yes if using DIR/libNAME during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=no + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=no + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=unsupported + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=yes + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="PATH DYLD_LIBRARY_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=yes + +# Compile-time system search path for libraries +sys_lib_search_path_spec=" /usr/local/lib/gcc/i686-apple-darwin8.8.1/3.4.0/ /usr/lib/gcc/i686-apple-darwin8.8.1/3.4.0/ /usr/local/lib/gcc/i686-apple-darwin8.8.1/3.4.0/../../../../i686-apple-darwin8.8.1/lib/i686-apple-darwin8.8.1/3.4.0/ /usr/local/lib/gcc/i686-apple-darwin8.8.1/3.4.0/../../../../i686-apple-darwin8.8.1/lib/ /usr/local/lib/gcc/i686-apple-darwin8.8.1/3.4.0/../../../i686-apple-darwin8.8.1/3.4.0/ /usr/local/lib/gcc/i686-apple-darwin8.8.1/3.4.0/../../../ /lib/i686-apple-darwin8.8.1/3.4.0/ /lib/ /usr/lib/i686-apple-darwin8.8.1/3.4.0/ /usr/lib/ /lib /usr/lib /usr/local/lib" + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec="/usr/local/lib /lib /usr/lib" + +# Fix the shell variable $srcfile for the compiler. +fix_srcfile_path="" + +# Set to yes if exported symbols are required. +always_export_symbols=no + +# The commands to list exported symbols. +export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols" + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds="" + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms="_GLOBAL_OFFSET_TABLE_" + +# Symbols that must always be exported. +include_expsyms="" + +# ### END LIBTOOL TAG CONFIG: F77 + From liblas-commits at hobu.net Mon Mar 17 10:19:46 2008 From: liblas-commits at hobu.net (liblas-commits@hobu.net) Date: Mon Mar 17 10:19:53 2008 Subject: [Liblas-commits] r534 - trunk Message-ID: <20080317151946.2DFAF6A3CD9@mail.hobu.net> Author: hobu Date: Mon Mar 17 10:19:45 2008 New Revision: 534 URL: http://liblas.org/changeset/534 Log: update for 0.9.1 Modified: trunk/nmake.opt Modified: trunk/nmake.opt ============================================================================== --- trunk/nmake.opt (original) +++ trunk/nmake.opt Mon Mar 17 10:19:45 2008 @@ -1,5 +1,5 @@ -LAS_VERSION=0.9 -PACKAGE_VERSION="0.9.0" +LAS_VERSION=0.9.1 +PACKAGE_VERSION="0.9.1" LAS_LIB = liblas.lib LAS_DLL = liblas$(LAS_VERSION).dll LAS_LIB_DLL = liblas_i.lib From liblas-commits at hobu.net Mon Mar 17 10:21:09 2008 From: liblas-commits at hobu.net (liblas-commits@hobu.net) Date: Mon Mar 17 10:21:16 2008 Subject: [Liblas-commits] r535 - in tags/0.9.1: . apps Message-ID: <20080317152109.6946C6A3D7E@mail.hobu.net> Author: hobu Date: Mon Mar 17 10:21:08 2008 New Revision: 535 URL: http://liblas.org/changeset/535 Log: tag 0.9.1 Added: tags/0.9.1/ - copied from r531, /trunk/ tags/0.9.1/apps/Makefile.am - copied unchanged from r533, /trunk/apps/Makefile.am tags/0.9.1/apps/Makefile.in - copied unchanged from r533, /trunk/apps/Makefile.in tags/0.9.1/configure - copied unchanged from r533, /trunk/configure tags/0.9.1/configure.ac - copied unchanged from r533, /trunk/configure.ac tags/0.9.1/libtool - copied unchanged from r533, /trunk/libtool tags/0.9.1/nmake.opt - copied unchanged from r534, /trunk/nmake.opt From liblas-commits at hobu.net Sun Mar 30 22:11:09 2008 From: liblas-commits at hobu.net (liblas-commits@hobu.net) Date: Sun Mar 30 22:11:17 2008 Subject: [Liblas-commits] r536 - trunk/apps Message-ID: <20080331031109.0C1A27196DA@mail.hobu.net> Author: hobu Date: Sun Mar 30 22:11:07 2008 New Revision: 536 URL: http://liblas.org/changeset/536 Log: add summary of points by return Modified: trunk/apps/lascommon.c Modified: trunk/apps/lascommon.c ============================================================================== --- trunk/apps/lascommon.c (original) +++ trunk/apps/lascommon.c Sun Mar 30 22:11:07 2008 @@ -163,6 +163,8 @@ void print_point_summary(LASPointSummary* summary, LASHeaderH header) { long rgpsum = 0; + long pbretsum = 0; + int i = 0; if (!summary) {LASError_Print("Point Summary does not exist!"); exit(1);} @@ -224,6 +226,15 @@ LASPoint_GetClassification(summary->pmin), LASPoint_GetClassification(summary->pmax) ); + + fprintf(stderr, "\n Number of Points by Return\n"); + fprintf(stderr, "---------------------------------------------------------\n"); + + for (i = 0; i < 5; i++) { + pbretsum = pbretsum + summary->number_of_points_by_return[i]; + fprintf(stderr, "\t(%d) %d", i,summary->number_of_points_by_return[i]); + } + fprintf(stderr, "\n Total Points: %ld\n", pbretsum); fprintf(stderr, "\n Number of Returns by Pulse\n"); fprintf(stderr, "---------------------------------------------------------\n"); From liblas-commits at hobu.net Sun Mar 30 22:24:19 2008 From: liblas-commits at hobu.net (liblas-commits@hobu.net) Date: Sun Mar 30 22:24:27 2008 Subject: [Liblas-commits] r537 - trunk/apps Message-ID: <20080331032419.EB18671982D@mail.hobu.net> Author: hobu Date: Sun Mar 30 22:24:18 2008 New Revision: 537 URL: http://liblas.org/changeset/537 Log: add the ability to clip based on classification Modified: trunk/apps/las2las.c Modified: trunk/apps/las2las.c ============================================================================== --- trunk/apps/las2las.c (original) +++ trunk/apps/las2las.c Sun Mar 30 22:24:18 2008 @@ -42,8 +42,8 @@ fprintf(stderr," las2las -i in.las -eliminate_scan_angle_above 15 -o out.las\n"); fprintf(stderr,"\n"); - fprintf(stderr,"Eliminate intensities below 1000 and write to stdout:\n"); - fprintf(stderr," las2las -i in.las -eliminate_intensity_below 1000 --stdout > out.las\n"); + fprintf(stderr,"Eliminate intensities below 1000 and classifications that equal 2 (ground) and write to stdout:\n"); + fprintf(stderr," las2las -i in.las -eliminate_intensity_below 1000 --eliminate_class 2 --stdout > out.las\n"); fprintf(stderr,"\n"); fprintf(stderr,"Capture only first returns and clip to bounding box:\n"); @@ -84,6 +84,7 @@ int elim_return = 0; int elim_scan_angle_above = 0; int elim_intensity_below = 0; + int elim_class = 0; int first_only = FALSE; int last_only = FALSE; @@ -105,6 +106,7 @@ int eliminated_return = 0; int eliminated_scan_angle = 0; int eliminated_intensity = 0; + int eliminated_class = 0; int eliminated_first_only = 0; int eliminated_last_only = 0; @@ -185,6 +187,15 @@ i++; elim_scan_angle_above = atoi(argv[i]); } + else if ( strcmp(argv[i],"--eliminate_class") == 0 || + strcmp(argv[i],"-eliminate_class") == 0 || + strcmp(argv[i],"-elim_class") == 0 || + strcmp(argv[i],"--class") == 0 + ) + { + i++; + elim_class = atoi(argv[i]); + } else if ( strcmp(argv[i],"--eliminate_intensity_below") == 0 || strcmp(argv[i],"-eliminate_intensity_below") == 0 || strcmp(argv[i],"-elim_intensity_below") == 0 || @@ -308,6 +319,12 @@ p = LASReader_GetNextPoint(reader); continue; } + if (elim_class && ( elim_class == LASPoint_GetClassification(p))) + { + eliminated_class++; + p = LASReader_GetNextPoint(reader); + continue; + } if (elim_intensity_below && LASPoint_GetIntensity(p) < elim_intensity_below) { eliminated_intensity++; @@ -403,6 +420,10 @@ fprintf(stderr, "eliminated based on last returns only: %d\n", eliminated_last_only); + if (eliminated_class) + fprintf(stderr, + "eliminated classification: %d\n", + eliminated_class); if (clipped) fprintf(stderr, "clipped: %d\n", From liblas-commits at hobu.net Sun Mar 30 22:55:43 2008 From: liblas-commits at hobu.net (liblas-commits@hobu.net) Date: Sun Mar 30 22:55:50 2008 Subject: [Liblas-commits] r538 - trunk/apps Message-ID: <20080331035543.8A387719997@mail.hobu.net> Author: hobu Date: Sun Mar 30 22:55:42 2008 New Revision: 538 URL: http://liblas.org/changeset/538 Log: add txt2las target Modified: trunk/apps/makefile.vc Modified: trunk/apps/makefile.vc ============================================================================== --- trunk/apps/makefile.vc (original) +++ trunk/apps/makefile.vc Sun Mar 30 22:55:42 2008 @@ -25,7 +25,11 @@ $(CC) $(CFLAGS) lasmerge.c lascommon.c $(LAS_ROOT)/src/$(LAS_LIB_DLL) if exist $@.manifest mt -manifest $@.manifest -outputresource:$@;1 -default: las2las.exe lasinfo.exe las2txt.exe lasmerge.exe +txt2las.exe: + $(CC) $(CFLAGS) txt2las.c lascommon.c $(LAS_ROOT)/src/$(LAS_LIB_DLL) + if exist $@.manifest mt -manifest $@.manifest -outputresource:$@;1 + +default: las2las.exe lasinfo.exe las2txt.exe lasmerge.exe txt2las.exe clean: