[Liblas-commits] hg: 2 new changesets
liblas-commits at liblas.org
liblas-commits at liblas.org
Tue Oct 12 13:15:59 EDT 2010
changeset 65a0e377811e in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=65a0e377811e
summary: Tweaked binary data access to not to calculate position of iterator but pointer in continuous memory block.
changeset 2dcb73ca71fd in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=2dcb73ca71fd
summary: merge
diffstat:
apps/CMakeLists.txt | 36 +-
apps/las2las-old.c | 1163 ++++++++++
apps/las2las.c | 1163 ----------
apps/las2las.cpp | 348 ++
apps/las2las2.cpp | 348 --
apps/lasinfo-old.c | 418 +++
apps/lasinfo.c | 418 ---
apps/lasinfo.cpp | 241 ++
apps/lasinfo2.cpp | 205 -
doc/utilities/index.txt | 3 +-
doc/utilities/las2las-old.txt | 159 +
doc/utilities/las2las.txt | 315 ++-
doc/utilities/las2las2.txt | 354 ---
doc/utilities/lasinfo-old.txt | 138 +
doc/utilities/lasinfo.txt | 183 +-
include/liblas/detail/binary.hpp | 1 +
include/liblas/detail/private_utility.hpp | 8 +-
include/liblas/external/property_tree/detail/xml_parser_writer_settings.hpp | 12 +-
include/liblas/lasdimension.hpp | 4 +-
src/lasdimension.cpp | 45 +
src/lasheader.cpp | 2 +
src/lasschema.cpp | 39 +-
src/utility.cpp | 178 +-
23 files changed, 3062 insertions(+), 2719 deletions(-)
diffs (truncated from 6111 to 300 lines):
diff -r 5c3ee7cacba8 -r 2dcb73ca71fd apps/CMakeLists.txt
--- a/apps/CMakeLists.txt Tue Oct 12 17:02:41 2010 +0100
+++ b/apps/CMakeLists.txt Tue Oct 12 18:16:59 2010 +0100
@@ -14,13 +14,13 @@
###############################################################################
# Collect programs to build
+set(LASINFO_OLD lasinfo-old)
set(LASINFO lasinfo)
set(LASMERGE lasmerge)
set(LAS2LAS las2las)
+set(LAS2LAS_OLD las2las-old)
set(LAS2TXT las2txt)
set(TXT2LAS txt2las)
-set(LAS2LAS2 las2las2 )
-set(LASINFO2 lasinfo2)
set(LASBLOCK lasblock )
set(BIGFILE_TEST bigfile_test)
@@ -42,8 +42,8 @@
endif()
set(LIBLAS_UTILITIES
- ${LASINFO} ${LASMERGE} ${LAS2LAS} ${LAS2TXT} ${TXT2LAS}
- ${LAS2OGR} ${LAS2OCI} ${LAS2LAS2} ${LASBLOCK} ${LASINFO2})
+ ${LASINFO_OLD} ${LASINFO} ${LASMERGE} ${LAS2LAS} ${LAS2TXT} ${TXT2LAS}
+ ${LAS2OGR} ${LAS2OCI} ${LAS2LAS} ${LAS2LAS_OLD} ${LASBLOCK} )
# TODO: Experimental and requires testing --mloskot
# Generate user-specific settings for Visual Studio project
@@ -72,27 +72,27 @@
link_directories(${Boost_LIBRARY_DIRS})
# Build lasinfo
-if(LASINFO)
- set(LASINFO_SRC lascommon.c ${LASINFO}.c)
- add_executable(${LASINFO} ${LASINFO_SRC})
- target_link_libraries(${LASINFO} ${LIBLAS_C_LIB_NAME})
+if(LASINFO_OLD)
+ set(LASINFO_OLD_SRC lascommon.c ${LASINFO_OLD}.c)
+ add_executable(${LASINFO_OLD} ${LASINFO_OLD_SRC})
+ target_link_libraries(${LASINFO_OLD} ${LIBLAS_C_LIB_NAME})
endif()
# Build las2las
-if(LAS2LAS)
- set(LAS2LAS_SRC lascommon.c ${LAS2LAS}.c)
- add_executable(${LAS2LAS} ${LAS2LAS_SRC})
- target_link_libraries(${LAS2LAS} ${LIBLAS_C_LIB_NAME})
+if(LAS2LAS_OLD)
+ set(LAS2LAS_OLD_SRC lascommon.c ${LAS2LAS_OLD}.c)
+ add_executable(${LAS2LAS_OLD} ${LAS2LAS_OLD_SRC})
+ target_link_libraries(${LAS2LAS_OLD} ${LIBLAS_C_LIB_NAME})
endif()
-if(LAS2LAS2)
- add_executable(${LAS2LAS2} las2las2.cpp laskernel.cpp)
- target_link_libraries(${LAS2LAS2} ${APPS_CPP_DEPENDENCIES} ${Boost_LIBRARIES})
+if(LAS2LAS)
+ add_executable(${LAS2LAS} las2las.cpp laskernel.cpp)
+ target_link_libraries(${LAS2LAS} ${APPS_CPP_DEPENDENCIES} ${Boost_LIBRARIES})
endif()
-if(LASINFO2)
- add_executable(${LASINFO2} lasinfo2.cpp laskernel.cpp)
- target_link_libraries(${LASINFO2} ${APPS_CPP_DEPENDENCIES} ${Boost_LIBRARIES})
+if(LASINFO)
+ add_executable(${LASINFO} lasinfo.cpp laskernel.cpp)
+ target_link_libraries(${LASINFO} ${APPS_CPP_DEPENDENCIES} ${Boost_LIBRARIES})
endif()
# Build las2txt
diff -r 5c3ee7cacba8 -r 2dcb73ca71fd apps/las2las-old.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/apps/las2las-old.c Tue Oct 12 18:16:59 2010 +0100
@@ -0,0 +1,1163 @@
+/***************************************************************************
+ * $Id$
+ * $Date$
+ *
+ * Project: libLAS -- C/C++ read/write library for LAS LIDAR data
+ * Purpose: LAS translation with optional configuration
+ * Author: Martin Isenburg isenburg at cs.unc.edu
+ ***************************************************************************
+ * Copyright (c) 2007, Martin Isenburg isenburg at cs.unc.edu
+ *
+ * See LICENSE.txt in this source distribution for more information.
+ **************************************************************************/
+
+#include "liblas.h"
+/* std */
+#include <assert.h>
+#include <time.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifdef _WIN32
+#define compare_no_case(a,b,n) _strnicmp( (a), (b), (n) )
+#else
+#define compare_no_case(a,b,n) strncasecmp( (a), (b), (n) )
+#endif
+
+LASPointSummary* SummarizePoints(LASReaderH reader);
+void print_point_summary(FILE *file, LASPointSummary* summary, LASHeaderH header);
+void print_point(FILE *file, LASPointH point);
+void print_header(FILE *file, LASHeaderH header, const char* file_name, int bSkipVLR);
+void repair_header(FILE *file, LASHeaderH header, LASPointSummary* summary) ;
+
+#define LAS_FORMAT_10 0
+#define LAS_FORMAT_11 1
+#define LAS_FORMAT_12 2
+
+void do_bulk_copy(const char* infile, size_t in_start_point, const char* outfile)
+{
+ /* bulk copy assumes that the header has already been written to outfile
+ as it is supposed to be, and that we're just going to copy all of the
+ points in infile as they are.
+ */
+ FILE* file_out = 0;
+ FILE* file_in = 0;
+
+ size_t read = 0;
+ size_t written = 0;
+ size_t size = 1000;
+
+ char *buffer = 0;
+
+ buffer = (char*) malloc(size * sizeof(char));
+
+ if (buffer == 0) {
+ LASError_Print("unable to allocate buffer copy");
+ exit(1);
+ }
+ file_in = fopen(infile, "rb");
+ fseek(file_in, in_start_point, SEEK_SET);
+
+ if (file_in == 0) {
+ LASError_Print("input filename not valid for bulk copy");
+ exit(1);
+ }
+ file_out = fopen(outfile, "ab+");
+ if (file_out == 0) {
+ LASError_Print("output filename not valid for bulk copy");
+ exit(1);
+ }
+
+ while (feof(file_in) == 0) {
+ read = fread(buffer, 1, size, file_in);
+ written = fwrite(buffer, 1, read, file_out);
+
+ if (read != written) {
+ LASError_Print("unable to write data in bulk copy");
+ exit(1);
+ }
+ }
+
+ fclose(file_in);
+ fclose(file_out);
+ free(buffer);
+}
+
+
+void usage()
+{
+ fprintf(stderr,"----------------------------------------------------------\n");
+ fprintf(stderr," las2las-old (version %s) usage:\n", LAS_GetFullVersion());
+ fprintf(stderr,"----------------------------------------------------------\n");
+ fprintf(stderr,"\n");
+
+ fprintf(stderr,"Clip las file to a bounding box, throwing out points that have invalid data:\n");
+ fprintf(stderr," las2las-old -i in.las -clip 63000000 483450000 63050000 483500000 -o out.las --skip_invalid\n");
+ fprintf(stderr,"\n");
+
+ fprintf(stderr,"Read from stdin, eliminate intensities below 2000, and write to stdout:\n");
+ fprintf(stderr," las2las-old --eliminate_intensity_below 2000 --stdin --stdout < in.las > out.las \n");
+ fprintf(stderr,"\n");
+
+ fprintf(stderr,"Eliminate return number two:\n");
+ fprintf(stderr," las2las-old -i in.las -eliminate_return 2 -o out.las\n");
+ fprintf(stderr,"\n");
+
+ fprintf(stderr,"Eliminate scan angles above 15:\n");
+ fprintf(stderr," las2las-old -i in.las -eliminate_scan_angle_above 15 -o out.las\n");
+ fprintf(stderr,"\n");
+
+ fprintf(stderr,"Eliminate intensities below 1000:\n");
+ fprintf(stderr," las2las-old -i in.las -eliminate_intensity_below 1000 --stdout > out.las\n");
+ fprintf(stderr,"\n");
+
+ fprintf(stderr,"Eliminate intensities below 1000 and classifications that equal 2 (ground):\n");
+ fprintf(stderr," las2las-old -i in.las --eliminate_class 2 --out out.las\n");
+ fprintf(stderr,"\n");
+
+ fprintf(stderr,"Capture only first returns and clip to bounding box:\n");
+ fprintf(stderr," las2las-old -i in.las -first_only -clip 63000000 483450000 63050000 483500000 -o out.las\n");
+ fprintf(stderr,"\n");
+
+ fprintf(stderr,"Capture only last returns, eliminate intensities below 2000, and write to stdout:\n");
+ fprintf(stderr," las2las-old --input in.las --last_only --eliminate_intensity_below 2000 --stdout > out.las\n");
+ fprintf(stderr,"\n");
+
+ fprintf(stderr,"Reproject the data (requires GDAL support):\n");
+ fprintf(stderr," las2las-old -v in.las output.las -xyz_offset 0 0 0 "
+ "-t_srs EPSG:4326 --xyz_scale 0.0000001 0.0000001 0.0000001"
+ "-s_srs EPSG:26915\n");
+ fprintf(stderr,"\n");
+
+ fprintf(stderr, "\nFor more information, see the full documentation for las2las-old at:\n"
+ " http://liblas.org/utilities/las2las-old.html\n");
+ fprintf(stderr,"----------------------------------------------------------\n");
+
+}
+
+void ptime(const char *const msg)
+{
+ float t= ((float)clock())/CLOCKS_PER_SEC;
+ fprintf(stderr, "cumulative CPU time thru %s = %f\n", msg, t);
+}
+
+int main(int argc, char *argv[])
+{
+ int i;
+ int verbose = FALSE;
+ int use_stdin = FALSE;
+ int use_stdout = FALSE;
+ char* file_name_in = 0;
+ char* file_name_out = 0;
+ char* proj4_text = NULL;
+ double *clip_xy_min = NULL;
+ double *clip_xy_max = NULL;
+ int clip = FALSE;
+ int remove_extra_header = FALSE;
+ int elim_return = 0;
+ int elim_scan_angle_above = 0;
+ int elim_intensity_below = 0;
+ int elim_class = 0;
+ int clsidx = 0;
+ int first_only = FALSE;
+ int last_only = FALSE;
+ int skip_invalid = FALSE;
+ int format = LAS_FORMAT_12;
+ int bulk_copy = FALSE;
+
+ LASReaderH reader = NULL;
+ LASHeaderH header = NULL;
+ LASHeaderH surviving_header = NULL;
+ LASPointH p = NULL;
+ LASWriterH writer = NULL;
+
+ LASSRSH in_srs = NULL;
+ LASSRSH out_srs = NULL;
+ int use_min_offset = FALSE;
+ int do_reprojection = FALSE;
+ int do_set_offset = FALSE;
+ int do_set_scale = FALSE;
+ int do_pad_header = FALSE;
+
+ int header_pad = 0;
+
+ int first_surviving_point = TRUE;
+ unsigned int surviving_number_of_point_records = 0;
+ unsigned int surviving_number_of_points_by_return[] = {0,0,0,0,0,0,0,0};
+ LASPointH surviving_point_min = NULL;
+ LASPointH surviving_point_max = NULL;
+ double surviving_gps_time_min;
+ double surviving_gps_time_max;
+ int verticalCSType = -1, verticalDatum = -1, verticalUnits = 9001;
+ const char *verticalCitation = "";
+
+ int clipped = 0;
+ 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;
+ int thinned = 0;
+
+ int bThin = FALSE;
+ int nThin = 0;
+
+ double xyz_scale[3] = {0.0, 0.0, 0.0};
+ double xyz_offset[3] = {0.0, 0.0, 0.0};
+
+ double minx, maxx, miny, maxy, minz, maxz;
+
+ LASPointSummary* summary = NULL;
+
+ int ret = 0;
+
+ for (i = 1; i < argc; i++) {
+ if ( strcmp(argv[i],"-h") == 0 ||
+ strcmp(argv[i],"--help") == 0
+ )
+ {
+ usage();
+ exit(0);
+ }
+ else if ( strcmp(argv[i],"-v") == 0 ||
More information about the Liblas-commits
mailing list