本文整理汇总了C++中LASreader类的典型用法代码示例。如果您正苦于以下问题:C++ LASreader类的具体用法?C++ LASreader怎么用?C++ LASreader使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LASreader类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
//las testing tooo....
LASreadOpener lasreadopener;
LASreader * lasreader;
lasreadopener.set_file_name(las_path);
lasreader = lasreadopener.open();
if(!lasreader){
PyErr_SetString(PyExc_IOError, "Could not open lidar file.");
return NULL;
}
while(lasreader->read_point())
{
//printf("%u of %u\n", pcnt++, npts);
if(lasreader->point.classification != 1)
continue;
double x_coord = (lasreader->point.x * lasreader->point.quantizer->x_scale_factor) + lasreader->point.quantizer->x_offset;
double y_coord = (lasreader->point.y * lasreader->point.quantizer->y_scale_factor) + lasreader->point.quantizer->y_offset;
double z_coord = (lasreader->point.z * lasreader->point.quantizer->z_scale_factor) + lasreader->point.quantizer->z_offset;
printf("(%lf, %lf, %lf)(%lf, %lf, %lf)", x_coord, y_coord, z_coord,
lasreader->point.x, lasreader->point.quantizer->x_scale_factor,lasreader->point.quantizer->x_offset);
}
lasreader->close();
delete lasreader;
/*
int j;
for(j = 0; j < 10000; j++)
{
List *
float_list = initList();
int i;
for(i = 0; i < 100; i++)
{
float fdata = (float) i;
float * data = (float *) malloc(sizeof(float));
*data = fdata;
if(!addFront(float_list, data)){
printf("Error\n");
return 0;
}
}
freeList(float_list);
}
return 1;
*/
}
示例2: main
int main(int argc, char *argv[])
{
int i;
bool verbose = false;
double start_time = 0.0;
LASreadOpener lasreadopener;
LASwriteOpener laswriteopener;
if (argc == 1)
{
fprintf(stderr,"%s is better run in the command line\n", argv[0]);
char file_name[256];
fprintf(stderr,"enter input file: "); fgets(file_name, 256, stdin);
file_name[strlen(file_name)-1] = '\0';
lasreadopener.set_file_name(file_name);
fprintf(stderr,"enter output file: "); fgets(file_name, 256, stdin);
file_name[strlen(file_name)-1] = '\0';
laswriteopener.set_file_name(file_name);
}
else
{
lasreadopener.parse(argc, argv);
laswriteopener.parse(argc, argv);
}
for (i = 1; i < argc; i++)
{
if (argv[i][0] == '\0')
{
continue;
}
else if (strcmp(argv[i],"-h") == 0 || strcmp(argv[i],"-help") == 0)
{
usage();
}
else if (strcmp(argv[i],"-v") == 0 || strcmp(argv[i],"-verbose") == 0)
{
verbose = true;
}
else if (i == argc - 2 && !lasreadopener.active() && !laswriteopener.active())
{
lasreadopener.set_file_name(argv[i]);
}
else if (i == argc - 1 && !lasreadopener.active() && !laswriteopener.active())
{
lasreadopener.set_file_name(argv[i]);
}
else if (i == argc - 1 && lasreadopener.active() && !laswriteopener.active())
{
laswriteopener.set_file_name(argv[i]);
}
else
{
fprintf(stderr, "ERROR: cannot understand argument '%s'\n", argv[i]);
usage();
}
}
if (verbose) start_time = taketime();
// check input & output
if (!lasreadopener.active())
{
fprintf(stderr,"ERROR: no input specified\n");
usage(argc == 1);
}
if (!laswriteopener.active())
{
fprintf(stderr,"ERROR: no output specified\n");
usage(argc == 1);
}
// open lasreader
LASreader* lasreader = lasreadopener.open();
if (lasreader == 0)
{
fprintf(stderr, "ERROR: could not open lasreader\n");
byebye(argc==1);
}
// open laswriter
LASwriter* laswriter = laswriteopener.open(&lasreader->header);
if (laswriter == 0)
{
fprintf(stderr, "ERROR: could not open laswriter\n");
byebye(argc==1);
}
#ifdef _WIN32
if (verbose) fprintf(stderr, "reading %I64d points from '%s' and writing them modified to '%s'.\n", lasreader->npoints, lasreadopener.get_file_name(), laswriteopener.get_file_name());
#else
if (verbose) fprintf(stderr, "reading %lld points from '%s' and writing them modified to '%s'.\n", lasreader->npoints, lasreadopener.get_file_name(), laswriteopener.get_file_name());
#endif
// loop over points and modify them
//.........这里部分代码省略.........
示例3: main
//.........这里部分代码省略.........
{
fprintf(stderr, "ERROR: no input specified\n");
byebye(true, argc==1);
}
// make sure we do not corrupt the input file
if (lasreadopener.get_file_name() && laswriteopener.get_file_name() && (strcmp(lasreadopener.get_file_name(), laswriteopener.get_file_name()) == 0))
{
fprintf(stderr, "ERROR: input and output file name are identical\n");
usage(true);
}
// check if projection info was set in the command line
int number_of_keys;
GeoProjectionGeoKeys* geo_keys = 0;
int num_geo_double_params;
double* geo_double_params = 0;
if (geoprojectionconverter.has_projection())
{
projection_was_set = geoprojectionconverter.get_geo_keys_from_projection(number_of_keys, &geo_keys, num_geo_double_params, &geo_double_params);
}
// possibly loop over multiple input files
while (lasreadopener.active())
{
if (verbose) full_start_time = start_time = taketime();
// open lasreader
LASreader* lasreader = lasreadopener.open();
if (lasreader == 0)
{
fprintf(stderr, "ERROR: could not open lasreader\n");
byebye(true, argc==1);
}
// run presicion statistics across the first array_max points
if (!output)
{
fprintf(stdout, "original scale factors: %g %g %g\n", lasreader->header.x_scale_factor, lasreader->header.y_scale_factor, lasreader->header.z_scale_factor);
// create the arrays
int* array_x = 0;
int* array_y = 0;
int* array_z = 0;
if (report_x)
{
array_x = new int[array_max];
}
if (report_y)
{
array_y = new int[array_max];
}
if (report_z)
{
array_z = new int[array_max];
}
double* array_gps = 0;
if (report_gps && lasreader->point.have_gps_time)
{
示例4: main
//.........这里部分代码省略.........
}
quadtree.intersect_tile(10, 10, 10);
quadtree.get_intersected_cells();
while (quadtree.has_intersected_cells())
{
F32 min[2],max[2];
quadtree.get_cell_bounding_box(quadtree.intersected_cell, min, max);
fprintf(stderr," checking tile %d with %g/%g %g/%g\n", quadtree.intersected_cell, min[0], min[1], max[0], max[1]);
}
fprintf(stderr,"intersect circle\n");
quadtree.intersect_circle(10, 10, 10);
quadtree.get_intersected_cells();
while (quadtree.has_intersected_cells())
{
F32 min[2],max[2];
quadtree.get_cell_bounding_box(quadtree.intersected_cell, min, max);
fprintf(stderr," checking tile %d with %g/%g %g/%g\n", quadtree.intersected_cell, min[0], min[1], max[0], max[1]);
}
*/
// possibly loop over multiple input files
if (verbose && lasreadopener.get_file_name_number() > 1)
{
total_start_time = taketime();
}
while (lasreadopener.active())
{
if (verbose) start_time = taketime();
// open lasreader
LASreader* lasreader = lasreadopener.open();
if (lasreader == 0)
{
fprintf(stderr, "ERROR: could not open lasreader\n");
byebye(true, argc==1);
}
// setup the quadtree
LASquadtree* lasquadtree = new LASquadtree;
if (tile_size == 0.0f)
{
F32 t;
if (((lasreader->header.max_x - lasreader->header.min_x) < 1000) && ((lasreader->header.max_y - lasreader->header.min_y) < 1000))
{
t = 10.0f;
}
else if (((lasreader->header.max_x - lasreader->header.min_x) < 10000) && ((lasreader->header.max_y - lasreader->header.min_y) < 10000))
{
t = 100.0f;
}
else if (((lasreader->header.max_x - lasreader->header.min_x) < 100000) && ((lasreader->header.max_y - lasreader->header.min_y) < 100000))
{
t = 1000.0f;
}
else if (((lasreader->header.max_x - lasreader->header.min_x) < 1000000) && ((lasreader->header.max_y - lasreader->header.min_y) < 1000000))
{
t = 10000.0f;
}
else
{
t = 100000.0f;
}
示例5: main
//.........这里部分代码省略.........
{
fprintf(stderr, "ERROR: no input specified\n");
byebye(true, argc==1);
}
if (!laswriteopener.active())
{
fprintf(stderr, "ERROR: no output specified\n");
byebye(true, argc==1);
}
// make sure we do not corrupt the input file
if (lasreadopener.get_file_name() && laswriteopener.get_file_name() && (strcmp(lasreadopener.get_file_name(), laswriteopener.get_file_name()) == 0))
{
fprintf(stderr, "ERROR: input and output file name are identical\n");
usage(true);
}
// check if projection info was set in the command line
int number_of_keys;
GeoProjectionGeoKeys* geo_keys = 0;
int num_geo_double_params;
double* geo_double_params = 0;
if (geoprojectionconverter.has_projection())
{
projection_was_set = geoprojectionconverter.get_geo_keys_from_projection(number_of_keys, &geo_keys, num_geo_double_params, &geo_double_params);
}
if (verbose) start_time = taketime();
LASreader* lasreader = lasreadopener.open();
if (lasreader == 0)
{
fprintf(stderr, "ERROR: could not open lasreader\n");
byebye(true, argc==1);
}
#ifdef _WIN32
if (verbose) {
fprintf(stderr,"merging headers took %g sec. there are %I64d points in total.\n", taketime()-start_time, lasreader->npoints);
start_time = taketime();
}
#else
if (verbose) {
fprintf(stderr,"merging headers took %g sec. there are %lld points in total.\n", taketime()-start_time, lasreader->npoints);
start_time = taketime();
}
#endif
// prepare the header for the surviving points
strncpy(lasreader->header.system_identifier, "LAStools (c) by rapidlasso GmbH", 32);
lasreader->header.system_identifier[31] = '\0';
char temp[64];
sprintf(temp, "lasmerge (version %d)", LAS_TOOLS_VERSION);
strncpy(lasreader->header.generating_software, temp, 32);
lasreader->header.generating_software[31] = '\0';
if (projection_was_set)
{
lasreader->header.set_geo_keys(number_of_keys, (LASvlr_key_entry*)geo_keys);
free(geo_keys);
if (geo_double_params)
示例6: mexFunction
void mexFunction (int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
int verbose = FALSE, got_R = FALSE, scanC = FALSE, scanD = FALSE, get_BB_only = FALSE;
int i, argc = 0, n_arg_no_char = 0, classif = 0, intens = 0, nRet = 0, srcID = 0;
unsigned int nPoints;
char **argv, *fname = NULL, *parse_string = "xyz";
double *bbox, west, east, south, north, z_min = -1001, z_max, angle = 0;
if (nrhs == 0) {
mexPrintf ("usage: [xyz, bbox] = lasreader_mex ('filename', ['-A<ang>'], ['-C<class>'], ['-D<id>']\n");
mexPrintf (" [-I<intens>]', ['-N<return>'], ['-R<x_min/x_max/y_min/y_max[/z_min/z_max]>']);\n");
mexPrintf (" OR\n");
mexPrintf (" [class, bbox] = lasreader_mex ('filename', '-S'),\n\n");
mexPrintf (" OR\n");
mexPrintf (" [IDs, bbox] = lasreader_mex ('filename', '-D'),\n\n");
mexPrintf (" OR\n");
mexPrintf (" bbox = lasreader_mex ('filename', '-B'),\n\n");
mexPrintf ("First case usage:\n");
mexPrintf ("where xyz is 3xN array with the XYZ point coordinates:\n");
mexPrintf ("and bbox is a 1x6 vector with [xmin xmax ymin ymax zmin zmax]\n");
mexPrintf (" -A<ang> Clip out points with scan angle > ang\n");
mexPrintf (" -C<class> Retain only points with classification = class\n");
mexPrintf (" -D<id> Retain only points with Source IDs = id (DO NOT CONFUSE WITH -D)\n");
mexPrintf (" -D Scan file for a list of Source IDs (see below) (DO NOT CONFUSE WITH -D<id>).\n");
mexPrintf (" -I<intens> Clip out points with intensity < intens\n");
mexPrintf (" -N<return> Select first return (-N1) or last return (-N10)\n");
mexPrintf (" -R<x_min/x_max/y_min/y_max> - Clip to bounding box.\n");
mexPrintf (" Optionaly add z_min/z_max to make a 3D bounding box.\n\n");
mexPrintf (" -S Scan file for a list of Classifications (see below).\n");
mexPrintf (" -V Prints header contents info on ML shell.\n");
mexPrintf ("Second/Third cases:\n");
mexPrintf ("class|ID is a 1xN vector with a list of different classificatins|IDs\n");
mexPrintf ("present in file. No other data (except optional BBox) is return here.\n");
mexPrintf ("Fourth case:\n");
mexPrintf ("\tReturns only the bonding box 1x6 vector.\n");
return;
}
if (!mxIsChar(prhs[0])) mexErrMsgTxt ("First arg must contain the filename string.\n");
if (nlhs != 1 && get_BB_only) mexErrMsgTxt ("-B option implies one output only.\n");
fname = (char *) mxArrayToString (prhs[0]); /* Load the file name into a char string */
if (nrhs > 1) {
argc = nrhs;
for (i = 1; i < nrhs; i++) { /* Check input to find how many arguments are of type char */
if(!mxIsChar(prhs[i])) {
argc--;
n_arg_no_char++; /* Number of arguments that have a type other than char */
}
}
argc++; /* to account for the program's name to be inserted in argv[0] */
/* get the length of the input string */
argv = (char **)mxCalloc(argc, sizeof(char *));
argv[0] = "LASreader";
for (i = 1; i < argc; i++)
argv[i] = (char *)mxArrayToString(prhs[i+n_arg_no_char-1]);
}
for (i = 1; i < argc; i++) {
if (argv[i][0] == '-') {
switch (argv[i][1]) {
case 'A':
angle = atof(&argv[i][2]);
break;
case 'B':
get_BB_only = TRUE;
break;
case 'C':
classif = atoi(&argv[i][2]);
break;
case 'D':
if (argv[i][2])
srcID = atoi(&argv[i][2]);
else
scanD = TRUE;
break;
case 'I':
intens = atoi(&argv[i][2]);
break;
case 'N':
nRet = atoi(&argv[i][2]);
break;
case 'R':
if (decode_R (argv[i], &west, &east, &south, &north, &z_min, &z_max))
mexErrMsgTxt("Error decoding -R option!");
got_R = TRUE;
break;
case 'S':
scanC = TRUE;
break;
case 'V':
verbose = TRUE;
break;
}
}
}
//.........这里部分代码省略.........
示例7: main
//.........这里部分代码省略.........
{
fprintf(stderr, "ERROR: no input specified\n");
byebye(true, argc==1);
}
// make sure that input and output are not *both* piped
if (lasreadopener.is_piped() && laswriteopener.is_piped())
{
fprintf(stderr, "ERROR: input and output cannot both be piped\n");
byebye(true, argc==1);
}
// check if projection info was set in the command line
int number_of_keys;
GeoProjectionGeoKeys* geo_keys = 0;
int num_geo_double_params;
double* geo_double_params = 0;
if (geoprojectionconverter.has_projection())
{
projection_was_set = geoprojectionconverter.get_geo_keys_from_projection(number_of_keys, &geo_keys, num_geo_double_params, &geo_double_params);
}
// loop over multiple input files
while (lasreadopener.active())
{
if (verbose) start_time = taketime();
// open lasreader
LASreader* lasreader = lasreadopener.open();
if (lasreader == 0)
{
fprintf(stderr, "ERROR: could not open lasreader\n");
byebye(true, argc==1);
}
// check output
if (!laswriteopener.active())
{
// create name from input name
laswriteopener.make_file_name(lasreadopener.get_file_name(), -2);
}
// if the output was piped we need to precompute the bounding box, etc ...
if (laswriteopener.is_piped())
{
// because the output goes to a pipe we have to precompute the header
// information with an additional pass.
if (verbose) { fprintf(stderr, "piped output. extra read pass over file '%s' ...\n", lasreadopener.get_file_name()); }
while (lasreader->read_point());
lasreader->close();
// output some stats
if (verbose)
{
#ifdef _WIN32
示例8: main
//.........这里部分代码省略.........
}
}
#ifdef COMPILE_WITH_GUI
if (gui)
{
return las2txt_gui(argc, argv, &lasreadopener);
}
#endif
#ifdef COMPILE_WITH_MULTI_CORE
if ((cores > 1) && (lasreadopener.get_file_name_number() > 1) && (!lasreadopener.is_merged()))
{
return las2txt_multi_core(argc, argv, &lasreadopener, &laswriteopener, cores);
}
#endif
// check input
if (!lasreadopener.active())
{
fprintf(stderr,"ERROR: no input specified\n");
byebye(true, argc == 1);
}
// possibly loop over multiple input files
while (lasreadopener.active())
{
if (verbose) start_time = taketime();
// open lasreader
LASreader* lasreader = lasreadopener.open();
if (lasreader == 0)
{
fprintf(stderr, "ERROR: could not open lasreader\n");
byebye(true, argc==1);
}
// (maybe) open laswaveform13reader
LASwaveform13reader* laswaveform13reader = lasreadopener.open_waveform13(&lasreader->header);
// get a pointer to the header
LASheader* header = &(lasreader->header);
// open output file
FILE* file_out;
if (laswriteopener.is_piped())
{
file_out = stdout;
}
else
{
// create output file name if needed
if (laswriteopener.get_file_name() == 0)
{
if (lasreadopener.get_file_name() == 0)
{
fprintf(stderr, "ERROR: no output file specified\n");
byebye(true, argc==1);
示例9: main
//.........这里部分代码省略.........
{
fprintf(stderr, "ERROR: no input specified\n");
byebye(true, argc==1);
}
if (!laswriteopener.active())
{
fprintf(stderr, "ERROR: no output specified\n");
byebye(true, argc==1);
}
// make sure we do not corrupt the input file
if (lasreadopener.get_file_name() && laswriteopener.get_file_name() && (strcmp(lasreadopener.get_file_name(), laswriteopener.get_file_name()) == 0))
{
fprintf(stderr, "ERROR: input and output file name are identical\n");
usage(true);
}
// check if projection info was set in the command line
int number_of_keys;
GeoProjectionGeoKeys* geo_keys = 0;
int num_geo_double_params;
double* geo_double_params = 0;
if (geoprojectionconverter.has_projection())
{
projection_was_set = geoprojectionconverter.get_geo_keys_from_projection(number_of_keys, &geo_keys, num_geo_double_params, &geo_double_params);
}
if (verbose) start_time = taketime();
LASreader* lasreader = lasreadopener.open();
lasreader->populate_rank_points();
LASreaderMerged *lasreadermerged = (LASreaderMerged *)lasreader;
I32 process_count = lasreadermerged->get_process_count();
dbg(3, "rank %i, lasreadermerged->npoints %lli", lasreadermerged->get_rank(), lasreadermerged->npoints);
for (i=0; i<process_count; i++)
{
dbg(3, "rank %i, rank_begin_point %lli", lasreadermerged->get_rank(), lasreadermerged->get_rank_begin_index()[i]);
for(int j=lasreadermerged->get_file_name_start(); j< lasreadermerged->get_file_name_number(); j++)
{
dbg(3, "rank %i, number %i name %s count %lli, begin", lasreadermerged->get_rank(), j, lasreadermerged->get_file_names()[j], lasreadermerged->get_file_point_counts()[j]);
}
}
dbg(3,"type of reader returned: class %s and declared name %s", typeid(*lasreader).name(), quote(*lasreader));
if (lasreader == 0)
{
fprintf(stderr, "ERROR: could not open lasreader\n");
byebye(true, argc==1);
}
#ifdef _WIN32
if (verbose) { fprintf(stderr,"merging headers took %g sec. there are %I64d points in total.\n", taketime()-start_time, lasreader->npoints); start_time = taketime(); }
#else
if (verbose) { fprintf(stderr,"merging headers took %g sec. there are %lld points in total.\n", taketime()-start_time, lasreader->npoints); start_time = taketime(); }
#endif
// prepare the header for the surviving points
示例10: append
BOOL LASindex::append(const char* file_name) const
{
#ifdef LASZIPDLL_EXPORTS
return FALSE;
#else
LASreadOpener lasreadopener;
if (file_name == 0) return FALSE;
// open reader
LASreader* lasreader = lasreadopener.open(file_name);
if (lasreader == 0) return FALSE;
if (lasreader->header.laszip == 0) return FALSE;
// close reader
lasreader->close();
FILE* file = fopen(file_name, "rb");
ByteStreamIn* bytestreamin = 0;
if (IS_LITTLE_ENDIAN())
bytestreamin = new ByteStreamInFileLE(file);
else
bytestreamin = new ByteStreamInFileBE(file);
// maybe write LASindex EVLR start position into LASzip VLR
I64 offset_laz_vlr = -1;
// where to write LASindex EVLR that will contain the LAX file
I64 number_of_special_evlrs = lasreader->header.laszip->number_of_special_evlrs;
I64 offset_to_special_evlrs = lasreader->header.laszip->offset_to_special_evlrs;
if ((number_of_special_evlrs == -1) && (offset_to_special_evlrs == -1))
{
bytestreamin->seekEnd();
number_of_special_evlrs = 1;
offset_to_special_evlrs = bytestreamin->tell();
// find LASzip VLR
I64 total = lasreader->header.header_size + 2;
U32 number_of_variable_length_records = lasreader->header.number_of_variable_length_records + 1 + (lasreader->header.vlr_lastiling != 0) + (lasreader->header.vlr_lasoriginal != 0);
for (U32 u = 0; u < number_of_variable_length_records; u++)
{
bytestreamin->seek(total);
CHAR user_id[16];
try {
bytestreamin->getBytes((U8*)user_id, 16);
}
catch(...)
{
fprintf(stderr,"ERROR: reading header.vlrs[%d].user_id\n", u);
return FALSE;
}
if (strcmp(user_id, "laszip encoded") == 0)
{
offset_laz_vlr = bytestreamin->tell() - 18;
break;
}
U16 record_id;
try {
bytestreamin->get16bitsLE((U8*)&record_id);
}
catch(...)
{
fprintf(stderr,"ERROR: reading header.vlrs[%d].record_id\n", u);
return FALSE;
}
U16 record_length_after_header;
try {
bytestreamin->get16bitsLE((U8*)&record_length_after_header);
}
catch(...)
{
fprintf(stderr,"ERROR: reading header.vlrs[%d].record_length_after_header\n", u);
return FALSE;
}
total += (54 + record_length_after_header);
}
if (number_of_special_evlrs == -1) return FALSE;
}
delete bytestreamin;
fclose(file);
ByteStreamOut* bytestreamout;
file = fopen(file_name, "rb+");
if (IS_LITTLE_ENDIAN())
bytestreamout = new ByteStreamOutFileLE(file);
else
bytestreamout = new ByteStreamOutFileBE(file);
bytestreamout->seek(offset_to_special_evlrs);
LASevlr lax_evlr;
//.........这里部分代码省略.........
示例11: main
//.........这里部分代码省略.........
{
fprintf(stderr,"ERROR: no input specified\n");
usage(true, argc==1);
}
// make sure we do not corrupt the input file
if (lasreadopener.get_file_name() && laswriteopener.get_file_name() && (strcmp(lasreadopener.get_file_name(), laswriteopener.get_file_name()) == 0))
{
fprintf(stderr, "ERROR: input and output file name are identical\n");
usage(true);
}
// check if projection info was set in the command line
int number_of_keys;
GeoProjectionGeoKeys* geo_keys = 0;
int num_geo_double_params;
double* geo_double_params = 0;
if (geoprojectionconverter.has_projection())
{
projection_was_set = geoprojectionconverter.get_geo_keys_from_projection(number_of_keys, &geo_keys, num_geo_double_params, &geo_double_params);
}
// loop over multiple input files
while (lasreadopener.active())
{
if (verbose) start_time = taketime();
// open lasreader
LASreader* lasreader = lasreadopener.open();
if (lasreader == 0)
{
fprintf(stderr, "ERROR: could not open lasreader\n");
usage(true, argc==1);
}
// switch
if (report_file_size)
{
// maybe only report uncompressed file size
I64 uncompressed_file_size = (I64)lasreader->header.number_of_point_records * (I64)lasreader->header.point_data_record_length + lasreader->header.offset_to_point_data;
if (uncompressed_file_size == (I64)((U32)uncompressed_file_size))
fprintf(stderr,"uncompressed file size is %u bytes or %.2f MB for '%s'\n", (U32)uncompressed_file_size, (F64)uncompressed_file_size/1024.0/1024.0, lasreadopener.get_file_name());
else
fprintf(stderr,"uncompressed file size is %.2f MB or %.2f GB for '%s'\n", (F64)uncompressed_file_size/1024.0/1024.0, (F64)uncompressed_file_size/1024.0/1024.0/1024.0, lasreadopener.get_file_name());
}
else if (dry)
{
// maybe only a dry read pass
start_time = taketime();
while (lasreader->read_point());
fprintf(stderr,"needed %g secs to read '%s'\n", taketime()-start_time, lasreadopener.get_file_name());
}
else
{
I64 start_of_waveform_data_packet_record = 0;
// create output file name if no output was specified
if (!laswriteopener.active())
{
示例12: main
//.........这里部分代码省略.........
fprintf(stderr,"ERROR: no input specified\n");
usage(true, argc==1);
}
BOOL extra_pass = laswriteopener.is_piped();
// for piped output we need an extra pass
if (extra_pass)
{
if (lasreadopener.is_piped())
{
fprintf(stderr, "ERROR: input and output cannot both be piped\n");
usage(true);
}
}
// make sure we do not corrupt the input file
if (lasreadopener.get_file_name() && laswriteopener.get_file_name() && (strcmp(lasreadopener.get_file_name(), laswriteopener.get_file_name()) == 0))
{
fprintf(stderr, "ERROR: input and output file name are identical\n");
usage(true);
}
// possibly loop over multiple input files
while (lasreadopener.active())
{
// if (verbose) start_time = taketime();
// open lasreader
LASreader* lasreader = lasreadopener.open();
if (lasreader == 0)
{
fprintf(stderr, "ERROR: could not open lasreader\n");
usage(true, argc==1);
}
// store the inventory for the header
LASinventory lasinventory;
// the point we write sometimes needs to be copied
LASpoint* point = 0;
// prepare the header for output
if (set_gps_time_endcoding != -1)
{
if (set_gps_time_endcoding == 0)
{
if ((lasreader->header.global_encoding & 1) == 0)
{
fprintf(stderr, "WARNING: global encoding indicates file already in GPS week time\n");
if (force)
{
fprintf(stderr, " forced conversion.\n");
}
else
{
fprintf(stderr, " use '-force' to force conversion.\n");
byebye(true);
示例13: main
//.........这里部分代码省略.........
fprintf(stderr,"ERROR: no input specified\n");
usage(true, argc==1);
}
BOOL extra_pass = laswriteopener.is_piped();
// for piped output we need an extra pass
if (extra_pass)
{
if (lasreadopener.is_piped())
{
fprintf(stderr, "ERROR: input and output cannot both be piped\n");
usage(true);
}
}
// make sure we do not corrupt the input file
if (lasreadopener.get_file_name() && laswriteopener.get_file_name() && (strcmp(lasreadopener.get_file_name(), laswriteopener.get_file_name()) == 0))
{
fprintf(stderr, "ERROR: input and output file name are identical\n");
usage(true);
}
// possibly loop over multiple input files
while (lasreadopener.active())
{
if (verbose) start_time = taketime();
// open lasreader
LASreader* lasreader = lasreadopener.open();
if (lasreader == 0)
{
fprintf(stderr, "ERROR: could not open lasreader\n");
usage(true, argc==1);
}
// store the inventory for the header
LASinventory lasinventory;
// the point we write sometimes needs to be copied
LASpoint* point = 0;
// prepare the header for output
if (set_gps_time_endcoding != -1)
{
if (set_gps_time_endcoding == 0)
{
if ((lasreader->header.global_encoding & 1) == 0)
{
fprintf(stderr, "WARNING: global encoding indicates file already in GPS week time\n");
if (force)
{
fprintf(stderr, " forced conversion.\n");
}
else
{
fprintf(stderr, " use '-force' to force conversion.\n");
byebye(true);
示例14: main
//.........这里部分代码省略.........
{
one_report_per_file = FALSE;
}
else if (!one_report_per_file)
{
xml_output_file = "validate.xml";
}
}
// maybe we are doing one summary report
if (xml_output_file)
{
if (!xmlwriter.open(xml_output_file, "LASvalidator"))
{
byebye(LAS_VALIDATE_WRITE_PERMISSION_ERROR, argc == 1);
}
}
// accumulated pass
U32 total_pass = VALIDATE_PASS;
// possibly loop over multiple input files
while (lasreadopener.is_active())
{
// in very verbose mode we measure the time for each file
if (very_verbose) start_time = taketime();
// open lasreader
LASreader* lasreader = lasreadopener.open();
if (lasreader == 0)
{
fprintf(stderr, "ERROR: could not open lasreader\n");
byebye(LAS_VALIDATE_INPUT_FILE_NOT_FOUND, argc == 1);
}
// get a pointer to the header
LASheader* lasheader = &lasreader->header;
// maybe we are doing one report per file
if (one_report_per_file)
{
int len = strlen(lasreadopener.get_path());
CHAR* current_xml_output_file = (CHAR*)malloc(len + 5);
strcpy(current_xml_output_file, lasreadopener.get_path());
current_xml_output_file[len-4] = '_';
current_xml_output_file[len-3] = 'L';
current_xml_output_file[len-2] = 'V';
current_xml_output_file[len-1] = 'S';
current_xml_output_file[len ] = '.';
current_xml_output_file[len+1] = 'x';
current_xml_output_file[len+2] = 'm';
current_xml_output_file[len+3] = 'l';
current_xml_output_file[len+4] = '\0';
if (!xmlwriter.open(current_xml_output_file, "LASvalidator"))
{
byebye(LAS_VALIDATE_WRITE_PERMISSION_ERROR, argc == 1);
}
free(current_xml_output_file);
}